Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class page extends page_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_page"][ page ]
 
Properties
protected_cdate[ page_db ]
protected_cdate_dirty[ page_db ]
protected_debug[ page_ext ]
protected_deleted[ page_db ]
protected_deleted_dirty[ page_db ]
protected_description[ page_db ]
protected_description_dirty[ page_db ]
protected_dirty[ obj ]
protected_footer[ page_db ]
protected_footer_dirty[ page_db ]
protected_footer_path[ page_ext ]
protected_header[ page_db ]
protected_header_dirty[ page_db ]
protected_header_menu[ page_db ]
protected_header_menu_dirty[ page_db ]
protected_header_menu_path[ page_ext ]
protected_header_path[ page_ext ]
protected_helix[ page_db ]
protected_helix_dirty[ page_db ]
protected_id[ page_db ]
protected_id_dirty[ page_db ]
protected_left_menu[ page_db ]
protected_left_menu_dirty[ page_db ]
protected_left_menu_path[ page_ext ]
protected_mdate[ page_db ]
protected_mdate_dirty[ page_db ]
protected_name[ page_db ]
protected_name_dirty[ page_db ]
protected_path[ page_ext ]
publicproperty_objects_array[ obj ]
protected_render[ page_ext ]
protected_right_menu[ page_db ]
protected_right_menu_dirty[ page_db ]
protected_right_menu_path[ page_ext ]
protected_title[ page_db ]
protected_title_dirty[ page_db ]
protected_version[ page_db ]
protected_version_dirty[ page_db ]
 
Methods
publicclose_document ( )[ page_ext ]
Parameters
No parameters for this method
Code
062  public function close_document()
063  {
064      echo '</html>';
065  }
publiccommit ( )[ page_db ]
Parameters
No parameters for this method
Code
140  public function commit()
141  {
142      if ($this->_id > 0)
143      {
144          $this->update();
145      }
146      else
147      {
148          $this->insert();
149      }
150 
151      foreach ($this->property_objects_array as $property=>$object)
152      {
153          $this->{$property} = $object;
154      }
155 
156      return true;
157  }
public__construct ( id , name , helix )[ page_ext ]
Parameters
optionalid
optionalname
optionalhelix
Code
016  public function __construct($__id=null, $__name=null, $__helix=null)
017  {
018      parent::__construct($__id);
019      if (!is_null($__name))
020      {
021          $this->_name = $__name;
022          $this->_helix = $__helix;
023          $db = page::db();
024          $q  = " SELECT * ";
025          $q .= " FROM cor_page ";
026          $q .= " WHERE name = '$__name' ";
027          $q .= " AND helix=" . (is_null($__helix) ? (ADMIN ? "1" : "0") : ($__helix ? "1" : "0"));
028          $q .= " AND deleted=0 ";
029 
030          $db->query($q);
031          if ($db->next_record() && $db->num_rows() == 1)
032          {
033              $this->_id = $db->f("id");
034              $this->_name = $db->f("name");
035              $this->_description = $db->f("description");
036              $this->_helix = $db->f("helix");
037              $this->_title = $db->f("title");
038              $this->_header = $db->f("header");
039              $this->_header_menu = $db->f("header_menu");
040              $this->_left_menu = $db->f("left_menu");
041              $this->_right_menu = $db->f("right_menu");
042              $this->_footer = $db->f("footer");
043              $this->_version = $db->f("version");
044              $this->_mdate = $db->f("mdate");
045              $this->_cdate = $db->f("cdate");
046              $this->_deleted = $db->f("deleted");
047          }
048      }
049  }
protected staticdb ( )[ page_db ]
Parameters
No parameters for this method
Code
782  protected static function db()
783  {
784      return new db();
785  }
publicdelete ( )[ page_db ]
Parameters
No parameters for this method
Code
217  public function delete()
218  {
219      $db = page::db();
220      $q  = " UPDATE cor_page SET ";
221      $q .= " deleted = 1 ";
222      $q .= " WHERE id = " . $this->_id;
223      $db->query($q);
224      $this->deleted = true;
225      return true;
226  }
public staticdelete_all ( )[ page_db ]
Parameters
No parameters for this method
Code
323  public static function delete_all()
324  {
325      $db = page::db();
326      $q  = " UPDATE cor_page SET ";
327      $q .= " deleted = 1 ";
328     
329      $db->query($q);
330      return true;
331  }
public__get ( p )[ obj ]
Parameters
requiredp
Code
007  public function __get($p)
008  {
009      $methods = get_class_methods($this);
010      $properties = get_object_vars($this);
011      if (in_array("get_$p",$methods))
012      {
013          return $this->{"get_$p"}();
014      }
015      else if (array_key_exists("_$p",$properties))
016      {
017          return $this->{"_$p"};
018      }
019      else if (in_array("get_" . substr($p,strpos($p,"_")+1), $methods))
020      {
021          return $this->{"get_" . substr($p,strpos($p,"_")+1)}(substr($p,0,strpos($p,"_")));
022      }
023      else
024      {
025          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
026          return null;
027      }
028  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_article ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
386  public function get_article($__type="default")
387  {
388      $object = is_null(keyval($this->property_objects_array,"{$__type}_article")) ? new article($this->get_article_id($__type)) : $this->property_objects_array["{$__type}_article"];
389      $this->property_objects_array["{$__type}_article"] = $object;
390      return $object;
391  }
publicget_article_id ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
392  public function get_article_id($__type="default")
393  {
394      $ids = $this->get_article_ids($__type, true);
395      return (count($ids)==1 ? $ids[0] : null);
396  }
publicget_article_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
397  public function get_article_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
398  {
399      $article_ids = array();
400      $db = page::db();
401      $q  = " SELECT cms_article.content_id FROM cms_article_page INNER JOIN cms_article ON cms_article_page.article_content_id=cms_article.content_id AND cms_article_page.deleted=0 AND cms_article.deleted=0 AND cms_article_page.page_id='$this->id' " . (is_null($__type) ? "" : " AND cms_article_page.article_page_type_id='" . article_page::type_id($__type) . "'") . ($__get_primary ? " AND cms_article_page.primary=1 " : "");
402      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
403      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
404      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
405      $db->query($q);
406      while ($db->next_record())
407      {
408          $article_ids[] = $db->f("content_id");
409      }
410      return $article_ids;
411  }
publicget_article_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
412  public function get_article_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
413  {
414      $ids = $this->get_article_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
415      $objects = array();
416      foreach ($ids as $index=>$id)
417      {
418          $objects[$index] = new article($id);
419      }
420      return $objects;
421  }
publicget_classname ( )[ obj ]
Parameters
No parameters for this method
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
public staticget_columns ( columns , order , lookups , where_clause , limit , offset [0] )[ page_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
248  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
249  {
250      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
251      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
252      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
253 
254      $db = page::db();
255      $data = array();
256      $q  = " SELECT $colstring ";
257      $q .= " FROM cor_page ";
258      $q .= " WHERE cor_page.deleted = 0 ";
259      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
260 
261      if (is_string($__order))
262      {
263          $q .= "ORDER BY " . $__order;
264      }
265      else if (is_array($__order) and count($__order)>0)
266      {
267          $orderings = array();
268          foreach ($__order as $col=>$dir)
269          {
270              $orderings[] = " $col $dir ";
271          }
272          $q .= "ORDER BY " . implode(", ", $orderings);
273      }
274      else if (is_object($__order))
275      {
276          $q .= "";
277      }
278      else
279      {
280          // THERE IS NO `order` COLUMN ON THIS OBJECT
281      }
282 
283      if (!is_null($__limit))
284      {
285          $q .= " LIMIT $__offset , $__limit ";
286      }
287 
288      $db->query($q);
289 
290      if (count($colarray)>1 || $colstring=="*")
291      {
292          while ($db->next_record())
293          {
294              $data[] = $db->record;
295          }
296      }
297      else
298      {
299          while ($db->next_record())
300          {
301              $data[] = $db->f(0);
302          }
303      }
304 
305      return $data;
306  }
publicget_content ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
485  public function get_content($__type="default")
486  {
487      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
488      $this->property_objects_array["{$__type}_content"] = $object;
489      return $object;
490  }
publicget_content_id ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
491  public function get_content_id($__type="default")
492  {
493      $ids = $this->get_content_ids($__type, true);
494      return (count($ids)==1 ? $ids[0] : null);
495  }
publicget_content_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
496  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
497  {
498      $content_ids = array();
499      $db = page::db();
500      $q  = " SELECT cms_content.id FROM cms_content_page INNER JOIN cms_content ON cms_content_page.content_id=cms_content.id AND cms_content_page.deleted=0 AND cms_content.deleted=0 AND cms_content_page.page_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_page.content_page_type_id='" . content_page::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_page.primary=1 " : "");
501      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
502      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
503      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
504      $db->query($q);
505      while ($db->next_record())
506      {
507          $content_ids[] = $db->f("id");
508      }
509      return $content_ids;
510  }
publicget_content_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
511  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
512  {
513      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
514      $objects = array();
515      foreach ($ids as $index=>$id)
516      {
517          $objects[$index] = new content($id);
518      }
519      return $objects;
520  }
publicget_debug ( )[ page_ext ]
Parameters
No parameters for this method
Code
378  public function get_debug()
379  {
380      $this->_debug=false;
381      if ((DEBUG || keyval($_REQUEST,"DEBUG")) && keyval($_REQUEST,"DEBUG") != "0")
382      {
383          $this->_debug=true;
384      }
385      else
386      {
387          $this->_debug=false;
388      }
389      return $this->_debug;
390  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicget_error_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
308  public function get_error_path()
309  {
310      return PAGE_SITE . "interface/templates/error.php";
311  }
publicget_footer_path ( )[ page_ext ]
publicget_header_menu_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
326  public function get_header_menu_path()
327  {
328      if ($this->header_menu)
329      {
330          $this->_header_menu_path = PAGE_SITE . "interface/templates/" . $this->header_menu;
331      }
332      else
333      {
334          $this->_header_menu_path = PAGE_SITE . "interface/templates/header_menu.php";
335      }
336          return $this->_header_menu_path;
337  }
publicget_header_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
313  public function get_header_path()
314  {
315      if ($this->header)
316      {
317          $this->_header_path = PAGE_SITE . "interface/templates/" . $this->header;
318      }
319      else
320      {
321          $this->_header_path = PAGE_SITE . "interface/templates/header.php";
322      }
323          return $this->_header_path;
324  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ page_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
308  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
309  {
310      return page::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
311  }
publicget_json ( )[ obj ]
Parameters
No parameters for this method
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
publicget_left_menu_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
339  public function get_left_menu_path()
340  {
341      if ($this->left_menu)
342      {
343          $this->_left_menu_path = PAGE_SITE . "interface/templates/" . $this->left_menu;
344      }
345      else
346      {
347          $this->_left_menu_path = PAGE_SITE . "interface/templates/left_menu.php";
348      }
349          return $this->_left_menu_path;
350  }
publicget_menu ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
683  public function get_menu($__type="default")
684  {
685      $object = is_null(keyval($this->property_objects_array,"{$__type}_menu")) ? new menu($this->get_menu_id($__type)) : $this->property_objects_array["{$__type}_menu"];
686      $this->property_objects_array["{$__type}_menu"] = $object;
687      return $object;
688  }
publicget_menu_id ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
689  public function get_menu_id($__type="default")
690  {
691      $ids = $this->get_menu_ids($__type, true);
692      return (count($ids)==1 ? $ids[0] : null);
693  }
publicget_menu_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
694  public function get_menu_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
695  {
696      $menu_ids = array();
697      $db = page::db();
698      $q  = " SELECT ifc_menu.id FROM ifc_menu_page INNER JOIN ifc_menu ON ifc_menu_page.menu_id=ifc_menu.id AND ifc_menu_page.deleted=0 AND ifc_menu.deleted=0 AND ifc_menu_page.page_id='$this->id' " . (is_null($__type) ? "" : " AND ifc_menu_page.menu_page_type_id='" . menu_page::type_id($__type) . "'") . ($__get_primary ? " AND ifc_menu_page.primary=1 " : "");
699      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
700      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
701      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
702      $db->query($q);
703      while ($db->next_record())
704      {
705          $menu_ids[] = $db->f("id");
706      }
707      return $menu_ids;
708  }
publicget_menu_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
709  public function get_menu_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
710  {
711      $ids = $this->get_menu_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
712      $objects = array();
713      foreach ($ids as $index=>$id)
714      {
715          $objects[$index] = new menu($id);
716      }
717      return $objects;
718  }
publicget_meta_string ( )[ page_ext ]
Parameters
No parameters for this method
Code
426  public function get_meta_string()
427  {
428      $meta_string = "";
429      foreach (meta::get_ids() as $meta_id)
430      {
431          $meta = new meta($meta_id);
432          $meta_string .= "<meta name=\"$meta->name\" content=\"" . ent($meta->content) . "\" />\n";
433      }
434      return $meta_string;
435  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ page_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
313  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
314  {
315      $objects = array();
316      foreach (page::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
317      {
318          $objects[] = new page($id);
319      }
320      return $objects;
321  }
publicget_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
286  public function get_path()
287  {
288      global $params;
289     
290      $this->_path = (PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.php");
291      if (count($params)>1)
292      {
293          for ($i=count($params)-1; $i>0; $i--)
294          {
295              $subpath = implode("/",array_slice($params,1,$i));
296              $subpage = basename($subpath);
297              $fullpath = PAGE_SITE . "interface/pages/{$this->name}/{$subpath}/{$subpage}.php";
298              if (file_exists($fullpath))
299              {
300                  $this->_path = $fullpath;
301                  break;
302              }
303          }
304      }
305          return $this->_path;
306  }
publicget_perm ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
584  public function get_perm($__type="default")
585  {
586      $object = is_null(keyval($this->property_objects_array,"{$__type}_perm")) ? new perm($this->get_perm_id($__type)) : $this->property_objects_array["{$__type}_perm"];
587      $this->property_objects_array["{$__type}_perm"] = $object;
588      return $object;
589  }
publicget_perm_id ( type ["default"] )[ page_db ]
Parameters
optionaltype ["default"]
Code
590  public function get_perm_id($__type="default")
591  {
592      $ids = $this->get_perm_ids($__type, true);
593      return (count($ids)==1 ? $ids[0] : null);
594  }
publicget_perm_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
595  public function get_perm_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
596  {
597      $perm_ids = array();
598      $db = page::db();
599      $q  = " SELECT cor_perm.id FROM cor_page_perm INNER JOIN cor_perm ON cor_page_perm.perm_id=cor_perm.id AND cor_page_perm.deleted=0 AND cor_perm.deleted=0 AND cor_page_perm.page_id='$this->id' " . (is_null($__type) ? "" : " AND cor_page_perm.page_perm_type_id='" . page_perm::type_id($__type) . "'") . ($__get_primary ? " AND cor_page_perm.primary=1 " : "");
600      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
601      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
602      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
603      $db->query($q);
604      while ($db->next_record())
605      {
606          $perm_ids[] = $db->f("id");
607      }
608      return $perm_ids;
609  }
publicget_perm_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ page_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
610  public function get_perm_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
611  {
612      $ids = $this->get_perm_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
613      $objects = array();
614      foreach ($ids as $index=>$id)
615      {
616          $objects[$index] = new perm($id);
617      }
618      return $objects;
619  }
publicget_perms ( )[ page_ext ]
Parameters
No parameters for this method
Code
051  public function get_perms()
052  {
053      return $this->perm_ids;
054  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_right_menu_path ( )[ page_ext ]
Parameters
No parameters for this method
Code
352  public function get_right_menu_path()
353  {
354      if ($this->right_menu)
355      {
356          $this->_right_menu_path = PAGE_SITE . "interface/templates/" . $this->right_menu;
357      }
358      else
359      {
360          $this->_right_menu_path = PAGE_SITE . "interface/templates/right_menu.php";
361      }
362          return $this->_right_menu_path;
363  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
protectedinsert ( )[ page_db ]
Parameters
No parameters for this method
Code
159  protected function insert()
160  {
161      $db = page::db();
162      $q  = " INSERT INTO cor_page ( ";
163      $q .= $db->param_string("name") . ", ";
164      $q .= $db->param_string("description") . ", ";
165      $q .= $db->param_string("helix") . ", ";
166      $q .= $db->param_string("title") . ", ";
167      $q .= $db->param_string("header") . ", ";
168      $q .= $db->param_string("header_menu") . ", ";
169      $q .= $db->param_string("left_menu") . ", ";
170      $q .= $db->param_string("right_menu") . ", ";
171      $q .= $db->param_string("footer") . ", ";
172      $q .= $db->param_string("version") . ", ";
173      $q .= $db->param_string("mdate") . ", ";
174      $q .= $db->param_string("cdate") . ", ";
175      $q .= $db->param_string("deleted");
176      $q .= " ) VALUES ( ";
177      $q .= $db->value_string($this->_name) . ", ";
178      $q .= $db->value_string($this->_description) . ", ";
179      $q .= ($this->_helix ? "'1'" : "'0'") . ", ";
180      $q .= $db->value_string($this->_title) . ", ";
181      $q .= $db->value_string($this->_header) . ", ";
182      $q .= $db->value_string($this->_header_menu) . ", ";
183      $q .= $db->value_string($this->_left_menu) . ", ";
184      $q .= $db->value_string($this->_right_menu) . ", ";
185      $q .= $db->value_string($this->_footer) . ", ";
186      $q .= $db->value_string($this->_version) . ", ";
187      $q .= $db->value_string(timestamp()) . ", ";
188      $q .= $db->value_string(timestamp()) . ", ";
189      $q .= $this->deleted ? "'1'" : "'0'";
190      $q .= " ) ";
191      $db->query($q);
192      $this->_id = $db->insert_id;
193      return true;
194  }
publicmap ( )[ page_db ]
Parameters
No parameters for this method
Code
123  public function map()
124  {
125      $this->_name = array_key_exists("page:name",$_REQUEST) ? reqval("page:name") : $this->_name;
126      $this->_description = array_key_exists("page:description",$_REQUEST) ? reqval("page:description") : $this->_description;
127      $this->_helix = array_key_exists("page:helix",$_REQUEST) ? reqval("page:helix") : $this->_helix;
128      $this->_title = array_key_exists("page:title",$_REQUEST) ? reqval("page:title") : $this->_title;
129      $this->_header = array_key_exists("page:header",$_REQUEST) ? reqval("page:header") : $this->_header;
130      $this->_header_menu = array_key_exists("page:header_menu",$_REQUEST) ? reqval("page:header_menu") : $this->_header_menu;
131      $this->_left_menu = array_key_exists("page:left_menu",$_REQUEST) ? reqval("page:left_menu") : $this->_left_menu;
132      $this->_right_menu = array_key_exists("page:right_menu",$_REQUEST) ? reqval("page:right_menu") : $this->_right_menu;
133      $this->_footer = array_key_exists("page:footer",$_REQUEST) ? reqval("page:footer") : $this->_footer;
134      $this->_version = array_key_exists("page:version",$_REQUEST) ? reqval("page:version") : $this->_version;
135      $this->_mdate = array_key_exists("page:mdate",$_REQUEST) ? reqval("page:mdate") : $this->_mdate;
136      $this->_cdate = array_key_exists("page:cdate",$_REQUEST) ? reqval("page:cdate") : $this->_cdate;
137      $this->_deleted = array_key_exists("page:deleted",$_REQUEST) ? reqval("page:deleted") : $this->_deleted;
138  }
publicopen_document ( )[ page_ext ]
Parameters
No parameters for this method
Code
056  public function open_document()
057  {
058      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; nl();
059      echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'; nl();   
060  }
publicpurge ( )[ page_db ]
Parameters
No parameters for this method
Code
239  public function purge()
240  {
241      $db = page::db();
242      $q  = " DELETE FROM cor_page ";
243      $q .= " WHERE id = " . $this->_id;
244      $db->query($q);
245      return true;
246  }
public staticsearch ( keyword )[ page_ext ]
public__set ( p , v )[ obj ]
Parameters
requiredp
requiredv
Code
030  public function __set($p,$v)
031  {
032      $methods = get_class_methods($this);
033      $properties = get_object_vars($this);
034      if (in_array("set_$p",$methods))
035      {
036          $this->{"set_$p"}($v);
037      }
038      else if (array_key_exists("_$p",$properties))
039      {
040          if (!preg_match('/_dirty$/',$p) && property_exists($this,"_{$p}_dirty"))
041          {
042              if (is_object($this->{"_$p"}))
043              {
044                  $this->{"_$p"}->dirty = true;
045              }
046              else
047              {
048                  $this->{"_{$p}_dirty"} = $this->{$p}==$v ? false : true;
049              }
050          }
051          $this->{"_$p"} = $v;
052      }
053      else if (in_array("set_" . substr($p,strpos($p,"_")+1), $methods))
054      {
055          $this->{"set_" . substr($p,strpos($p,"_")+1)}($v,substr($p,0,strpos($p,"_")));
056      }
057      else
058      {
059          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
060      }
061  }
publicset_article ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
423  public function set_article($__v, $__type="default")
424  {
425      $object = is_null(keyval($this->property_objects_array,"{$__type}_article")) ? new article($this->get_article_id($__type)) : $this->property_objects_array["{$__type}_article"];
426      if (is_null($__v))
427      {
428          $rel = new article_page(null,$object->id,$this->id,article_page::type_id($__type));
429          $rel->delete();
430          if (!is_null(keyval($this->property_objects_array,"{$__type}_article")))
431          {
432              $this->property_objects_array["{$__type}_article"] = null;
433          }
434      }
435      else
436      {
437          $id = $object->id;
438          $object = $__v;
439          $object->id = $__v->id>0 ? $__v->id : $id;
440          $object->commit();
441          $this->set_article_ids(array($object->id),$__type);
442      }
443  }
publicset_article_id ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
444  public function set_article_id($__v, $__type="default")
445  {
446      $this->set_article_ids(array($__v),$__type);
447  }
publicset_article_ids ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
448  public function set_article_ids($__v, $__type="default")
449  {
450      if ($this->id == 0)
451      {
452          $this->commit();
453      }
454      $type_id = article_page::type_id($__type);
455      article_page::delete_all(null,$this->id,$type_id);
456      if (is_array($__v))
457      {
458          foreach ($__v as $index=>$id)
459          {
460              $object = new article_page(null,$id,$this->id,$type_id);
461              $object->deleted = false;
462              $object->article_page_type_id = $type_id;
463              $object->commit();
464              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_article")))
465              {
466                  $this->property_objects_array["{$__type}_article"] = new article($object->article_id);
467              }
468          }
469          $this->_dirty = true;
470      }
471  }
publicset_article_list ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
472  public function set_article_list($__v, $__type="default")
473  {
474      if (is_array($__v))
475      {
476          $ids = array();
477          foreach ($__v as $index=>$object)
478          {
479              $ids[] = $object->id;
480          }
481          $this->set_article_ids($ids,$__type);
482      }
483  }
publicset_content ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
522  public function set_content($__v, $__type="default")
523  {
524      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
525      if (is_null($__v))
526      {
527          $rel = new content_page(null,$object->id,$this->id,content_page::type_id($__type));
528          $rel->delete();
529          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
530          {
531              $this->property_objects_array["{$__type}_content"] = null;
532          }
533      }
534      else
535      {
536          $id = $object->id;
537          $object = $__v;
538          $object->id = $__v->id>0 ? $__v->id : $id;
539          $object->commit();
540          $this->set_content_ids(array($object->id),$__type);
541      }
542  }
publicset_content_id ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
543  public function set_content_id($__v, $__type="default")
544  {
545      $this->set_content_ids(array($__v),$__type);
546  }
publicset_content_ids ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
547  public function set_content_ids($__v, $__type="default")
548  {
549      if ($this->id == 0)
550      {
551          $this->commit();
552      }
553      $type_id = content_page::type_id($__type);
554      content_page::delete_all(null,$this->id,$type_id);
555      if (is_array($__v))
556      {
557          foreach ($__v as $index=>$id)
558          {
559              $object = new content_page(null,$id,$this->id,$type_id);
560              $object->deleted = false;
561              $object->content_page_type_id = $type_id;
562              $object->commit();
563              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
564              {
565                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
566              }
567          }
568          $this->_dirty = true;
569      }
570  }
publicset_content_list ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
571  public function set_content_list($__v, $__type="default")
572  {
573      if (is_array($__v))
574      {
575          $ids = array();
576          foreach ($__v as $index=>$object)
577          {
578              $ids[] = $object->id;
579          }
580          $this->set_content_ids($ids,$__type);
581      }
582  }
publicset_menu ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
720  public function set_menu($__v, $__type="default")
721  {
722      $object = is_null(keyval($this->property_objects_array,"{$__type}_menu")) ? new menu($this->get_menu_id($__type)) : $this->property_objects_array["{$__type}_menu"];
723      if (is_null($__v))
724      {
725          $rel = new menu_page(null,$object->id,$this->id,menu_page::type_id($__type));
726          $rel->delete();
727          if (!is_null(keyval($this->property_objects_array,"{$__type}_menu")))
728          {
729              $this->property_objects_array["{$__type}_menu"] = null;
730          }
731      }
732      else
733      {
734          $id = $object->id;
735          $object = $__v;
736          $object->id = $__v->id>0 ? $__v->id : $id;
737          $object->commit();
738          $this->set_menu_ids(array($object->id),$__type);
739      }
740  }
publicset_menu_id ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
741  public function set_menu_id($__v, $__type="default")
742  {
743      $this->set_menu_ids(array($__v),$__type);
744  }
publicset_menu_ids ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
745  public function set_menu_ids($__v, $__type="default")
746  {
747      if ($this->id == 0)
748      {
749          $this->commit();
750      }
751      $type_id = menu_page::type_id($__type);
752      menu_page::delete_all(null,$this->id,$type_id);
753      if (is_array($__v))
754      {
755          foreach ($__v as $index=>$id)
756          {
757              $object = new menu_page(null,$id,$this->id,$type_id);
758              $object->deleted = false;
759              $object->menu_page_type_id = $type_id;
760              $object->commit();
761              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_menu")))
762              {
763                  $this->property_objects_array["{$__type}_menu"] = new menu($object->menu_id);
764              }
765          }
766          $this->_dirty = true;
767      }
768  }
publicset_menu_list ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
769  public function set_menu_list($__v, $__type="default")
770  {
771      if (is_array($__v))
772      {
773          $ids = array();
774          foreach ($__v as $index=>$object)
775          {
776              $ids[] = $object->id;
777          }
778          $this->set_menu_ids($ids,$__type);
779      }
780  }
publicset_perm ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
621  public function set_perm($__v, $__type="default")
622  {
623      $object = is_null(keyval($this->property_objects_array,"{$__type}_perm")) ? new perm($this->get_perm_id($__type)) : $this->property_objects_array["{$__type}_perm"];
624      if (is_null($__v))
625      {
626          $rel = new page_perm(null,$this->id,$object->id,page_perm::type_id($__type));
627          $rel->delete();
628          if (!is_null(keyval($this->property_objects_array,"{$__type}_perm")))
629          {
630              $this->property_objects_array["{$__type}_perm"] = null;
631          }
632      }
633      else
634      {
635          $id = $object->id;
636          $object = $__v;
637          $object->id = $__v->id>0 ? $__v->id : $id;
638          $object->commit();
639          $this->set_perm_ids(array($object->id),$__type);
640      }
641  }
publicset_perm_id ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
642  public function set_perm_id($__v, $__type="default")
643  {
644      $this->set_perm_ids(array($__v),$__type);
645  }
publicset_perm_ids ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
646  public function set_perm_ids($__v, $__type="default")
647  {
648      if ($this->id == 0)
649      {
650          $this->commit();
651      }
652      $type_id = page_perm::type_id($__type);
653      page_perm::delete_all($this->id,null,$type_id);
654      if (is_array($__v))
655      {
656          foreach ($__v as $index=>$id)
657          {
658              $object = new page_perm(null,$this->id,$id,$type_id);
659              $object->deleted = false;
660              $object->page_perm_type_id = $type_id;
661              $object->commit();
662              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_perm")))
663              {
664                  $this->property_objects_array["{$__type}_perm"] = new perm($object->perm_id);
665              }
666          }
667          $this->_dirty = true;
668      }
669  }
publicset_perm_list ( v , type ["default"] )[ page_db ]
Parameters
requiredv
optionaltype ["default"]
Code
670  public function set_perm_list($__v, $__type="default")
671  {
672      if (is_array($__v))
673      {
674          $ids = array();
675          foreach ($__v as $index=>$object)
676          {
677              $ids[] = $object->id;
678          }
679          $this->set_perm_ids($ids,$__type);
680      }
681  }
publicshow ( )[ page_ext ]
Parameters
No parameters for this method
Code
121  public function show()
122  {
123      global $perm,$sess,$index,$errors,$fo,$page,$params;
124 
125      foreach ($errors->items as $k=>$v)
126      {
127          debug($v->title . " : " . $v->message,__FILE__,__LINE__);
128      }
129 
130      if (!is_true(NOCODEBEHIND))
131      {
132          include_once(PAGE_SITE . "interface/templates/templates.cb.php");
133          if ($this->render)
134          {
135              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.cb.php"))
136              {
137                  include_once(PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.cb.php");
138              }
139          }
140      }
141 
142      /////////////////////////////////////////////////////////////////////////
143      // INCLUDE THIS SECTION IF IT IS A FULL PAGE REQUEST ONLY
144      /////////////////////////////////////////////////////////////////////////
145      if (FORMAT === "markup")
146      {
147          $this->open_document();
148          $this->show_head();
149          if (!is_true(SITE_USE_OUTPUT_BUFFERING))
150          {
151              ob_end_flush();
152          }
153          echo '<body>'; nl(3);
154      }
155      if (FORMAT === "markup")
156      {
157          /////////////////////////////////////////////////////////////////////////
158          // SHOW THE HEADER
159          /////////////////////////////////////////////////////////////////////////
160          if (!is_true(NOFRAME))
161          {
162              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/header.php"))
163              {
164                  include_once(PAGE_SITE . "interface/pages/{$this->name}/header.php");
165              }
166              else if (is_file(PAGE_SITE . "interface/templates/{$this->header}") && file_exists(PAGE_SITE . "interface/templates/{$this->header}"))
167              {
168                  include_once(PAGE_SITE . "interface/templates/{$this->header}");
169              }
170              else if (file_exists(PAGE_SITE . "interface/templates/header.php"))
171              {
172                  include_once(PAGE_SITE . "interface/templates/header.php");
173              }
174          }
175 
176          /////////////////////////////////////////////////////////////////////////
177          // SHOW THE HEADER MENU
178          /////////////////////////////////////////////////////////////////////////
179          if (!is_true(NOFRAME))
180          {
181              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/header_menu.php"))
182              {
183                  include_once(PAGE_SITE . "interface/pages/{$this->name}/header_menu.php");
184              }
185              else if (is_file(PAGE_SITE . "interface/templates/{$this->header_menu}") && file_exists(PAGE_SITE . "interface/templates/{$this->header_menu}"))
186              {
187                  include_once(PAGE_SITE . "interface/templates/{$this->header_menu}");
188              }
189              else if (file_exists(PAGE_SITE . "interface/templates/header_menu.php"))
190              {
191                  include_once(PAGE_SITE . "interface/templates/header_menu.php");
192              }
193          }
194 
195          /////////////////////////////////////////////////////////////////////////
196          // SHOW THE LEFT MENU
197          /////////////////////////////////////////////////////////////////////////
198          if (!is_true(NOFRAME))
199          {
200              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/left_menu.php"))
201              {
202                  include_once(PAGE_SITE . "interface/pages/{$this->name}/left_menu.php");
203              }
204              else if (is_file(PAGE_SITE . "interface/templates/{$this->left_menu}") && file_exists(PAGE_SITE . "interface/templates/{$this->left_menu}"))
205              {
206                  include_once(PAGE_SITE . "interface/templates/{$this->left_menu}");
207              }
208              else if (file_exists(PAGE_SITE . "interface/templates/left_menu.php"))
209              {
210                  include_once(PAGE_SITE . "interface/templates/left_menu.php");
211              }
212          }
213      }
214 
215      if ($errors->exist)
216      {
217          include_once($this->error_path);
218      }
219 
220      if ($this->render)
221      {
222          if (file_exists(PAGE_SITE . "interface/pages/beforepage/beforepage.php"))
223          {
224              include_once(PAGE_SITE . "interface/pages/beforepage/beforepage.php");
225          }
226 
227          /////////////////////////////////////////////////////////////////////////
228          // INCLUDE THE PHYSICAL FILE OF THE PAGE
229          /////////////////////////////////////////////////////////////////////////
230          require_once($this->path);
231 
232          if (file_exists(PAGE_SITE . "interface/pages/afterpage/afterpage.php"))
233          {
234              include_once(PAGE_SITE . "interface/pages/afterpage/afterpage.php");
235          }
236      }
237 
238      if (FORMAT === "markup")
239      {
240          /////////////////////////////////////////////////////////////////////////
241          // SHOW THE RIGHT MENU
242          /////////////////////////////////////////////////////////////////////////
243          if (!is_true(NOFRAME))
244          {
245              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/right_menu.php"))
246              {
247                  include_once(PAGE_SITE . "interface/pages/{$this->name}/right_menu.php");
248              }
249              else if (is_file(PAGE_SITE . "interface/templates/{$this->right_menu}") && file_exists(PAGE_SITE . "interface/templates/{$this->right_menu}"))
250              {
251                  include_once(PAGE_SITE . "interface/templates/{$this->right_menu}");
252              }
253              else if (file_exists(PAGE_SITE . "interface/templates/right_menu.php"))
254              {
255                  include_once(PAGE_SITE . "interface/templates/right_menu.php");
256              }
257          }
258 
259          /////////////////////////////////////////////////////////////////////////
260          // SHOW THE FOOTER
261          /////////////////////////////////////////////////////////////////////////
262          if (!is_true(NOFRAME))
263          {
264              if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/footer.php"))
265              {
266                  include_once(PAGE_SITE . "interface/pages/{$this->name}/footer.php");
267              }
268              else if (is_file(PAGE_SITE . "interface/templates/{$this->footer}") && file_exists(PAGE_SITE . "interface/templates/{$this->footer}"))
269              {
270                  include_once(PAGE_SITE . "interface/templates/{$this->footer}");
271              }
272              else if (file_exists(PAGE_SITE . "interface/templates/footer.php"))
273              {
274                  include_once(PAGE_SITE . "interface/templates/footer.php");
275              }
276          }
277      }
278      if (FORMAT === "markup")
279      {
280          nl(3);
281          echo '</body>';
282          $this->close_document();
283      }
284  }
publicshow_head ( )[ page_ext ]
Parameters
No parameters for this method
Code
067  public function show_head()
068  {
069      global $perm,$sess,$index,$errors,$fo,$page,$params;
070 
071      echo '<head>'; nl();
072          echo '<title>';
073              echo strlen(trim($this->title))>0 ? $this->title : SITE_TITLE;
074          echo '</title>'; nl();
075          echo $this->meta_string;
076          if (!is_true(NOSTYLE))
077          {
078              if (is_true(EXTJS_ENABLE))
079              {
080                  echo '<link href="' . CURRENT_URL . 'helix/scripts/extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />'; nl();
081              }
082              echo '<link href="' . CURRENT_URL . (ADMIN ? "helix/" : "") . 'styles/helix.css" rel="stylesheet" type="text/css" />'; nl();
083              if ($this->render)
084              {
085                  if (file_exists(SITE . "interface/pages/{$this->name}/{$this->name}.css"))
086                  {
087                      style::open(); nl();
088                          include_once(PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.css"); nl();
089                      style::close(); nl();
090                  }
091              }
092          }
093          if (!is_true(NOSCRIPT))
094          {
095              if (is_true(EXTJS_ENABLE))
096              {
097                  if (is_true(EXTJS_CORE_ONLY))
098                  {
099                      script::open(CURRENT_URL . "helix/scripts/extjs/ext-core" . (EXTJS_DEBUG ? "-debug" : "") . ".js"); script::close(); nl();
100                  }
101                  else
102                  {
103                      script::open(CURRENT_URL . "helix/scripts/extjs/ext-base" . (EXTJS_DEBUG ? "-debug" : "") . ".js"); script::close(); nl();
104                      script::open(CURRENT_URL . "helix/scripts/extjs/ext-all" . (EXTJS_DEBUG ? "-debug" : "") . ".js"); script::close(); nl();   
105                  }
106              }
107              script::open(CURRENT_URL . (ADMIN ? "helix/" : "") . "scripts/helix.js"); script::close(); nl();
108              if ($this->render)
109              {
110                  if (file_exists(PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.js"))
111                  {
112                      script::open(); nl();
113                          include_once(PAGE_SITE . "interface/pages/{$this->name}/{$this->name}.js"); nl();
114                      script::close(); nl();
115                  }
116              }
117          }
118      echo '</head>'; nl();   
119  }
public__toString ( )[ page_db ]
Parameters
No parameters for this method
Code
381  public function __toString()
382  {
383      return (is_null($this->name) ? "" : $this->name);
384  }
publicundelete ( )[ page_db ]
Parameters
No parameters for this method
Code
228  public function undelete()
229  {
230      $db = page::db();
231      $q  = " UPDATE cor_page SET ";
232      $q .= " deleted = 0 ";
233      $q .= " WHERE id = " . $this->_id;
234      $db->query($q);
235      $this->deleted = false;
236      return true;
237  }
protectedupdate ( )[ page_db ]
Parameters
No parameters for this method
Code
196  protected function update()
197  {
198      $db = page::db();
199      $q  = " UPDATE cor_page SET ";
200      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
201      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
202      $q .= $db->param_string("helix") . " = " . ($this->_helix ? "'1'" : "'0'") . ", ";
203      $q .= $db->param_string("title") . " = " . $db->value_string($this->_title) . ", ";
204      $q .= $db->param_string("header") . " = " . $db->value_string($this->_header) . ", ";
205      $q .= $db->param_string("header_menu") . " = " . $db->value_string($this->_header_menu) . ", ";
206      $q .= $db->param_string("left_menu") . " = " . $db->value_string($this->_left_menu) . ", ";
207      $q .= $db->param_string("right_menu") . " = " . $db->value_string($this->_right_menu) . ", ";
208      $q .= $db->param_string("footer") . " = " . $db->value_string($this->_footer) . ", ";
209      $q .= $db->param_string("version") . " = " . $db->value_string($this->_version) . ", ";
210      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
211      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
212      $q .= " WHERE id = " . $this->_id;
213      $db->query($q);
214      return true;
215  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicarticle[ page_db ]
Code
386  public function get_article($__type="default")
387  {
388      $object = is_null(keyval($this->property_objects_array,"{$__type}_article")) ? new article($this->get_article_id($__type)) : $this->property_objects_array["{$__type}_article"];
389      $this->property_objects_array["{$__type}_article"] = $object;
390      return $object;
391  }
Code
423  public function set_article($__v, $__type="default")
424  {
425      $object = is_null(keyval($this->property_objects_array,"{$__type}_article")) ? new article($this->get_article_id($__type)) : $this->property_objects_array["{$__type}_article"];
426      if (is_null($__v))
427      {
428          $rel = new article_page(null,$object->id,$this->id,article_page::type_id($__type));
429          $rel->delete();
430          if (!is_null(keyval($this->property_objects_array,"{$__type}_article")))
431          {
432              $this->property_objects_array["{$__type}_article"] = null;
433          }
434      }
435      else
436      {
437          $id = $object->id;
438          $object = $__v;
439          $object->id = $__v->id>0 ? $__v->id : $id;
440          $object->commit();
441          $this->set_article_ids(array($object->id),$__type);
442      }
443  }
publicarticle_id[ page_db ]
Code
392  public function get_article_id($__type="default")
393  {
394      $ids = $this->get_article_ids($__type, true);
395      return (count($ids)==1 ? $ids[0] : null);
396  }
Code
444  public function set_article_id($__v, $__type="default")
445  {
446      $this->set_article_ids(array($__v),$__type);
447  }
publicarticle_ids[ page_db ]
Code
397  public function get_article_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
398  {
399      $article_ids = array();
400      $db = page::db();
401      $q  = " SELECT cms_article.content_id FROM cms_article_page INNER JOIN cms_article ON cms_article_page.article_content_id=cms_article.content_id AND cms_article_page.deleted=0 AND cms_article.deleted=0 AND cms_article_page.page_id='$this->id' " . (is_null($__type) ? "" : " AND cms_article_page.article_page_type_id='" . article_page::type_id($__type) . "'") . ($__get_primary ? " AND cms_article_page.primary=1 " : "");
402      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
403      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
404      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
405      $db->query($q);
406      while ($db->next_record())
407      {
408          $article_ids[] = $db->f("content_id");
409      }
410      return $article_ids;
411  }
Code
448  public function set_article_ids($__v, $__type="default")
449  {
450      if ($this->id == 0)
451      {
452          $this->commit();
453      }
454      $type_id = article_page::type_id($__type);
455      article_page::delete_all(null,$this->id,$type_id);
456      if (is_array($__v))
457      {
458          foreach ($__v as $index=>$id)
459          {
460              $object = new article_page(null,$id,$this->id,$type_id);
461              $object->deleted = false;
462              $object->article_page_type_id = $type_id;
463              $object->commit();
464              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_article")))
465              {
466                  $this->property_objects_array["{$__type}_article"] = new article($object->article_id);
467              }
468          }
469          $this->_dirty = true;
470      }
471  }
publicarticle_list[ page_db ]
Code
412  public function get_article_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
413  {
414      $ids = $this->get_article_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
415      $objects = array();
416      foreach ($ids as $index=>$id)
417      {
418          $objects[$index] = new article($id);
419      }
420      return $objects;
421  }
Code
472  public function set_article_list($__v, $__type="default")
473  {
474      if (is_array($__v))
475      {
476          $ids = array();
477          foreach ($__v as $index=>$object)
478          {
479              $ids[] = $object->id;
480          }
481          $this->set_article_ids($ids,$__type);
482      }
483  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ page_db ]
Code
248  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
249  {
250      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
251      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
252      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
253 
254      $db = page::db();
255      $data = array();
256      $q  = " SELECT $colstring ";
257      $q .= " FROM cor_page ";
258      $q .= " WHERE cor_page.deleted = 0 ";
259      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
260 
261      if (is_string($__order))
262      {
263          $q .= "ORDER BY " . $__order;
264      }
265      else if (is_array($__order) and count($__order)>0)
266      {
267          $orderings = array();
268          foreach ($__order as $col=>$dir)
269          {
270              $orderings[] = " $col $dir ";
271          }
272          $q .= "ORDER BY " . implode(", ", $orderings);
273      }
274      else if (is_object($__order))
275      {
276          $q .= "";
277      }
278      else
279      {
280          // THERE IS NO `order` COLUMN ON THIS OBJECT
281      }
282 
283      if (!is_null($__limit))
284      {
285          $q .= " LIMIT $__offset , $__limit ";
286      }
287 
288      $db->query($q);
289 
290      if (count($colarray)>1 || $colstring=="*")
291      {
292          while ($db->next_record())
293          {
294              $data[] = $db->record;
295          }
296      }
297      else
298      {
299          while ($db->next_record())
300          {
301              $data[] = $db->f(0);
302          }
303      }
304 
305      return $data;
306  }
publiccontent[ page_db ]
Code
485  public function get_content($__type="default")
486  {
487      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
488      $this->property_objects_array["{$__type}_content"] = $object;
489      return $object;
490  }
Code
522  public function set_content($__v, $__type="default")
523  {
524      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
525      if (is_null($__v))
526      {
527          $rel = new content_page(null,$object->id,$this->id,content_page::type_id($__type));
528          $rel->delete();
529          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
530          {
531              $this->property_objects_array["{$__type}_content"] = null;
532          }
533      }
534      else
535      {
536          $id = $object->id;
537          $object = $__v;
538          $object->id = $__v->id>0 ? $__v->id : $id;
539          $object->commit();
540          $this->set_content_ids(array($object->id),$__type);
541      }
542  }
publiccontent_id[ page_db ]
Code
491  public function get_content_id($__type="default")
492  {
493      $ids = $this->get_content_ids($__type, true);
494      return (count($ids)==1 ? $ids[0] : null);
495  }
Code
543  public function set_content_id($__v, $__type="default")
544  {
545      $this->set_content_ids(array($__v),$__type);
546  }
publiccontent_ids[ page_db ]
Code
496  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
497  {
498      $content_ids = array();
499      $db = page::db();
500      $q  = " SELECT cms_content.id FROM cms_content_page INNER JOIN cms_content ON cms_content_page.content_id=cms_content.id AND cms_content_page.deleted=0 AND cms_content.deleted=0 AND cms_content_page.page_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_page.content_page_type_id='" . content_page::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_page.primary=1 " : "");
501      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
502      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
503      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
504      $db->query($q);
505      while ($db->next_record())
506      {
507          $content_ids[] = $db->f("id");
508      }
509      return $content_ids;
510  }
Code
547  public function set_content_ids($__v, $__type="default")
548  {
549      if ($this->id == 0)
550      {
551          $this->commit();
552      }
553      $type_id = content_page::type_id($__type);
554      content_page::delete_all(null,$this->id,$type_id);
555      if (is_array($__v))
556      {
557          foreach ($__v as $index=>$id)
558          {
559              $object = new content_page(null,$id,$this->id,$type_id);
560              $object->deleted = false;
561              $object->content_page_type_id = $type_id;
562              $object->commit();
563              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
564              {
565                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
566              }
567          }
568          $this->_dirty = true;
569      }
570  }
publiccontent_list[ page_db ]
Code
511  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
512  {
513      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
514      $objects = array();
515      foreach ($ids as $index=>$id)
516      {
517          $objects[$index] = new content($id);
518      }
519      return $objects;
520  }
Code
571  public function set_content_list($__v, $__type="default")
572  {
573      if (is_array($__v))
574      {
575          $ids = array();
576          foreach ($__v as $index=>$object)
577          {
578              $ids[] = $object->id;
579          }
580          $this->set_content_ids($ids,$__type);
581      }
582  }