Example #1
0
 /**
  *
  * @param string $pID - the javascript identity of the table
  * @param string $pStore_ID - the name of the datastore identity
  * @param array $pColumns - a parameter set for thecolumn definitions
  * @return string $pIdentifier -- the name of the identity column of the dataset
  *
  */
 public function dojogrid($pID, $pStore_ID = NULL, $pRows = array(), $pIdentifier = 'id', $pParams = NULL, $pOptions = NULL)
 {
     $declare = FALSE;
     $this->prep_view();
     $height = 400;
     $width = 600;
     $query = array($pIdentifier => '*');
     if ($pOptions && is_array($pOptions)) {
         extract($pOptions);
         // may override all params
     }
     $query = is_string($query) ? $query : Zend_Json::encode($query);
     $query_string = str_replace('"', "'", $query);
     if (empty($pStore_ID)) {
         $pStore_ID = $pID . '_store';
     }
     if ($declare) {
         return sef::grid_declarative($pID, $pRows, $query_string, $pStore_ID, $height, $width, $pParams);
     } else {
         return self::grid_interp($pID, $pRows, $query_string, $pStore_ID, $height, $width, $pParams);
     }
 }
 /**
  * Include php files with TTL expiration
  * 
  * Use phpInclude to load PHP files dinamically, also with cache
  * 
  * @param  string  Varname
  * @param  string  File tyo include
  * @param  integer  time to life for saved files (blank or '0', disable cache)
  * @return string   Return PHP file
  */
 public static function phpInclude($name, $file, $ttl = '')
 {
     $fcontents = "";
     if (substr($file, 0, 1) != "/") {
         $file = $_SERVER["DOCUMENT_ROOT"] . "/" . $file;
     }
     if (self::test($name) === FALSE || $ttl == 0) {
         if (file_exists($file)) {
             $fcontents = file_get_contents($file);
         }
         $fcontents = str_replace('<' . '?php', '', $fcontents);
         $fcontents = str_replace('?>', '', $fcontents);
         self::set($name, $fcontents);
         self::set($name . "@ttl", $ttl == '' ? 0 : time() + $ttl);
         return $fcontents;
     } else {
         $fcontents = self::get($name);
         $fcontentsTTL = self::get($name . "@ttl");
         if ($fcontentsTTL != 0 && $fcontentsTTL > time()) {
             self::clear($name);
             return sef::phpInclude($name, $file, $ttl);
         } else {
             if ($fcontents === FALSE) {
                 $fcontents = "";
             }
         }
         return $fcontents;
     }
 }