• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

cms/smarttable.class.php

Go to the documentation of this file.
00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 { 
00004         header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005         echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006         echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007         exit(1);
00008 }
00032 class smarttable
00033 {
00039         function includeCode($code)
00040         {
00041                 global $urlRequestRoot,$cmsFolder;
00042                 $before=<<<CODE
00043                 <style type="text/css" title="currentStyle">
00044                                 @import "$urlRequestRoot/$cmsFolder/modules/smarttable/css/demo_page.css";
00045                                 @import "$urlRequestRoot/$cmsFolder/modules/smarttable/css/demo_table_jui.css";
00046                                 @import "$urlRequestRoot/$cmsFolder/modules/smarttable/themes/smoothness/jquery-ui-1.7.2.custom.css";
00047                 </style>
00048                 <script type="text/javascript" language="javascript" src="$urlRequestRoot/$cmsFolder/modules/smarttable/js/jquery.dataTables.min.js"></script>
00049                 <script type="text/javascript" charset="utf-8">
00050                 function initSmartTable()
00051                 {
00052 CODE;
00053                 $after=<<<CODE
00054                 }
00055                 </script>
00056 CODE;
00057                 return $before.$code.$after;
00058         }
00066         function render($tableidarray,$paramsarray)
00067         {
00068                 $ret="";
00069                 foreach($tableidarray as $tableid)
00070                 {
00071                         $ret.=self::generate_js($tableid,$paramsarray[$tableid]);
00072                 }
00073                 return self::includeCode($ret);
00074         }
00082         function generate_js($tableid,$params)
00083         {
00084                 $config=array(
00085                                 'bJQueryUI' => 'true',
00086                                 'sPaginationType' => 'full_numbers',
00087                                 'bAutoWidth' => 'true'
00088                         );
00089                 if($params!=null)
00090                 foreach($params as $param=>$value)
00091                 {
00092                         $config[$param]=$value;
00093                 }
00094                 $genparams = "";
00095                 foreach($config as $param=>$value)
00096                 {
00097                         if($param[0]=='b')
00098                                 $genparams .= "\"$param\" :  $value, \n";
00099                         else if($param[0]=='s')
00100                                 $genparams .= "\"$param\" : \"$value\", \n";
00101                         else if($param[0]=='a')
00102                                 $genparams .= "\"$param\" : [ $value ], \n"; 
00103                 }       
00104                 
00105                 $ret=<<<CODE
00106                 
00107                         $(document).ready(function() {
00108                                 oTable = $('#$tableid').dataTable({
00109                                         $genparams
00110                                 });
00111                         } );
00112                 
00113 CODE;
00114                 return $ret;
00115         }
00116 }
00117 
00118 ?>

Generated on Sun Jan 2 2011 04:55:32 for Pragyan CMS by  doxygen 1.7.1