Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class employee_type extends employee_type_ext

Hide Inherited MembersHuman Resources
Description
No description.
 
Constants
constantTABLENAME ["hr_employee_type"][ employee_type ]
 
Properties
protected_abbreviation[ employee_type_db ]
protected_abbreviation_dirty[ employee_type_db ]
protected_cdate[ employee_type_db ]
protected_cdate_dirty[ employee_type_db ]
protected_deleted[ employee_type_db ]
protected_deleted_dirty[ employee_type_db ]
protected_description[ employee_type_db ]
protected_description_dirty[ employee_type_db ]
protected_dirty[ obj ]
protected_id[ employee_type_db ]
protected_id_dirty[ employee_type_db ]
protected_mdate[ employee_type_db ]
protected_mdate_dirty[ employee_type_db ]
protected_name[ employee_type_db ]
protected_name_dirty[ employee_type_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
106  public function commit()
107  {
108      if ($this->_id > 0)
109      {
110          $this->update();
111      }
112      else
113      {
114          $this->insert();
115      }
116 
117      foreach ($this->property_objects_array as $property=>$object)
118      {
119          $this->{$property} = $object;
120      }
121 
122      return true;
123  }
public__construct ( id , name , abbreviation )[ employee_type_db ]
Parameters
optionalid
optionalname
optionalabbreviation
Code
044  public function __construct($__id=null, $__name=null, $__abbreviation=null)
045  {
046      $this->_id = 0;
047      $this->_name = $__name;
048      $this->_description = "";
049      $this->_abbreviation = $__abbreviation;
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->_abbreviation_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) && is_null($__abbreviation))
063      {
064          return;
065      }
066 
067      $db = employee_type::db();
068      $q  = " SELECT hr_employee_type.id,hr_employee_type.name,hr_employee_type.description,hr_employee_type.abbreviation,hr_employee_type.mdate,hr_employee_type.cdate,hr_employee_type.deleted ";
069      $q .= " FROM hr_employee_type ";       
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      else if (!is_null($__abbreviation))
079      {
080          $q .= " WHERE abbreviation = '$__abbreviation' ";
081      }
082 
083      $db->query($q);
084      if ($db->next_record() && $db->num_rows() == 1)
085      {
086          $this->_id = $db->f("id");
087          $this->_name = $db->f("name");
088          $this->_description = $db->f("description");
089          $this->_abbreviation = $db->f("abbreviation");
090          $this->_mdate = $db->f("mdate");
091          $this->_cdate = $db->f("cdate");
092          $this->_deleted = $db->f("deleted");
093      }
094  }
protected staticdb ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
331  protected static function db()
332  {
333      return new db();
334  }
publicdelete ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
162  public function delete()
163  {
164      $db = employee_type::db();
165      $q  = " UPDATE hr_employee_type SET ";
166      $q .= " deleted = 1 ";
167      $q .= " WHERE id = " . $this->_id;
168      $db->query($q);
169      $this->deleted = true;
170      return true;
171  }
public staticdelete_all ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
268  public static function delete_all()
269  {
270      $db = employee_type::db();
271      $q  = " UPDATE hr_employee_type SET ";
272      $q .= " deleted = 1 ";
273     
274      $db->query($q);
275      return true;
276  }
public__get ( p )[ obj ]
Parameters
requiredp
Code
007  public function __get($p)
008  {
009      $methods = get_class_methods($this);
010      $properties = get_object_vars($this);
011      if (in_array("get_$p",$methods))
012      {
013          return $this->{"get_$p"}();
014      }
015      else if (array_key_exists("_$p",$properties))
016      {
017          return $this->{"_$p"};
018      }
019      else if (in_array("get_" . substr($p,strpos($p,"_")+1), $methods))
020      {
021          return $this->{"get_" . substr($p,strpos($p,"_")+1)}(substr($p,0,strpos($p,"_")));
022      }
023      else
024      {
025          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
026          return null;
027      }
028  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_classname ( )[ obj ]
Parameters
No parameters for this method
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
public staticget_columns ( columns , order , lookups , where_clause , limit , offset [0] )[ employee_type_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
193  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
194  {
195      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
196      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
197      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
198 
199      $db = employee_type::db();
200      $data = array();
201      $q  = " SELECT $colstring ";
202      $q .= " FROM hr_employee_type ";
203      $q .= " WHERE hr_employee_type.deleted = 0 ";
204      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
205 
206      if (is_string($__order))
207      {
208          $q .= "ORDER BY " . $__order;
209      }
210      else if (is_array($__order) and count($__order)>0)
211      {
212          $orderings = array();
213          foreach ($__order as $col=>$dir)
214          {
215              $orderings[] = " $col $dir ";
216          }
217          $q .= "ORDER BY " . implode(", ", $orderings);
218      }
219      else if (is_object($__order))
220      {
221          $q .= "";
222      }
223      else
224      {
225          // THERE IS NO `order` COLUMN ON THIS OBJECT
226      }
227 
228      if (!is_null($__limit))
229      {
230          $q .= " LIMIT $__offset , $__limit ";
231      }
232 
233      $db->query($q);
234 
235      if (count($colarray)>1 || $colstring=="*")
236      {
237          while ($db->next_record())
238          {
239              $data[] = $db->record;
240          }
241      }
242      else
243      {
244          while ($db->next_record())
245          {
246              $data[] = $db->f(0);
247          }
248      }
249 
250      return $data;
251  }
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] )[ employee_type_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
253  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
254  {
255      return employee_type::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
256  }
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] )[ employee_type_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
258  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
259  {
260      $objects = array();
261      foreach (employee_type::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
262      {
263          $objects[] = new employee_type($id);
264      }
265      return $objects;
266  }
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  }
protectedinsert ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
125  protected function insert()
126  {
127      $db = employee_type::db();
128      $q  = " INSERT INTO hr_employee_type ( ";
129      $q .= $db->param_string("name") . ", ";
130      $q .= $db->param_string("description") . ", ";
131      $q .= $db->param_string("abbreviation") . ", ";
132      $q .= $db->param_string("mdate") . ", ";
133      $q .= $db->param_string("cdate") . ", ";
134      $q .= $db->param_string("deleted");
135      $q .= " ) VALUES ( ";
136      $q .= $db->value_string($this->_name) . ", ";
137      $q .= $db->value_string($this->_description) . ", ";
138      $q .= $db->value_string($this->_abbreviation) . ", ";
139      $q .= $db->value_string(timestamp()) . ", ";
140      $q .= $db->value_string(timestamp()) . ", ";
141      $q .= $this->deleted ? "'1'" : "'0'";
142      $q .= " ) ";
143      $db->query($q);
144      $this->_id = $db->insert_id;
145      return true;
146  }
publicmap ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
096  public function map()
097  {
098      $this->_name = array_key_exists("employee_type:name",$_REQUEST) ? reqval("employee_type:name") : $this->_name;
099      $this->_description = array_key_exists("employee_type:description",$_REQUEST) ? reqval("employee_type:description") : $this->_description;
100      $this->_abbreviation = array_key_exists("employee_type:abbreviation",$_REQUEST) ? reqval("employee_type:abbreviation") : $this->_abbreviation;
101      $this->_mdate = array_key_exists("employee_type:mdate",$_REQUEST) ? reqval("employee_type:mdate") : $this->_mdate;
102      $this->_cdate = array_key_exists("employee_type:cdate",$_REQUEST) ? reqval("employee_type:cdate") : $this->_cdate;
103      $this->_deleted = array_key_exists("employee_type:deleted",$_REQUEST) ? reqval("employee_type:deleted") : $this->_deleted;
104  }
publicpurge ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
184  public function purge()
185  {
186      $db = employee_type::db();
187      $q  = " DELETE FROM hr_employee_type ";
188      $q .= " WHERE id = " . $this->_id;
189      $db->query($q);
190      return true;
191  }
public staticsearch ( keyword )[ employee_type_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  }
public__toString ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
326  public function __toString()
327  {
328      return (is_null($this->name) ? "" : $this->name);
329  }
publicundelete ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
173  public function undelete()
174  {
175      $db = employee_type::db();
176      $q  = " UPDATE hr_employee_type SET ";
177      $q .= " deleted = 0 ";
178      $q .= " WHERE id = " . $this->_id;
179      $db->query($q);
180      $this->deleted = false;
181      return true;
182  }
protectedupdate ( )[ employee_type_db ]
Parameters
No parameters for this method
Code
148  protected function update()
149  {
150      $db = employee_type::db();
151      $q  = " UPDATE hr_employee_type SET ";
152      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
153      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
154      $q .= $db->param_string("abbreviation") . " = " . $db->value_string($this->_abbreviation) . ", ";
155      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
156      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
157      $q .= " WHERE id = " . $this->_id;
158      $db->query($q);
159      return true;
160  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ employee_type_db ]
Code
193  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
194  {
195      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
196      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
197      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
198 
199      $db = employee_type::db();
200      $data = array();
201      $q  = " SELECT $colstring ";
202      $q .= " FROM hr_employee_type ";
203      $q .= " WHERE hr_employee_type.deleted = 0 ";
204      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
205 
206      if (is_string($__order))
207      {
208          $q .= "ORDER BY " . $__order;
209      }
210      else if (is_array($__order) and count($__order)>0)
211      {
212          $orderings = array();
213          foreach ($__order as $col=>$dir)
214          {
215              $orderings[] = " $col $dir ";
216          }
217          $q .= "ORDER BY " . implode(", ", $orderings);
218      }
219      else if (is_object($__order))
220      {
221          $q .= "";
222      }
223      else
224      {
225          // THERE IS NO `order` COLUMN ON THIS OBJECT
226      }
227 
228      if (!is_null($__limit))
229      {
230          $q .= " LIMIT $__offset , $__limit ";
231      }
232 
233      $db->query($q);
234 
235      if (count($colarray)>1 || $colstring=="*")
236      {
237          while ($db->next_record())
238          {
239              $data[] = $db->record;
240          }
241      }
242      else
243      {
244          while ($db->next_record())
245          {
246              $data[] = $db->f(0);
247          }
248      }
249 
250      return $data;
251  }
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[ employee_type_db ]
Code
253  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
254  {
255      return employee_type::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
256  }
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[ employee_type_db ]
Code
258  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
259  {
260      $objects = array();
261      foreach (employee_type::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
262      {
263          $objects[] = new employee_type($id);
264      }
265      return $objects;
266  }
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  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads