Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class budget_task extends budget_task_ext

Hide Inherited MembersProject Management
Description
No description.
 
Constants
constantTABLENAME ["prj_budget_task"][ budget_task ]
 
Properties
protected_budget_id[ budget_task_db ]
protected_budget_id_dirty[ budget_task_db ]
protected_budget_task_type_id[ budget_task_db ]
protected_budget_task_type_id_dirty[ budget_task_db ]
protected_cdate[ budget_task_db ]
protected_cdate_dirty[ budget_task_db ]
protected_deleted[ budget_task_db ]
protected_deleted_dirty[ budget_task_db ]
protected_dirty[ obj ]
protected_id[ budget_task_db ]
protected_id_dirty[ budget_task_db ]
protected_mdate[ budget_task_db ]
protected_mdate_dirty[ budget_task_db ]
protected_primary[ budget_task_db ]
protected_primary_dirty[ budget_task_db ]
publicproperty_objects_array[ obj ]
protected_task_id[ budget_task_db ]
protected_task_id_dirty[ budget_task_db ]
 
Methods
publiccommit ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
108  public function commit()
109  {
110      if ($this->_id > 0)
111      {
112          return $this->update();
113      }
114      else
115      {
116          return $this->insert();
117      }
118  }
public__construct ( id , budget_id , task_id , budget_task_type_id [0] )[ budget_task_db ]
Parameters
optionalid
optionalbudget_id
optionaltask_id
optionalbudget_task_type_id [0]
Code
046  public function __construct($__id=null, $__budget_id=null, $__task_id=null, $__budget_task_type_id=0)
047  {
048      $this->_id = 0;
049      $this->_budget_id = 0;
050      $this->_task_id = 0;
051      $this->_budget_task_type_id = 0;
052      $this->_primary = false;
053      $this->_mdate = null;
054      $this->_cdate = null;
055      $this->_deleted = false;
056 
057      $this->_id_dirty = false;
058      $this->_budget_id_dirty = false;
059      $this->_task_id_dirty = false;
060      $this->_budget_task_type_id_dirty = false;
061      $this->_primary_dirty = false;
062      $this->_mdate_dirty = false;
063      $this->_cdate_dirty = false;
064      $this->_deleted_dirty = false;
065 
066      if (is_null($__budget_id) && is_null($__task_id) && is_null($__budget_task_type_id) && is_null($__id))
067      {
068          return;
069      }
070 
071      $db = budget_task::db();
072      $q  = " SELECT * ";
073      $q .= " FROM prj_budget_task ";       
074      if (!is_null($__id))
075      {
076          $q .= " WHERE id = '$__id' ";
077      }
078      else if (!is_null($__budget_id) && !is_null($__task_id) && !is_null($__budget_task_type_id))
079      {
080          $this->budget_id = $__budget_id;
081          $this->task_id = $__task_id;
082          $this->budget_task_type_id = $__budget_task_type_id;
083          $q .= " WHERE budget_id = '$__budget_id' AND task_id = '$__task_id' AND budget_task_type_id = '$__budget_task_type_id' ";
084      }
085 
086      $db->query($q);
087      if ($db->next_record() && $db->num_rows() == 1)
088      {
089          $this->_id = $db->f("id");
090          $this->_budget_id = $db->f("budget_id");
091          $this->_task_id = $db->f("task_id");
092          $this->_budget_task_type_id = $db->f("budget_task_type_id");
093          $this->_primary = $db->f("primary");
094          $this->_mdate = $db->f("mdate");
095          $this->_cdate = $db->f("cdate");
096          $this->_deleted = $db->f("deleted");
097      }
098  }
protected staticdb ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
346  protected static function db()
347  {
348      return new db();
349  }
publicdelete ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
160  public function delete()
161  {
162      $db = budget_task::db();
163      $q  = " UPDATE prj_budget_task SET ";
164      $q .= " deleted = 1 ";
165      $q .= " WHERE id = '" . $this->_id . "'";
166      $db->query($q);
167      return true;
168  }
public staticdelete_all ( budget_id , task_id , budget_task_type_id )[ budget_task_db ]
Parameters
optionalbudget_id
optionaltask_id
optionalbudget_task_type_id
Code
267  public static function delete_all($__budget_id=null, $__task_id=null, $__budget_task_type_id=null)
268  {
269      $db = budget_task::db();
270      $q  = " UPDATE prj_budget_task SET ";
271      $q .= " deleted = 1 ";
272 
273      $filters = array();
274      if (!is_null($__budget_id))
275      {
276          $filters[] = " budget_id = '$__budget_id' ";
277      }
278      if (!is_null($__task_id))
279      {
280          $filters[] = " task_id = '$__task_id' ";
281      }
282      if (!is_null($__budget_task_type_id))
283      {
284          $filters[] = " budget_task_type_id = '$__budget_task_type_id' ";
285      }
286 
287      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
288 
289      $db->query($q);
290      return true;
291  }
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 ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
310  public function get_budget()
311  {
312      return new budget($this->budget_id);
313  }
publicget_budget_task_type ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
334  public function get_budget_task_type()
335  {
336      return new budget_task_type($this->budget_task_type_id);
337  }
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 , budget_id , task_id , budget_task_type_id , order , limit , offset [0] )[ budget_task_db ]
Parameters
requiredcolumns
optionalbudget_id
optionaltask_id
optionalbudget_task_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
179  public static function get_columns($__columns, $__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
180  {
181      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
182      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
183 
184      $db = budget_task::db();
185      $data = array();
186      $q  = " SELECT $colstring ";
187      $q .= " FROM prj_budget_task ";
188 
189      $filters = array();
190      if (!is_null($__budget_id))
191      {
192          $filters[] = " budget_id = '$__budget_id' ";
193      }
194      if (!is_null($__task_id))
195      {
196          $filters[] = " task_id = '$__task_id' ";
197      }
198      if (!is_null($__budget_task_type_id))
199      {
200          $filters[] = " budget_task_type_id = '$__budget_task_type_id' ";
201      }
202 
203      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
204 
205      if (is_string($__order))
206      {
207          $q .= "ORDER BY " . $__order;
208      }
209      else if (is_array($__order) and count($__order)>0)
210      {
211          $orderings = array();
212          foreach ($__order as $col=>$dir)
213          {
214              $orderings[] = " $col $dir ";
215          }
216          $q .= "ORDER BY " . implode(", ", $orderings);
217      }
218      else if (is_object($__order))
219      {
220          $q .= "";
221      }
222      else
223      {
224          // THERE IS NO `order` COLUMN ON THIS OBJECT
225      }
226 
227      if (!is_null($__limit))
228      {
229          $q .= " LIMIT $__offset , $__limit ";
230      }
231 
232      $db->query($q);
233 
234      if (count($colarray)>1 || $colstring=="*")
235      {
236          while ($db->next_record())
237          {
238              $data[] = $db->record;
239          }
240      }
241      else
242      {
243          while ($db->next_record())
244          {
245              $data[] = $db->f(0);
246          }
247      }
248 
249      return $data;
250  }
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 ( budget_id , task_id , budget_task_type_id , order , limit , offset [0] )[ budget_task_db ]
Parameters
optionalbudget_id
optionaltask_id
optionalbudget_task_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
252  public static function get_ids($__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
253  {
254      return budget_task::get_columns("id", $__budget_id, $__task_id, $__budget_task_type_id, $__order, $__limit, $__offset);
255  }
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 ( budget_id , task_id , budget_task_type_id , order , limit , offset [0] )[ budget_task_db ]
Parameters
optionalbudget_id
optionaltask_id
optionalbudget_task_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
257  public static function get_objects($__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
258  {
259      $objects = array();
260      foreach (budget_task::get_columns("id", $__budget_id, $__task_id, $__budget_task_type_id, $__order, $__limit, $__offset) as $id)
261      {
262          $objects[] = new budget_task($id);
263      }
264      return $objects;
265  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publicget_task ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
322  public function get_task()
323  {
324      return new task($this->task_id);
325  }
publicget_type ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
299  public function get_type()
300  {
301      $type = new budget_task_type($this->_budget_task_type_id);
302      return $type->name;
303  }
protectedinsert ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
120  protected function insert()
121  {
122      $db = budget_task::db();
123      $q  = " INSERT INTO prj_budget_task ( ";
124      $q .= $db->param_string("budget_id") . ", ";
125      $q .= $db->param_string("task_id") . ", ";
126      $q .= $db->param_string("budget_task_type_id") . ", ";
127      $q .= $db->param_string("primary") . ", ";
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->_budget_id) . ", ";
133      $q .= $db->value_string($this->_task_id) . ", ";
134      $q .= $db->value_string($this->_budget_task_type_id) . ", ";
135      $q .= ($this->_primary ? "'1'" : "'0'") . ", ";
136      $q .= $db->value_string(timestamp()) . ", ";
137      $q .= $db->value_string(timestamp()) . ", ";
138      $q .= $this->deleted ? "'1'" : "'0'";
139      $q .= " ) ";
140      $db->query($q);
141      $this->_id = $db->insert_id;
142      return true;
143  }
publicmap ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
100  public function map()
101  {
102      $this->_primary = array_key_exists("budget_task:primary",$_REQUEST) ? reqval("budget_task:primary") : $this->_primary;
103      $this->_mdate = array_key_exists("budget_task:mdate",$_REQUEST) ? reqval("budget_task:mdate") : $this->_mdate;
104      $this->_cdate = array_key_exists("budget_task:cdate",$_REQUEST) ? reqval("budget_task:cdate") : $this->_cdate;
105      $this->_deleted = array_key_exists("budget_task:deleted",$_REQUEST) ? reqval("budget_task:deleted") : $this->_deleted;
106  }
publicpurge ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
170  public function purge()
171  {
172      $db = budget_task::db();
173      $q  = " DELETE FROM prj_budget_task ";
174      $q .= " WHERE id = '" . $this->_id . "'";
175      $db->query($q);
176      return true;
177  }
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 )[ budget_task_db ]
Parameters
requiredv
Code
314  public function set_budget($v)
315  {
316      if ($v->id > 0)
317      {
318          $this->budget_id = $v->id;
319      }
320  }
publicset_budget_task_type ( v )[ budget_task_db ]
Parameters
requiredv
Code
338  public function set_budget_task_type($v)
339  {
340      if ($v->id > 0)
341      {
342          $this->budget_task_type_id = $v->id;
343      }
344  }
publicset_task ( v )[ budget_task_db ]
Parameters
requiredv
Code
326  public function set_task($v)
327  {
328      if ($v->id > 0)
329      {
330          $this->task_id = $v->id;
331      }
332  }
publicset_type ( v )[ budget_task_db ]
Parameters
requiredv
Code
304  public function set_type($v)
305  {
306      $type = new budget_task_type(null, $v);
307      $this->budget_task_type_id = $type->id;
308  }
public statictype_id ( type_name )[ budget_task_db ]
Parameters
requiredtype_name
Code
293  public static function type_id($__type_name)
294  {
295      $type = new budget_task_type(null, $__type_name);
296      return $type->id;
297  }
protectedupdate ( )[ budget_task_db ]
Parameters
No parameters for this method
Code
145  protected function update()
146  {
147      $db = budget_task::db();
148      $q  = " UPDATE prj_budget_task SET ";
149      $q .= $db->param_string("budget_id") . " = " . $db->value_string($this->_budget_id) . ", ";
150      $q .= $db->param_string("task_id") . " = " . $db->value_string($this->_task_id) . ", ";
151      $q .= $db->param_string("budget_task_type_id") . " = " . $db->value_string($this->_budget_task_type_id) . ", ";
152      $q .= $db->param_string("primary") . " = " . ($this->_primary ? "'1'" : "'0'") . ", ";
153      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
154      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
155      $q .= " WHERE id = " . $this->_id;
156      $db->query($q);
157      return true;
158  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicbudget[ budget_task_db ]
Code
310  public function get_budget()
311  {
312      return new budget($this->budget_id);
313  }
Code
314  public function set_budget($v)
315  {
316      if ($v->id > 0)
317      {
318          $this->budget_id = $v->id;
319      }
320  }
publicbudget_task_type[ budget_task_db ]
Code
334  public function get_budget_task_type()
335  {
336      return new budget_task_type($this->budget_task_type_id);
337  }
Code
338  public function set_budget_task_type($v)
339  {
340      if ($v->id > 0)
341      {
342          $this->budget_task_type_id = $v->id;
343      }
344  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ budget_task_db ]
Code
179  public static function get_columns($__columns, $__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
180  {
181      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
182      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
183 
184      $db = budget_task::db();
185      $data = array();
186      $q  = " SELECT $colstring ";
187      $q .= " FROM prj_budget_task ";
188 
189      $filters = array();
190      if (!is_null($__budget_id))
191      {
192          $filters[] = " budget_id = '$__budget_id' ";
193      }
194      if (!is_null($__task_id))
195      {
196          $filters[] = " task_id = '$__task_id' ";
197      }
198      if (!is_null($__budget_task_type_id))
199      {
200          $filters[] = " budget_task_type_id = '$__budget_task_type_id' ";
201      }
202 
203      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
204 
205      if (is_string($__order))
206      {
207          $q .= "ORDER BY " . $__order;
208      }
209      else if (is_array($__order) and count($__order)>0)
210      {
211          $orderings = array();
212          foreach ($__order as $col=>$dir)
213          {
214              $orderings[] = " $col $dir ";
215          }
216          $q .= "ORDER BY " . implode(", ", $orderings);
217      }
218      else if (is_object($__order))
219      {
220          $q .= "";
221      }
222      else
223      {
224          // THERE IS NO `order` COLUMN ON THIS OBJECT
225      }
226 
227      if (!is_null($__limit))
228      {
229          $q .= " LIMIT $__offset , $__limit ";
230      }
231 
232      $db->query($q);
233 
234      if (count($colarray)>1 || $colstring=="*")
235      {
236          while ($db->next_record())
237          {
238              $data[] = $db->record;
239          }
240      }
241      else
242      {
243          while ($db->next_record())
244          {
245              $data[] = $db->f(0);
246          }
247      }
248 
249      return $data;
250  }
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[ budget_task_db ]
Code
252  public static function get_ids($__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
253  {
254      return budget_task::get_columns("id", $__budget_id, $__task_id, $__budget_task_type_id, $__order, $__limit, $__offset);
255  }
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[ budget_task_db ]
Code
257  public static function get_objects($__budget_id=null, $__task_id=null, $__budget_task_type_id=null, $__order=null, $__limit=null, $__offset=0)
258  {
259      $objects = array();
260      foreach (budget_task::get_columns("id", $__budget_id, $__task_id, $__budget_task_type_id, $__order, $__limit, $__offset) as $id)
261      {
262          $objects[] = new budget_task($id);
263      }
264      return $objects;
265  }
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  }
publictask[ budget_task_db ]
Code
322  public function get_task()
323  {
324      return new task($this->task_id);
325  }
Code
326  public function set_task($v)
327  {
328      if ($v->id > 0)
329      {
330          $this->task_id = $v->id;
331      }
332  }
publictype[ budget_task_db ]
Code
299  public function get_type()
300  {
301      $type = new budget_task_type($this->_budget_task_type_id);
302      return $type->name;
303  }
Code
304  public function set_type($v)
305  {
306      $type = new budget_task_type(null, $v);
307      $this->budget_task_type_id = $type->id;
308  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads