Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class comment extends comment_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_comment"][ comment ]
 
Properties
protected_body[ comment_db ]
protected_body_dirty[ comment_db ]
protected_cdate[ comment_db ]
protected_cdate_dirty[ comment_db ]
protected_deleted[ comment_db ]
protected_deleted_dirty[ comment_db ]
protected_dirty[ obj ]
protected_id[ comment_db ]
protected_id_dirty[ comment_db ]
protected_mdate[ comment_db ]
protected_mdate_dirty[ comment_db ]
publicproperty_objects_array[ obj ]
protected_subject[ comment_db ]
protected_subject_dirty[ comment_db ]
 
Methods
publiccommit ( )[ comment_db ]
Parameters
No parameters for this method
Code
092  public function commit()
093  {
094      if ($this->_id > 0)
095      {
096          $this->update();
097      }
098      else
099      {
100          $this->insert();
101      }
102 
103      foreach ($this->property_objects_array as $property=>$object)
104      {
105          $this->{$property} = $object;
106      }
107 
108      return true;
109  }
public__construct ( id )[ comment_db ]
Parameters
optionalid
Code
042  public function __construct($__id=null)
043  {
044      $this->_id = 0;
045      $this->_subject = "";
046      $this->_body = "";
047      $this->_mdate = null;
048      $this->_cdate = null;
049      $this->_deleted = false;
050 
051      $this->_id_dirty = false;
052      $this->_subject_dirty = false;
053      $this->_body_dirty = false;
054      $this->_mdate_dirty = false;
055      $this->_cdate_dirty = false;
056      $this->_deleted_dirty = false;
057 
058      if (is_null($__id))
059      {
060          return;
061      }
062 
063      $db = comment::db();
064      $q  = " SELECT cor_comment.id,cor_comment.subject,cor_comment.body,cor_comment.mdate,cor_comment.cdate,cor_comment.deleted ";
065      $q .= " FROM cor_comment ";       
066      if (!is_null($__id))
067      {
068          $q .= " WHERE id = '$__id' ";
069      }
070 
071      $db->query($q);
072      if ($db->next_record() && $db->num_rows() == 1)
073      {
074          $this->_id = $db->f("id");
075          $this->_subject = $db->f("subject");
076          $this->_body = $db->f("body");
077          $this->_mdate = $db->f("mdate");
078          $this->_cdate = $db->f("cdate");
079          $this->_deleted = $db->f("deleted");
080      }
081  }
protected staticdb ( )[ comment_db ]
Parameters
No parameters for this method
Code
1007  protected static function db()
1008  {
1009      return new db();
1010  }
publicdelete ( )[ comment_db ]
Parameters
No parameters for this method
Code
145  public function delete()
146  {
147      $db = comment::db();
148      $q  = " UPDATE cor_comment SET ";
149      $q .= " deleted = 1 ";
150      $q .= " WHERE id = " . $this->_id;
151      $db->query($q);
152      $this->deleted = true;
153      return true;
154  }
public staticdelete_all ( )[ comment_db ]
Parameters
No parameters for this method
Code
251  public static function delete_all()
252  {
253      $db = comment::db();
254      $q  = " UPDATE cor_comment SET ";
255      $q .= " deleted = 1 ";
256     
257      $db->query($q);
258      return true;
259  }
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"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
512  public function get_business($__type="default")
513  {
514      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
515      $this->property_objects_array["{$__type}_business"] = $object;
516      return $object;
517  }
publicget_business_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
518  public function get_business_id($__type="default")
519  {
520      $ids = $this->get_business_ids($__type, true);
521      return (count($ids)==1 ? $ids[0] : null);
522  }
publicget_business_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
523  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
524  {
525      $business_ids = array();
526      $db = comment::db();
527      $q  = " SELECT bus_business.entity_id FROM crm_business_comment INNER JOIN bus_business ON crm_business_comment.business_entity_id=bus_business.entity_id AND crm_business_comment.deleted=0 AND bus_business.deleted=0 AND crm_business_comment.comment_id='$this->id' " . (is_null($__type) ? "" : " AND crm_business_comment.business_comment_type_id='" . business_comment::type_id($__type) . "'") . ($__get_primary ? " AND crm_business_comment.primary=1 " : "");
528      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
529      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
530      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
531      $db->query($q);
532      while ($db->next_record())
533      {
534          $business_ids[] = $db->f("entity_id");
535      }
536      return $business_ids;
537  }
publicget_business_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
538  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
539  {
540      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
541      $objects = array();
542      foreach ($ids as $index=>$id)
543      {
544          $objects[$index] = new business($id);
545      }
546      return $objects;
547  }
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] )[ comment_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
176  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
177  {
178      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
179      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
180      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
181 
182      $db = comment::db();
183      $data = array();
184      $q  = " SELECT $colstring ";
185      $q .= " FROM cor_comment ";
186      $q .= " WHERE cor_comment.deleted = 0 ";
187      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
188 
189      if (is_string($__order))
190      {
191          $q .= "ORDER BY " . $__order;
192      }
193      else if (is_array($__order) and count($__order)>0)
194      {
195          $orderings = array();
196          foreach ($__order as $col=>$dir)
197          {
198              $orderings[] = " $col $dir ";
199          }
200          $q .= "ORDER BY " . implode(", ", $orderings);
201      }
202      else if (is_object($__order))
203      {
204          $q .= "";
205      }
206      else
207      {
208          // THERE IS NO `order` COLUMN ON THIS OBJECT
209      }
210 
211      if (!is_null($__limit))
212      {
213          $q .= " LIMIT $__offset , $__limit ";
214      }
215 
216      $db->query($q);
217 
218      if (count($colarray)>1 || $colstring=="*")
219      {
220          while ($db->next_record())
221          {
222              $data[] = $db->record;
223          }
224      }
225      else
226      {
227          while ($db->next_record())
228          {
229              $data[] = $db->f(0);
230          }
231      }
232 
233      return $data;
234  }
publicget_contact ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
611  public function get_contact($__type="default")
612  {
613      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
614      $this->property_objects_array["{$__type}_contact"] = $object;
615      return $object;
616  }
publicget_contact_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
617  public function get_contact_id($__type="default")
618  {
619      $ids = $this->get_contact_ids($__type, true);
620      return (count($ids)==1 ? $ids[0] : null);
621  }
publicget_contact_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
622  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
623  {
624      $contact_ids = array();
625      $db = comment::db();
626      $q  = " SELECT crm_contact.person_entity_id FROM crm_comment_contact INNER JOIN crm_contact ON crm_comment_contact.contact_person_entity_id=crm_contact.person_entity_id AND crm_comment_contact.deleted=0 AND crm_contact.deleted=0 AND crm_comment_contact.comment_id='$this->id' " . (is_null($__type) ? "" : " AND crm_comment_contact.comment_contact_type_id='" . comment_contact::type_id($__type) . "'") . ($__get_primary ? " AND crm_comment_contact.primary=1 " : "");
627      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
628      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
629      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
630      $db->query($q);
631      while ($db->next_record())
632      {
633          $contact_ids[] = $db->f("person_entity_id");
634      }
635      return $contact_ids;
636  }
publicget_contact_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
637  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
638  {
639      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
640      $objects = array();
641      foreach ($ids as $index=>$id)
642      {
643          $objects[$index] = new contact($id);
644      }
645      return $objects;
646  }
publicget_content ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
314  public function get_content($__type="default")
315  {
316      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
317      $this->property_objects_array["{$__type}_content"] = $object;
318      return $object;
319  }
publicget_content_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
320  public function get_content_id($__type="default")
321  {
322      $ids = $this->get_content_ids($__type, true);
323      return (count($ids)==1 ? $ids[0] : null);
324  }
publicget_content_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
325  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
326  {
327      $content_ids = array();
328      $db = comment::db();
329      $q  = " SELECT cms_content.id FROM cms_comment_content INNER JOIN cms_content ON cms_comment_content.content_id=cms_content.id AND cms_comment_content.deleted=0 AND cms_content.deleted=0 AND cms_comment_content.comment_id='$this->id' " . (is_null($__type) ? "" : " AND cms_comment_content.comment_content_type_id='" . comment_content::type_id($__type) . "'") . ($__get_primary ? " AND cms_comment_content.primary=1 " : "");
330      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
331      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
332      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
333      $db->query($q);
334      while ($db->next_record())
335      {
336          $content_ids[] = $db->f("id");
337      }
338      return $content_ids;
339  }
publicget_content_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
340  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
341  {
342      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
343      $objects = array();
344      foreach ($ids as $index=>$id)
345      {
346          $objects[$index] = new content($id);
347      }
348      return $objects;
349  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicget_document ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
710  public function get_document($__type="default")
711  {
712      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
713      $this->property_objects_array["{$__type}_document"] = $object;
714      return $object;
715  }
publicget_document_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
716  public function get_document_id($__type="default")
717  {
718      $ids = $this->get_document_ids($__type, true);
719      return (count($ids)==1 ? $ids[0] : null);
720  }
publicget_document_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
721  public function get_document_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
722  {
723      $document_ids = array();
724      $db = comment::db();
725      $q  = " SELECT doc_document.id FROM doc_comment_document INNER JOIN doc_document ON doc_comment_document.document_id=doc_document.id AND doc_comment_document.deleted=0 AND doc_document.deleted=0 AND doc_comment_document.comment_id='$this->id' " . (is_null($__type) ? "" : " AND doc_comment_document.comment_document_type_id='" . comment_document::type_id($__type) . "'") . ($__get_primary ? " AND doc_comment_document.primary=1 " : "");
726      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
727      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
728      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
729      $db->query($q);
730      while ($db->next_record())
731      {
732          $document_ids[] = $db->f("id");
733      }
734      return $document_ids;
735  }
publicget_document_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
736  public function get_document_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
737  {
738      $ids = $this->get_document_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
739      $objects = array();
740      foreach ($ids as $index=>$id)
741      {
742          $objects[$index] = new document($id);
743      }
744      return $objects;
745  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ comment_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
236  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
237  {
238      return comment::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
239  }
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] )[ comment_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
241  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
242  {
243      $objects = array();
244      foreach (comment::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
245      {
246          $objects[] = new comment($id);
247      }
248      return $objects;
249  }
publicget_projectentity ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
809  public function get_projectentity($__type="default")
810  {
811      $object = is_null(keyval($this->property_objects_array,"{$__type}_projectentity")) ? new projectentity($this->get_projectentity_id($__type)) : $this->property_objects_array["{$__type}_projectentity"];
812      $this->property_objects_array["{$__type}_projectentity"] = $object;
813      return $object;
814  }
publicget_projectentity_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
815  public function get_projectentity_id($__type="default")
816  {
817      $ids = $this->get_projectentity_ids($__type, true);
818      return (count($ids)==1 ? $ids[0] : null);
819  }
publicget_projectentity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
820  public function get_projectentity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
821  {
822      $projectentity_ids = array();
823      $db = comment::db();
824      $q  = " SELECT prj_projectentity.id FROM prj_comment_projectentity INNER JOIN prj_projectentity ON prj_comment_projectentity.projectentity_id=prj_projectentity.id AND prj_comment_projectentity.deleted=0 AND prj_projectentity.deleted=0 AND prj_comment_projectentity.comment_id='$this->id' " . (is_null($__type) ? "" : " AND prj_comment_projectentity.comment_projectentity_type_id='" . comment_projectentity::type_id($__type) . "'") . ($__get_primary ? " AND prj_comment_projectentity.primary=1 " : "");
825      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
826      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
827      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
828      $db->query($q);
829      while ($db->next_record())
830      {
831          $projectentity_ids[] = $db->f("id");
832      }
833      return $projectentity_ids;
834  }
publicget_projectentity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
835  public function get_projectentity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
836  {
837      $ids = $this->get_projectentity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
838      $objects = array();
839      foreach ($ids as $index=>$id)
840      {
841          $objects[$index] = new projectentity($id);
842      }
843      return $objects;
844  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publicget_task ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
908  public function get_task($__type="default")
909  {
910      $object = is_null(keyval($this->property_objects_array,"{$__type}_task")) ? new task($this->get_task_id($__type)) : $this->property_objects_array["{$__type}_task"];
911      $this->property_objects_array["{$__type}_task"] = $object;
912      return $object;
913  }
publicget_task_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
914  public function get_task_id($__type="default")
915  {
916      $ids = $this->get_task_ids($__type, true);
917      return (count($ids)==1 ? $ids[0] : null);
918  }
publicget_task_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
919  public function get_task_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
920  {
921      $task_ids = array();
922      $db = comment::db();
923      $q  = " SELECT prj_task.id FROM prj_comment_task INNER JOIN prj_task ON prj_comment_task.task_id=prj_task.id AND prj_comment_task.deleted=0 AND prj_task.deleted=0 AND prj_comment_task.comment_id='$this->id' " . (is_null($__type) ? "" : " AND prj_comment_task.comment_task_type_id='" . comment_task::type_id($__type) . "'") . ($__get_primary ? " AND prj_comment_task.primary=1 " : "");
924      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
925      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
926      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
927      $db->query($q);
928      while ($db->next_record())
929      {
930          $task_ids[] = $db->f("id");
931      }
932      return $task_ids;
933  }
publicget_task_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
934  public function get_task_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
935  {
936      $ids = $this->get_task_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
937      $objects = array();
938      foreach ($ids as $index=>$id)
939      {
940          $objects[$index] = new task($id);
941      }
942      return $objects;
943  }
publicget_user ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
413  public function get_user($__type="default")
414  {
415      $object = is_null(keyval($this->property_objects_array,"{$__type}_user")) ? new user($this->get_user_id($__type)) : $this->property_objects_array["{$__type}_user"];
416      $this->property_objects_array["{$__type}_user"] = $object;
417      return $object;
418  }
publicget_user_id ( type ["default"] )[ comment_db ]
Parameters
optionaltype ["default"]
Code
419  public function get_user_id($__type="default")
420  {
421      $ids = $this->get_user_ids($__type, true);
422      return (count($ids)==1 ? $ids[0] : null);
423  }
publicget_user_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
424  public function get_user_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
425  {
426      $user_ids = array();
427      $db = comment::db();
428      $q  = " SELECT cor_user.person_entity_id FROM cor_comment_user INNER JOIN cor_user ON cor_comment_user.user_person_entity_id=cor_user.person_entity_id AND cor_comment_user.deleted=0 AND cor_user.deleted=0 AND cor_comment_user.comment_id='$this->id' " . (is_null($__type) ? "" : " AND cor_comment_user.comment_user_type_id='" . comment_user::type_id($__type) . "'") . ($__get_primary ? " AND cor_comment_user.primary=1 " : "");
429      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
430      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
431      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
432      $db->query($q);
433      while ($db->next_record())
434      {
435          $user_ids[] = $db->f("person_entity_id");
436      }
437      return $user_ids;
438  }
publicget_user_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ comment_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
439  public function get_user_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
440  {
441      $ids = $this->get_user_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
442      $objects = array();
443      foreach ($ids as $index=>$id)
444      {
445          $objects[$index] = new user($id);
446      }
447      return $objects;
448  }
protectedinsert ( )[ comment_db ]
Parameters
No parameters for this method
Code
111  protected function insert()
112  {
113      $db = comment::db();
114      $q  = " INSERT INTO cor_comment ( ";
115      $q .= $db->param_string("subject") . ", ";
116      $q .= $db->param_string("body") . ", ";
117      $q .= $db->param_string("mdate") . ", ";
118      $q .= $db->param_string("cdate") . ", ";
119      $q .= $db->param_string("deleted");
120      $q .= " ) VALUES ( ";
121      $q .= $db->value_string($this->_subject) . ", ";
122      $q .= $db->value_string($this->_body) . ", ";
123      $q .= $db->value_string(timestamp()) . ", ";
124      $q .= $db->value_string(timestamp()) . ", ";
125      $q .= $this->deleted ? "'1'" : "'0'";
126      $q .= " ) ";
127      $db->query($q);
128      $this->_id = $db->insert_id;
129      return true;
130  }
publicmap ( )[ comment_db ]
Parameters
No parameters for this method
Code
083  public function map()
084  {
085      $this->_subject = array_key_exists("comment:subject",$_REQUEST) ? reqval("comment:subject") : $this->_subject;
086      $this->_body = array_key_exists("comment:body",$_REQUEST) ? reqval("comment:body") : $this->_body;
087      $this->_mdate = array_key_exists("comment:mdate",$_REQUEST) ? reqval("comment:mdate") : $this->_mdate;
088      $this->_cdate = array_key_exists("comment:cdate",$_REQUEST) ? reqval("comment:cdate") : $this->_cdate;
089      $this->_deleted = array_key_exists("comment:deleted",$_REQUEST) ? reqval("comment:deleted") : $this->_deleted;
090  }
publicpurge ( )[ comment_db ]
Parameters
No parameters for this method
Code
167  public function purge()
168  {
169      $db = comment::db();
170      $q  = " DELETE FROM cor_comment ";
171      $q .= " WHERE id = " . $this->_id;
172      $db->query($q);
173      return true;
174  }
public staticsearch ( keyword )[ comment_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"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
549  public function set_business($__v, $__type="default")
550  {
551      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
552      if (is_null($__v))
553      {
554          $rel = new business_comment(null,$object->id,$this->id,business_comment::type_id($__type));
555          $rel->delete();
556          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
557          {
558              $this->property_objects_array["{$__type}_business"] = null;
559          }
560      }
561      else
562      {
563          $id = $object->id;
564          $object = $__v;
565          $object->id = $__v->id>0 ? $__v->id : $id;
566          $object->commit();
567          $this->set_business_ids(array($object->id),$__type);
568      }
569  }
publicset_business_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
570  public function set_business_id($__v, $__type="default")
571  {
572      $this->set_business_ids(array($__v),$__type);
573  }
publicset_business_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
574  public function set_business_ids($__v, $__type="default")
575  {
576      if ($this->id == 0)
577      {
578          $this->commit();
579      }
580      $type_id = business_comment::type_id($__type);
581      business_comment::delete_all(null,$this->id,$type_id);
582      if (is_array($__v))
583      {
584          foreach ($__v as $index=>$id)
585          {
586              $object = new business_comment(null,$id,$this->id,$type_id);
587              $object->deleted = false;
588              $object->business_comment_type_id = $type_id;
589              $object->commit();
590              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
591              {
592                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
593              }
594          }
595          $this->_dirty = true;
596      }
597  }
publicset_business_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
598  public function set_business_list($__v, $__type="default")
599  {
600      if (is_array($__v))
601      {
602          $ids = array();
603          foreach ($__v as $index=>$object)
604          {
605              $ids[] = $object->id;
606          }
607          $this->set_business_ids($ids,$__type);
608      }
609  }
publicset_contact ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
648  public function set_contact($__v, $__type="default")
649  {
650      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
651      if (is_null($__v))
652      {
653          $rel = new comment_contact(null,$this->id,$object->id,comment_contact::type_id($__type));
654          $rel->delete();
655          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
656          {
657              $this->property_objects_array["{$__type}_contact"] = null;
658          }
659      }
660      else
661      {
662          $id = $object->id;
663          $object = $__v;
664          $object->id = $__v->id>0 ? $__v->id : $id;
665          $object->commit();
666          $this->set_contact_ids(array($object->id),$__type);
667      }
668  }
publicset_contact_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
669  public function set_contact_id($__v, $__type="default")
670  {
671      $this->set_contact_ids(array($__v),$__type);
672  }
publicset_contact_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
673  public function set_contact_ids($__v, $__type="default")
674  {
675      if ($this->id == 0)
676      {
677          $this->commit();
678      }
679      $type_id = comment_contact::type_id($__type);
680      comment_contact::delete_all($this->id,null,$type_id);
681      if (is_array($__v))
682      {
683          foreach ($__v as $index=>$id)
684          {
685              $object = new comment_contact(null,$this->id,$id,$type_id);
686              $object->deleted = false;
687              $object->comment_contact_type_id = $type_id;
688              $object->commit();
689              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
690              {
691                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
692              }
693          }
694          $this->_dirty = true;
695      }
696  }
publicset_contact_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
697  public function set_contact_list($__v, $__type="default")
698  {
699      if (is_array($__v))
700      {
701          $ids = array();
702          foreach ($__v as $index=>$object)
703          {
704              $ids[] = $object->id;
705          }
706          $this->set_contact_ids($ids,$__type);
707      }
708  }
publicset_content ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
351  public function set_content($__v, $__type="default")
352  {
353      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
354      if (is_null($__v))
355      {
356          $rel = new comment_content(null,$this->id,$object->id,comment_content::type_id($__type));
357          $rel->delete();
358          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
359          {
360              $this->property_objects_array["{$__type}_content"] = null;
361          }
362      }
363      else
364      {
365          $id = $object->id;
366          $object = $__v;
367          $object->id = $__v->id>0 ? $__v->id : $id;
368          $object->commit();
369          $this->set_content_ids(array($object->id),$__type);
370      }
371  }
publicset_content_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
372  public function set_content_id($__v, $__type="default")
373  {
374      $this->set_content_ids(array($__v),$__type);
375  }
publicset_content_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
376  public function set_content_ids($__v, $__type="default")
377  {
378      if ($this->id == 0)
379      {
380          $this->commit();
381      }
382      $type_id = comment_content::type_id($__type);
383      comment_content::delete_all($this->id,null,$type_id);
384      if (is_array($__v))
385      {
386          foreach ($__v as $index=>$id)
387          {
388              $object = new comment_content(null,$this->id,$id,$type_id);
389              $object->deleted = false;
390              $object->comment_content_type_id = $type_id;
391              $object->commit();
392              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_content")))
393              {
394                  $this->property_objects_array["{$__type}_content"] = new content($object->content_id);
395              }
396          }
397          $this->_dirty = true;
398      }
399  }
publicset_content_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
400  public function set_content_list($__v, $__type="default")
401  {
402      if (is_array($__v))
403      {
404          $ids = array();
405          foreach ($__v as $index=>$object)
406          {
407              $ids[] = $object->id;
408          }
409          $this->set_content_ids($ids,$__type);
410      }
411  }
publicset_document ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
747  public function set_document($__v, $__type="default")
748  {
749      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
750      if (is_null($__v))
751      {
752          $rel = new comment_document(null,$this->id,$object->id,comment_document::type_id($__type));
753          $rel->delete();
754          if (!is_null(keyval($this->property_objects_array,"{$__type}_document")))
755          {
756              $this->property_objects_array["{$__type}_document"] = null;
757          }
758      }
759      else
760      {
761          $id = $object->id;
762          $object = $__v;
763          $object->id = $__v->id>0 ? $__v->id : $id;
764          $object->commit();
765          $this->set_document_ids(array($object->id),$__type);
766      }
767  }
publicset_document_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
768  public function set_document_id($__v, $__type="default")
769  {
770      $this->set_document_ids(array($__v),$__type);
771  }
publicset_document_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
772  public function set_document_ids($__v, $__type="default")
773  {
774      if ($this->id == 0)
775      {
776          $this->commit();
777      }
778      $type_id = comment_document::type_id($__type);
779      comment_document::delete_all($this->id,null,$type_id);
780      if (is_array($__v))
781      {
782          foreach ($__v as $index=>$id)
783          {
784              $object = new comment_document(null,$this->id,$id,$type_id);
785              $object->deleted = false;
786              $object->comment_document_type_id = $type_id;
787              $object->commit();
788              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_document")))
789              {
790                  $this->property_objects_array["{$__type}_document"] = new document($object->document_id);
791              }
792          }
793          $this->_dirty = true;
794      }
795  }
publicset_document_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
796  public function set_document_list($__v, $__type="default")
797  {
798      if (is_array($__v))
799      {
800          $ids = array();
801          foreach ($__v as $index=>$object)
802          {
803              $ids[] = $object->id;
804          }
805          $this->set_document_ids($ids,$__type);
806      }
807  }
publicset_projectentity ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
846  public function set_projectentity($__v, $__type="default")
847  {
848      $object = is_null(keyval($this->property_objects_array,"{$__type}_projectentity")) ? new projectentity($this->get_projectentity_id($__type)) : $this->property_objects_array["{$__type}_projectentity"];
849      if (is_null($__v))
850      {
851          $rel = new comment_projectentity(null,$this->id,$object->id,comment_projectentity::type_id($__type));
852          $rel->delete();
853          if (!is_null(keyval($this->property_objects_array,"{$__type}_projectentity")))
854          {
855              $this->property_objects_array["{$__type}_projectentity"] = null;
856          }
857      }
858      else
859      {
860          $id = $object->id;
861          $object = $__v;
862          $object->id = $__v->id>0 ? $__v->id : $id;
863          $object->commit();
864          $this->set_projectentity_ids(array($object->id),$__type);
865      }
866  }
publicset_projectentity_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
867  public function set_projectentity_id($__v, $__type="default")
868  {
869      $this->set_projectentity_ids(array($__v),$__type);
870  }
publicset_projectentity_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
871  public function set_projectentity_ids($__v, $__type="default")
872  {
873      if ($this->id == 0)
874      {
875          $this->commit();
876      }
877      $type_id = comment_projectentity::type_id($__type);
878      comment_projectentity::delete_all($this->id,null,$type_id);
879      if (is_array($__v))
880      {
881          foreach ($__v as $index=>$id)
882          {
883              $object = new comment_projectentity(null,$this->id,$id,$type_id);
884              $object->deleted = false;
885              $object->comment_projectentity_type_id = $type_id;
886              $object->commit();
887              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_projectentity")))
888              {
889                  $this->property_objects_array["{$__type}_projectentity"] = new projectentity($object->projectentity_id);
890              }
891          }
892          $this->_dirty = true;
893      }
894  }
publicset_projectentity_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
895  public function set_projectentity_list($__v, $__type="default")
896  {
897      if (is_array($__v))
898      {
899          $ids = array();
900          foreach ($__v as $index=>$object)
901          {
902              $ids[] = $object->id;
903          }
904          $this->set_projectentity_ids($ids,$__type);
905      }
906  }
publicset_task ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
945  public function set_task($__v, $__type="default")
946  {
947      $object = is_null(keyval($this->property_objects_array,"{$__type}_task")) ? new task($this->get_task_id($__type)) : $this->property_objects_array["{$__type}_task"];
948      if (is_null($__v))
949      {
950          $rel = new comment_task(null,$this->id,$object->id,comment_task::type_id($__type));
951          $rel->delete();
952          if (!is_null(keyval($this->property_objects_array,"{$__type}_task")))
953          {
954              $this->property_objects_array["{$__type}_task"] = null;
955          }
956      }
957      else
958      {
959          $id = $object->id;
960          $object = $__v;
961          $object->id = $__v->id>0 ? $__v->id : $id;
962          $object->commit();
963          $this->set_task_ids(array($object->id),$__type);
964      }
965  }
publicset_task_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
966  public function set_task_id($__v, $__type="default")
967  {
968      $this->set_task_ids(array($__v),$__type);
969  }
publicset_task_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
970  public function set_task_ids($__v, $__type="default")
971  {
972      if ($this->id == 0)
973      {
974          $this->commit();
975      }
976      $type_id = comment_task::type_id($__type);
977      comment_task::delete_all($this->id,null,$type_id);
978      if (is_array($__v))
979      {
980          foreach ($__v as $index=>$id)
981          {
982              $object = new comment_task(null,$this->id,$id,$type_id);
983              $object->deleted = false;
984              $object->comment_task_type_id = $type_id;
985              $object->commit();
986              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_task")))
987              {
988                  $this->property_objects_array["{$__type}_task"] = new task($object->task_id);
989              }
990          }
991          $this->_dirty = true;
992      }
993  }
publicset_task_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
994  public function set_task_list($__v, $__type="default")
995  {
996      if (is_array($__v))
997      {
998          $ids = array();
999          foreach ($__v as $index=>$object)
1000          {
1001              $ids[] = $object->id;
1002          }
1003          $this->set_task_ids($ids,$__type);
1004      }
1005  }
publicset_user ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
450  public function set_user($__v, $__type="default")
451  {
452      $object = is_null(keyval($this->property_objects_array,"{$__type}_user")) ? new user($this->get_user_id($__type)) : $this->property_objects_array["{$__type}_user"];
453      if (is_null($__v))
454      {
455          $rel = new comment_user(null,$this->id,$object->id,comment_user::type_id($__type));
456          $rel->delete();
457          if (!is_null(keyval($this->property_objects_array,"{$__type}_user")))
458          {
459              $this->property_objects_array["{$__type}_user"] = null;
460          }
461      }
462      else
463      {
464          $id = $object->id;
465          $object = $__v;
466          $object->id = $__v->id>0 ? $__v->id : $id;
467          $object->commit();
468          $this->set_user_ids(array($object->id),$__type);
469      }
470  }
publicset_user_id ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
471  public function set_user_id($__v, $__type="default")
472  {
473      $this->set_user_ids(array($__v),$__type);
474  }
publicset_user_ids ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
475  public function set_user_ids($__v, $__type="default")
476  {
477      if ($this->id == 0)
478      {
479          $this->commit();
480      }
481      $type_id = comment_user::type_id($__type);
482      comment_user::delete_all($this->id,null,$type_id);
483      if (is_array($__v))
484      {
485          foreach ($__v as $index=>$id)
486          {
487              $object = new comment_user(null,$this->id,$id,$type_id);
488              $object->deleted = false;
489              $object->comment_user_type_id = $type_id;
490              $object->commit();
491              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_user")))
492              {
493                  $this->property_objects_array["{$__type}_user"] = new user($object->user_id);
494              }
495          }
496          $this->_dirty = true;
497      }
498  }
publicset_user_list ( v , type ["default"] )[ comment_db ]
Parameters
requiredv
optionaltype ["default"]
Code
499  public function set_user_list($__v, $__type="default")
500  {
501      if (is_array($__v))
502      {
503          $ids = array();
504          foreach ($__v as $index=>$object)
505          {
506              $ids[] = $object->id;
507          }
508          $this->set_user_ids($ids,$__type);
509      }
510  }
public__toString ( )[ comment_db ]
Parameters
No parameters for this method
Code
309  public function __toString()
310  {
311      return (is_null($this->id) ? "" : $this->id);
312  }
publicundelete ( )[ comment_db ]
Parameters
No parameters for this method
Code
156  public function undelete()
157  {
158      $db = comment::db();
159      $q  = " UPDATE cor_comment SET ";
160      $q .= " deleted = 0 ";
161      $q .= " WHERE id = " . $this->_id;
162      $db->query($q);
163      $this->deleted = false;
164      return true;
165  }
protectedupdate ( )[ comment_db ]
Parameters
No parameters for this method
Code
132  protected function update()
133  {
134      $db = comment::db();
135      $q  = " UPDATE cor_comment SET ";
136      $q .= $db->param_string("subject") . " = " . $db->value_string($this->_subject) . ", ";
137      $q .= $db->param_string("body") . " = " . $db->value_string($this->_body) . ", ";
138      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
139      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
140      $q .= " WHERE id = " . $this->_id;
141      $db->query($q);
142      return true;
143  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicbusiness[ comment_db ]
Code
512  public function get_business($__type="default")
513  {
514      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
515      $this->property_objects_array["{$__type}_business"] = $object;
516      return $object;
517  }
Code
549  public function set_business($__v, $__type="default")
550  {
551      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
552      if (is_null($__v))
553      {
554          $rel = new business_comment(null,$object->id,$this->id,business_comment::type_id($__type));
555          $rel->delete();
556          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
557          {
558              $this->property_objects_array["{$__type}_business"] = null;
559          }
560      }
561      else
562      {
563          $id = $object->id;
564          $object = $__v;
565          $object->id = $__v->id>0 ? $__v->id : $id;
566          $object->commit();
567          $this->set_business_ids(array($object->id),$__type);
568      }
569  }
publicbusiness_id[ comment_db ]
Code
518  public function get_business_id($__type="default")
519  {
520      $ids = $this->get_business_ids($__type, true);
521      return (count($ids)==1 ? $ids[0] : null);
522  }
Code
570  public function set_business_id($__v, $__type="default")
571  {
572      $this->set_business_ids(array($__v),$__type);
573  }
publicbusiness_ids[ comment_db ]
Code
523  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
524  {
525      $business_ids = array();
526      $db = comment::db();
527      $q  = " SELECT bus_business.entity_id FROM crm_business_comment INNER JOIN bus_business ON crm_business_comment.business_entity_id=bus_business.entity_id AND crm_business_comment.deleted=0 AND bus_business.deleted=0 AND crm_business_comment.comment_id='$this->id' " . (is_null($__type) ? "" : " AND crm_business_comment.business_comment_type_id='" . business_comment::type_id($__type) . "'") . ($__get_primary ? " AND crm_business_comment.primary=1 " : "");
528      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
529      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
530      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
531      $db->query($q);
532      while ($db->next_record())
533      {
534          $business_ids[] = $db->f("entity_id");
535      }
536      return $business_ids;
537  }
Code
574  public function set_business_ids($__v, $__type="default")
575  {
576      if ($this->id == 0)
577      {
578          $this->commit();
579      }
580      $type_id = business_comment::type_id($__type);
581      business_comment::delete_all(null,$this->id,$type_id);
582      if (is_array($__v))
583      {
584          foreach ($__v as $index=>$id)
585          {
586              $object = new business_comment(null,$id,$this->id,$type_id);
587              $object->deleted = false;
588              $object->business_comment_type_id = $type_id;
589              $object->commit();
590              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
591              {
592                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
593              }
594          }
595          $this->_dirty = true;
596      }
597  }
publicbusiness_list[ comment_db ]
Code
538  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
539  {
540      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
541      $objects = array();
542      foreach ($ids as $index=>$id)
543      {
544          $objects[$index] = new business($id);
545      }
546      return $objects;
547  }
Code
598  public function set_business_list($__v, $__type="default")
599  {
600      if (is_array($__v))
601      {
602          $ids = array();
603          foreach ($__v as $index=>$object)
604          {
605              $ids[] = $object->id;
606          }
607          $this->set_business_ids($ids,$__type);
608      }
609  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ comment_db ]
Code
176  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
177  {
178      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
179      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
180      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
181 
182      $db = comment::db();
183      $data = array();
184      $q  = " SELECT $colstring ";
185      $q .= " FROM cor_comment ";
186      $q .= " WHERE cor_comment.deleted = 0 ";
187      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
188 
189      if (is_string($__order))
190      {
191          $q .= "ORDER BY " . $__order;
192      }
193      else if (is_array($__order) and count($__order)>0)
194      {
195          $orderings = array();
196          foreach ($__order as $col=>$dir)
197          {
198              $orderings[] = " $col $dir ";
199          }
200          $q .= "ORDER BY " . implode(", ", $orderings);
201      }
202      else if (is_object($__order))
203      {
204          $q .= "";
205      }
206      else
207      {
208          // THERE IS NO `order` COLUMN ON THIS OBJECT
209      }
210 
211      if (!is_null($__limit))
212      {
213          $q .= " LIMIT $__offset , $__limit ";
214      }
215 
216      $db->query($q);
217 
218      if (count($colarray)>1 || $colstring=="*")
219      {
220          while ($db->next_record())
221          {
222              $data[] = $db->record;
223          }
224      }
225      else
226      {
227          while ($db->next_record())
228          {
229              $data[] = $db->f(0);
230          }
231      }
232 
233      return $data;
234  }
publiccontact[ comment_db ]
Code
611  public function get_contact($__type="default")
612  {
613      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
614      $this->property_objects_array["{$__type}_contact"] = $object;
615      return $object;
616  }
Code
648  public function set_contact($__v, $__type="default")
649  {
650      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
651      if (is_null($__v))
652      {
653          $rel = new comment_contact(null,$this->id,$object->id,comment_contact::type_id($__type));
654          $rel->delete();
655          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
656          {
657              $this->property_objects_array["{$__type}_contact"] = null;
658          }
659      }
660      else
661      {
662          $id = $object->id;
663          $object = $__v;
664          $object->id = $__v->id>0 ? $__v->id : $id;
665          $object->commit();
666          $this->set_contact_ids(array($object->id),$__type);
667      }
668  }
publiccontact_id[ comment_db ]
Code
617  public function get_contact_id($__type="default")
618  {
619      $ids = $this->get_contact_ids($__type, true);
620      return (count($ids)==1 ? $ids[0] : null);
621  }
Code
669  public function set_contact_id($__v, $__type="default")
670  {
671      $this->set_contact_ids(array($__v),$__type);
672  }
publiccontact_ids[ comment_db ]
Code
622  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
623  {
624      $contact_ids = array();
625      $db = comment::db();
626      $q  = " SELECT crm_contact.person_entity_id FROM crm_comment_contact INNER JOIN crm_contact ON crm_comment_contact.contact_person_entity_id=crm_contact.person_entity_id AND crm_comment_contact.deleted=0 AND crm_contact.deleted=0 AND crm_comment_contact.comment_id='$this->id' " . (is_null($__type) ? "" : " AND crm_comment_contact.comment_contact_type_id='" . comment_contact::type_id($__type) . "'") . ($__get_primary ? " AND crm_comment_contact.primary=1 " : "");
627      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
628      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
629      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
630      $db->query($q);
631      while ($db->next_record())
632      {
633          $contact_ids[] = $db->f("person_entity_id");
634      }
635      return $contact_ids;
636  }
Code
673  public function set_contact_ids($__v, $__type="default")
674  {
675      if ($this->id == 0)
676      {
677          $this->commit();
678      }
679      $type_id = comment_contact::type_id($__type);
680      comment_contact::delete_all($this->id,null,$type_id);
681      if (is_array($__v))
682      {
683          foreach ($__v as $index=>$id)
684          {
685              $object = new comment_contact(null,$this->id,$id,$type_id);
686              $object->deleted = false;
687              $object->comment_contact_type_id = $type_id;
688              $object->commit();
689              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
690              {
691                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
692              }
693          }
694          $this->_dirty = true;
695      }
696  }
publiccontact_list[ comment_db ]
Code
637  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
638  {
639      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
640      $objects = array();
641      foreach ($ids as $index=>$id)
642      {
643          $objects[$index] = new contact($id);
644      }
645      return $objects;
646  }
Code
697  public function set_contact_list($__v, $__type="default")
698  {
699      if (is_array($__v))
700      {
701       &n