Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class url extends url_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_url"][ url ]
 
Properties
protected_cdate[ url_db ]
protected_cdate_dirty[ url_db ]
protected_deleted[ url_db ]
protected_deleted_dirty[ url_db ]
protected_dirty[ obj ]
protected_id[ url_db ]
protected_id_dirty[ url_db ]
protected_mdate[ url_db ]
protected_mdate_dirty[ url_db ]
publicproperty_objects_array[ obj ]
protected_value[ url_db ]
protected_value_dirty[ url_db ]
 
Methods
publiccommit ( )[ url_db ]
Parameters
No parameters for this method
Code
086  public function commit()
087  {
088      if ($this->_id > 0)
089      {
090          $this->update();
091      }
092      else
093      {
094          $this->insert();
095      }
096 
097      foreach ($this->property_objects_array as $property=>$object)
098      {
099          $this->{$property} = $object;
100      }
101 
102      return true;
103  }
public__construct ( id , value )[ url_db ]
Parameters
optionalid
optionalvalue
Code
040  public function __construct($__id=null, $__value=null)
041  {
042      $this->_id = 0;
043      $this->_value = $__value;
044      $this->_mdate = null;
045      $this->_cdate = null;
046      $this->_deleted = false;
047 
048      $this->_id_dirty = false;
049      $this->_value_dirty = false;
050      $this->_mdate_dirty = false;
051      $this->_cdate_dirty = false;
052      $this->_deleted_dirty = false;
053 
054      if (is_null($__id))
055      {
056          return;
057      }
058 
059      $db = url::db();
060      $q  = " SELECT cor_url.id,cor_url.value,cor_url.mdate,cor_url.cdate,cor_url.deleted ";
061      $q .= " FROM cor_url ";       
062      if (!is_null($__id))
063      {
064          $q .= " WHERE id = '$__id' ";
065      }
066 
067      $db->query($q);
068      if ($db->next_record() && $db->num_rows() == 1)
069      {
070          $this->_id = $db->f("id");
071          $this->_value = $db->f("value");
072          $this->_mdate = $db->f("mdate");
073          $this->_cdate = $db->f("cdate");
074          $this->_deleted = $db->f("deleted");
075      }
076  }
protected staticdb ( )[ url_db ]
Parameters
No parameters for this method
Code
800  protected static function db()
801  {
802      return new db();
803  }
publicdelete ( )[ url_db ]
Parameters
No parameters for this method
Code
136  public function delete()
137  {
138      $db = url::db();
139      $q  = " UPDATE cor_url SET ";
140      $q .= " deleted = 1 ";
141      $q .= " WHERE id = " . $this->_id;
142      $db->query($q);
143      $this->deleted = true;
144      return true;
145  }
public staticdelete_all ( )[ url_db ]
Parameters
No parameters for this method
Code
242  public static function delete_all()
243  {
244      $db = url::db();
245      $q  = " UPDATE cor_url SET ";
246      $q .= " deleted = 1 ";
247     
248      $db->query($q);
249      return true;
250  }
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_asset ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
305  public function get_asset($__type="default")
306  {
307      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
308      $this->property_objects_array["{$__type}_asset"] = $object;
309      return $object;
310  }
publicget_asset_id ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
311  public function get_asset_id($__type="default")
312  {
313      $ids = $this->get_asset_ids($__type, true);
314      return (count($ids)==1 ? $ids[0] : null);
315  }
publicget_asset_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
316  public function get_asset_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
317  {
318      $asset_ids = array();
319      $db = url::db();
320      $q  = " SELECT am_asset.id FROM am_asset_url INNER JOIN am_asset ON am_asset_url.asset_id=am_asset.id AND am_asset_url.deleted=0 AND am_asset.deleted=0 AND am_asset_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_url.asset_url_type_id='" . asset_url::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_url.primary=1 " : "");
321      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
322      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
323      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
324      $db->query($q);
325      while ($db->next_record())
326      {
327          $asset_ids[] = $db->f("id");
328      }
329      return $asset_ids;
330  }
publicget_asset_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
331  public function get_asset_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
332  {
333      $ids = $this->get_asset_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
334      $objects = array();
335      foreach ($ids as $index=>$id)
336      {
337          $objects[$index] = new asset($id);
338      }
339      return $objects;
340  }
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] )[ url_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
167  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
168  {
169      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
170      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
171      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
172 
173      $db = url::db();
174      $data = array();
175      $q  = " SELECT $colstring ";
176      $q .= " FROM cor_url ";
177      $q .= " WHERE cor_url.deleted = 0 ";
178      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
179 
180      if (is_string($__order))
181      {
182          $q .= "ORDER BY " . $__order;
183      }
184      else if (is_array($__order) and count($__order)>0)
185      {
186          $orderings = array();
187          foreach ($__order as $col=>$dir)
188          {
189              $orderings[] = " $col $dir ";
190          }
191          $q .= "ORDER BY " . implode(", ", $orderings);
192      }
193      else if (is_object($__order))
194      {
195          $q .= "";
196      }
197      else
198      {
199          // THERE IS NO `order` COLUMN ON THIS OBJECT
200      }
201 
202      if (!is_null($__limit))
203      {
204          $q .= " LIMIT $__offset , $__limit ";
205      }
206 
207      $db->query($q);
208 
209      if (count($colarray)>1 || $colstring=="*")
210      {
211          while ($db->next_record())
212          {
213              $data[] = $db->record;
214          }
215      }
216      else
217      {
218          while ($db->next_record())
219          {
220              $data[] = $db->f(0);
221          }
222      }
223 
224      return $data;
225  }
publicget_content ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
503  public function get_content($__type="default")
504  {
505      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
506      $this->property_objects_array["{$__type}_content"] = $object;
507      return $object;
508  }
publicget_content_id ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
509  public function get_content_id($__type="default")
510  {
511      $ids = $this->get_content_ids($__type, true);
512      return (count($ids)==1 ? $ids[0] : null);
513  }
publicget_content_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
514  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
515  {
516      $content_ids = array();
517      $db = url::db();
518      $q  = " SELECT cms_content.id FROM cms_content_url INNER JOIN cms_content ON cms_content_url.content_id=cms_content.id AND cms_content_url.deleted=0 AND cms_content.deleted=0 AND cms_content_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_url.content_url_type_id='" . content_url::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_url.primary=1 " : "");
519      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
520      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
521      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
522      $db->query($q);
523      while ($db->next_record())
524      {
525          $content_ids[] = $db->f("id");
526      }
527      return $content_ids;
528  }
publicget_content_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
529  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
530  {
531      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
532      $objects = array();
533      foreach ($ids as $index=>$id)
534      {
535          $objects[$index] = new content($id);
536      }
537      return $objects;
538  }
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_document ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
701  public function get_document($__type="default")
702  {
703      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
704      $this->property_objects_array["{$__type}_document"] = $object;
705      return $object;
706  }
publicget_document_id ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
707  public function get_document_id($__type="default")
708  {
709      $ids = $this->get_document_ids($__type, true);
710      return (count($ids)==1 ? $ids[0] : null);
711  }
publicget_document_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
712  public function get_document_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
713  {
714      $document_ids = array();
715      $db = url::db();
716      $q  = " SELECT doc_document.id FROM doc_document_url INNER JOIN doc_document ON doc_document_url.document_id=doc_document.id AND doc_document_url.deleted=0 AND doc_document.deleted=0 AND doc_document_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND doc_document_url.document_url_type_id='" . document_url::type_id($__type) . "'") . ($__get_primary ? " AND doc_document_url.primary=1 " : "");
717      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
718      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
719      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
720      $db->query($q);
721      while ($db->next_record())
722      {
723          $document_ids[] = $db->f("id");
724      }
725      return $document_ids;
726  }
publicget_document_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
727  public function get_document_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
728  {
729      $ids = $this->get_document_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
730      $objects = array();
731      foreach ($ids as $index=>$id)
732      {
733          $objects[$index] = new document($id);
734      }
735      return $objects;
736  }
publicget_entity ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
602  public function get_entity($__type="default")
603  {
604      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
605      $this->property_objects_array["{$__type}_entity"] = $object;
606      return $object;
607  }
publicget_entity_id ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
608  public function get_entity_id($__type="default")
609  {
610      $ids = $this->get_entity_ids($__type, true);
611      return (count($ids)==1 ? $ids[0] : null);
612  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
613  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
614  {
615      $entity_ids = array();
616      $db = url::db();
617      $q  = " SELECT cor_entity.id FROM cor_entity_url INNER JOIN cor_entity ON cor_entity_url.entity_id=cor_entity.id AND cor_entity_url.deleted=0 AND cor_entity.deleted=0 AND cor_entity_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cor_entity_url.entity_url_type_id='" . entity_url::type_id($__type) . "'") . ($__get_primary ? " AND cor_entity_url.primary=1 " : "");
618      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
619      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
620      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
621      $db->query($q);
622      while ($db->next_record())
623      {
624          $entity_ids[] = $db->f("id");
625      }
626      return $entity_ids;
627  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
628  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
629  {
630      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
631      $objects = array();
632      foreach ($ids as $index=>$id)
633      {
634          $objects[$index] = new entity($id);
635      }
636      return $objects;
637  }
publicget_event ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
404  public function get_event($__type="default")
405  {
406      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
407      $this->property_objects_array["{$__type}_event"] = $object;
408      return $object;
409  }
publicget_event_id ( type ["default"] )[ url_db ]
Parameters
optionaltype ["default"]
Code
410  public function get_event_id($__type="default")
411  {
412      $ids = $this->get_event_ids($__type, true);
413      return (count($ids)==1 ? $ids[0] : null);
414  }
publicget_event_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
415  public function get_event_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
416  {
417      $event_ids = array();
418      $db = url::db();
419      $q  = " SELECT cal_event.id FROM cal_event_url INNER JOIN cal_event ON cal_event_url.event_id=cal_event.id AND cal_event_url.deleted=0 AND cal_event.deleted=0 AND cal_event_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cal_event_url.event_url_type_id='" . event_url::type_id($__type) . "'") . ($__get_primary ? " AND cal_event_url.primary=1 " : "");
420      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
421      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
422      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
423      $db->query($q);
424      while ($db->next_record())
425      {
426          $event_ids[] = $db->f("id");
427      }
428      return $event_ids;
429  }
publicget_event_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ url_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
430  public function get_event_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
431  {
432      $ids = $this->get_event_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
433      $objects = array();
434      foreach ($ids as $index=>$id)
435      {
436          $objects[$index] = new event($id);
437      }
438      return $objects;
439  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ url_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
227  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
228  {
229      return url::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
230  }
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  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ url_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
232  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
233  {
234      $objects = array();
235      foreach (url::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
236      {
237          $objects[] = new url($id);
238      }
239      return $objects;
240  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
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 ( )[ url_db ]
Parameters
No parameters for this method
Code
105  protected function insert()
106  {
107      $db = url::db();
108      $q  = " INSERT INTO cor_url ( ";
109      $q .= $db->param_string("value") . ", ";
110      $q .= $db->param_string("mdate") . ", ";
111      $q .= $db->param_string("cdate") . ", ";
112      $q .= $db->param_string("deleted");
113      $q .= " ) VALUES ( ";
114      $q .= $db->value_string($this->_value) . ", ";
115      $q .= $db->value_string(timestamp()) . ", ";
116      $q .= $db->value_string(timestamp()) . ", ";
117      $q .= $this->deleted ? "'1'" : "'0'";
118      $q .= " ) ";
119      $db->query($q);
120      $this->_id = $db->insert_id;
121      return true;
122  }
publicmap ( )[ url_db ]
Parameters
No parameters for this method
Code
078  public function map()
079  {
080      $this->_value = array_key_exists("url:value",$_REQUEST) ? reqval("url:value") : $this->_value;
081      $this->_mdate = array_key_exists("url:mdate",$_REQUEST) ? reqval("url:mdate") : $this->_mdate;
082      $this->_cdate = array_key_exists("url:cdate",$_REQUEST) ? reqval("url:cdate") : $this->_cdate;
083      $this->_deleted = array_key_exists("url:deleted",$_REQUEST) ? reqval("url:deleted") : $this->_deleted;
084  }
publicpurge ( )[ url_db ]
Parameters
No parameters for this method
Code
158  public function purge()
159  {
160      $db = url::db();
161      $q  = " DELETE FROM cor_url ";
162      $q .= " WHERE id = " . $this->_id;
163      $db->query($q);
164      return true;
165  }
public staticsearch ( keyword )[ url_db ]
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_asset ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
342  public function set_asset($__v, $__type="default")
343  {
344      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
345      if (is_null($__v))
346      {
347          $rel = new asset_url(null,$object->id,$this->id,asset_url::type_id($__type));
348          $rel->delete();
349          if (!is_null(keyval($this->property_objects_array,"{$__type}_asset")))
350          {
351              $this->property_objects_array["{$__type}_asset"] = null;
352          }
353      }
354      else
355      {
356          $id = $object->id;
357          $object = $__v;
358          $object->id = $__v->id>0 ? $__v->id : $id;
359          $object->commit();
360          $this->set_asset_ids(array($object->id),$__type);
361      }
362  }
publicset_asset_id ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
363  public function set_asset_id($__v, $__type="default")
364  {
365      $this->set_asset_ids(array($__v),$__type);
366  }
publicset_asset_ids ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
367  public function set_asset_ids($__v, $__type="default")
368  {
369      if ($this->id == 0)
370      {
371          $this->commit();
372      }
373      $type_id = asset_url::type_id($__type);
374      asset_url::delete_all(null,$this->id,$type_id);
375      if (is_array($__v))
376      {
377          foreach ($__v as $index=>$id)
378          {
379              $object = new asset_url(null,$id,$this->id,$type_id);
380              $object->deleted = false;
381              $object->asset_url_type_id = $type_id;
382              $object->commit();
383              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_asset")))
384              {
385                  $this->property_objects_array["{$__type}_asset"] = new asset($object->asset_id);
386              }
387          }
388          $this->_dirty = true;
389      }
390  }
publicset_asset_list ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
391  public function set_asset_list($__v, $__type="default")
392  {
393      if (is_array($__v))
394      {
395          $ids = array();
396          foreach ($__v as $index=>$object)
397          {
398              $ids[] = $object->id;
399          }
400          $this->set_asset_ids($ids,$__type);
401      }
402  }
publicset_content ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
540  public function set_content($__v, $__type="default")
541  {
542      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
543      if (is_null($__v))
544      {
545          $rel = new content_url(null,$object->id,$this->id,content_url::type_id($__type));
546          $rel->delete();
547          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
548          {
549              $this->property_objects_array["{$__type}_content"] = null;
550          }
551      }
552      else
553      {
554          $id = $object->id;
555          $object = $__v;
556          $object->id = $__v->id>0 ? $__v->id : $id;
557          $object->commit();
558          $this->set_content_ids(array($object->id),$__type);
559      }
560  }
publicset_content_id ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
561  public function set_content_id($__v, $__type="default")
562  {
563      $this->set_content_ids(array($__v),$__type);
564  }
publicset_content_ids ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
565  public function set_content_ids($__v, $__type="default")
566  {
567      if ($this->id == 0)
568      {
569          $this->commit();
570      }
571      $type_id = content_url::type_id($__type);
572      content_url::delete_all(null,$this->id,$type_id);
573      if (is_array($__v))
574      {
575          foreach ($__v as $index=>$id)
576          {
577              $object = new content_url(null,$id,$this->id,$type_id);
578              $object->deleted = false;
579              $object->content_url_type_id = $type_id;
580              $object->commit();
581              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
582              {
583                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
584              }
585          }
586          $this->_dirty = true;
587      }
588  }
publicset_content_list ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
589  public function set_content_list($__v, $__type="default")
590  {
591      if (is_array($__v))
592      {
593          $ids = array();
594          foreach ($__v as $index=>$object)
595          {
596              $ids[] = $object->id;
597          }
598          $this->set_content_ids($ids,$__type);
599      }
600  }
publicset_document ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
738  public function set_document($__v, $__type="default")
739  {
740      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
741      if (is_null($__v))
742      {
743          $rel = new document_url(null,$object->id,$this->id,document_url::type_id($__type));
744          $rel->delete();
745          if (!is_null(keyval($this->property_objects_array,"{$__type}_document")))
746          {
747              $this->property_objects_array["{$__type}_document"] = null;
748          }
749      }
750      else
751      {
752          $id = $object->id;
753          $object = $__v;
754          $object->id = $__v->id>0 ? $__v->id : $id;
755          $object->commit();
756          $this->set_document_ids(array($object->id),$__type);
757      }
758  }
publicset_document_id ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
759  public function set_document_id($__v, $__type="default")
760  {
761      $this->set_document_ids(array($__v),$__type);
762  }
publicset_document_ids ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
763  public function set_document_ids($__v, $__type="default")
764  {
765      if ($this->id == 0)
766      {
767          $this->commit();
768      }
769      $type_id = document_url::type_id($__type);
770      document_url::delete_all(null,$this->id,$type_id);
771      if (is_array($__v))
772      {
773          foreach ($__v as $index=>$id)
774          {
775              $object = new document_url(null,$id,$this->id,$type_id);
776              $object->deleted = false;
777              $object->document_url_type_id = $type_id;
778              $object->commit();
779              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_document")))
780              {
781                  $this->property_objects_array["{$__type}_document"] = new document($object->document_id);
782              }
783          }
784          $this->_dirty = true;
785      }
786  }
publicset_document_list ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
787  public function set_document_list($__v, $__type="default")
788  {
789      if (is_array($__v))
790      {
791          $ids = array();
792          foreach ($__v as $index=>$object)
793          {
794              $ids[] = $object->id;
795          }
796          $this->set_document_ids($ids,$__type);
797      }
798  }
publicset_entity ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
639  public function set_entity($__v, $__type="default")
640  {
641      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
642      if (is_null($__v))
643      {
644          $rel = new entity_url(null,$object->id,$this->id,entity_url::type_id($__type));
645          $rel->delete();
646          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
647          {
648              $this->property_objects_array["{$__type}_entity"] = null;
649          }
650      }
651      else
652      {
653          $id = $object->id;
654          $object = $__v;
655          $object->id = $__v->id>0 ? $__v->id : $id;
656          $object->commit();
657          $this->set_entity_ids(array($object->id),$__type);
658      }
659  }
publicset_entity_id ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
660  public function set_entity_id($__v, $__type="default")
661  {
662      $this->set_entity_ids(array($__v),$__type);
663  }
publicset_entity_ids ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
664  public function set_entity_ids($__v, $__type="default")
665  {
666      if ($this->id == 0)
667      {
668          $this->commit();
669      }
670      $type_id = entity_url::type_id($__type);
671      entity_url::delete_all(null,$this->id,$type_id);
672      if (is_array($__v))
673      {
674          foreach ($__v as $index=>$id)
675          {
676              $object = new entity_url(null,$id,$this->id,$type_id);
677              $object->deleted = false;
678              $object->entity_url_type_id = $type_id;
679              $object->commit();
680              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
681              {
682                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
683              }
684          }
685          $this->_dirty = true;
686      }
687  }
publicset_entity_list ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
688  public function set_entity_list($__v, $__type="default")
689  {
690      if (is_array($__v))
691      {
692          $ids = array();
693          foreach ($__v as $index=>$object)
694          {
695              $ids[] = $object->id;
696          }
697          $this->set_entity_ids($ids,$__type);
698      }
699  }
publicset_event ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
441  public function set_event($__v, $__type="default")
442  {
443      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
444      if (is_null($__v))
445      {
446          $rel = new event_url(null,$object->id,$this->id,event_url::type_id($__type));
447          $rel->delete();
448          if (!is_null(keyval($this->property_objects_array,"{$__type}_event")))
449          {
450              $this->property_objects_array["{$__type}_event"] = null;
451          }
452      }
453      else
454      {
455          $id = $object->id;
456          $object = $__v;
457          $object->id = $__v->id>0 ? $__v->id : $id;
458          $object->commit();
459          $this->set_event_ids(array($object->id),$__type);
460      }
461  }
publicset_event_id ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
462  public function set_event_id($__v, $__type="default")
463  {
464      $this->set_event_ids(array($__v),$__type);
465  }
publicset_event_ids ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
466  public function set_event_ids($__v, $__type="default")
467  {
468      if ($this->id == 0)
469      {
470          $this->commit();
471      }
472      $type_id = event_url::type_id($__type);
473      event_url::delete_all(null,$this->id,$type_id);
474      if (is_array($__v))
475      {
476          foreach ($__v as $index=>$id)
477          {
478              $object = new event_url(null,$id,$this->id,$type_id);
479              $object->deleted = false;
480              $object->event_url_type_id = $type_id;
481              $object->commit();
482              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_event")))
483              {
484                  $this->property_objects_array["{$__type}_event"] = new event($object->event_id);
485              }
486          }
487          $this->_dirty = true;
488      }
489  }
publicset_event_list ( v , type ["default"] )[ url_db ]
Parameters
requiredv
optionaltype ["default"]
Code
490  public function set_event_list($__v, $__type="default")
491  {
492      if (is_array($__v))
493      {
494          $ids = array();
495          foreach ($__v as $index=>$object)
496          {
497              $ids[] = $object->id;
498          }
499          $this->set_event_ids($ids,$__type);
500      }
501  }
public__toString ( )[ url_db ]
Parameters
No parameters for this method
Code
300  public function __toString()
301  {
302      return (is_null($this->value) ? "" : $this->value);
303  }
publicundelete ( )[ url_db ]
Parameters
No parameters for this method
Code
147  public function undelete()
148  {
149      $db = url::db();
150      $q  = " UPDATE cor_url SET ";
151      $q .= " deleted = 0 ";
152      $q .= " WHERE id = " . $this->_id;
153      $db->query($q);
154      $this->deleted = false;
155      return true;
156  }
protectedupdate ( )[ url_db ]
Parameters
No parameters for this method
Code
124  protected function update()
125  {
126      $db = url::db();
127      $q  = " UPDATE cor_url SET ";
128      $q .= $db->param_string("value") . " = " . $db->value_string($this->_value) . ", ";
129      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
130      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
131      $q .= " WHERE id = " . $this->_id;
132      $db->query($q);
133      return true;
134  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicasset[ url_db ]
Code
305  public function get_asset($__type="default")
306  {
307      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
308      $this->property_objects_array["{$__type}_asset"] = $object;
309      return $object;
310  }
Code
342  public function set_asset($__v, $__type="default")
343  {
344      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
345      if (is_null($__v))
346      {
347          $rel = new asset_url(null,$object->id,$this->id,asset_url::type_id($__type));
348          $rel->delete();
349          if (!is_null(keyval($this->property_objects_array,"{$__type}_asset")))
350          {
351              $this->property_objects_array["{$__type}_asset"] = null;
352          }
353      }
354      else
355      {
356          $id = $object->id;
357          $object = $__v;
358          $object->id = $__v->id>0 ? $__v->id : $id;
359          $object->commit();
360          $this->set_asset_ids(array($object->id),$__type);
361      }
362  }
publicasset_id[ url_db ]
Code
311  public function get_asset_id($__type="default")
312  {
313      $ids = $this->get_asset_ids($__type, true);
314      return (count($ids)==1 ? $ids[0] : null);
315  }
Code
363  public function set_asset_id($__v, $__type="default")
364  {
365      $this->set_asset_ids(array($__v),$__type);
366  }
publicasset_ids[ url_db ]
Code
316  public function get_asset_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
317  {
318      $asset_ids = array();
319      $db = url::db();
320      $q  = " SELECT am_asset.id FROM am_asset_url INNER JOIN am_asset ON am_asset_url.asset_id=am_asset.id AND am_asset_url.deleted=0 AND am_asset.deleted=0 AND am_asset_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_url.asset_url_type_id='" . asset_url::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_url.primary=1 " : "");
321      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
322      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
323      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
324      $db->query($q);
325      while ($db->next_record())
326      {
327          $asset_ids[] = $db->f("id");
328      }
329      return $asset_ids;
330  }
Code
367  public function set_asset_ids($__v, $__type="default")
368  {
369      if ($this->id == 0)
370      {
371          $this->commit();
372      }
373      $type_id = asset_url::type_id($__type);
374      asset_url::delete_all(null,$this->id,$type_id);
375      if (is_array($__v))
376      {
377          foreach ($__v as $index=>$id)
378          {
379              $object = new asset_url(null,$id,$this->id,$type_id);
380              $object->deleted = false;
381              $object->asset_url_type_id = $type_id;
382              $object->commit();
383              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_asset")))
384              {
385                  $this->property_objects_array["{$__type}_asset"] = new asset($object->asset_id);
386              }
387          }
388          $this->_dirty = true;
389      }
390  }
publicasset_list[ url_db ]
Code
331  public function get_asset_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
332  {
333      $ids = $this->get_asset_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
334      $objects = array();
335      foreach ($ids as $index=>$id)
336      {
337          $objects[$index] = new asset($id);
338      }
339      return $objects;
340  }
Code
391  public function set_asset_list($__v, $__type="default")
392  {
393      if (is_array($__v))
394      {
395          $ids = array();
396          foreach ($__v as $index=>$object)
397          {
398              $ids[] = $object->id;
399          }
400          $this->set_asset_ids($ids,$__type);
401      }
402  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ url_db ]
Code
167  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
168  {
169      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
170      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
171      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
172 
173      $db = url::db();
174      $data = array();
175      $q  = " SELECT $colstring ";
176      $q .= " FROM cor_url ";
177      $q .= " WHERE cor_url.deleted = 0 ";
178      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
179 
180      if (is_string($__order))
181      {
182          $q .= "ORDER BY " . $__order;
183      }
184      else if (is_array($__order) and count($__order)>0)
185      {
186          $orderings = array();
187          foreach ($__order as $col=>$dir)
188          {
189              $orderings[] = " $col $dir ";
190          }
191          $q .= "ORDER BY " . implode(", ", $orderings);
192      }
193      else if (is_object($__order))
194      {
195          $q .= "";
196      }
197      else
198      {
199          // THERE IS NO `order` COLUMN ON THIS OBJECT
200      }
201 
202      if (!is_null($__limit))
203      {
204          $q .= " LIMIT $__offset , $__limit ";
205      }
206 
207      $db->query($q);
208 
209      if (count($colarray)>1 || $colstring=="*")
210      {
211          while ($db->next_record())
212          {
213              $data[] = $db->record;
214          }
215      }
216      else
217      {
218          while ($db->next_record())
219          {
220              $data[] = $db->f(0);
221          }
222      }
223 
224      return $data;
225  }
publiccontent[ url_db ]
Code
503  public function get_content($__type="default")
504  {
505      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
506      $this->property_objects_array["{$__type}_content"] = $object;
507      return $object;
508  }
Code
540  public function set_content($__v, $__type="default")
541  {
542      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
543      if (is_null($__v))
544      {
545          $rel = new content_url(null,$object->id,$this->id,content_url::type_id($__type));
546          $rel->delete();
547          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
548          {
549              $this->property_objects_array["{$__type}_content"] = null;
550          }
551      }
552      else
553      {
554          $id = $object->id;
555          $object = $__v;
556          $object->id = $__v->id>0 ? $__v->id : $id;
557          $object->commit();
558          $this->set_content_ids(array($object->id),$__type);
559      }
560  }
publiccontent_id[ url_db ]
Code
509  public function get_content_id($__type="default")
510  {
511      $ids = $this->get_content_ids($__type, true);
512      return (count($ids)==1 ? $ids[0] : null);
513  }
Code
561  public function set_content_id($__v, $__type="default")
562  {
563      $this->set_content_ids(array($__v),$__type);
564  }
publiccontent_ids[ url_db ]
Code
514  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
515  {
516      $content_ids = array();
517      $db = url::db();
518      $q  = " SELECT cms_content.id FROM cms_content_url INNER JOIN cms_content ON cms_content_url.content_id=cms_content.id AND cms_content_url.deleted=0 AND cms_content.deleted=0 AND cms_content_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_url.content_url_type_id='" . content_url::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_url.primary=1 " : "");
519      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
520      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
521      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
522      $db->query($q);
523      while ($db->next_record())
524      {
525          $content_ids[] = $db->f("id");
526      }
527      return $content_ids;
528  }
Code
565  public function set_content_ids($__v, $__type="default")
566  {
567      if ($this->id == 0)
568      {
569          $this->commit();
570      }
571      $type_id = content_url::type_id($__type);
572      content_url::delete_all(null,$this->id,$type_id);
573      if (is_array($__v))
574      {
575          foreach ($__v as $index=>$id)
576          {
577              $object = new content_url(null,$id,$this->id,$type_id);
578              $object->deleted = false;
579              $object->content_url_type_id = $type_id;
580              $object->commit();
581              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
582              {
583                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
584              }
585          }
586          $this->_dirty = true;
587      }
588  }
publiccontent_list[ url_db ]
Code
529  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
530  {
531      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
532      $objects = array();
533      foreach ($ids as $index=>$id)
534      {
535          $objects[$index] = new content($id);
536      }
537      return $objects;
538  }
Code
589  public function set_content_list($__v, $__type="default")
590  {
591      if (is_array($__v))
592      {
593          $ids = array();
594          foreach ($__v as $index=>$object)
595          {
596              $ids[] = $object->id;
597          }
598          $this->set_content_ids($ids,$__type);
599      }
600  }
publicdirty[ obj ]
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  }
publicdocument[ url_db ]
Code
701  public function get_document($__type="default")
702  {
703      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
704      $this->property_objects_array["{$__type}_document"] = $object;
705      return $object;
706  }
Code
738  public function set_document($__v, $__type="default")
739  {
740      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
741      if (is_null($__v))
742      {
743          $rel = new document_url(null,$object->id,$this->id,document_url::type_id($__type));
744          $rel->delete();
745          if (!is_null(keyval($this->property_objects_array,"{$__type}_document")))
746          {
747              $this->property_objects_array["{$__type}_document"] = null;
748          }
749      }
750      else
751      {
752          $id = $object->id;
753          $object = $__v;
754          $object->id = $__v->id>0 ? $__v->id : $id;
755          $object->commit();
756          $this->set_document_ids(array($object->id),$__type);
757      }
758  }
publicdocument_id[ url_db ]
Code
707  public function get_document_id($__type="default")
708  {
709      $ids = $this->get_document_ids($__type, true);
710      return (count($ids)==1 ? $ids[0] : null);
711  }
Code
759  public function set_document_id($__v, $__type="default")
760  {
761      $this->set_document_ids(array($__v),$__type);
762  }
publicdocument_ids[ url_db ]
Code
712  public function get_document_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
713  {
714      $document_ids = array();
715      $db = url::db();
716      $q  = " SELECT doc_document.id FROM doc_document_url INNER JOIN doc_document ON doc_document_url.document_id=doc_document.id AND doc_document_url.deleted=0 AND doc_document.deleted=0 AND doc_document_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND doc_document_url.document_url_type_id='" . document_url::type_id($__type) . "'") . ($__get_primary ? " AND doc_document_url.primary=1 " : "");
717      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
718      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
719      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
720      $db->query($q);
721      while ($db->next_record())
722      {
723          $document_ids[] = $db->f("id");
724      }
725      return $document_ids;
726  }
Code
763  public function set_document_ids($__v, $__type="default")
764  {
765      if ($this->id == 0)
766      {
767          $this->commit();
768      }
769      $type_id = document_url::type_id($__type);
770      document_url::delete_all(null,$this->id,$type_id);
771      if (is_array($__v))
772      {
773          foreach ($__v as $index=>$id)
774          {
775              $object = new document_url(null,$id,$this->id,$type_id);
776              $object->deleted = false;
777              $object->document_url_type_id = $type_id;
778              $object->commit();
779              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_document")))
780              {
781                  $this->property_objects_array["{$__type}_document"] = new document($object->document_id);
782              }
783          }
784          $this->_dirty = true;
785      }
786  }
publicdocument_list[ url_db ]
Code
727  public function get_document_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
728  {
729      $ids = $this->get_document_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
730      $objects = array();
731      foreach ($ids as $index=>$id)
732      {
733          $objects[$index] = new document($id);
734      }
735      return $objects;
736  }
Code
787  public function set_document_list($__v, $__type="default")
788  {
789      if (is_array($__v))
790      {
791          $ids = array();
792          foreach ($__v as $index=>$object)
793          {
794              $ids[] = $object->id;
795          }
796          $this->set_document_ids($ids,$__type);
797      }
798  }
publicentity[ url_db ]
Code
602  public function get_entity($__type="default")
603  {
604      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
605      $this->property_objects_array["{$__type}_entity"] = $object;
606      return $object;
607  }
Code
639  public function set_entity($__v, $__type="default")
640  {
641      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
642      if (is_null($__v))
643      {
644          $rel = new entity_url(null,$object->id,$this->id,entity_url::type_id($__type));
645          $rel->delete();
646          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
647          {
648              $this->property_objects_array["{$__type}_entity"] = null;
649          }
650      }
651      else
652      {
653          $id = $object->id;
654          $object = $__v;
655          $object->id = $__v->id>0 ? $__v->id : $id;
656          $object->commit();
657          $this->set_entity_ids(array($object->id),$__type);
658      }
659  }
publicentity_id[ url_db ]
Code
608  public function get_entity_id($__type="default")
609  {
610      $ids = $this->get_entity_ids($__type, true);
611      return (count($ids)==1 ? $ids[0] : null);
612  }
Code
660  public function set_entity_id($__v, $__type="default")
661  {
662      $this->set_entity_ids(array($__v),$__type);
663  }
publicentity_ids[ url_db ]
Code
613  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
614  {
615      $entity_ids = array();
616      $db = url::db();
617      $q  = " SELECT cor_entity.id FROM cor_entity_url INNER JOIN cor_entity ON cor_entity_url.entity_id=cor_entity.id AND cor_entity_url.deleted=0 AND cor_entity.deleted=0 AND cor_entity_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cor_entity_url.entity_url_type_id='" . entity_url::type_id($__type) . "'") . ($__get_primary ? " AND cor_entity_url.primary=1 " : "");
618      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
619      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
620      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
621      $db->query($q);
622      while ($db->next_record())
623      {
624          $entity_ids[] = $db->f("id");
625      }
626      return $entity_ids;
627  }
Code
664  public function set_entity_ids($__v, $__type="default")
665  {
666      if ($this->id == 0)
667      {
668          $this->commit();
669      }
670      $type_id = entity_url::type_id($__type);
671      entity_url::delete_all(null,$this->id,$type_id);
672      if (is_array($__v))
673      {
674          foreach ($__v as $index=>$id)
675          {
676              $object = new entity_url(null,$id,$this->id,$type_id);
677              $object->deleted = false;
678              $object->entity_url_type_id = $type_id;
679              $object->commit();
680              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
681              {
682                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
683              }
684          }
685          $this->_dirty = true;
686      }
687  }
publicentity_list[ url_db ]
Code
628  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
629  {
630      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
631      $objects = array();
632      foreach ($ids as $index=>$id)
633      {
634          $objects[$index] = new entity($id);
635      }
636      return $objects;
637  }
Code
688  public function set_entity_list($__v, $__type="default")
689  {
690      if (is_array($__v))
691      {
692          $ids = array();
693          foreach ($__v as $index=>$object)
694          {
695              $ids[] = $object->id;
696          }
697          $this->set_entity_ids($ids,$__type);
698      }
699  }
publicevent[ url_db ]
Code
404  public function get_event($__type="default")
405  {
406      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
407      $this->property_objects_array["{$__type}_event"] = $object;
408      return $object;
409  }
Code
441  public function set_event($__v, $__type="default")
442  {
443      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
444      if (is_null($__v))
445      {
446          $rel = new event_url(null,$object->id,$this->id,event_url::type_id($__type));
447          $rel->delete();
448          if (!is_null(keyval($this->property_objects_array,"{$__type}_event")))
449          {
450              $this->property_objects_array["{$__type}_event"] = null;
451          }
452      }
453      else
454      {
455          $id = $object->id;
456          $object = $__v;
457          $object->id = $__v->id>0 ? $__v->id : $id;
458          $object->commit();
459          $this->set_event_ids(array($object->id),$__type);
460      }
461  }
publicevent_id[ url_db ]
Code
410  public function get_event_id($__type="default")
411  {
412      $ids = $this->get_event_ids($__type, true);
413      return (count($ids)==1 ? $ids[0] : null);
414  }
Code
462  public function set_event_id($__v, $__type="default")
463  {
464      $this->set_event_ids(array($__v),$__type);
465  }
publicevent_ids[ url_db ]
Code
415  public function get_event_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
416  {
417      $event_ids = array();
418      $db = url::db();
419      $q  = " SELECT cal_event.id FROM cal_event_url INNER JOIN cal_event ON cal_event_url.event_id=cal_event.id AND cal_event_url.deleted=0 AND cal_event.deleted=0 AND cal_event_url.url_id='$this->id' " . (is_null($__type) ? "" : " AND cal_event_url.event_url_type_id='" . event_url::type_id($__type)