Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class budgetchange extends budgetchange_ext

Hide Inherited MembersFinance and Accounting
Description
No description.
 
Constants
constantTABLENAME ["fa_budgetchange"][ budgetchange ]
 
Properties
protected_budgetchange_type_id[ budgetchange_db ]
protected_budgetchange_type_id_dirty[ budgetchange_db ]
protected_cdate[ budgetchange_db ]
protected_cdate_dirty[ budgetchange_db ]
protected_deleted[ budgetchange_db ]
protected_deleted_dirty[ budgetchange_db ]
protected_description[ budgetchange_db ]
protected_description_dirty[ budgetchange_db ]
protected_dirty[ obj ]
protected_id[ budgetchange_db ]
protected_id_dirty[ budgetchange_db ]
protected_mdate[ budgetchange_db ]
protected_mdate_dirty[ budgetchange_db ]
protected_name[ budgetchange_db ]
protected_name_dirty[ budgetchange_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
102  public function commit()
103  {
104      if ($this->_id > 0)
105      {
106          $this->update();
107      }
108      else
109      {
110          $this->insert();
111      }
112 
113      foreach ($this->property_objects_array as $property=>$object)
114      {
115          $this->{$property} = $object;
116      }
117 
118      return true;
119  }
public__construct ( id , name )[ budgetchange_db ]
Parameters
optionalid
optionalname
Code
044  public function __construct($__id=null, $__name=null)
045  {
046      $this->_id = 0;
047      $this->_name = $__name;
048      $this->_description = "";
049      $this->_budgetchange_type_id = 0;
050      $this->_mdate = null;
051      $this->_cdate = null;
052      $this->_deleted = false;
053 
054      $this->_id_dirty = false;
055      $this->_name_dirty = false;
056      $this->_description_dirty = false;
057      $this->_budgetchange_type_id_dirty = false;
058      $this->_mdate_dirty = false;
059      $this->_cdate_dirty = false;
060      $this->_deleted_dirty = false;
061 
062      if (is_null($__id) && is_null($__name))
063      {
064          return;
065      }
066 
067      $db = budgetchange::db();
068      $q  = " SELECT fa_budgetchange.id,fa_budgetchange.name,fa_budgetchange.description,fa_budgetchange.budgetchange_type_id,fa_budgetchange.mdate,fa_budgetchange.cdate,fa_budgetchange.deleted ";
069      $q .= " FROM fa_budgetchange ";       
070      if (!is_null($__id))
071      {
072          $q .= " WHERE id = '$__id' ";
073      }
074      else if (!is_null($__name))
075      {
076          $q .= " WHERE name = '$__name' ";
077      }
078 
079      $db->query($q);
080      if ($db->next_record() && $db->num_rows() == 1)
081      {
082          $this->_id = $db->f("id");
083          $this->_name = $db->f("name");
084          $this->_description = $db->f("description");
085          $this->_budgetchange_type_id = $db->f("budgetchange_type_id");
086          $this->_mdate = $db->f("mdate");
087          $this->_cdate = $db->f("cdate");
088          $this->_deleted = $db->f("deleted");
089      }
090  }
protected staticdb ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
456  protected static function db()
457  {
458      return new db();
459  }
publicdelete ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
158  public function delete()
159  {
160      $db = budgetchange::db();
161      $q  = " UPDATE fa_budgetchange SET ";
162      $q .= " deleted = 1 ";
163      $q .= " WHERE id = " . $this->_id;
164      $db->query($q);
165      $this->deleted = true;
166      return true;
167  }
public staticdelete_all ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
265  public static function delete_all()
266  {
267      $db = budgetchange::db();
268      $q  = " UPDATE fa_budgetchange SET ";
269      $q .= " deleted = 1 ";
270     
271      $db->query($q);
272      return true;
273  }
public__get ( p )[ obj ]
Parameters
requiredp
Code
007  public function __get($p)
008  {
009      $methods = get_class_methods($this);
010      $properties = get_object_vars($this);
011      if (in_array("get_$p",$methods))
012      {
013          return $this->{"get_$p"}();
014      }
015      else if (array_key_exists("_$p",$properties))
016      {
017          return $this->{"_$p"};
018      }
019      else if (in_array("get_" . substr($p,strpos($p,"_")+1), $methods))
020      {
021          return $this->{"get_" . substr($p,strpos($p,"_")+1)}(substr($p,0,strpos($p,"_")));
022      }
023      else
024      {
025          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
026          return null;
027      }
028  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_budgetchange_type ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
345  public function get_budgetchange_type()
346  {
347      return new budgetchange_type($this->budgetchange_type_id);
348  }
publicget_budgetvalue ( type ["default"] )[ budgetchange_db ]
Parameters
optionaltype ["default"]
Code
357  public function get_budgetvalue($__type="default")
358  {
359      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")) ? new budgetvalue($this->get_budgetvalue_id($__type)) : $this->property_objects_array["{$__type}_budgetvalue"];
360      $this->property_objects_array["{$__type}_budgetvalue"] = $object;
361      return $object;
362  }
publicget_budgetvalue_id ( type ["default"] )[ budgetchange_db ]
Parameters
optionaltype ["default"]
Code
363  public function get_budgetvalue_id($__type="default")
364  {
365      $ids = $this->get_budgetvalue_ids($__type, true);
366      return (count($ids)==1 ? $ids[0] : null);
367  }
publicget_budgetvalue_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetchange_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
368  public function get_budgetvalue_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
369  {
370      $budgetvalue_ids = array();
371      $db = budgetchange::db();
372      $q  = " SELECT fa_budgetvalue.id FROM fa_budgetchange_budgetvalue INNER JOIN fa_budgetvalue ON fa_budgetchange_budgetvalue.budgetvalue_id=fa_budgetvalue.id AND fa_budgetchange_budgetvalue.deleted=0 AND fa_budgetvalue.deleted=0 AND fa_budgetchange_budgetvalue.budgetchange_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 " : "");
373      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
374      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
375      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
376      $db->query($q);
377      while ($db->next_record())
378      {
379          $budgetvalue_ids[] = $db->f("id");
380      }
381      return $budgetvalue_ids;
382  }
publicget_budgetvalue_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ budgetchange_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
383  public function get_budgetvalue_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
384  {
385      $ids = $this->get_budgetvalue_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
386      $objects = array();
387      foreach ($ids as $index=>$id)
388      {
389          $objects[$index] = new budgetvalue($id);
390      }
391      return $objects;
392  }
publicget_classname ( )[ obj ]
Parameters
No parameters for this method
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
public staticget_columns ( columns , order , lookups , where_clause , limit , offset [0] )[ budgetchange_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
189  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
190  {
191      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
192      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
193      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
194 
195      $db = budgetchange::db();
196      $data = array();
197      $q  = " SELECT $colstring ";
198      $q .= " FROM fa_budgetchange ";
199      $q .= " WHERE fa_budgetchange.deleted = 0 ";
200      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
201      $q .= array_key_exists("budgetchange_type_id",$lookups) ? " AND fa_budgetchange.budgetchange_type_id='" . $lookups["budgetchange_type_id"] . "' " : "";
202 
203      if (is_string($__order))
204      {
205          $q .= "ORDER BY " . $__order;
206      }
207      else if (is_array($__order) and count($__order)>0)
208      {
209          $orderings = array();
210          foreach ($__order as $col=>$dir)
211          {
212              $orderings[] = " $col $dir ";
213          }
214          $q .= "ORDER BY " . implode(", ", $orderings);
215      }
216      else if (is_object($__order))
217      {
218          $q .= "";
219      }
220      else
221      {
222          // THERE IS NO `order` COLUMN ON THIS OBJECT
223      }
224 
225      if (!is_null($__limit))
226      {
227          $q .= " LIMIT $__offset , $__limit ";
228      }
229 
230      $db->query($q);
231 
232      if (count($colarray)>1 || $colstring=="*")
233      {
234          while ($db->next_record())
235          {
236              $data[] = $db->record;
237          }
238      }
239      else
240      {
241          while ($db->next_record())
242          {
243              $data[] = $db->f(0);
244          }
245      }
246 
247      return $data;
248  }
publicget_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] )[ budgetchange_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
250  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
251  {
252      return budgetchange::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
253  }
publicget_json ( )[ obj ]
Parameters
No parameters for this method
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ budgetchange_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
255  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
256  {
257      $objects = array();
258      foreach (budgetchange::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
259      {
260          $objects[] = new budgetchange($id);
261      }
262      return $objects;
263  }
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_type ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
334  public function get_type()
335  {
336      $type = new budgetchange_type($this->_budgetchange_type_id);
337      return $type->name;
338  }
protectedinsert ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
121  protected function insert()
122  {
123      $db = budgetchange::db();
124      $q  = " INSERT INTO fa_budgetchange ( ";
125      $q .= $db->param_string("name") . ", ";
126      $q .= $db->param_string("description") . ", ";
127      $q .= $db->param_string("budgetchange_type_id") . ", ";
128      $q .= $db->param_string("mdate") . ", ";
129      $q .= $db->param_string("cdate") . ", ";
130      $q .= $db->param_string("deleted");
131      $q .= " ) VALUES ( ";
132      $q .= $db->value_string($this->_name) . ", ";
133      $q .= $db->value_string($this->_description) . ", ";
134      $q .= $db->value_string($this->_budgetchange_type_id) . ", ";
135      $q .= $db->value_string(timestamp()) . ", ";
136      $q .= $db->value_string(timestamp()) . ", ";
137      $q .= $this->deleted ? "'1'" : "'0'";
138      $q .= " ) ";
139      $db->query($q);
140      $this->_id = $db->insert_id;
141      return true;
142  }
publicmap ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
092  public function map()
093  {
094      $this->_name = array_key_exists("budgetchange:name",$_REQUEST) ? reqval("budgetchange:name") : $this->_name;
095      $this->_description = array_key_exists("budgetchange:description",$_REQUEST) ? reqval("budgetchange:description") : $this->_description;
096      $this->_budgetchange_type_id = array_key_exists("budgetchange:budgetchange_type_id",$_REQUEST) ? reqval("budgetchange:budgetchange_type_id") : $this->_budgetchange_type_id;
097      $this->_mdate = array_key_exists("budgetchange:mdate",$_REQUEST) ? reqval("budgetchange:mdate") : $this->_mdate;
098      $this->_cdate = array_key_exists("budgetchange:cdate",$_REQUEST) ? reqval("budgetchange:cdate") : $this->_cdate;
099      $this->_deleted = array_key_exists("budgetchange:deleted",$_REQUEST) ? reqval("budgetchange:deleted") : $this->_deleted;
100  }
publicpurge ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
180  public function purge()
181  {
182      $db = budgetchange::db();
183      $q  = " DELETE FROM fa_budgetchange ";
184      $q .= " WHERE id = " . $this->_id;
185      $db->query($q);
186      return true;
187  }
public staticsearch ( keyword )[ budgetchange_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_budgetchange_type ( v )[ budgetchange_db ]
Parameters
requiredv
Code
349  public function set_budgetchange_type($v)
350  {
351      if ($v->id > 0)
352      {
353          $this->budgetchange_type_id = $v->id;
354      }
355  }
publicset_budgetvalue ( v , type ["default"] )[ budgetchange_db ]
Parameters
requiredv
optionaltype ["default"]
Code
394  public function set_budgetvalue($__v, $__type="default")
395  {
396      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")) ? new budgetvalue($this->get_budgetvalue_id($__type)) : $this->property_objects_array["{$__type}_budgetvalue"];
397      if (is_null($__v))
398      {
399          $rel = new budgetchange_budgetvalue(null,$this->id,$object->id,budgetchange_budgetvalue::type_id($__type));
400          $rel->delete();
401          if (!is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")))
402          {
403              $this->property_objects_array["{$__type}_budgetvalue"] = null;
404          }
405      }
406      else
407      {
408          $id = $object->id;
409          $object = $__v;
410          $object->id = $__v->id>0 ? $__v->id : $id;
411          $object->commit();
412          $this->set_budgetvalue_ids(array($object->id),$__type);
413      }
414  }
publicset_budgetvalue_id ( v , type ["default"] )[ budgetchange_db ]
Parameters
requiredv
optionaltype ["default"]
Code
415  public function set_budgetvalue_id($__v, $__type="default")
416  {
417      $this->set_budgetvalue_ids(array($__v),$__type);
418  }
publicset_budgetvalue_ids ( v , type ["default"] )[ budgetchange_db ]
Parameters
requiredv
optionaltype ["default"]
Code
419  public function set_budgetvalue_ids($__v, $__type="default")
420  {
421      if ($this->id == 0)
422      {
423          $this->commit();
424      }
425      $type_id = budgetchange_budgetvalue::type_id($__type);
426      budgetchange_budgetvalue::delete_all($this->id,null,$type_id);
427      if (is_array($__v))
428      {
429          foreach ($__v as $index=>$id)
430          {
431              $object = new budgetchange_budgetvalue(null,$this->id,$id,$type_id);
432              $object->deleted = false;
433              $object->budgetchange_budgetvalue_type_id = $type_id;
434              $object->commit();
435              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")))
436              {
437                  $this->property_objects_array["{$__type}_budgetvalue"] = new budgetvalue($object->budgetvalue_id);
438              }
439          }
440          $this->_dirty = true;
441      }
442  }
publicset_budgetvalue_list ( v , type ["default"] )[ budgetchange_db ]
Parameters
requiredv
optionaltype ["default"]
Code
443  public function set_budgetvalue_list($__v, $__type="default")
444  {
445      if (is_array($__v))
446      {
447          $ids = array();
448          foreach ($__v as $index=>$object)
449          {
450              $ids[] = $object->id;
451          }
452          $this->set_budgetvalue_ids($ids,$__type);
453      }
454  }
publicset_type ( v )[ budgetchange_db ]
Parameters
requiredv
Code
339  public function set_type($v)
340  {
341      $type = new budgetchange_type(null, $v);
342      $this->budgetchange_type_id = $type->id;
343  }
public__toString ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
323  public function __toString()
324  {
325      return (is_null($this->name) ? "" : $this->name);
326  }
public statictype_id ( type_name )[ budgetchange_db ]
Parameters
requiredtype_name
Code
328  public static function type_id($__type_name)
329  {
330      $type = new budgetchange_type(null, $__type_name);
331      return $type->id;
332  }
publicundelete ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
169  public function undelete()
170  {
171      $db = budgetchange::db();
172      $q  = " UPDATE fa_budgetchange SET ";
173      $q .= " deleted = 0 ";
174      $q .= " WHERE id = " . $this->_id;
175      $db->query($q);
176      $this->deleted = false;
177      return true;
178  }
protectedupdate ( )[ budgetchange_db ]
Parameters
No parameters for this method
Code
144  protected function update()
145  {
146      $db = budgetchange::db();
147      $q  = " UPDATE fa_budgetchange SET ";
148      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
149      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
150      $q .= $db->param_string("budgetchange_type_id") . " = " . $db->value_string($this->_budgetchange_type_id) . ", ";
151      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
152      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
153      $q .= " WHERE id = " . $this->_id;
154      $db->query($q);
155      return true;
156  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicbudgetchange_type[ budgetchange_db ]
Code
345  public function get_budgetchange_type()
346  {
347      return new budgetchange_type($this->budgetchange_type_id);
348  }
Code
349  public function set_budgetchange_type($v)
350  {
351      if ($v->id > 0)
352      {
353          $this->budgetchange_type_id = $v->id;
354      }
355  }
publicbudgetvalue[ budgetchange_db ]
Code
357  public function get_budgetvalue($__type="default")
358  {
359      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")) ? new budgetvalue($this->get_budgetvalue_id($__type)) : $this->property_objects_array["{$__type}_budgetvalue"];
360      $this->property_objects_array["{$__type}_budgetvalue"] = $object;
361      return $object;
362  }
Code
394  public function set_budgetvalue($__v, $__type="default")
395  {
396      $object = is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")) ? new budgetvalue($this->get_budgetvalue_id($__type)) : $this->property_objects_array["{$__type}_budgetvalue"];
397      if (is_null($__v))
398      {
399          $rel = new budgetchange_budgetvalue(null,$this->id,$object->id,budgetchange_budgetvalue::type_id($__type));
400          $rel->delete();
401          if (!is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")))
402          {
403              $this->property_objects_array["{$__type}_budgetvalue"] = null;
404          }
405      }
406      else
407      {
408          $id = $object->id;
409          $object = $__v;
410          $object->id = $__v->id>0 ? $__v->id : $id;
411          $object->commit();
412          $this->set_budgetvalue_ids(array($object->id),$__type);
413      }
414  }
publicbudgetvalue_id[ budgetchange_db ]
Code
363  public function get_budgetvalue_id($__type="default")
364  {
365      $ids = $this->get_budgetvalue_ids($__type, true);
366      return (count($ids)==1 ? $ids[0] : null);
367  }
Code
415  public function set_budgetvalue_id($__v, $__type="default")
416  {
417      $this->set_budgetvalue_ids(array($__v),$__type);
418  }
publicbudgetvalue_ids[ budgetchange_db ]
Code
368  public function get_budgetvalue_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
369  {
370      $budgetvalue_ids = array();
371      $db = budgetchange::db();
372      $q  = " SELECT fa_budgetvalue.id FROM fa_budgetchange_budgetvalue INNER JOIN fa_budgetvalue ON fa_budgetchange_budgetvalue.budgetvalue_id=fa_budgetvalue.id AND fa_budgetchange_budgetvalue.deleted=0 AND fa_budgetvalue.deleted=0 AND fa_budgetchange_budgetvalue.budgetchange_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 " : "");
373      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
374      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
375      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
376      $db->query($q);
377      while ($db->next_record())
378      {
379          $budgetvalue_ids[] = $db->f("id");
380      }
381      return $budgetvalue_ids;
382  }
Code
419  public function set_budgetvalue_ids($__v, $__type="default")
420  {
421      if ($this->id == 0)
422      {
423          $this->commit();
424      }
425      $type_id = budgetchange_budgetvalue::type_id($__type);
426      budgetchange_budgetvalue::delete_all($this->id,null,$type_id);
427      if (is_array($__v))
428      {
429          foreach ($__v as $index=>$id)
430          {
431              $object = new budgetchange_budgetvalue(null,$this->id,$id,$type_id);
432              $object->deleted = false;
433              $object->budgetchange_budgetvalue_type_id = $type_id;
434              $object->commit();
435              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_budgetvalue")))
436              {
437                  $this->property_objects_array["{$__type}_budgetvalue"] = new budgetvalue($object->budgetvalue_id);
438              }
439          }
440          $this->_dirty = true;
441      }
442  }
publicbudgetvalue_list[ budgetchange_db ]
Code
383  public function get_budgetvalue_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
384  {
385      $ids = $this->get_budgetvalue_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
386      $objects = array();
387      foreach ($ids as $index=>$id)
388      {
389          $objects[$index] = new budgetvalue($id);
390      }
391      return $objects;
392  }
Code
443  public function set_budgetvalue_list($__v, $__type="default")
444  {
445      if (is_array($__v))
446      {
447          $ids = array();
448          foreach ($__v as $index=>$object)
449          {
450              $ids[] = $object->id;
451          }
452          $this->set_budgetvalue_ids($ids,$__type);
453      }
454  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ budgetchange_db ]
Code
189  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
190  {
191      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
192      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
193      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
194 
195      $db = budgetchange::db();
196      $data = array();
197      $q  = " SELECT $colstring ";
198      $q .= " FROM fa_budgetchange ";
199      $q .= " WHERE fa_budgetchange.deleted = 0 ";
200      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
201      $q .= array_key_exists("budgetchange_type_id",$lookups) ? " AND fa_budgetchange.budgetchange_type_id='" . $lookups["budgetchange_type_id"] . "' " : "";
202 
203      if (is_string($__order))
204      {
205          $q .= "ORDER BY " . $__order;
206      }
207      else if (is_array($__order) and count($__order)>0)
208      {
209          $orderings = array();
210          foreach ($__order as $col=>$dir)
211          {
212              $orderings[] = " $col $dir ";
213          }
214          $q .= "ORDER BY " . implode(", ", $orderings);
215      }
216      else if (is_object($__order))
217      {
218          $q .= "";
219      }
220      else
221      {
222          // THERE IS NO `order` COLUMN ON THIS OBJECT
223      }
224 
225      if (!is_null($__limit))
226      {
227          $q .= " LIMIT $__offset , $__limit ";
228      }
229 
230      $db->query($q);
231 
232      if (count($colarray)>1 || $colstring=="*")
233      {
234          while ($db->next_record())
235          {
236              $data[] = $db->record;
237          }
238      }
239      else
240      {
241          while ($db->next_record())
242          {
243              $data[] = $db->f(0);
244          }
245      }
246 
247      return $data;
248  }
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[ budgetchange_db ]
Code
250  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
251  {
252      return budgetchange::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
253  }
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[ budgetchange_db ]
Code
255  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
256  {
257      $objects = array();
258      foreach (budgetchange::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
259      {
260          $objects[] = new budgetchange($id);
261      }
262      return $objects;
263  }
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  }
publictype[ budgetchange_db ]
Code
334  public function get_type()
335  {
336      $type = new budgetchange_type($this->_budgetchange_type_id);
337      return $type->name;
338  }
Code
339  public function set_type($v)
340  {
341      $type = new budgetchange_type(null, $v);
342      $this->budgetchange_type_id = $type->id;
343  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads