Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class group extends group_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_group"][ group ]
 
Properties
protected_cdate[ group_db ]
protected_cdate_dirty[ group_db ]
protected_deleted[ group_db ]
protected_deleted_dirty[ group_db ]
protected_description[ group_db ]
protected_description_dirty[ group_db ]
protected_dirty[ obj ]
protected_group_type_id[ group_db ]
protected_group_type_id_dirty[ group_db ]
protected_id[ group_db ]
protected_id_dirty[ group_db ]
protected_mdate[ group_db ]
protected_mdate_dirty[ group_db ]
protected_name[ group_db ]
protected_name_dirty[ group_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ group_db ]
Parameters
No parameters for this method
Code
102  public function commit()
103  {
104      if ($this->_id > 0)
105      {
106          $this->update();
107      }
108      else
109      {
110          $this->insert();
111      }
112 
113      foreach ($this->property_objects_array as $property=>$object)
114      {
115          $this->{$property} = $object;
116      }
117 
118      return true;
119  }
public__construct ( id , name )[ group_db ]
Parameters
optionalid
optionalname
Code
044  public function __construct($__id=null, $__name=null)
045  {
046      $this->_id = 0;
047      $this->_name = $__name;
048      $this->_description = "";
049      $this->_group_type_id = 0;
050      $this->_mdate = null;
051      $this->_cdate = null;
052      $this->_deleted = false;
053 
054      $this->_id_dirty = false;
055      $this->_name_dirty = false;
056      $this->_description_dirty = false;
057      $this->_group_type_id_dirty = false;
058      $this->_mdate_dirty = false;
059      $this->_cdate_dirty = false;
060      $this->_deleted_dirty = false;
061 
062      if (is_null($__id) && is_null($__name))
063      {
064          return;
065      }
066 
067      $db = group::db();
068      $q  = " SELECT cor_group.id,cor_group.name,cor_group.description,cor_group.group_type_id,cor_group.mdate,cor_group.cdate,cor_group.deleted ";
069      $q .= " FROM cor_group ";       
070      if (!is_null($__id))
071      {
072          $q .= " WHERE id = '$__id' ";
073      }
074      else if (!is_null($__name))
075      {
076          $q .= " WHERE name = '$__name' ";
077      }
078 
079      $db->query($q);
080      if ($db->next_record() && $db->num_rows() == 1)
081      {
082          $this->_id = $db->f("id");
083          $this->_name = $db->f("name");
084          $this->_description = $db->f("description");
085          $this->_group_type_id = $db->f("group_type_id");
086          $this->_mdate = $db->f("mdate");
087          $this->_cdate = $db->f("cdate");
088          $this->_deleted = $db->f("deleted");
089      }
090  }
protected staticdb ( )[ group_db ]
Parameters
No parameters for this method
Code
953  protected static function db()
954  {
955      return new db();
956  }
publicdelete ( )[ group_db ]
Parameters
No parameters for this method
Code
158  public function delete()
159  {
160      $db = group::db();
161      $q  = " UPDATE cor_group SET ";
162      $q .= " deleted = 1 ";
163      $q .= " WHERE id = " . $this->_id;
164      $db->query($q);
165      $this->deleted = true;
166      return true;
167  }
public staticdelete_all ( )[ group_db ]
Parameters
No parameters for this method
Code
265  public static function delete_all()
266  {
267      $db = group::db();
268      $q  = " UPDATE cor_group SET ";
269      $q .= " deleted = 1 ";
270     
271      $db->query($q);
272      return true;
273  }
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_business ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
357  public function get_business($__type="default")
358  {
359      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
360      $this->property_objects_array["{$__type}_business"] = $object;
361      return $object;
362  }
publicget_business_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
363  public function get_business_id($__type="default")
364  {
365      $ids = $this->get_business_ids($__type, true);
366      return (count($ids)==1 ? $ids[0] : null);
367  }
publicget_business_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
368  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
369  {
370      $business_ids = array();
371      $db = group::db();
372      $q  = " SELECT bus_business.entity_id FROM bus_business_group INNER JOIN bus_business ON bus_business_group.business_entity_id=bus_business.entity_id AND bus_business_group.deleted=0 AND bus_business.deleted=0 AND bus_business_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND bus_business_group.business_group_type_id='" . business_group::type_id($__type) . "'") . ($__get_primary ? " AND bus_business_group.primary=1 " : "");
373      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
374      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
375      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
376      $db->query($q);
377      while ($db->next_record())
378      {
379          $business_ids[] = $db->f("entity_id");
380      }
381      return $business_ids;
382  }
publicget_business_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
383  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
384  {
385      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
386      $objects = array();
387      foreach ($ids as $index=>$id)
388      {
389          $objects[$index] = new business($id);
390      }
391      return $objects;
392  }
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] )[ group_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
189  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
190  {
191      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
192      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
193      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
194 
195      $db = group::db();
196      $data = array();
197      $q  = " SELECT $colstring ";
198      $q .= " FROM cor_group ";
199      $q .= " WHERE cor_group.deleted = 0 ";
200      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
201      $q .= array_key_exists("group_type_id",$lookups) ? " AND cor_group.group_type_id='" . $lookups["group_type_id"] . "' " : "";
202 
203      if (is_string($__order))
204      {
205          $q .= "ORDER BY " . $__order;
206      }
207      else if (is_array($__order) and count($__order)>0)
208      {
209          $orderings = array();
210          foreach ($__order as $col=>$dir)
211          {
212              $orderings[] = " $col $dir ";
213          }
214          $q .= "ORDER BY " . implode(", ", $orderings);
215      }
216      else if (is_object($__order))
217      {
218          $q .= "";
219      }
220      else
221      {
222          // THERE IS NO `order` COLUMN ON THIS OBJECT
223      }
224 
225      if (!is_null($__limit))
226      {
227          $q .= " LIMIT $__offset , $__limit ";
228      }
229 
230      $db->query($q);
231 
232      if (count($colarray)>1 || $colstring=="*")
233      {
234          while ($db->next_record())
235          {
236              $data[] = $db->record;
237          }
238      }
239      else
240      {
241          while ($db->next_record())
242          {
243              $data[] = $db->f(0);
244          }
245      }
246 
247      return $data;
248  }
publicget_contact ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
854  public function get_contact($__type="default")
855  {
856      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
857      $this->property_objects_array["{$__type}_contact"] = $object;
858      return $object;
859  }
publicget_contact_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
860  public function get_contact_id($__type="default")
861  {
862      $ids = $this->get_contact_ids($__type, true);
863      return (count($ids)==1 ? $ids[0] : null);
864  }
publicget_contact_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
865  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
866  {
867      $contact_ids = array();
868      $db = group::db();
869      $q  = " SELECT crm_contact.person_entity_id FROM crm_contact_group INNER JOIN crm_contact ON crm_contact_group.contact_person_entity_id=crm_contact.person_entity_id AND crm_contact_group.deleted=0 AND crm_contact.deleted=0 AND crm_contact_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND crm_contact_group.contact_group_type_id='" . contact_group::type_id($__type) . "'") . ($__get_primary ? " AND crm_contact_group.primary=1 " : "");
870      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
871      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
872      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
873      $db->query($q);
874      while ($db->next_record())
875      {
876          $contact_ids[] = $db->f("person_entity_id");
877      }
878      return $contact_ids;
879  }
publicget_contact_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
880  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
881  {
882      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
883      $objects = array();
884      foreach ($ids as $index=>$id)
885      {
886          $objects[$index] = new contact($id);
887      }
888      return $objects;
889  }
publicget_content ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
555  public function get_content($__type="default")
556  {
557      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
558      $this->property_objects_array["{$__type}_content"] = $object;
559      return $object;
560  }
publicget_content_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
561  public function get_content_id($__type="default")
562  {
563      $ids = $this->get_content_ids($__type, true);
564      return (count($ids)==1 ? $ids[0] : null);
565  }
publicget_content_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
566  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
567  {
568      $content_ids = array();
569      $db = group::db();
570      $q  = " SELECT cms_content.id FROM cms_content_group INNER JOIN cms_content ON cms_content_group.content_id=cms_content.id AND cms_content_group.deleted=0 AND cms_content.deleted=0 AND cms_content_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_group.content_group_type_id='" . content_group::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_group.primary=1 " : "");
571      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
572      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
573      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
574      $db->query($q);
575      while ($db->next_record())
576      {
577          $content_ids[] = $db->f("id");
578      }
579      return $content_ids;
580  }
publicget_content_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
581  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
582  {
583      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
584      $objects = array();
585      foreach ($ids as $index=>$id)
586      {
587          $objects[$index] = new content($id);
588      }
589      return $objects;
590  }
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_group_type ( )[ group_db ]
Parameters
No parameters for this method
Code
345  public function get_group_type()
346  {
347      return new group_type($this->group_type_id);
348  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ group_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
250  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
251  {
252      return group::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
253  }
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] )[ group_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
255  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
256  {
257      $objects = array();
258      foreach (group::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
259      {
260          $objects[] = new group($id);
261      }
262      return $objects;
263  }
publicget_orgposition ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
456  public function get_orgposition($__type="default")
457  {
458      $object = is_null(keyval($this->property_objects_array,"{$__type}_orgposition")) ? new orgposition($this->get_orgposition_id($__type)) : $this->property_objects_array["{$__type}_orgposition"];
459      $this->property_objects_array["{$__type}_orgposition"] = $object;
460      return $object;
461  }
publicget_orgposition_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
462  public function get_orgposition_id($__type="default")
463  {
464      $ids = $this->get_orgposition_ids($__type, true);
465      return (count($ids)==1 ? $ids[0] : null);
466  }
publicget_orgposition_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
467  public function get_orgposition_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
468  {
469      $orgposition_ids = array();
470      $db = group::db();
471      $q  = " SELECT bus_orgposition.id FROM bus_group_orgposition INNER JOIN bus_orgposition ON bus_group_orgposition.orgposition_id=bus_orgposition.id AND bus_group_orgposition.deleted=0 AND bus_orgposition.deleted=0 AND bus_group_orgposition.group_id='$this->id' " . (is_null($__type) ? "" : " AND bus_group_orgposition.group_orgposition_type_id='" . group_orgposition::type_id($__type) . "'") . ($__get_primary ? " AND bus_group_orgposition.primary=1 " : "");
472      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
473      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
474      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
475      $db->query($q);
476      while ($db->next_record())
477      {
478          $orgposition_ids[] = $db->f("id");
479      }
480      return $orgposition_ids;
481  }
publicget_orgposition_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
482  public function get_orgposition_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
483  {
484      $ids = $this->get_orgposition_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
485      $objects = array();
486      foreach ($ids as $index=>$id)
487      {
488          $objects[$index] = new orgposition($id);
489      }
490      return $objects;
491  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_resource ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
753  public function get_resource($__type="default")
754  {
755      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
756      $this->property_objects_array["{$__type}_resource"] = $object;
757      return $object;
758  }
publicget_resource_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
759  public function get_resource_id($__type="default")
760  {
761      $ids = $this->get_resource_ids($__type, true);
762      return (count($ids)==1 ? $ids[0] : null);
763  }
publicget_resource_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
764  public function get_resource_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
765  {
766      $resource_ids = array();
767      $db = group::db();
768      $q  = " SELECT cor_resource.id FROM cor_group_resource INNER JOIN cor_resource ON cor_group_resource.resource_id=cor_resource.id AND cor_group_resource.deleted=0 AND cor_resource.deleted=0 AND cor_group_resource.group_id='$this->id' " . (is_null($__type) ? "" : " AND cor_group_resource.group_resource_type_id='" . group_resource::type_id($__type) . "'") . ($__get_primary ? " AND cor_group_resource.primary=1 " : "");
769      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
770      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
771      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
772      $db->query($q);
773      while ($db->next_record())
774      {
775          $resource_ids[] = $db->f("id");
776      }
777      return $resource_ids;
778  }
publicget_resource_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
779  public function get_resource_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
780  {
781      $ids = $this->get_resource_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
782      $objects = array();
783      foreach ($ids as $index=>$id)
784      {
785          $objects[$index] = new resource($id);
786      }
787      return $objects;
788  }
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 ( )[ group_db ]
Parameters
No parameters for this method
Code
334  public function get_type()
335  {
336      $type = new group_type($this->_group_type_id);
337      return $type->name;
338  }
publicget_user ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
654  public function get_user($__type="default")
655  {
656      $object = is_null(keyval($this->property_objects_array,"{$__type}_user")) ? new user($this->get_user_id($__type)) : $this->property_objects_array["{$__type}_user"];
657      $this->property_objects_array["{$__type}_user"] = $object;
658      return $object;
659  }
publicget_user_id ( type ["default"] )[ group_db ]
Parameters
optionaltype ["default"]
Code
660  public function get_user_id($__type="default")
661  {
662      $ids = $this->get_user_ids($__type, true);
663      return (count($ids)==1 ? $ids[0] : null);
664  }
publicget_user_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
665  public function get_user_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
666  {
667      $user_ids = array();
668      $db = group::db();
669      $q  = " SELECT cor_user.person_entity_id FROM cor_group_user INNER JOIN cor_user ON cor_group_user.user_person_entity_id=cor_user.person_entity_id AND cor_group_user.deleted=0 AND cor_user.deleted=0 AND cor_group_user.group_id='$this->id' " . (is_null($__type) ? "" : " AND cor_group_user.group_user_type_id='" . group_user::type_id($__type) . "'") . ($__get_primary ? " AND cor_group_user.primary=1 " : "");
670      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
671      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
672      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
673      $db->query($q);
674      while ($db->next_record())
675      {
676          $user_ids[] = $db->f("person_entity_id");
677      }
678      return $user_ids;
679  }
publicget_user_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ group_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
680  public function get_user_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
681  {
682      $ids = $this->get_user_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
683      $objects = array();
684      foreach ($ids as $index=>$id)
685      {
686          $objects[$index] = new user($id);
687      }
688      return $objects;
689  }
protectedinsert ( )[ group_db ]
Parameters
No parameters for this method
Code
121  protected function insert()
122  {
123      $db = group::db();
124      $q  = " INSERT INTO cor_group ( ";
125      $q .= $db->param_string("name") . ", ";
126      $q .= $db->param_string("description") . ", ";
127      $q .= $db->param_string("group_type_id") . ", ";
128      $q .= $db->param_string("mdate") . ", ";
129      $q .= $db->param_string("cdate") . ", ";
130      $q .= $db->param_string("deleted");
131      $q .= " ) VALUES ( ";
132      $q .= $db->value_string($this->_name) . ", ";
133      $q .= $db->value_string($this->_description) . ", ";
134      $q .= $db->value_string($this->_group_type_id) . ", ";
135      $q .= $db->value_string(timestamp()) . ", ";
136      $q .= $db->value_string(timestamp()) . ", ";
137      $q .= $this->deleted ? "'1'" : "'0'";
138      $q .= " ) ";
139      $db->query($q);
140      $this->_id = $db->insert_id;
141      return true;
142  }
publicmap ( )[ group_db ]
Parameters
No parameters for this method
Code
092  public function map()
093  {
094      $this->_name = array_key_exists("group:name",$_REQUEST) ? reqval("group:name") : $this->_name;
095      $this->_description = array_key_exists("group:description",$_REQUEST) ? reqval("group:description") : $this->_description;
096      $this->_group_type_id = array_key_exists("group:group_type_id",$_REQUEST) ? reqval("group:group_type_id") : $this->_group_type_id;
097      $this->_mdate = array_key_exists("group:mdate",$_REQUEST) ? reqval("group:mdate") : $this->_mdate;
098      $this->_cdate = array_key_exists("group:cdate",$_REQUEST) ? reqval("group:cdate") : $this->_cdate;
099      $this->_deleted = array_key_exists("group:deleted",$_REQUEST) ? reqval("group:deleted") : $this->_deleted;
100  }
publicpurge ( )[ group_db ]
Parameters
No parameters for this method
Code
180  public function purge()
181  {
182      $db = group::db();
183      $q  = " DELETE FROM cor_group ";
184      $q .= " WHERE id = " . $this->_id;
185      $db->query($q);
186      return true;
187  }
public staticsearch ( keyword )[ group_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_business ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
394  public function set_business($__v, $__type="default")
395  {
396      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
397      if (is_null($__v))
398      {
399          $rel = new business_group(null,$object->id,$this->id,business_group::type_id($__type));
400          $rel->delete();
401          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
402          {
403              $this->property_objects_array["{$__type}_business"] = null;
404          }
405      }
406      else
407      {
408          $id = $object->id;
409          $object = $__v;
410          $object->id = $__v->id>0 ? $__v->id : $id;
411          $object->commit();
412          $this->set_business_ids(array($object->id),$__type);
413      }
414  }
publicset_business_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
415  public function set_business_id($__v, $__type="default")
416  {
417      $this->set_business_ids(array($__v),$__type);
418  }
publicset_business_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
419  public function set_business_ids($__v, $__type="default")
420  {
421      if ($this->id == 0)
422      {
423          $this->commit();
424      }
425      $type_id = business_group::type_id($__type);
426      business_group::delete_all(null,$this->id,$type_id);
427      if (is_array($__v))
428      {
429          foreach ($__v as $index=>$id)
430          {
431              $object = new business_group(null,$id,$this->id,$type_id);
432              $object->deleted = false;
433              $object->business_group_type_id = $type_id;
434              $object->commit();
435              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
436              {
437                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
438              }
439          }
440          $this->_dirty = true;
441      }
442  }
publicset_business_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
443  public function set_business_list($__v, $__type="default")
444  {
445      if (is_array($__v))
446      {
447          $ids = array();
448          foreach ($__v as $index=>$object)
449          {
450              $ids[] = $object->id;
451          }
452          $this->set_business_ids($ids,$__type);
453      }
454  }
publicset_contact ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
891  public function set_contact($__v, $__type="default")
892  {
893      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
894      if (is_null($__v))
895      {
896          $rel = new contact_group(null,$object->id,$this->id,contact_group::type_id($__type));
897          $rel->delete();
898          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
899          {
900              $this->property_objects_array["{$__type}_contact"] = null;
901          }
902      }
903      else
904      {
905          $id = $object->id;
906          $object = $__v;
907          $object->id = $__v->id>0 ? $__v->id : $id;
908          $object->commit();
909          $this->set_contact_ids(array($object->id),$__type);
910      }
911  }
publicset_contact_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
912  public function set_contact_id($__v, $__type="default")
913  {
914      $this->set_contact_ids(array($__v),$__type);
915  }
publicset_contact_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
916  public function set_contact_ids($__v, $__type="default")
917  {
918      if ($this->id == 0)
919      {
920          $this->commit();
921      }
922      $type_id = contact_group::type_id($__type);
923      contact_group::delete_all(null,$this->id,$type_id);
924      if (is_array($__v))
925      {
926          foreach ($__v as $index=>$id)
927          {
928              $object = new contact_group(null,$id,$this->id,$type_id);
929              $object->deleted = false;
930              $object->contact_group_type_id = $type_id;
931              $object->commit();
932              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
933              {
934                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
935              }
936          }
937          $this->_dirty = true;
938      }
939  }
publicset_contact_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
940  public function set_contact_list($__v, $__type="default")
941  {
942      if (is_array($__v))
943      {
944          $ids = array();
945          foreach ($__v as $index=>$object)
946          {
947              $ids[] = $object->id;
948          }
949          $this->set_contact_ids($ids,$__type);
950      }
951  }
publicset_content ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
592  public function set_content($__v, $__type="default")
593  {
594      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
595      if (is_null($__v))
596      {
597          $rel = new content_group(null,$object->id,$this->id,content_group::type_id($__type));
598          $rel->delete();
599          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
600          {
601              $this->property_objects_array["{$__type}_content"] = null;
602          }
603      }
604      else
605      {
606          $id = $object->id;
607          $object = $__v;
608          $object->id = $__v->id>0 ? $__v->id : $id;
609          $object->commit();
610          $this->set_content_ids(array($object->id),$__type);
611      }
612  }
publicset_content_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
613  public function set_content_id($__v, $__type="default")
614  {
615      $this->set_content_ids(array($__v),$__type);
616  }
publicset_content_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
617  public function set_content_ids($__v, $__type="default")
618  {
619      if ($this->id == 0)
620      {
621          $this->commit();
622      }
623      $type_id = content_group::type_id($__type);
624      content_group::delete_all(null,$this->id,$type_id);
625      if (is_array($__v))
626      {
627          foreach ($__v as $index=>$id)
628          {
629              $object = new content_group(null,$id,$this->id,$type_id);
630              $object->deleted = false;
631              $object->content_group_type_id = $type_id;
632              $object->commit();
633              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
634              {
635                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
636              }
637          }
638          $this->_dirty = true;
639      }
640  }
publicset_content_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
641  public function set_content_list($__v, $__type="default")
642  {
643      if (is_array($__v))
644      {
645          $ids = array();
646          foreach ($__v as $index=>$object)
647          {
648              $ids[] = $object->id;
649          }
650          $this->set_content_ids($ids,$__type);
651      }
652  }
publicset_group_type ( v )[ group_db ]
Parameters
requiredv
Code
349  public function set_group_type($v)
350  {
351      if ($v->id > 0)
352      {
353          $this->group_type_id = $v->id;
354      }
355  }
publicset_orgposition ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
493  public function set_orgposition($__v, $__type="default")
494  {
495      $object = is_null(keyval($this->property_objects_array,"{$__type}_orgposition")) ? new orgposition($this->get_orgposition_id($__type)) : $this->property_objects_array["{$__type}_orgposition"];
496      if (is_null($__v))
497      {
498          $rel = new group_orgposition(null,$this->id,$object->id,group_orgposition::type_id($__type));
499          $rel->delete();
500          if (!is_null(keyval($this->property_objects_array,"{$__type}_orgposition")))
501          {
502              $this->property_objects_array["{$__type}_orgposition"] = null;
503          }
504      }
505      else
506      {
507          $id = $object->id;
508          $object = $__v;
509          $object->id = $__v->id>0 ? $__v->id : $id;
510          $object->commit();
511          $this->set_orgposition_ids(array($object->id),$__type);
512      }
513  }
publicset_orgposition_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
514  public function set_orgposition_id($__v, $__type="default")
515  {
516      $this->set_orgposition_ids(array($__v),$__type);
517  }
publicset_orgposition_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
518  public function set_orgposition_ids($__v, $__type="default")
519  {
520      if ($this->id == 0)
521      {
522          $this->commit();
523      }
524      $type_id = group_orgposition::type_id($__type);
525      group_orgposition::delete_all($this->id,null,$type_id);
526      if (is_array($__v))
527      {
528          foreach ($__v as $index=>$id)
529          {
530              $object = new group_orgposition(null,$this->id,$id,$type_id);
531              $object->deleted = false;
532              $object->group_orgposition_type_id = $type_id;
533              $object->commit();
534              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_orgposition")))
535              {
536                  $this->property_objects_array["{$__type}_orgposition"] = new orgposition($object->orgposition_id);
537              }
538          }
539          $this->_dirty = true;
540      }
541  }
publicset_orgposition_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
542  public function set_orgposition_list($__v, $__type="default")
543  {
544      if (is_array($__v))
545      {
546          $ids = array();
547          foreach ($__v as $index=>$object)
548          {
549              $ids[] = $object->id;
550          }
551          $this->set_orgposition_ids($ids,$__type);
552      }
553  }
publicset_resource ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
790  public function set_resource($__v, $__type="default")
791  {
792      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
793      if (is_null($__v))
794      {
795          $rel = new group_resource(null,$this->id,$object->id,group_resource::type_id($__type));
796          $rel->delete();
797          if (!is_null(keyval($this->property_objects_array,"{$__type}_resource")))
798          {
799              $this->property_objects_array["{$__type}_resource"] = null;
800          }
801      }
802      else
803      {
804          $hash = $object->hash;
805          $id = $object->id;
806          $object = $__v;
807          $object->hash = $__v->id>0 ? $__v->hash : $hash;
808          $object->id = $__v->id>0 ? $__v->id : $id;
809          $object->commit();
810          $this->set_resource_ids(array($object->id),$__type);
811      }
812  }
publicset_resource_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
813  public function set_resource_id($__v, $__type="default")
814  {
815      $this->set_resource_ids(array($__v),$__type);
816  }
publicset_resource_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
817  public function set_resource_ids($__v, $__type="default")
818  {
819      if ($this->id == 0)
820      {
821          $this->commit();
822      }
823      $type_id = group_resource::type_id($__type);
824      group_resource::delete_all($this->id,null,$type_id);
825      if (is_array($__v))
826      {
827          foreach ($__v as $index=>$id)
828          {
829              $object = new group_resource(null,$this->id,$id,$type_id);
830              $object->deleted = false;
831              $object->group_resource_type_id = $type_id;
832              $object->commit();
833              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_resource")))
834              {
835                  $this->property_objects_array["{$__type}_resource"] = new resource($object->resource_id);
836              }
837          }
838          $this->_dirty = true;
839      }
840  }
publicset_resource_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
841  public function set_resource_list($__v, $__type="default")
842  {
843      if (is_array($__v))
844      {
845          $ids = array();
846          foreach ($__v as $index=>$object)
847          {
848              $ids[] = $object->id;
849          }
850          $this->set_resource_ids($ids,$__type);
851      }
852  }
publicset_type ( v )[ group_db ]
Parameters
requiredv
Code
339  public function set_type($v)
340  {
341      $type = new group_type(null, $v);
342      $this->group_type_id = $type->id;
343  }
publicset_user ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
691  public function set_user($__v, $__type="default")
692  {
693      $object = is_null(keyval($this->property_objects_array,"{$__type}_user")) ? new user($this->get_user_id($__type)) : $this->property_objects_array["{$__type}_user"];
694      if (is_null($__v))
695      {
696          $rel = new group_user(null,$this->id,$object->id,group_user::type_id($__type));
697          $rel->delete();
698          if (!is_null(keyval($this->property_objects_array,"{$__type}_user")))
699          {
700              $this->property_objects_array["{$__type}_user"] = null;
701          }
702      }
703      else
704      {
705          $id = $object->id;
706          $object = $__v;
707          $object->id = $__v->id>0 ? $__v->id : $id;
708          $object->commit();
709          $this->set_user_ids(array($object->id),$__type);
710      }
711  }
publicset_user_id ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
712  public function set_user_id($__v, $__type="default")
713  {
714      $this->set_user_ids(array($__v),$__type);
715  }
publicset_user_ids ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
716  public function set_user_ids($__v, $__type="default")
717  {
718      if ($this->id == 0)
719      {
720          $this->commit();
721      }
722      $type_id = group_user::type_id($__type);
723      group_user::delete_all($this->id,null,$type_id);
724      if (is_array($__v))
725      {
726          foreach ($__v as $index=>$id)
727          {
728              $object = new group_user(null,$this->id,$id,$type_id);
729              $object->deleted = false;
730              $object->group_user_type_id = $type_id;
731              $object->commit();
732              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_user")))
733              {
734                  $this->property_objects_array["{$__type}_user"] = new user($object->user_id);
735              }
736          }
737          $this->_dirty = true;
738      }
739  }
publicset_user_list ( v , type ["default"] )[ group_db ]
Parameters
requiredv
optionaltype ["default"]
Code
740  public function set_user_list($__v, $__type="default")
741  {
742      if (is_array($__v))
743      {
744          $ids = array();
745          foreach ($__v as $index=>$object)
746          {
747              $ids[] = $object->id;
748          }
749          $this->set_user_ids($ids,$__type);
750      }
751  }
public__toString ( )[ group_db ]
Parameters
No parameters for this method
Code
323  public function __toString()
324  {
325      return (is_null($this->name) ? "" : $this->name);
326  }
public statictype_id ( type_name )[ group_db ]
Parameters
requiredtype_name
Code
328  public static function type_id($__type_name)
329  {
330      $type = new group_type(null, $__type_name);
331      return $type->id;
332  }
publicundelete ( )[ group_db ]
Parameters
No parameters for this method
Code
169  public function undelete()
170  {
171      $db = group::db();
172      $q  = " UPDATE cor_group SET ";
173      $q .= " deleted = 0 ";
174      $q .= " WHERE id = " . $this->_id;
175      $db->query($q);
176      $this->deleted = false;
177      return true;
178  }
protectedupdate ( )[ group_db ]
Parameters
No parameters for this method
Code
144  protected function update()
145  {
146      $db = group::db();
147      $q  = " UPDATE cor_group SET ";
148      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
149      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
150      $q .= $db->param_string("group_type_id") . " = " . $db->value_string($this->_group_type_id) . ", ";
151      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
152      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
153      $q .= " WHERE id = " . $this->_id;
154      $db->query($q);
155      return true;
156  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicbusiness[ group_db ]
Code
357  public function get_business($__type="default")
358  {
359      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
360      $this->property_objects_array["{$__type}_business"] = $object;
361      return $object;
362  }
Code
394  public function set_business($__v, $__type="default")
395  {
396      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
397      if (is_null($__v))
398      {
399          $rel = new business_group(null,$object->id,$this->id,business_group::type_id($__type));
400          $rel->delete();
401          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
402          {
403              $this->property_objects_array["{$__type}_business"] = null;
404          }
405      }
406      else
407      {
408          $id = $object->id;
409          $object = $__v;
410          $object->id = $__v->id>0 ? $__v->id : $id;
411          $object->commit();
412          $this->set_business_ids(array($object->id),$__type);
413      }
414  }
publicbusiness_id[ group_db ]
Code
363  public function get_business_id($__type="default")
364  {
365      $ids = $this->get_business_ids($__type, true);
366      return (count($ids)==1 ? $ids[0] : null);
367  }
Code
415  public function set_business_id($__v, $__type="default")
416  {
417      $this->set_business_ids(array($__v),$__type);
418  }
publicbusiness_ids[ group_db ]
Code
368  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
369  {
370      $business_ids = array();
371      $db = group::db();
372      $q  = " SELECT bus_business.entity_id FROM bus_business_group INNER JOIN bus_business ON bus_business_group.business_entity_id=bus_business.entity_id AND bus_business_group.deleted=0 AND bus_business.deleted=0 AND bus_business_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND bus_business_group.business_group_type_id='" . business_group::type_id($__type) . "'") . ($__get_primary ? " AND bus_business_group.primary=1 " : "");
373      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
374      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
375      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
376      $db->query($q);
377      while ($db->next_record())
378      {
379          $business_ids[] = $db->f("entity_id");
380      }
381      return $business_ids;
382  }
Code
419  public function set_business_ids($__v, $__type="default")
420  {
421      if ($this->id == 0)
422      {
423          $this->commit();
424      }
425      $type_id = business_group::type_id($__type);
426      business_group::delete_all(null,$this->id,$type_id);
427      if (is_array($__v))
428      {
429          foreach ($__v as $index=>$id)
430          {
431              $object = new business_group(null,$id,$this->id,$type_id);
432              $object->deleted = false;
433              $object->business_group_type_id = $type_id;
434              $object->commit();
435              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
436              {
437                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
438              }
439          }
440          $this->_dirty = true;
441      }
442  }
publicbusiness_list[ group_db ]
Code
383  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
384  {
385      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
386      $objects = array();
387      foreach ($ids as $index=>$id)
388      {
389          $objects[$index] = new business($id);
390      }
391      return $objects;
392  }
Code
443  public function set_business_list($__v, $__type="default")
444  {
445      if (is_array($__v))
446      {
447          $ids = array();
448          foreach ($__v as $index=>$object)
449          {
450              $ids[] = $object->id;
451          }
452          $this->set_business_ids($ids,$__type);
453      }
454  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ group_db ]
Code
189  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
190  {
191      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
192      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
193      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
194 
195      $db = group::db();
196      $data = array();
197      $q  = " SELECT $colstring ";
198      $q .= " FROM cor_group ";
199      $q .= " WHERE cor_group.deleted = 0 ";
200      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
201      $q .= array_key_exists("group_type_id",$lookups) ? " AND cor_group.group_type_id='" . $lookups["group_type_id"] . "' " : "";
202 
203      if (is_string($__order))
204      {
205          $q .= "ORDER BY " . $__order;
206      }
207      else if (is_array($__order) and count($__order)>0)
208      {
209          $orderings = array();
210          foreach ($__order as $col=>$dir)
211          {
212              $orderings[] = " $col $dir ";
213          }
214          $q .= "ORDER BY " . implode(", ", $orderings);
215      }
216      else if (is_object($__order))
217      {
218          $q .= "";
219      }
220      else
221      {
222          // THERE IS NO `order` COLUMN ON THIS OBJECT
223      }
224 
225      if (!is_null($__limit))
226      {
227          $q .= " LIMIT $__offset , $__limit ";
228      }
229 
230      $db->query($q);
231 
232      if (count($colarray)>1 || $colstring=="*")
233      {
234          while ($db->next_record())
235          {
236              $data[] = $db->record;
237          }
238      }
239      else
240      {
241          while ($db->next_record())
242          {
243              $data[] = $db->f(0);
244          }
245      }
246 
247      return $data;
248  }
publiccontact[ group_db ]
Code
854  public function get_contact($__type="default")
855  {
856      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
857      $this->property_objects_array["{$__type}_contact"] = $object;
858      return $object;
859  }
Code
891  public function set_contact($__v, $__type="default")
892  {
893      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
894      if (is_null($__v))
895      {
896          $rel = new contact_group(null,$object->id,$this->id,contact_group::type_id($__type));
897          $rel->delete();
898          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
899          {
900              $this->property_objects_array["{$__type}_contact"] = null;
901          }
902      }
903      else
904      {
905          $id = $object->id;
906          $object = $__v;
907          $object->id = $__v->id>0 ? $__v->id : $id;
908          $object->commit();
909          $this->set_contact_ids(array($object->id),$__type);
910      }
911  }
publiccontact_id[ group_db ]
Code
860  public function get_contact_id($__type="default")
861  {
862      $ids = $this->get_contact_ids($__type, true);
863      return (count($ids)==1 ? $ids[0] : null);
864  }
Code
912  public function set_contact_id($__v, $__type="default")
913  {
914      $this->set_contact_ids(array($__v),$__type);
915  }
publiccontact_ids[ group_db ]
Code
865  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
866  {
867      $contact_ids = array();
868      $db = group::db();
869      $q  = " SELECT crm_contact.person_entity_id FROM crm_contact_group INNER JOIN crm_contact ON crm_contact_group.contact_person_entity_id=crm_contact.person_entity_id AND crm_contact_group.deleted=0 AND crm_contact.deleted=0 AND crm_contact_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND crm_contact_group.contact_group_type_id='" . contact_group::type_id($__type) . "'") . ($__get_primary ? " AND crm_contact_group.primary=1 " : "");
870      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
871      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
872      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
873      $db->query($q);
874      while ($db->next_record())
875      {
876          $contact_ids[] = $db->f("person_entity_id");
877      }
878      return $contact_ids;
879  }
Code
916  public function set_contact_ids($__v, $__type="default")
917  {
918      if ($this->id == 0)
919      {
920          $this->commit();
921      }
922      $type_id = contact_group::type_id($__type);
923      contact_group::delete_all(null,$this->id,$type_id);
924      if (is_array($__v))
925      {
926          foreach ($__v as $index=>$id)
927          {
928              $object = new contact_group(null,$id,$this->id,$type_id);
929              $object->deleted = false;
930              $object->contact_group_type_id = $type_id;
931              $object->commit();
932              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
933              {
934                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
935              }
936          }
937          $this->_dirty = true;
938      }
939  }
publiccontact_list[ group_db ]
Code
880  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
881  {
882      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
883      $objects = array();
884      foreach ($ids as $index=>$id)
885      {
886          $objects[$index] = new contact($id);
887      }
888      return $objects;
889  }
Code
940  public function set_contact_list($__v, $__type="default")
941  {
942      if (is_array($__v))
943      {
944          $ids = array();
945          foreach ($__v as $index=>$object)
946          {
947              $ids[] = $object->id;
948          }
949          $this->set_contact_ids($ids,$__type);
950      }
951  }
publiccontent[ group_db ]
Code
555  public function get_content($__type="default")
556  {
557      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
558      $this->property_objects_array["{$__type}_content"] = $object;
559      return $object;
560  }
Code
592  public function set_content($__v, $__type="default")
593  {
594      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
595      if (is_null($__v))
596      {
597          $rel = new content_group(null,$object->id,$this->id,content_group::type_id($__type));
598          $rel->delete();
599          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
600          {
601              $this->property_objects_array["{$__type}_content"] = null;
602          }
603      }
604      else
605      {
606          $id = $object->id;
607          $object = $__v;
608          $object->id = $__v->id>0 ? $__v->id : $id;
609          $object->commit();
610          $this->set_content_ids(array($object->id),$__type);
611      }
612  }
publiccontent_id[ group_db ]
Code
561  public function get_content_id($__type="default")
562  {
563      $ids = $this->get_content_ids($__type, true);
564      return (count($ids)==1 ? $ids[0] : null);
565  }
Code
613  public function set_content_id($__v, $__type="default")
614  {
615      $this->set_content_ids(array($__v),$__type);
616  }
publiccontent_ids[ group_db ]
Code
566  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
567  {
568      $content_ids = array();
569      $db = group::db();
570      $q  = " SELECT cms_content.id FROM cms_content_group INNER JOIN cms_content ON cms_content_group.content_id=cms_content.id AND cms_content_group.deleted=0 AND cms_content.deleted=0 AND cms_content_group.group_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_group.content_group_type_id='" . content_group::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_group.primary=1 " : "");
571      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
572      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
573      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
574      $db->query($q);
575      while ($db->next_record())
576      {
577          $content_ids[] = $db->f("id");
578      }
579      return $content_ids;
580  }
Code
617  public function set_content_ids($__v, $__type="default")
618  {
619      if ($this->id == 0)
620      {
621          $this->commit();
622      }
623      $type_id = content_group::type_id($__type);
624      content_group::delete_all(null,$this->id,$type_id);
625      if (is_array($__v))
626      {