Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class rating extends rating_ext

Hide Inherited MembersRatings
Description
No description.
 
Constants
constantTABLENAME ["rating_rating"][ rating ]
 
Properties
protected_cdate[ rating_db ]
protected_cdate_dirty[ rating_db ]
protected_deleted[ rating_db ]
protected_deleted_dirty[ rating_db ]
protected_description[ rating_db ]
protected_description_dirty[ rating_db ]
protected_dirty[ obj ]
protected_id[ rating_db ]
protected_id_dirty[ rating_db ]
protected_mdate[ rating_db ]
protected_mdate_dirty[ rating_db ]
protected_name[ rating_db ]
protected_name_dirty[ rating_db ]
protected_order[ rating_db ]
protected_order_dirty[ rating_db ]
publicproperty_objects_array[ obj ]
protected_rating_type_id[ rating_db ]
protected_rating_type_id_dirty[ rating_db ]
protected_value[ rating_db ]
protected_value_dirty[ rating_db ]
 
Methods
publiccommit ( )[ rating_db ]
Parameters
No parameters for this method
Code
110  public function commit()
111  {
112      if ($this->_id > 0)
113      {
114          $this->update();
115      }
116      else
117      {
118          $this->insert();
119      }
120 
121      foreach ($this->property_objects_array as $property=>$object)
122      {
123          $this->{$property} = $object;
124      }
125 
126      return true;
127  }
public__construct ( id )[ rating_db ]
Parameters
optionalid
Code
048  public function __construct($__id=null)
049  {
050      $this->_id = 0;
051      $this->_name = "";
052      $this->_description = "";
053      $this->_value = "";
054      $this->_rating_type_id = 0;
055      $this->_order = 0;
056      $this->_mdate = null;
057      $this->_cdate = null;
058      $this->_deleted = false;
059 
060      $this->_id_dirty = false;
061      $this->_name_dirty = false;
062      $this->_description_dirty = false;
063      $this->_value_dirty = false;
064      $this->_rating_type_id_dirty = false;
065      $this->_order_dirty = false;
066      $this->_mdate_dirty = false;
067      $this->_cdate_dirty = false;
068      $this->_deleted_dirty = false;
069 
070      if (is_null($__id))
071      {
072          return;
073      }
074 
075      $db = rating::db();
076      $q  = " SELECT rating_rating.id,rating_rating.name,rating_rating.description,rating_rating.value,rating_rating.rating_type_id,rating_rating.order,rating_rating.mdate,rating_rating.cdate,rating_rating.deleted ";
077      $q .= " FROM rating_rating ";       
078      if (!is_null($__id))
079      {
080          $q .= " WHERE id = '$__id' ";
081      }
082 
083      $db->query($q);
084      if ($db->next_record() && $db->num_rows() == 1)
085      {
086          $this->_id = $db->f("id");
087          $this->_name = $db->f("name");
088          $this->_description = $db->f("description");
089          $this->_value = $db->f("value");
090          $this->_rating_type_id = $db->f("rating_type_id");
091          $this->_order = $db->f("order");
092          $this->_mdate = $db->f("mdate");
093          $this->_cdate = $db->f("cdate");
094          $this->_deleted = $db->f("deleted");
095      }
096  }
protected staticdb ( )[ rating_db ]
Parameters
No parameters for this method
Code
470  protected static function db()
471  {
472      return new db();
473  }
publicdelete ( )[ rating_db ]
Parameters
No parameters for this method
Code
172  public function delete()
173  {
174      $db = rating::db();
175      $q  = " UPDATE rating_rating SET ";
176      $q .= " deleted = 1 ";
177      $q .= " WHERE id = " . $this->_id;
178      $db->query($q);
179      $this->deleted = true;
180      return true;
181  }
public staticdelete_all ( )[ rating_db ]
Parameters
No parameters for this method
Code
279  public static function delete_all()
280  {
281      $db = rating::db();
282      $q  = " UPDATE rating_rating SET ";
283      $q .= " deleted = 1 ";
284     
285      $db->query($q);
286      return true;
287  }
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_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] )[ rating_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
203  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
204  {
205      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
206      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
207      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
208 
209      $db = rating::db();
210      $data = array();
211      $q  = " SELECT $colstring ";
212      $q .= " FROM rating_rating ";
213      $q .= " WHERE rating_rating.deleted = 0 ";
214      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
215      $q .= array_key_exists("rating_type_id",$lookups) ? " AND rating_rating.rating_type_id='" . $lookups["rating_type_id"] . "' " : "";
216 
217      if (is_string($__order))
218      {
219          $q .= "ORDER BY " . $__order;
220      }
221      else if (is_array($__order) and count($__order)>0)
222      {
223          $orderings = array();
224          foreach ($__order as $col=>$dir)
225          {
226              $orderings[] = " $col $dir ";
227          }
228          $q .= "ORDER BY " . implode(", ", $orderings);
229      }
230      else if (is_object($__order))
231      {
232          $q .= "";
233      }
234      else
235      {
236          $q .= " ORDER BY " . $db->param_string("order");
237      }
238 
239      if (!is_null($__limit))
240      {
241          $q .= " LIMIT $__offset , $__limit ";
242      }
243 
244      $db->query($q);
245 
246      if (count($colarray)>1 || $colstring=="*")
247      {
248          while ($db->next_record())
249          {
250              $data[] = $db->record;
251          }
252      }
253      else
254      {
255          while ($db->next_record())
256          {
257              $data[] = $db->f(0);
258          }
259      }
260 
261      return $data;
262  }
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  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ rating_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
264  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
265  {
266      return rating::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
267  }
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] )[ rating_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
269  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
270  {
271      $objects = array();
272      foreach (rating::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
273      {
274          $objects[] = new rating($id);
275      }
276      return $objects;
277  }
publicget_person ( type ["default"] )[ rating_db ]
Parameters
optionaltype ["default"]
Code
371  public function get_person($__type="default")
372  {
373      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
374      $this->property_objects_array["{$__type}_person"] = $object;
375      return $object;
376  }
publicget_person_id ( type ["default"] )[ rating_db ]
Parameters
optionaltype ["default"]
Code
377  public function get_person_id($__type="default")
378  {
379      $ids = $this->get_person_ids($__type, true);
380      return (count($ids)==1 ? $ids[0] : null);
381  }
publicget_person_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ rating_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
382  public function get_person_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
383  {
384      $person_ids = array();
385      $db = rating::db();
386      $q  = " SELECT cor_person.entity_id FROM rating_person_rating INNER JOIN cor_person ON rating_person_rating.person_entity_id=cor_person.entity_id AND rating_person_rating.deleted=0 AND cor_person.deleted=0 AND rating_person_rating.rating_id='$this->id' " . (is_null($__type) ? "" : " AND rating_person_rating.person_rating_type_id='" . person_rating::type_id($__type) . "'") . ($__get_primary ? " AND rating_person_rating.primary=1 " : "");
387      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
388      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
389      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
390      $db->query($q);
391      while ($db->next_record())
392      {
393          $person_ids[] = $db->f("entity_id");
394      }
395      return $person_ids;
396  }
publicget_person_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ rating_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
397  public function get_person_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
398  {
399      $ids = $this->get_person_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
400      $objects = array();
401      foreach ($ids as $index=>$id)
402      {
403          $objects[$index] = new person($id);
404      }
405      return $objects;
406  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_rating_type ( )[ rating_db ]
Parameters
No parameters for this method
Code
359  public function get_rating_type()
360  {
361      return new rating_type($this->rating_type_id);
362  }
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 ( )[ rating_db ]
Parameters
No parameters for this method
Code
348  public function get_type()
349  {
350      $type = new rating_type($this->_rating_type_id);
351      return $type->name;
352  }
protectedinsert ( )[ rating_db ]
Parameters
No parameters for this method
Code
129  protected function insert()
130  {
131      $db = rating::db();
132      $q  = " INSERT INTO rating_rating ( ";
133      $q .= $db->param_string("name") . ", ";
134      $q .= $db->param_string("description") . ", ";
135      $q .= $db->param_string("value") . ", ";
136      $q .= $db->param_string("rating_type_id") . ", ";
137      $q .= $db->param_string("order") . ", ";
138      $q .= $db->param_string("mdate") . ", ";
139      $q .= $db->param_string("cdate") . ", ";
140      $q .= $db->param_string("deleted");
141      $q .= " ) VALUES ( ";
142      $q .= $db->value_string($this->_name) . ", ";
143      $q .= $db->value_string($this->_description) . ", ";
144      $q .= $db->value_string($this->_value) . ", ";
145      $q .= $db->value_string($this->_rating_type_id) . ", ";
146      $q .= $db->value_string($this->_order) . ", ";
147      $q .= $db->value_string(timestamp()) . ", ";
148      $q .= $db->value_string(timestamp()) . ", ";
149      $q .= $this->deleted ? "'1'" : "'0'";
150      $q .= " ) ";
151      $db->query($q);
152      $this->_id = $db->insert_id;
153      return true;
154  }
publicmap ( )[ rating_db ]
Parameters
No parameters for this method
Code
098  public function map()
099  {
100      $this->_name = array_key_exists("rating:name",$_REQUEST) ? reqval("rating:name") : $this->_name;
101      $this->_description = array_key_exists("rating:description",$_REQUEST) ? reqval("rating:description") : $this->_description;
102      $this->_value = array_key_exists("rating:value",$_REQUEST) ? reqval("rating:value") : $this->_value;
103      $this->_rating_type_id = array_key_exists("rating:rating_type_id",$_REQUEST) ? reqval("rating:rating_type_id") : $this->_rating_type_id;
104      $this->_order = array_key_exists("rating:order",$_REQUEST) ? reqval("rating:order") : $this->_order;
105      $this->_mdate = array_key_exists("rating:mdate",$_REQUEST) ? reqval("rating:mdate") : $this->_mdate;
106      $this->_cdate = array_key_exists("rating:cdate",$_REQUEST) ? reqval("rating:cdate") : $this->_cdate;
107      $this->_deleted = array_key_exists("rating:deleted",$_REQUEST) ? reqval("rating:deleted") : $this->_deleted;
108  }
publicpurge ( )[ rating_db ]
Parameters
No parameters for this method
Code
194  public function purge()
195  {
196      $db = rating::db();
197      $q  = " DELETE FROM rating_rating ";
198      $q .= " WHERE id = " . $this->_id;
199      $db->query($q);
200      return true;
201  }
public staticsearch ( keyword )[ rating_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_person ( v , type ["default"] )[ rating_db ]
Parameters
requiredv
optionaltype ["default"]
Code
408  public function set_person($__v, $__type="default")
409  {
410      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
411      if (is_null($__v))
412      {
413          $rel = new person_rating(null,$object->id,$this->id,person_rating::type_id($__type));
414          $rel->delete();
415          if (!is_null(keyval($this->property_objects_array,"{$__type}_person")))
416          {
417              $this->property_objects_array["{$__type}_person"] = null;
418          }
419      }
420      else
421      {
422          $id = $object->id;
423          $object = $__v;
424          $object->id = $__v->id>0 ? $__v->id : $id;
425          $object->commit();
426          $this->set_person_ids(array($object->id),$__type);
427      }
428  }
publicset_person_id ( v , type ["default"] )[ rating_db ]
Parameters
requiredv
optionaltype ["default"]
Code
429  public function set_person_id($__v, $__type="default")
430  {
431      $this->set_person_ids(array($__v),$__type);
432  }
publicset_person_ids ( v , type ["default"] )[ rating_db ]
Parameters
requiredv
optionaltype ["default"]
Code
433  public function set_person_ids($__v, $__type="default")
434  {
435      if ($this->id == 0)
436      {
437          $this->commit();
438      }
439      $type_id = person_rating::type_id($__type);
440      person_rating::delete_all(null,$this->id,$type_id);
441      if (is_array($__v))
442      {
443          foreach ($__v as $index=>$id)
444          {
445              $object = new person_rating(null,$id,$this->id,$type_id);
446              $object->deleted = false;
447              $object->person_rating_type_id = $type_id;
448              $object->commit();
449              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_person")))
450              {
451                  $this->property_objects_array["{$__type}_person"] = new person($object->person_id);
452              }
453          }
454          $this->_dirty = true;
455      }
456  }
publicset_person_list ( v , type ["default"] )[ rating_db ]
Parameters
requiredv
optionaltype ["default"]
Code
457  public function set_person_list($__v, $__type="default")
458  {
459      if (is_array($__v))
460      {
461          $ids = array();
462          foreach ($__v as $index=>$object)
463          {
464              $ids[] = $object->id;
465          }
466          $this->set_person_ids($ids,$__type);
467      }
468  }
publicset_rating_type ( v )[ rating_db ]
Parameters
requiredv
Code
363  public function set_rating_type($v)
364  {
365      if ($v->id > 0)
366      {
367          $this->rating_type_id = $v->id;
368      }
369  }
publicset_type ( v )[ rating_db ]
Parameters
requiredv
Code
353  public function set_type($v)
354  {
355      $type = new rating_type(null, $v);
356      $this->rating_type_id = $type->id;
357  }
public__toString ( )[ rating_db ]
Parameters
No parameters for this method
Code
337  public function __toString()
338  {
339      return (is_null($this->name) ? "" : $this->name);
340  }
public statictype_id ( type_name )[ rating_db ]
Parameters
requiredtype_name
Code
342  public static function type_id($__type_name)
343  {
344      $type = new rating_type(null, $__type_name);
345      return $type->id;
346  }
publicundelete ( )[ rating_db ]
Parameters
No parameters for this method
Code
183  public function undelete()
184  {
185      $db = rating::db();
186      $q  = " UPDATE rating_rating SET ";
187      $q .= " deleted = 0 ";
188      $q .= " WHERE id = " . $this->_id;
189      $db->query($q);
190      $this->deleted = false;
191      return true;
192  }
protectedupdate ( )[ rating_db ]
Parameters
No parameters for this method
Code
156  protected function update()
157  {
158      $db = rating::db();
159      $q  = " UPDATE rating_rating SET ";
160      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
161      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
162      $q .= $db->param_string("value") . " = " . $db->value_string($this->_value) . ", ";
163      $q .= $db->param_string("rating_type_id") . " = " . $db->value_string($this->_rating_type_id) . ", ";
164      $q .= $db->param_string("order") . " = " . $db->value_string($this->_order) . ", ";
165      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
166      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
167      $q .= " WHERE id = " . $this->_id;
168      $db->query($q);
169      return true;
170  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ rating_db ]
Code
203  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
204  {
205      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
206      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
207      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
208 
209      $db = rating::db();
210      $data = array();
211      $q  = " SELECT $colstring ";
212      $q .= " FROM rating_rating ";
213      $q .= " WHERE rating_rating.deleted = 0 ";
214      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
215      $q .= array_key_exists("rating_type_id",$lookups) ? " AND rating_rating.rating_type_id='" . $lookups["rating_type_id"] . "' " : "";
216 
217      if (is_string($__order))
218      {
219          $q .= "ORDER BY " . $__order;
220      }
221      else if (is_array($__order) and count($__order)>0)
222      {
223          $orderings = array();
224          foreach ($__order as $col=>$dir)
225          {
226              $orderings[] = " $col $dir ";
227          }
228          $q .= "ORDER BY " . implode(", ", $orderings);
229      }
230      else if (is_object($__order))
231      {
232          $q .= "";
233      }
234      else
235      {
236          $q .= " ORDER BY " . $db->param_string("order");
237      }
238 
239      if (!is_null($__limit))
240      {
241          $q .= " LIMIT $__offset , $__limit ";
242      }
243 
244      $db->query($q);
245 
246      if (count($colarray)>1 || $colstring=="*")
247      {
248          while ($db->next_record())
249          {
250              $data[] = $db->record;
251          }
252      }
253      else
254      {
255          while ($db->next_record())
256          {
257              $data[] = $db->f(0);
258          }
259      }
260 
261      return $data;
262  }
publicdirty[ obj ]
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicids[ rating_db ]
Code
264  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
265  {
266      return rating::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
267  }
publicjson[ obj ]
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  }
publicobjects[ rating_db ]
Code
269  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
270  {
271      $objects = array();
272      foreach (rating::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
273      {
274          $objects[] = new rating($id);
275      }
276      return $objects;
277  }
publicperson[ rating_db ]
Code
371  public function get_person($__type="default")
372  {
373      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
374      $this->property_objects_array["{$__type}_person"] = $object;
375      return $object;
376  }
Code
408  public function set_person($__v, $__type="default")
409  {
410      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
411      if (is_null($__v))
412      {
413          $rel = new person_rating(null,$object->id,$this->id,person_rating::type_id($__type));
414          $rel->delete();
415          if (!is_null(keyval($this->property_objects_array,"{$__type}_person")))
416          {
417              $this->property_objects_array["{$__type}_person"] = null;
418          }
419      }
420      else
421      {
422          $id = $object->id;
423          $object = $__v;
424          $object->id = $__v->id>0 ? $__v->id : $id;
425          $object->commit();
426          $this->set_person_ids(array($object->id),$__type);
427      }
428  }
publicperson_id[ rating_db ]
Code
377  public function get_person_id($__type="default")
378  {
379      $ids = $this->get_person_ids($__type, true);
380      return (count($ids)==1 ? $ids[0] : null);
381  }
Code
429  public function set_person_id($__v, $__type="default")
430  {
431      $this->set_person_ids(array($__v),$__type);
432  }
publicperson_ids[ rating_db ]
Code
382  public function get_person_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
383  {
384      $person_ids = array();
385      $db = rating::db();
386      $q  = " SELECT cor_person.entity_id FROM rating_person_rating INNER JOIN cor_person ON rating_person_rating.person_entity_id=cor_person.entity_id AND rating_person_rating.deleted=0 AND cor_person.deleted=0 AND rating_person_rating.rating_id='$this->id' " . (is_null($__type) ? "" : " AND rating_person_rating.person_rating_type_id='" . person_rating::type_id($__type) . "'") . ($__get_primary ? " AND rating_person_rating.primary=1 " : "");
387      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
388      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
389      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
390      $db->query($q);
391      while ($db->next_record())
392      {
393          $person_ids[] = $db->f("entity_id");
394      }
395      return $person_ids;
396  }
Code
433  public function set_person_ids($__v, $__type="default")
434  {
435      if ($this->id == 0)
436      {
437          $this->commit();
438      }
439      $type_id = person_rating::type_id($__type);
440      person_rating::delete_all(null,$this->id,$type_id);
441      if (is_array($__v))
442      {
443          foreach ($__v as $index=>$id)
444          {
445              $object = new person_rating(null,$id,$this->id,$type_id);
446              $object->deleted = false;
447              $object->person_rating_type_id = $type_id;
448              $object->commit();
449              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_person")))
450              {
451                  $this->property_objects_array["{$__type}_person"] = new person($object->person_id);
452              }
453          }
454          $this->_dirty = true;
455      }
456  }
publicperson_list[ rating_db ]
Code
397  public function get_person_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
398  {
399      $ids = $this->get_person_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
400      $objects = array();
401      foreach ($ids as $index=>$id)
402      {
403          $objects[$index] = new person($id);
404      }
405      return $objects;
406  }
Code
457  public function set_person_list($__v, $__type="default")
458  {
459      if (is_array($__v))
460      {
461          $ids = array();
462          foreach ($__v as $index=>$object)
463          {
464              $ids[] = $object->id;
465          }
466          $this->set_person_ids($ids,$__type);
467      }
468  }
publicproperties[ obj ]
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicrating_type[ rating_db ]
Code
359  public function get_rating_type()
360  {
361      return new rating_type($this->rating_type_id);
362  }
Code
363  public function set_rating_type($v)
364  {
365      if ($v->id > 0)
366      {
367          $this->rating_type_id = $v->id;
368      }
369  }
publicstring[ obj ]
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publictype[ rating_db ]
Code
348  public function get_type()
349  {
350      $type = new rating_type($this->_rating_type_id);
351      return $type->name;
352  }
Code
353  public function set_type($v)
354  {
355      $type = new rating_type(null, $v);
356      $this->rating_type_id = $type->id;
357  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads