Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class budgetvalue extends budgetvalue_ext

Hide Inherited MembersFinance and Accounting
Description
No description.
 
Constants
constantTABLENAME ["fa_budgetvalue"][ budgetvalue ]
 
Properties
protected_cdate[ budgetvalue_db ]
protected_cdate_dirty[ budgetvalue_db ]
protected_deleted[ budgetvalue_db ]
protected_deleted_dirty[ budgetvalue_db ]
protected_dirty[ obj ]
protected_id[ budgetvalue_db ]
protected_id_dirty[ budgetvalue_db ]
protected_mdate[ budgetvalue_db ]
protected_mdate_dirty[ budgetvalue_db ]
publicproperty_objects_array[ obj ]
protected_unit_id[ budgetvalue_db ]
protected_unit_id_dirty[ budgetvalue_db ]
protected_value[ budgetvalue_db ]
protected_value_dirty[ budgetvalue_db ]
 
Methods
publiccommit ( )[ budgetvalue_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 )[ budgetvalue_db ]
Parameters
optionalid
Code
042  public function __construct($__id=null)
043  {
044      $this->_id = 0;
045      $this->_value = 0;
046      $this->_unit_id = 0;
047      $this->_mdate = null;
048      $this->_cdate = null;
049      $this->_deleted = false;
050 
051      $this->_id_dirty = false;
052      $this->_value_dirty = false;
053      $this->_unit_id_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 = budgetvalue::db();
064      $q  = " SELECT fa_budgetvalue.id,fa_budgetvalue.value,fa_budgetvalue.unit_id,fa_budgetvalue.mdate,fa_budgetvalue.cdate,fa_budgetvalue.deleted ";
065      $q .= " FROM fa_budgetvalue ";       
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->_value = $db->f("value");
076          $this->_unit_id = $db->f("unit_id");
077          $this->_mdate = $db->f("mdate");
078          $this->_cdate = $db->f("cdate");
079          $this->_deleted = $db->f("deleted");
080      }
081  }
protected staticdb ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
525  protected static function db()
526  {
527      return new db();
528  }
publicdelete ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
145  public function delete()
146  {
147      $db = budgetvalue::db();
148      $q  = " UPDATE fa_budgetvalue 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 ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
252  public static function delete_all()
253  {
254      $db = budgetvalue::db();
255      $q  = " UPDATE fa_budgetvalue SET ";
256      $q .= " deleted = 1 ";
257     
258      $db->query($q);
259      return true;
260  }
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_budget ( type ["default"] )[ budgetvalue_db ]
Parameters
optionaltype ["default"]
Code
327  public function get_budget($__type="default")
328  {
329      $object = is_null(keyval($this->property_objects_array,"{$__type}_budget")) ? new budget($this->get_budget_id($__type)) : $this->property_objects_array["{$__type}_budget"];
330      $this->property_objects_array["{$__type}_budget"] = $object;
331      return $object;
332  }
publicget_budget_id ( type ["default"] )[ budgetvalue_db ]
Parameters
optionaltype ["default"]
Code
333  public function get_budget_id($__type="default")
334  {
335      $ids = $this->get_budget_ids($__type, true);
336      return (count($ids)==1 ? $ids[0] : null);
337  }
publicget_budget_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetvalue_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
338  public function get_budget_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
339  {
340      $budget_ids = array();
341      $db = budgetvalue::db();
342      $q  = " SELECT fa_budget.id FROM fa_budget_budgetvalue INNER JOIN fa_budget ON fa_budget_budgetvalue.budget_id=fa_budget.id AND fa_budget_budgetvalue.deleted=0 AND fa_budget.deleted=0 AND fa_budget_budgetvalue.budgetvalue_id='$this->id' " . (is_null($__type) ? "" : " AND fa_budget_budgetvalue.budget_budgetvalue_type_id='" . budget_budgetvalue::type_id($__type) . "'") . ($__get_primary ? " AND fa_budget_budgetvalue.primary=1 " : "");
343      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
344      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
345      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
346      $db->query($q);
347      while ($db->next_record())
348      {
349          $budget_ids[] = $db->f("id");
350      }
351      return $budget_ids;
352  }
publicget_budget_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetvalue_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
353  public function get_budget_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
354  {
355      $ids = $this->get_budget_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
356      $objects = array();
357      foreach ($ids as $index=>$id)
358      {
359          $objects[$index] = new budget($id);
360      }
361      return $objects;
362  }
publicget_budgetchange ( type ["default"] )[ budgetvalue_db ]
Parameters
optionaltype ["default"]
Code
426  public function get_budgetchange($__type="default")
427  {
428      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")) ? new budgetchange($this->get_budgetchange_id($__type)) : $this->property_objects_array["{$__type}_budgetchange"];
429      $this->property_objects_array["{$__type}_budgetchange"] = $object;
430      return $object;
431  }
publicget_budgetchange_id ( type ["default"] )[ budgetvalue_db ]
Parameters
optionaltype ["default"]
Code
432  public function get_budgetchange_id($__type="default")
433  {
434      $ids = $this->get_budgetchange_ids($__type, true);
435      return (count($ids)==1 ? $ids[0] : null);
436  }
publicget_budgetchange_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetvalue_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
437  public function get_budgetchange_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
438  {
439      $budgetchange_ids = array();
440      $db = budgetvalue::db();
441      $q  = " SELECT fa_budgetchange.id FROM fa_budgetchange_budgetvalue INNER JOIN fa_budgetchange ON fa_budgetchange_budgetvalue.budgetchange_id=fa_budgetchange.id AND fa_budgetchange_budgetvalue.deleted=0 AND fa_budgetchange.deleted=0 AND fa_budgetchange_budgetvalue.budgetvalue_id='$this->id' " . (is_null($__type) ? "" : " AND fa_budgetchange_budgetvalue.budgetchange_budgetvalue_type_id='" . budgetchange_budgetvalue::type_id($__type) . "'") . ($__get_primary ? " AND fa_budgetchange_budgetvalue.primary=1 " : "");
442      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
443      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
444      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
445      $db->query($q);
446      while ($db->next_record())
447      {
448          $budgetchange_ids[] = $db->f("id");
449      }
450      return $budgetchange_ids;
451  }
publicget_budgetchange_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetvalue_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
452  public function get_budgetchange_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
453  {
454      $ids = $this->get_budgetchange_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
455      $objects = array();
456      foreach ($ids as $index=>$id)
457      {
458          $objects[$index] = new budgetchange($id);
459      }
460      return $objects;
461  }
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] )[ budgetvalue_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 = budgetvalue::db();
183      $data = array();
184      $q  = " SELECT $colstring ";
185      $q .= " FROM fa_budgetvalue ";
186      $q .= " WHERE fa_budgetvalue.deleted = 0 ";
187      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
188      $q .= array_key_exists("unit_id",$lookups) ? " AND fa_budgetvalue.unit_id='" . $lookups["unit_id"] . "' " : "";
189 
190      if (is_string($__order))
191      {
192          $q .= "ORDER BY " . $__order;
193      }
194      else if (is_array($__order) and count($__order)>0)
195      {
196          $orderings = array();
197          foreach ($__order as $col=>$dir)
198          {
199              $orderings[] = " $col $dir ";
200          }
201          $q .= "ORDER BY " . implode(", ", $orderings);
202      }
203      else if (is_object($__order))
204      {
205          $q .= "";
206      }
207      else
208      {
209          // THERE IS NO `order` COLUMN ON THIS OBJECT
210      }
211 
212      if (!is_null($__limit))
213      {
214          $q .= " LIMIT $__offset , $__limit ";
215      }
216 
217      $db->query($q);
218 
219      if (count($colarray)>1 || $colstring=="*")
220      {
221          while ($db->next_record())
222          {
223              $data[] = $db->record;
224          }
225      }
226      else
227      {
228          while ($db->next_record())
229          {
230              $data[] = $db->f(0);
231          }
232      }
233 
234      return $data;
235  }
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] )[ budgetvalue_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
237  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
238  {
239      return budgetvalue::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
240  }
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] )[ budgetvalue_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
242  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
243  {
244      $objects = array();
245      foreach (budgetvalue::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
246      {
247          $objects[] = new budgetvalue($id);
248      }
249      return $objects;
250  }
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_unit ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
315  public function get_unit()
316  {
317      return new unit($this->unit_id);
318  }
protectedinsert ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
111  protected function insert()
112  {
113      $db = budgetvalue::db();
114      $q  = " INSERT INTO fa_budgetvalue ( ";
115      $q .= $db->param_string("value") . ", ";
116      $q .= $db->param_string("unit_id") . ", ";
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->_value) . ", ";
122      $q .= $db->value_string($this->_unit_id) . ", ";
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 ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
083  public function map()
084  {
085      $this->_value = array_key_exists("budgetvalue:value",$_REQUEST) ? reqval("budgetvalue:value") : $this->_value;
086      $this->_unit_id = array_key_exists("budgetvalue:unit_id",$_REQUEST) ? reqval("budgetvalue:unit_id") : $this->_unit_id;
087      $this->_mdate = array_key_exists("budgetvalue:mdate",$_REQUEST) ? reqval("budgetvalue:mdate") : $this->_mdate;
088      $this->_cdate = array_key_exists("budgetvalue:cdate",$_REQUEST) ? reqval("budgetvalue:cdate") : $this->_cdate;
089      $this->_deleted = array_key_exists("budgetvalue:deleted",$_REQUEST) ? reqval("budgetvalue:deleted") : $this->_deleted;
090  }
publicpurge ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
167  public function purge()
168  {
169      $db = budgetvalue::db();
170      $q  = " DELETE FROM fa_budgetvalue ";
171      $q .= " WHERE id = " . $this->_id;
172      $db->query($q);
173      return true;
174  }
public staticsearch ( keyword )[ budgetvalue_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_budget ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
364  public function set_budget($__v, $__type="default")
365  {
366      $object = is_null(keyval($this->property_objects_array,"{$__type}_budget")) ? new budget($this->get_budget_id($__type)) : $this->property_objects_array["{$__type}_budget"];
367      if (is_null($__v))
368      {
369          $rel = new budget_budgetvalue(null,$object->id,$this->id,budget_budgetvalue::type_id($__type));
370          $rel->delete();
371          if (!is_null(keyval($this->property_objects_array,"{$__type}_budget")))
372          {
373              $this->property_objects_array["{$__type}_budget"] = null;
374          }
375      }
376      else
377      {
378          $id = $object->id;
379          $object = $__v;
380          $object->id = $__v->id>0 ? $__v->id : $id;
381          $object->commit();
382          $this->set_budget_ids(array($object->id),$__type);
383      }
384  }
publicset_budget_id ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
385  public function set_budget_id($__v, $__type="default")
386  {
387      $this->set_budget_ids(array($__v),$__type);
388  }
publicset_budget_ids ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
389  public function set_budget_ids($__v, $__type="default")
390  {
391      if ($this->id == 0)
392      {
393          $this->commit();
394      }
395      $type_id = budget_budgetvalue::type_id($__type);
396      budget_budgetvalue::delete_all(null,$this->id,$type_id);
397      if (is_array($__v))
398      {
399          foreach ($__v as $index=>$id)
400          {
401              $object = new budget_budgetvalue(null,$id,$this->id,$type_id);
402              $object->deleted = false;
403              $object->budget_budgetvalue_type_id = $type_id;
404              $object->commit();
405              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budget")))
406              {
407                  $this->property_objects_array["{$__type}_budget"] = new budget($object->budget_id);
408              }
409          }
410          $this->_dirty = true;
411      }
412  }
publicset_budget_list ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
413  public function set_budget_list($__v, $__type="default")
414  {
415      if (is_array($__v))
416      {
417          $ids = array();
418          foreach ($__v as $index=>$object)
419          {
420              $ids[] = $object->id;
421          }
422          $this->set_budget_ids($ids,$__type);
423      }
424  }
publicset_budgetchange ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
463  public function set_budgetchange($__v, $__type="default")
464  {
465      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")) ? new budgetchange($this->get_budgetchange_id($__type)) : $this->property_objects_array["{$__type}_budgetchange"];
466      if (is_null($__v))
467      {
468          $rel = new budgetchange_budgetvalue(null,$object->id,$this->id,budgetchange_budgetvalue::type_id($__type));
469          $rel->delete();
470          if (!is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")))
471          {
472              $this->property_objects_array["{$__type}_budgetchange"] = null;
473          }
474      }
475      else
476      {
477          $id = $object->id;
478          $object = $__v;
479          $object->id = $__v->id>0 ? $__v->id : $id;
480          $object->commit();
481          $this->set_budgetchange_ids(array($object->id),$__type);
482      }
483  }
publicset_budgetchange_id ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
484  public function set_budgetchange_id($__v, $__type="default")
485  {
486      $this->set_budgetchange_ids(array($__v),$__type);
487  }
publicset_budgetchange_ids ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
488  public function set_budgetchange_ids($__v, $__type="default")
489  {
490      if ($this->id == 0)
491      {
492          $this->commit();
493      }
494      $type_id = budgetchange_budgetvalue::type_id($__type);
495      budgetchange_budgetvalue::delete_all(null,$this->id,$type_id);
496      if (is_array($__v))
497      {
498          foreach ($__v as $index=>$id)
499          {
500              $object = new budgetchange_budgetvalue(null,$id,$this->id,$type_id);
501              $object->deleted = false;
502              $object->budgetchange_budgetvalue_type_id = $type_id;
503              $object->commit();
504              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")))
505              {
506                  $this->property_objects_array["{$__type}_budgetchange"] = new budgetchange($object->budgetchange_id);
507              }
508          }
509          $this->_dirty = true;
510      }
511  }
publicset_budgetchange_list ( v , type ["default"] )[ budgetvalue_db ]
Parameters
requiredv
optionaltype ["default"]
Code
512  public function set_budgetchange_list($__v, $__type="default")
513  {
514      if (is_array($__v))
515      {
516          $ids = array();
517          foreach ($__v as $index=>$object)
518          {
519              $ids[] = $object->id;
520          }
521          $this->set_budgetchange_ids($ids,$__type);
522      }
523  }
publicset_unit ( v )[ budgetvalue_db ]
Parameters
requiredv
Code
319  public function set_unit($v)
320  {
321      if ($v->id > 0)
322      {
323          $this->unit_id = $v->id;
324      }
325  }
public__toString ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
310  public function __toString()
311  {
312      return (is_null($this->id) ? "" : $this->id);
313  }
publicundelete ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
156  public function undelete()
157  {
158      $db = budgetvalue::db();
159      $q  = " UPDATE fa_budgetvalue SET ";
160      $q .= " deleted = 0 ";
161      $q .= " WHERE id = " . $this->_id;
162      $db->query($q);
163      $this->deleted = false;
164      return true;
165  }
protectedupdate ( )[ budgetvalue_db ]
Parameters
No parameters for this method
Code
132  protected function update()
133  {
134      $db = budgetvalue::db();
135      $q  = " UPDATE fa_budgetvalue SET ";
136      $q .= $db->param_string("value") . " = " . $db->value_string($this->_value) . ", ";
137      $q .= $db->param_string("unit_id") . " = " . $db->value_string($this->_unit_id) . ", ";
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  }
publicbudget[ budgetvalue_db ]
Code
327  public function get_budget($__type="default")
328  {
329      $object = is_null(keyval($this->property_objects_array,"{$__type}_budget")) ? new budget($this->get_budget_id($__type)) : $this->property_objects_array["{$__type}_budget"];
330      $this->property_objects_array["{$__type}_budget"] = $object;
331      return $object;
332  }
Code
364  public function set_budget($__v, $__type="default")
365  {
366      $object = is_null(keyval($this->property_objects_array,"{$__type}_budget")) ? new budget($this->get_budget_id($__type)) : $this->property_objects_array["{$__type}_budget"];
367      if (is_null($__v))
368      {
369          $rel = new budget_budgetvalue(null,$object->id,$this->id,budget_budgetvalue::type_id($__type));
370          $rel->delete();
371          if (!is_null(keyval($this->property_objects_array,"{$__type}_budget")))
372          {
373              $this->property_objects_array["{$__type}_budget"] = null;
374          }
375      }
376      else
377      {
378          $id = $object->id;
379          $object = $__v;
380          $object->id = $__v->id>0 ? $__v->id : $id;
381          $object->commit();
382          $this->set_budget_ids(array($object->id),$__type);
383      }
384  }
publicbudget_id[ budgetvalue_db ]
Code
333  public function get_budget_id($__type="default")
334  {
335      $ids = $this->get_budget_ids($__type, true);
336      return (count($ids)==1 ? $ids[0] : null);
337  }
Code
385  public function set_budget_id($__v, $__type="default")
386  {
387      $this->set_budget_ids(array($__v),$__type);
388  }
publicbudget_ids[ budgetvalue_db ]
Code
338  public function get_budget_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
339  {
340      $budget_ids = array();
341      $db = budgetvalue::db();
342      $q  = " SELECT fa_budget.id FROM fa_budget_budgetvalue INNER JOIN fa_budget ON fa_budget_budgetvalue.budget_id=fa_budget.id AND fa_budget_budgetvalue.deleted=0 AND fa_budget.deleted=0 AND fa_budget_budgetvalue.budgetvalue_id='$this->id' " . (is_null($__type) ? "" : " AND fa_budget_budgetvalue.budget_budgetvalue_type_id='" . budget_budgetvalue::type_id($__type) . "'") . ($__get_primary ? " AND fa_budget_budgetvalue.primary=1 " : "");
343      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
344      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
345      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
346      $db->query($q);
347      while ($db->next_record())
348      {
349          $budget_ids[] = $db->f("id");
350      }
351      return $budget_ids;
352  }
Code
389  public function set_budget_ids($__v, $__type="default")
390  {
391      if ($this->id == 0)
392      {
393          $this->commit();
394      }
395      $type_id = budget_budgetvalue::type_id($__type);
396      budget_budgetvalue::delete_all(null,$this->id,$type_id);
397      if (is_array($__v))
398      {
399          foreach ($__v as $index=>$id)
400          {
401              $object = new budget_budgetvalue(null,$id,$this->id,$type_id);
402              $object->deleted = false;
403              $object->budget_budgetvalue_type_id = $type_id;
404              $object->commit();
405              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budget")))
406              {
407                  $this->property_objects_array["{$__type}_budget"] = new budget($object->budget_id);
408              }
409          }
410          $this->_dirty = true;
411      }
412  }
publicbudget_list[ budgetvalue_db ]
Code
353  public function get_budget_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
354  {
355      $ids = $this->get_budget_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
356      $objects = array();
357      foreach ($ids as $index=>$id)
358      {
359          $objects[$index] = new budget($id);
360      }
361      return $objects;
362  }
Code
413  public function set_budget_list($__v, $__type="default")
414  {
415      if (is_array($__v))
416      {
417          $ids = array();
418          foreach ($__v as $index=>$object)
419          {
420              $ids[] = $object->id;
421          }
422          $this->set_budget_ids($ids,$__type);
423      }
424  }
publicbudgetchange[ budgetvalue_db ]
Code
426  public function get_budgetchange($__type="default")
427  {
428      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")) ? new budgetchange($this->get_budgetchange_id($__type)) : $this->property_objects_array["{$__type}_budgetchange"];
429      $this->property_objects_array["{$__type}_budgetchange"] = $object;
430      return $object;
431  }
Code
463  public function set_budgetchange($__v, $__type="default")
464  {
465      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")) ? new budgetchange($this->get_budgetchange_id($__type)) : $this->property_objects_array["{$__type}_budgetchange"];
466      if (is_null($__v))
467      {
468          $rel = new budgetchange_budgetvalue(null,$object->id,$this->id,budgetchange_budgetvalue::type_id($__type));
469          $rel->delete();
470          if (!is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")))
471          {
472              $this->property_objects_array["{$__type}_budgetchange"] = null;
473          }
474      }
475      else
476      {
477          $id = $object->id;
478          $object = $__v;
479          $object->id = $__v->id>0 ? $__v->id : $id;
480          $object->commit();
481          $this->set_budgetchange_ids(array($object->id),$__type);
482      }
483  }
publicbudgetchange_id[ budgetvalue_db ]
Code
432  public function get_budgetchange_id($__type="default")
433  {
434      $ids = $this->get_budgetchange_ids($__type, true);
435      return (count($ids)==1 ? $ids[0] : null);
436  }
Code
484  public function set_budgetchange_id($__v, $__type="default")
485  {
486      $this->set_budgetchange_ids(array($__v),$__type);
487  }
publicbudgetchange_ids[ budgetvalue_db ]
Code
437  public function get_budgetchange_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
438  {
439      $budgetchange_ids = array();
440      $db = budgetvalue::db();
441      $q  = " SELECT fa_budgetchange.id FROM fa_budgetchange_budgetvalue INNER JOIN fa_budgetchange ON fa_budgetchange_budgetvalue.budgetchange_id=fa_budgetchange.id AND fa_budgetchange_budgetvalue.deleted=0 AND fa_budgetchange.deleted=0 AND fa_budgetchange_budgetvalue.budgetvalue_id='$this->id' " . (is_null($__type) ? "" : " AND fa_budgetchange_budgetvalue.budgetchange_budgetvalue_type_id='" . budgetchange_budgetvalue::type_id($__type) . "'") . ($__get_primary ? " AND fa_budgetchange_budgetvalue.primary=1 " : "");
442      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
443      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
444      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
445      $db->query($q);
446      while ($db->next_record())
447      {
448          $budgetchange_ids[] = $db->f("id");
449      }
450      return $budgetchange_ids;
451  }
Code
488  public function set_budgetchange_ids($__v, $__type="default")
489  {
490      if ($this->id == 0)
491      {
492          $this->commit();
493      }
494      $type_id = budgetchange_budgetvalue::type_id($__type);
495      budgetchange_budgetvalue::delete_all(null,$this->id,$type_id);
496      if (is_array($__v))
497      {
498          foreach ($__v as $index=>$id)
499          {
500              $object = new budgetchange_budgetvalue(null,$id,$this->id,$type_id);
501              $object->deleted = false;
502              $object->budgetchange_budgetvalue_type_id = $type_id;
503              $object->commit();
504              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budgetchange")))
505              {
506                  $this->property_objects_array["{$__type}_budgetchange"] = new budgetchange($object->budgetchange_id);
507              }
508          }
509          $this->_dirty = true;
510      }
511  }
publicbudgetchange_list[ budgetvalue_db ]
Code
452  public function get_budgetchange_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
453  {
454      $ids = $this->get_budgetchange_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
455      $objects = array();
456      foreach ($ids as $index=>$id)
457      {
458          $objects[$index] = new budgetchange($id);
459      }
460      return $objects;
461  }
Code
512  public function set_budgetchange_list($__v, $__type="default")
513  {
514      if (is_array($__v))
515      {
516          $ids = array();
517          foreach ($__v as $index=>$object)
518          {
519              $ids[] = $object->id;
520          }
521          $this->set_budgetchange_ids($ids,$__type);
522      }
523  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ budgetvalue_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 = budgetvalue::db();
183      $data = array();
184      $q  = " SELECT $colstring ";
185      $q .= " FROM fa_budgetvalue ";
186      $q .= " WHERE fa_budgetvalue.deleted = 0 ";
187      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
188      $q .= array_key_exists("unit_id",$lookups) ? " AND fa_budgetvalue.unit_id='" . $lookups["unit_id"] . "' " : "";
189 
190      if (is_string($__order))
191      {
192          $q .= "ORDER BY " . $__order;
193      }
194      else if (is_array($__order) and count($__order)>0)
195      {
196          $orderings = array();
197          foreach ($__order as $col=>$dir)
198          {
199              $orderings[] = " $col $dir ";
200          }
201          $q .= "ORDER BY " . implode(", ", $orderings);
202      }
203      else if (is_object($__order))
204      {
205          $q .= "";
206      }
207      else
208      {
209          // THERE IS NO `order` COLUMN ON THIS OBJECT
210      }
211 
212      if (!is_null($__limit))
213      {
214          $q .= " LIMIT $__offset , $__limit ";
215      }
216 
217      $db->query($q);
218 
219      if (count($colarray)>1 || $colstring=="*")
220      {
221          while ($db->next_record())
222          {
223              $data[] = $db->record;
224          }
225      }
226      else
227      {
228          while ($db->next_record())
229          {
230              $data[] = $db->f(0);
231          }
232      }
233 
234      return $data;
235  }
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[ budgetvalue_db ]
Code
237  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
238  {
239      return budgetvalue::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
240  }
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[ budgetvalue_db ]
Code
242  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
243  {
244      $objects = array();
245      foreach (budgetvalue::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
246      {
247          $objects[] = new budgetvalue($id);
248      }
249      return $objects;
250  }
publicproperties[ obj ]
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicstring[ obj ]
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publicunit[ budgetvalue_db ]
Code
315  public function get_unit()
316  {
317      return new unit($this->unit_id);
318  }
Code
319  public function set_unit($v)
320  {
321      if ($v->id > 0)
322      {
323          $this->unit_id = $v->id;
324      }
325  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads