Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class event extends event_ext

Hide Inherited MembersCalendar
Description
No description.
 
Constants
constantTABLENAME ["cal_event"][ event ]
 
Properties
protected_allday[ event_db ]
protected_allday_dirty[ event_db ]
protected_capacity[ event_db ]
protected_capacity_dirty[ event_db ]
protected_cdate[ event_db ]
protected_cdate_dirty[ event_db ]
protected_deleted[ event_db ]
protected_deleted_dirty[ event_db ]
protected_description[ event_db ]
protected_description_dirty[ event_db ]
protected_dirty[ obj ]
protected_end_date[ event_db ]
protected_end_date_dirty[ event_db ]
protected_end_time[ event_db ]
protected_end_time_dirty[ event_db ]
protected_event_type_id[ event_db ]
protected_event_type_id_dirty[ event_db ]
protected_eventpriority_id[ event_db ]
protected_eventpriority_id_dirty[ event_db ]
protected_eventstatus_id[ event_db ]
protected_eventstatus_id_dirty[ event_db ]
protected_formatted_end_date[ event_ext ]
protected_formatted_end_time[ event_ext ]
protected_formatted_start_date[ event_ext ]
protected_formatted_start_time[ event_ext ]
protected_id[ event_db ]
protected_id_dirty[ event_db ]
protected_mdate[ event_db ]
protected_mdate_dirty[ event_db ]
protected_name[ event_db ]
protected_name_dirty[ event_db ]
protected_private[ event_db ]
protected_private_dirty[ event_db ]
publicproperty_objects_array[ obj ]
protected_start_date[ event_db ]
protected_start_date_dirty[ event_db ]
protected_start_time[ event_db ]
protected_start_time_dirty[ event_db ]
 
Methods
publiccommit ( )[ event_db ]
Parameters
No parameters for this method
Code
152  public function commit()
153  {
154      if ($this->_id > 0)
155      {
156          $this->update();
157      }
158      else
159      {
160          $this->insert();
161      }
162 
163      foreach ($this->property_objects_array as $property=>$object)
164      {
165          $this->{$property} = $object;
166      }
167 
168      return true;
169  }
public__construct ( id )[ event_ext ]
Parameters
optionalid
Code
012  public function __construct($__id=null)
013  {
014      parent::__construct($__id);
015 
016      $start_date = new date($this->_start_date);
017      $this->_formatted_start_date = $start_date->format();
018 
019      $end_date = new date($this->_end_date);
020      $this->_formatted_end_date = $end_date->format();
021 
022      $start_time = new time($this->_start_time);
023      $this->_formatted_start_time = $start_time->format();
024 
025      $end_time = new time($this->_end_time);
026      $this->_formatted_end_time = $end_time->format();
027  }
protected staticdb ( )[ event_db ]
Parameters
No parameters for this method
Code
1151  protected static function db()
1152  {
1153      return new db();
1154  }
publicdelete ( )[ event_db ]
Parameters
No parameters for this method
Code
235  public function delete()
236  {
237      $db = event::db();
238      $q  = " UPDATE cal_event SET ";
239      $q .= " deleted = 1 ";
240      $q .= " WHERE id = " . $this->_id;
241      $db->query($q);
242      $this->deleted = true;
243      return true;
244  }
public staticdelete_all ( )[ event_db ]
Parameters
No parameters for this method
Code
344  public static function delete_all()
345  {
346      $db = event::db();
347      $q  = " UPDATE cal_event SET ";
348      $q .= " deleted = 1 ";
349     
350      $db->query($q);
351      return true;
352  }
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_address ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
757  public function get_address($__type="default")
758  {
759      $object = is_null(keyval($this->property_objects_array,"{$__type}_address")) ? new address($this->get_address_id($__type)) : $this->property_objects_array["{$__type}_address"];
760      $this->property_objects_array["{$__type}_address"] = $object;
761      return $object;
762  }
publicget_address_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
763  public function get_address_id($__type="default")
764  {
765      $ids = $this->get_address_ids($__type, true);
766      return (count($ids)==1 ? $ids[0] : null);
767  }
publicget_address_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
768  public function get_address_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
769  {
770      $address_ids = array();
771      $db = event::db();
772      $q  = " SELECT cor_address.id FROM cal_address_event INNER JOIN cor_address ON cal_address_event.address_id=cor_address.id AND cal_address_event.deleted=0 AND cor_address.deleted=0 AND cal_address_event.event_id='$this->id' " . (is_null($__type) ? "" : " AND cal_address_event.address_event_type_id='" . address_event::type_id($__type) . "'") . ($__get_primary ? " AND cal_address_event.primary=1 " : "");
773      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
774      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
775      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
776      $db->query($q);
777      while ($db->next_record())
778      {
779          $address_ids[] = $db->f("id");
780      }
781      return $address_ids;
782  }
publicget_address_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
783  public function get_address_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
784  {
785      $ids = $this->get_address_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
786      $objects = array();
787      foreach ($ids as $index=>$id)
788      {
789          $objects[$index] = new address($id);
790      }
791      return $objects;
792  }
publicget_after_end ( )[ event_ext ]
Parameters
No parameters for this method
Code
088  public function get_after_end()
089  {
090      return (strtotime($this->end_date)-strtotime("now") < 0);
091  }
publicget_after_start ( )[ event_ext ]
Parameters
No parameters for this method
Code
083  public function get_after_start()
084  {
085      return (strtotime($this->start_date)-strtotime("now") < 0);
086  }
public staticget_all_for_date ( date )[ event_ext ]
Parameters
requireddate
Code
029  public static function get_all_for_date($__date)
030  {
031      $db = new db;
032      $ids = array();
033      $q  = " SELECT id ";
034      $q .= " FROM " . self::TABLENAME . " ";
035      $q .= " WHERE `start_date` <= '$__date' ";
036      $q .= " AND `end_date` >= '$__date' ";
037      $q .= " AND deleted = 0 ";
038      $db->query($q);
039 
040      while ($db->next_record())
041      {
042          $ids[] = $db->f("id");
043      }
044 
045      return $ids;
046  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_attendees ( )[ event_ext ]
Parameters
No parameters for this method
Code
139  public function get_attendees()
140  {
141      $attendees = array();
142      foreach(entity_event::get_ids(null,$this->id) as $entity_event_id)
143      {
144          $entity_event = new entity_event($entity_event_id);
145          if($entity_event->entity_event_type_id==2)
146          {
147              $attendees[] = new person($entity_event->entity_id);
148          }
149      }
150      return $attendees;
151  }
publicget_before_end ( )[ event_ext ]
Parameters
No parameters for this method
Code
098  public function get_before_end()
099  {
100      return !$this->after_end;
101  }
publicget_before_start ( )[ event_ext ]
Parameters
No parameters for this method
Code
093  public function get_before_start()
094  {
095      return !$this->after_start;
096  }
publicget_calendar ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
460  public function get_calendar($__type="default")
461  {
462      $object = is_null(keyval($this->property_objects_array,"{$__type}_calendar")) ? new calendar($this->get_calendar_id($__type)) : $this->property_objects_array["{$__type}_calendar"];
463      $this->property_objects_array["{$__type}_calendar"] = $object;
464      return $object;
465  }
publicget_calendar_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
466  public function get_calendar_id($__type="default")
467  {
468      $ids = $this->get_calendar_ids($__type, true);
469      return (count($ids)==1 ? $ids[0] : null);
470  }
publicget_calendar_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
471  public function get_calendar_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
472  {
473      $calendar_ids = array();
474      $db = event::db();
475      $q  = " SELECT cal_calendar.id FROM cal_calendar_event INNER JOIN cal_calendar ON cal_calendar_event.calendar_id=cal_calendar.id AND cal_calendar_event.deleted=0 AND cal_calendar.deleted=0 AND cal_calendar_event.event_id='$this->id' " . (is_null($__type) ? "" : " AND cal_calendar_event.calendar_event_type_id='" . calendar_event::type_id($__type) . "'") . ($__get_primary ? " AND cal_calendar_event.primary=1 " : "");
476      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
477      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
478      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
479      $db->query($q);
480      while ($db->next_record())
481      {
482          $calendar_ids[] = $db->f("id");
483      }
484      return $calendar_ids;
485  }
publicget_calendar_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
486  public function get_calendar_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
487  {
488      $ids = $this->get_calendar_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
489      $objects = array();
490      foreach ($ids as $index=>$id)
491      {
492          $objects[$index] = new calendar($id);
493      }
494      return $objects;
495  }
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] )[ event_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
266  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
267  {
268      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
269      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
270      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
271 
272      $db = event::db();
273      $data = array();
274      $q  = " SELECT $colstring ";
275      $q .= " FROM cal_event ";
276      $q .= " WHERE cal_event.deleted = 0 ";
277      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
278      $q .= array_key_exists("eventpriority_id",$lookups) ? " AND cal_event.eventpriority_id='" . $lookups["eventpriority_id"] . "' " : "";
279      $q .= array_key_exists("eventstatus_id",$lookups) ? " AND cal_event.eventstatus_id='" . $lookups["eventstatus_id"] . "' " : "";
280      $q .= array_key_exists("event_type_id",$lookups) ? " AND cal_event.event_type_id='" . $lookups["event_type_id"] . "' " : "";
281 
282      if (is_string($__order))
283      {
284          $q .= "ORDER BY " . $__order;
285      }
286      else if (is_array($__order) and count($__order)>0)
287      {
288          $orderings = array();
289          foreach ($__order as $col=>$dir)
290          {
291              $orderings[] = " $col $dir ";
292          }
293          $q .= "ORDER BY " . implode(", ", $orderings);
294      }
295      else if (is_object($__order))
296      {
297          $q .= "";
298      }
299      else
300      {
301          // THERE IS NO `order` COLUMN ON THIS OBJECT
302      }
303 
304      if (!is_null($__limit))
305      {
306          $q .= " LIMIT $__offset , $__limit ";
307      }
308 
309      $db->query($q);
310 
311      if (count($colarray)>1 || $colstring=="*")
312      {
313          while ($db->next_record())
314          {
315              $data[] = $db->record;
316          }
317      }
318      else
319      {
320          while ($db->next_record())
321          {
322              $data[] = $db->f(0);
323          }
324      }
325 
326      return $data;
327  }
publicget_contact ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
1052  public function get_contact($__type="default")
1053  {
1054      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
1055      $this->property_objects_array["{$__type}_contact"] = $object;
1056      return $object;
1057  }
publicget_contact_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
1058  public function get_contact_id($__type="default")
1059  {
1060      $ids = $this->get_contact_ids($__type, true);
1061      return (count($ids)==1 ? $ids[0] : null);
1062  }
publicget_contact_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1063  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1064  {
1065      $contact_ids = array();
1066      $db = event::db();
1067      $q  = " SELECT crm_contact.person_entity_id FROM crm_contact_event INNER JOIN crm_contact ON crm_contact_event.contact_person_entity_id=crm_contact.person_entity_id AND crm_contact_event.deleted=0 AND crm_contact.deleted=0 AND crm_contact_event.event_id='$this->id' " . (is_null($__type) ? "" : " AND crm_contact_event.contact_event_type_id='" . contact_event::type_id($__type) . "'") . ($__get_primary ? " AND crm_contact_event.primary=1 " : "");
1068      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1069      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1070      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1071      $db->query($q);
1072      while ($db->next_record())
1073      {
1074          $contact_ids[] = $db->f("person_entity_id");
1075      }
1076      return $contact_ids;
1077  }
publicget_contact_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1078  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1079  {
1080      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1081      $objects = array();
1082      foreach ($ids as $index=>$id)
1083      {
1084          $objects[$index] = new contact($id);
1085      }
1086      return $objects;
1087  }
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_entity ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
559  public function get_entity($__type="default")
560  {
561      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
562      $this->property_objects_array["{$__type}_entity"] = $object;
563      return $object;
564  }
publicget_entity_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
565  public function get_entity_id($__type="default")
566  {
567      $ids = $this->get_entity_ids($__type, true);
568      return (count($ids)==1 ? $ids[0] : null);
569  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
570  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
571  {
572      $entity_ids = array();
573      $db = event::db();
574      $q  = " SELECT cor_entity.id FROM cal_entity_event INNER JOIN cor_entity ON cal_entity_event.entity_id=cor_entity.id AND cal_entity_event.deleted=0 AND cor_entity.deleted=0 AND cal_entity_event.event_id='$this->id' " . (is_null($__type) ? "" : " AND cal_entity_event.entity_event_type_id='" . entity_event::type_id($__type) . "'") . ($__get_primary ? " AND cal_entity_event.primary=1 " : "");
575      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
576      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
577      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
578      $db->query($q);
579      while ($db->next_record())
580      {
581          $entity_ids[] = $db->f("id");
582      }
583      return $entity_ids;
584  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
585  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
586  {
587      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
588      $objects = array();
589      foreach ($ids as $index=>$id)
590      {
591          $objects[$index] = new entity($id);
592      }
593      return $objects;
594  }
publicget_event_type ( )[ event_db ]
Parameters
No parameters for this method
Code
448  public function get_event_type()
449  {
450      return new event_type($this->event_type_id);
451  }
publicget_eventdate ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
856  public function get_eventdate($__type="default")
857  {
858      $object = is_null(keyval($this->property_objects_array,"{$__type}_eventdate")) ? new eventdate($this->get_eventdate_id($__type)) : $this->property_objects_array["{$__type}_eventdate"];
859      $this->property_objects_array["{$__type}_eventdate"] = $object;
860      return $object;
861  }
publicget_eventdate_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
862  public function get_eventdate_id($__type="default")
863  {
864      $ids = $this->get_eventdate_ids($__type, true);
865      return (count($ids)==1 ? $ids[0] : null);
866  }
publicget_eventdate_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
867  public function get_eventdate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
868  {
869      $eventdate_ids = array();
870      $db = event::db();
871      $q  = " SELECT cal_eventdate.id FROM cal_event_eventdate INNER JOIN cal_eventdate ON cal_event_eventdate.eventdate_id=cal_eventdate.id AND cal_event_eventdate.deleted=0 AND cal_eventdate.deleted=0 AND cal_event_eventdate.event_id='$this->id' " . (is_null($__type) ? "" : " AND cal_event_eventdate.event_eventdate_type_id='" . event_eventdate::type_id($__type) . "'") . ($__get_primary ? " AND cal_event_eventdate.primary=1 " : "");
872      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
873      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
874      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
875      $db->query($q);
876      while ($db->next_record())
877      {
878          $eventdate_ids[] = $db->f("id");
879      }
880      return $eventdate_ids;
881  }
publicget_eventdate_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
882  public function get_eventdate_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
883  {
884      $ids = $this->get_eventdate_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
885      $objects = array();
886      foreach ($ids as $index=>$id)
887      {
888          $objects[$index] = new eventdate($id);
889      }
890      return $objects;
891  }
publicget_eventpriority ( )[ event_db ]
Parameters
No parameters for this method
Code
424  public function get_eventpriority()
425  {
426      return new eventpriority($this->eventpriority_id);
427  }
publicget_eventstatus ( )[ event_db ]
Parameters
No parameters for this method
Code
436  public function get_eventstatus()
437  {
438      return new eventstatus($this->eventstatus_id);
439  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ event_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
329  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
330  {
331      return event::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
332  }
publicget_in_progress ( )[ event_ext ]
Parameters
No parameters for this method
Code
103  public function get_in_progress()
104  {
105      return $this->after_start && $this->before_end;
106  }
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_most_recent ( )[ event_ext ]
Parameters
No parameters for this method
Code
048  public static function get_most_recent()
049  {
050      $date = new date("now");
051      $db = new db;
052      $ids = array();
053      $q  = " SELECT id ";
054      $q .= " FROM " . self::TABLENAME . " ";
055      $q .= " WHERE start_date >= '$date' ";
056      $q .= " AND deleted = 0 ";
057      $q .= " ORDER BY start_date ASC ";
058      $db->query($q);
059 
060      while ($db->next_record())
061      {
062          $ids[] = $db->f("id");
063      }
064 
065      return $ids;
066  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ event_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
334  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
335  {
336      $objects = array();
337      foreach (event::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
338      {
339          $objects[] = new event($id);
340      }
341      return $objects;
342  }
publicget_priority ( )[ event_ext ]
Parameters
No parameters for this method
Code
158  public function get_priority()
159  {
160      return $this->eventpriority_id > 0 ? $this->eventpriority->description : "";
161  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_service ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
658  public function get_service($__type="default")
659  {
660      $object = is_null(keyval($this->property_objects_array,"{$__type}_service")) ? new service($this->get_service_id($__type)) : $this->property_objects_array["{$__type}_service"];
661      $this->property_objects_array["{$__type}_service"] = $object;
662      return $object;
663  }
publicget_service_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
664  public function get_service_id($__type="default")
665  {
666      $ids = $this->get_service_ids($__type, true);
667      return (count($ids)==1 ? $ids[0] : null);
668  }
publicget_service_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
669  public function get_service_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
670  {
671      $service_ids = array();
672      $db = event::db();
673      $q  = " SELECT com_service.saleitem_id FROM cal_event_service INNER JOIN com_service ON cal_event_service.service_saleitem_id=com_service.saleitem_id AND cal_event_service.deleted=0 AND com_service.deleted=0 AND cal_event_service.event_id='$this->id' " . (is_null($__type) ? "" : " AND cal_event_service.event_service_type_id='" . event_service::type_id($__type) . "'") . ($__get_primary ? " AND cal_event_service.primary=1 " : "");
674      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
675      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
676      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
677      $db->query($q);
678      while ($db->next_record())
679      {
680          $service_ids[] = $db->f("saleitem_id");
681      }
682      return $service_ids;
683  }
publicget_service_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
684  public function get_service_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
685  {
686      $ids = $this->get_service_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
687      $objects = array();
688      foreach ($ids as $index=>$id)
689      {
690          $objects[$index] = new service($id);
691      }
692      return $objects;
693  }
publicget_status ( )[ event_ext ]
Parameters
No parameters for this method
Code
153  public function get_status()
154  {
155      return $this->eventstatus_id > 0 ? $this->eventstatus->description : "";
156  }
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  }
publicget_type ( )[ event_db ]
Parameters
No parameters for this method
Code
413  public function get_type()
414  {
415      $type = new event_type($this->_event_type_id);
416      return $type->name;
417  }
publicget_upcoming_event_ids ( limit )[ event_ext ]
Parameters
optionallimit
Code
068  public function get_upcoming_event_ids($__limit=null)
069  {
070      return event::get_ids("start_date",array(),"start_date>='" . date("Y-m-d") . "'",$__limit);
071  }
publicget_upcoming_events ( limit )[ event_ext ]
Parameters
optionallimit
Code
073  public function get_upcoming_events($__limit=null)
074  {
075      $events = array();
076      foreach (event::get_upcoming_event_ids($__limit) as $event_id)
077      {
078          $events[] = new event($event_id);
079      }
080      return $events;
081  }
publicget_url ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
954  public function get_url($__type="default")
955  {
956      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
957      $this->property_objects_array["{$__type}_url"] = $object;
958      return $object;
959  }
publicget_url_id ( type ["default"] )[ event_db ]
Parameters
optionaltype ["default"]
Code
960  public function get_url_id($__type="default")
961  {
962      $ids = $this->get_url_ids($__type, true);
963      return (count($ids)==1 ? $ids[0] : null);
964  }
publicget_url_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
965  public function get_url_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
966  {
967      $url_ids = array();
968      $db = event::db();
969      $q  = " SELECT cor_url.id FROM cal_event_url INNER JOIN cor_url ON cal_event_url.url_id=cor_url.id AND cal_event_url.deleted=0 AND cor_url.deleted=0 AND cal_event_url.event_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 " : "");
970      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
971      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
972      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
973      $db->query($q);
974      while ($db->next_record())
975      {
976          $url_ids[] = $db->f("id");
977      }
978      return $url_ids;
979  }
publicget_url_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ event_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
980  public function get_url_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
981  {
982      $ids = $this->get_url_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
983      $objects = array();
984      foreach ($ids as $index=>$id)
985      {
986          $objects[$index] = new url($id);
987      }
988      return $objects;
989  }
protectedinsert ( )[ event_db ]
Parameters
No parameters for this method
Code
171  protected function insert()
172  {
173      $db = event::db();
174      $q  = " INSERT INTO cal_event ( ";
175      $q .= $db->param_string("name") . ", ";
176      $q .= $db->param_string("start_date") . ", ";
177      $q .= $db->param_string("end_date") . ", ";
178      $q .= $db->param_string("description") . ", ";
179      $q .= $db->param_string("start_time") . ", ";
180      $q .= $db->param_string("end_time") . ", ";
181      $q .= $db->param_string("eventpriority_id") . ", ";
182      $q .= $db->param_string("eventstatus_id") . ", ";
183      $q .= $db->param_string("event_type_id") . ", ";
184      $q .= $db->param_string("capacity") . ", ";
185      $q .= $db->param_string("allday") . ", ";
186      $q .= $db->param_string("private") . ", ";
187      $q .= $db->param_string("mdate") . ", ";
188      $q .= $db->param_string("cdate") . ", ";
189      $q .= $db->param_string("deleted");
190      $q .= " ) VALUES ( ";
191      $q .= $db->value_string($this->_name) . ", ";
192      $q .= $db->value_string($this->_start_date) . ", ";
193      $q .= $db->value_string($this->_end_date) . ", ";
194      $q .= $db->value_string($this->_description) . ", ";
195      $q .= $db->value_string($this->_start_time) . ", ";
196      $q .= $db->value_string($this->_end_time) . ", ";
197      $q .= $db->value_string($this->_eventpriority_id) . ", ";
198      $q .= $db->value_string($this->_eventstatus_id) . ", ";
199      $q .= $db->value_string($this->_event_type_id) . ", ";
200      $q .= $db->value_string($this->_capacity) . ", ";
201      $q .= ($this->_allday ? "'1'" : "'0'") . ", ";
202      $q .= ($this->_private ? "'1'" : "'0'") . ", ";
203      $q .= $db->value_string(timestamp()) . ", ";
204      $q .= $db->value_string(timestamp()) . ", ";
205      $q .= $this->deleted ? "'1'" : "'0'";
206      $q .= " ) ";
207      $db->query($q);
208      $this->_id = $db->insert_id;
209      return true;
210  }
publicmap ( )[ event_db ]
Parameters
No parameters for this method
Code
133  public function map()
134  {
135      $this->_name = array_key_exists("event:name",$_REQUEST) ? reqval("event:name") : $this->_name;
136      $this->_start_date = array_key_exists("event:start_date",$_REQUEST) ? reqval("event:start_date") : $this->_start_date;
137      $this->_end_date = array_key_exists("event:end_date",$_REQUEST) ? reqval("event:end_date") : $this->_end_date;
138      $this->_description = array_key_exists("event:description",$_REQUEST) ? reqval("event:description") : $this->_description;
139      $this->_start_time = array_key_exists("event:start_time",$_REQUEST) ? reqval("event:start_time") : $this->_start_time;
140      $this->_end_time = array_key_exists("event:end_time",$_REQUEST) ? reqval("event:end_time") : $this->_end_time;
141      $this->_eventpriority_id = array_key_exists("event:eventpriority_id",$_REQUEST) ? reqval("event:eventpriority_id") : $this->_eventpriority_id;
142      $this->_eventstatus_id = array_key_exists("event:eventstatus_id",$_REQUEST) ? reqval("event:eventstatus_id") : $this->_eventstatus_id;
143      $this->_event_type_id = array_key_exists("event:event_type_id",$_REQUEST) ? reqval("event:event_type_id") : $this->_event_type_id;
144      $this->_capacity = array_key_exists("event:capacity",$_REQUEST) ? reqval("event:capacity") : $this->_capacity;
145      $this->_allday = array_key_exists("event:allday",$_REQUEST) ? reqval("event:allday") : $this->_allday;
146      $this->_private = array_key_exists("event:private",$_REQUEST) ? reqval("event:private") : $this->_private;
147      $this->_mdate = array_key_exists("event:mdate",$_REQUEST) ? reqval("event:mdate") : $this->_mdate;
148      $this->_cdate = array_key_exists("event:cdate",$_REQUEST) ? reqval("event:cdate") : $this->_cdate;
149      $this->_deleted = array_key_exists("event:deleted",$_REQUEST) ? reqval("event:deleted") : $this->_deleted;
150  }
publicpurge ( )[ event_db ]
Parameters
No parameters for this method
Code
257  public function purge()
258  {
259      $db = event::db();
260      $q  = " DELETE FROM cal_event ";
261      $q .= " WHERE id = " . $this->_id;
262      $db->query($q);
263      return true;
264  }
public staticsearch ( keyword )[ event_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_address ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
794  public function set_address($__v, $__type="default")
795  {
796      $object = is_null(keyval($this->property_objects_array,"{$__type}_address")) ? new address($this->get_address_id($__type)) : $this->property_objects_array["{$__type}_address"];
797      if (is_null($__v))
798      {
799          $rel = new address_event(null,$object->id,$this->id,address_event::type_id($__type));
800          $rel->delete();
801          if (!is_null(keyval($this->property_objects_array,"{$__type}_address")))
802          {
803              $this->property_objects_array["{$__type}_address"] = null;
804          }
805      }
806      else
807      {
808          $id = $object->id;
809          $object = $__v;
810          $object->id = $__v->id>0 ? $__v->id : $id;
811          $object->commit();
812          $this->set_address_ids(array($object->id),$__type);
813      }
814  }
publicset_address_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
815  public function set_address_id($__v, $__type="default")
816  {
817      $this->set_address_ids(array($__v),$__type);
818  }
publicset_address_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
819  public function set_address_ids($__v, $__type="default")
820  {
821      if ($this->id == 0)
822      {
823          $this->commit();
824      }
825      $type_id = address_event::type_id($__type);
826      address_event::delete_all(null,$this->id,$type_id);
827      if (is_array($__v))
828      {
829          foreach ($__v as $index=>$id)
830          {
831              $object = new address_event(null,$id,$this->id,$type_id);
832              $object->deleted = false;
833              $object->address_event_type_id = $type_id;
834              $object->commit();
835              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_address")))
836              {
837                  $this->property_objects_array["{$__type}_address"] = new address($object->address_id);
838              }
839          }
840          $this->_dirty = true;
841      }
842  }
publicset_address_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
843  public function set_address_list($__v, $__type="default")
844  {
845      if (is_array($__v))
846      {
847          $ids = array();
848          foreach ($__v as $index=>$object)
849          {
850              $ids[] = $object->id;
851          }
852          $this->set_address_ids($ids,$__type);
853      }
854  }
publicset_calendar ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
497  public function set_calendar($__v, $__type="default")
498  {
499      $object = is_null(keyval($this->property_objects_array,"{$__type}_calendar")) ? new calendar($this->get_calendar_id($__type)) : $this->property_objects_array["{$__type}_calendar"];
500      if (is_null($__v))
501      {
502          $rel = new calendar_event(null,$object->id,$this->id,calendar_event::type_id($__type));
503          $rel->delete();
504          if (!is_null(keyval($this->property_objects_array,"{$__type}_calendar")))
505          {
506              $this->property_objects_array["{$__type}_calendar"] = null;
507          }
508      }
509      else
510      {
511          $id = $object->id;
512          $object = $__v;
513          $object->id = $__v->id>0 ? $__v->id : $id;
514          $object->commit();
515          $this->set_calendar_ids(array($object->id),$__type);
516      }
517  }
publicset_calendar_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
518  public function set_calendar_id($__v, $__type="default")
519  {
520      $this->set_calendar_ids(array($__v),$__type);
521  }
publicset_calendar_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
522  public function set_calendar_ids($__v, $__type="default")
523  {
524      if ($this->id == 0)
525      {
526          $this->commit();
527      }
528      $type_id = calendar_event::type_id($__type);
529      calendar_event::delete_all(null,$this->id,$type_id);
530      if (is_array($__v))
531      {
532          foreach ($__v as $index=>$id)
533          {
534              $object = new calendar_event(null,$id,$this->id,$type_id);
535              $object->deleted = false;
536              $object->calendar_event_type_id = $type_id;
537              $object->commit();
538              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_calendar")))
539              {
540                  $this->property_objects_array["{$__type}_calendar"] = new calendar($object->calendar_id);
541              }
542          }
543          $this->_dirty = true;
544      }
545  }
publicset_calendar_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
546  public function set_calendar_list($__v, $__type="default")
547  {
548      if (is_array($__v))
549      {
550          $ids = array();
551          foreach ($__v as $index=>$object)
552          {
553              $ids[] = $object->id;
554          }
555          $this->set_calendar_ids($ids,$__type);
556      }
557  }
publicset_contact ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1089  public function set_contact($__v, $__type="default")
1090  {
1091      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
1092      if (is_null($__v))
1093      {
1094          $rel = new contact_event(null,$object->id,$this->id,contact_event::type_id($__type));
1095          $rel->delete();
1096          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
1097          {
1098              $this->property_objects_array["{$__type}_contact"] = null;
1099          }
1100      }
1101      else
1102      {
1103          $id = $object->id;
1104          $object = $__v;
1105          $object->id = $__v->id>0 ? $__v->id : $id;
1106          $object->commit();
1107          $this->set_contact_ids(array($object->id),$__type);
1108      }
1109  }
publicset_contact_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1110  public function set_contact_id($__v, $__type="default")
1111  {
1112      $this->set_contact_ids(array($__v),$__type);
1113  }
publicset_contact_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1114  public function set_contact_ids($__v, $__type="default")
1115  {
1116      if ($this->id == 0)
1117      {
1118          $this->commit();
1119      }
1120      $type_id = contact_event::type_id($__type);
1121      contact_event::delete_all(null,$this->id,$type_id);
1122      if (is_array($__v))
1123      {
1124          foreach ($__v as $index=>$id)
1125          {
1126              $object = new contact_event(null,$id,$this->id,$type_id);
1127              $object->deleted = false;
1128              $object->contact_event_type_id = $type_id;
1129              $object->commit();
1130              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
1131              {
1132                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
1133              }
1134          }
1135          $this->_dirty = true;
1136      }
1137  }
publicset_contact_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1138  public function set_contact_list($__v, $__type="default")
1139  {
1140      if (is_array($__v))
1141      {
1142          $ids = array();
1143          foreach ($__v as $index=>$object)
1144          {
1145              $ids[] = $object->id;
1146          }
1147          $this->set_contact_ids($ids,$__type);
1148      }
1149  }
publicset_entity ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
596  public function set_entity($__v, $__type="default")
597  {
598      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
599      if (is_null($__v))
600      {
601          $rel = new entity_event(null,$object->id,$this->id,entity_event::type_id($__type));
602          $rel->delete();
603          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
604          {
605              $this->property_objects_array["{$__type}_entity"] = null;
606          }
607      }
608      else
609      {
610          $id = $object->id;
611          $object = $__v;
612          $object->id = $__v->id>0 ? $__v->id : $id;
613          $object->commit();
614          $this->set_entity_ids(array($object->id),$__type);
615      }
616  }
publicset_entity_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
617  public function set_entity_id($__v, $__type="default")
618  {
619      $this->set_entity_ids(array($__v),$__type);
620  }
publicset_entity_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
621  public function set_entity_ids($__v, $__type="default")
622  {
623      if ($this->id == 0)
624      {
625          $this->commit();
626      }
627      $type_id = entity_event::type_id($__type);
628      entity_event::delete_all(null,$this->id,$type_id);
629      if (is_array($__v))
630      {
631          foreach ($__v as $index=>$id)
632          {
633              $object = new entity_event(null,$id,$this->id,$type_id);
634              $object->deleted = false;
635              $object->entity_event_type_id = $type_id;
636              $object->commit();
637              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
638              {
639                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
640              }
641          }
642          $this->_dirty = true;
643      }
644  }
publicset_entity_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
645  public function set_entity_list($__v, $__type="default")
646  {
647      if (is_array($__v))
648      {
649          $ids = array();
650          foreach ($__v as $index=>$object)
651          {
652              $ids[] = $object->id;
653          }
654          $this->set_entity_ids($ids,$__type);
655      }
656  }
publicset_event_type ( v )[ event_db ]
Parameters
requiredv
Code
452  public function set_event_type($v)
453  {
454      if ($v->id > 0)
455      {
456          $this->event_type_id = $v->id;
457      }
458  }
publicset_eventdate ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
893  public function set_eventdate($__v, $__type="default")
894  {
895      $object = is_null(keyval($this->property_objects_array,"{$__type}_eventdate")) ? new eventdate($this->get_eventdate_id($__type)) : $this->property_objects_array["{$__type}_eventdate"];
896      if (is_null($__v))
897      {
898          $rel = new event_eventdate(null,$this->id,$object->id,event_eventdate::type_id($__type));
899          $rel->delete();
900          $object->delete();
901          if (!is_null(keyval($this->property_objects_array,"{$__type}_eventdate")))
902          {
903              $this->property_objects_array["{$__type}_eventdate"] = null;
904          }
905      }
906      else
907      {
908          $object->value = is_object($__v) ? $__v->value : $__v;
909          $object->commit();
910          $this->set_eventdate_ids(array($object->id),$__type);
911      }
912  }
publicset_eventdate_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
913  public function set_eventdate_id($__v, $__type="default")
914  {
915      $this->set_eventdate_ids(array($__v),$__type);
916  }
publicset_eventdate_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
917  public function set_eventdate_ids($__v, $__type="default")
918  {
919      if ($this->id == 0)
920      {
921          $this->commit();
922      }
923      $type_id = event_eventdate::type_id($__type);
924      event_eventdate::delete_all($this->id,null,$type_id);
925      if (is_array($__v))
926      {
927          foreach ($__v as $index=>$id)
928          {
929              $object = new event_eventdate(null,$this->id,$id,$type_id);
930              $object->deleted = false;
931              $object->event_eventdate_type_id = $type_id;
932              $object->commit();
933              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_eventdate")))
934              {
935                  $this->property_objects_array["{$__type}_eventdate"] = new eventdate($object->eventdate_id);
936              }
937          }
938          $this->_dirty = true;
939      }
940  }
publicset_eventdate_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
941  public function set_eventdate_list($__v, $__type="default")
942  {
943      if (is_array($__v))
944      {
945          $ids = array();
946          foreach ($__v as $index=>$object)
947          {
948              $ids[] = $object->id;
949          }
950          $this->set_eventdate_ids($ids,$__type);
951      }
952  }
publicset_eventpriority ( v )[ event_db ]
Parameters
requiredv
Code
428  public function set_eventpriority($v)
429  {
430      if ($v->id > 0)
431      {
432          $this->eventpriority_id = $v->id;
433      }
434  }
publicset_eventstatus ( v )[ event_db ]
Parameters
requiredv
Code
440  public function set_eventstatus($v)
441  {
442      if ($v->id > 0)
443      {
444          $this->eventstatus_id = $v->id;
445      }
446  }
publicset_service ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
695  public function set_service($__v, $__type="default")
696  {
697      $object = is_null(keyval($this->property_objects_array,"{$__type}_service")) ? new service($this->get_service_id($__type)) : $this->property_objects_array["{$__type}_service"];
698      if (is_null($__v))
699      {
700          $rel = new event_service(null,$this->id,$object->id,event_service::type_id($__type));
701          $rel->delete();
702          if (!is_null(keyval($this->property_objects_array,"{$__type}_service")))
703          {
704              $this->property_objects_array["{$__type}_service"] = null;
705          }
706      }
707      else
708      {
709          $id = $object->id;
710          $object = $__v;
711          $object->id = $__v->id>0 ? $__v->id : $id;
712          $object->commit();
713          $this->set_service_ids(array($object->id),$__type);
714      }
715  }
publicset_service_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
716  public function set_service_id($__v, $__type="default")
717  {
718      $this->set_service_ids(array($__v),$__type);
719  }
publicset_service_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
720  public function set_service_ids($__v, $__type="default")
721  {
722      if ($this->id == 0)
723      {
724          $this->commit();
725      }
726      $type_id = event_service::type_id($__type);
727      event_service::delete_all($this->id,null,$type_id);
728      if (is_array($__v))
729      {
730          foreach ($__v as $index=>$id)
731          {
732              $object = new event_service(null,$this->id,$id,$type_id);
733              $object->deleted = false;
734              $object->event_service_type_id = $type_id;
735              $object->commit();
736              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_service")))
737              {
738                  $this->property_objects_array["{$__type}_service"] = new service($object->service_id);
739              }
740          }
741          $this->_dirty = true;
742      }
743  }
publicset_service_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
744  public function set_service_list($__v, $__type="default")
745  {
746      if (is_array($__v))
747      {
748          $ids = array();
749          foreach ($__v as $index=>$object)
750          {
751              $ids[] = $object->id;
752          }
753          $this->set_service_ids($ids,$__type);
754      }
755  }
publicset_type ( v )[ event_db ]
Parameters
requiredv
Code
418  public function set_type($v)
419  {
420      $type = new event_type(null, $v);
421      $this->event_type_id = $type->id;
422  }
publicset_url ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
991  public function set_url($__v, $__type="default")
992  {
993      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
994      if (is_null($__v))
995      {
996          $rel = new event_url(null,$this->id,$object->id,event_url::type_id($__type));
997          $rel->delete();
998          $object->delete();
999          if (!is_null(keyval($this->property_objects_array,"{$__type}_url")))
1000          {
1001              $this->property_objects_array["{$__type}_url"] = null;
1002          }
1003      }
1004      else
1005      {
1006          $object->value = is_object($__v) ? $__v->value : $__v;
1007          $object->commit();
1008          $this->set_url_ids(array($object->id),$__type);
1009      }
1010  }
publicset_url_id ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1011  public function set_url_id($__v, $__type="default")
1012  {
1013      $this->set_url_ids(array($__v),$__type);
1014  }
publicset_url_ids ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1015  public function set_url_ids($__v, $__type="default")
1016  {
1017      if ($this->id == 0)
1018      {
1019          $this->commit();
1020      }
1021      $type_id = event_url::type_id($__type);
1022      event_url::delete_all($this->id,null,$type_id);
1023      if (is_array($__v))
1024      {
1025          foreach ($__v as $index=>$id)
1026          {
1027              $object = new event_url(null,$this->id,$id,$type_id);
1028              $object->deleted = false;
1029              $object->event_url_type_id = $type_id;
1030              $object->commit();
1031              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_url")))
1032              {
1033                  $this->property_objects_array["{$__type}_url"] = new url($object->url_id);
1034              }
1035          }
1036          $this->_dirty = true;
1037      }
1038  }
publicset_url_list ( v , type ["default"] )[ event_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1039  public function set_url_list($__v, $__type="default")
1040  {
1041      if (is_array($__v))
1042      {
1043          $ids = array();
1044          foreach ($__v as $index=>$object)
1045          {
1046              $ids[] = $object->id;
1047          }
1048          $this->set_url_ids($ids,$__type);
1049      }
1050  }
public__toString ( )[ event_db ]
Parameters
No parameters for this method
Code
402  public function __toString()
403  {
404      return (is_null($this->name) ? "" : $this->name);
405  }
public statictype_id ( type_name )[ event_db ]
Parameters
requiredtype_name
Code
407  public static function type_id($__type_name)
408  {
409      $type = new event_type(null, $__type_name);
410      return $type->id;
411  }
publicundelete ( )[ event_db ]
Parameters
No parameters for this method
Code
246  public function undelete()
247  {
248      $db = event::db();
249      $q  = " UPDATE cal_event SET ";
250      $q .= " deleted = 0 ";
251      $q .= " WHERE id = " . $this->_id;
252      $db->query($q);
253      $this->deleted = false;
254      return true;
255  }
protectedupdate ( )[ event_db ]
Parameters
No parameters for this method
Code
212  protected function update()
213  {
214      $db = event::db();
215      $q  = " UPDATE cal_event SET ";
216      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
217      $q .= $db->param_string("start_date") . " = " . $db->value_string($this->_start_date) . ", ";
218      $q .= $db->param_string("end_date") . " = " . $db->value_string($this->_end_date) . ", ";
219      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
220      $q .= $db->param_string("start_time") . " = " . $db->value_string($this->_start_time) . ", ";
221      $q .= $db->param_string("end_time") . " = " . $db->value_string($this->_end_time) . ", ";
222      $q .= $db->param_string("eventpriority_id") . " = " . $db->value_string($this->_eventpriority_id) . ", ";
223      $q .= $db->param_string("eventstatus_id") . " = " . $db->value_string($this->_eventstatus_id) . ", ";
224      $q .= $db->param_string("event_type_id") . " = " . $db->value_string($this->_event_type_id) . ", ";
225      $q .= $db->param_string("capacity") . " = " . $db->value_string($this->_capacity) . ", ";
226      $q .= $db->param_string("allday") . " = " . ($this->_allday ? "'1'" : "'0'") . ", ";
227      $q .= $db->param_string("private") . " = " . ($this->_private ? "'1'" : "'0'") . ", ";
228      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
229      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
230      $q .= " WHERE id = " . $this->_id;
231      $db->query($q);
232      return true;
233  }
 
Accessors
publicaddress[ event_db ]
Code
757  public function get_address($__type="default")
758  {
759      $object = is_null(keyval($this->property_objects_array,"{$__type}_address")) ? new address($this->get_address_id($__type)) : $this->property_objects_array["{$__type}_address"];
760      $this->property_objects_array["{$__type}_address"] = $object;
761      return $object;
762  }
Code
794  public function set_address($__v, $__type="default")
795  {
796      $object = is_null(keyval($this->property_objects_array,"{$__type}_address")) ? new address($this->get_address_id($__type)) : $this->property_objects_array["{$__type}_address"];
797      if (is_null($__v))
798      {
799          $rel = new address_event(null,$object->id,$this->id,address_event::type_id($__type));
800          $rel->delete();
801          if (!is_null(keyval($this->property_objects_array,"{$__type}