Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class currencycode extends currencycode_ext

Hide Inherited MembersUser Interface
Description
No description.
 
Constants
constantTABLENAME ["ifc_currencycode"][ currencycode ]
 
Properties
protected_abbreviation[ currencycode_db ]
protected_abbreviation_dirty[ currencycode_db ]
protected_cdate[ currencycode_db ]
protected_cdate_dirty[ currencycode_db ]
protected_deleted[ currencycode_db ]
protected_deleted_dirty[ currencycode_db ]
protected_description[ currencycode_db ]
protected_description_dirty[ currencycode_db ]
protected_dirty[ obj ]
protected_id[ currencycode_db ]
protected_id_dirty[ currencycode_db ]
protected_mdate[ currencycode_db ]
protected_mdate_dirty[ currencycode_db ]
protected_name[ currencycode_db ]
protected_name_dirty[ currencycode_db ]
protected_number[ currencycode_db ]
protected_number_dirty[ currencycode_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
116  public function commit()
117  {
118      if ($this->_id > 0)
119      {
120          $this->update();
121      }
122      else
123      {
124          $this->insert();
125      }
126 
127      foreach ($this->property_objects_array as $property=>$object)
128      {
129          $this->{$property} = $object;
130      }
131 
132      return true;
133  }
public__construct ( id , name , abbreviation , number )[ currencycode_db ]
Parameters
optionalid
optionalname
optionalabbreviation
optionalnumber
Code
046  public function __construct($__id=null, $__name=null, $__abbreviation=null, $__number=null)
047  {
048      $this->_id = 0;
049      $this->_name = $__name;
050      $this->_description = "";
051      $this->_abbreviation = $__abbreviation;
052      $this->_number = $__number;
053      $this->_mdate = null;
054      $this->_cdate = null;
055      $this->_deleted = false;
056 
057      $this->_id_dirty = false;
058      $this->_name_dirty = false;
059      $this->_description_dirty = false;
060      $this->_abbreviation_dirty = false;
061      $this->_number_dirty = false;
062      $this->_mdate_dirty = false;
063      $this->_cdate_dirty = false;
064      $this->_deleted_dirty = false;
065 
066      if (is_null($__id) && is_null($__name) && is_null($__abbreviation) && is_null($__number))
067      {
068          return;
069      }
070 
071      $db = currencycode::db();
072      $q  = " SELECT ifc_currencycode.id,ifc_currencycode.name,ifc_currencycode.description,ifc_currencycode.abbreviation,ifc_currencycode.number,ifc_currencycode.mdate,ifc_currencycode.cdate,ifc_currencycode.deleted ";
073      $q .= " FROM ifc_currencycode ";       
074      if (!is_null($__id))
075      {
076          $q .= " WHERE id = '$__id' ";
077      }
078      else if (!is_null($__name))
079      {
080          $q .= " WHERE name = '$__name' ";
081      }
082      else if (!is_null($__abbreviation))
083      {
084          $q .= " WHERE abbreviation = '$__abbreviation' ";
085      }
086      else if (!is_null($__number))
087      {
088          $q .= " WHERE number = '$__number' ";
089      }
090 
091      $db->query($q);
092      if ($db->next_record() && $db->num_rows() == 1)
093      {
094          $this->_id = $db->f("id");
095          $this->_name = $db->f("name");
096          $this->_description = $db->f("description");
097          $this->_abbreviation = $db->f("abbreviation");
098          $this->_number = $db->f("number");
099          $this->_mdate = $db->f("mdate");
100          $this->_cdate = $db->f("cdate");
101          $this->_deleted = $db->f("deleted");
102      }
103  }
protected staticdb ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
344  protected static function db()
345  {
346      return new db();
347  }
publicdelete ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
175  public function delete()
176  {
177      $db = currencycode::db();
178      $q  = " UPDATE ifc_currencycode SET ";
179      $q .= " deleted = 1 ";
180      $q .= " WHERE id = " . $this->_id;
181      $db->query($q);
182      $this->deleted = true;
183      return true;
184  }
public staticdelete_all ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
281  public static function delete_all()
282  {
283      $db = currencycode::db();
284      $q  = " UPDATE ifc_currencycode SET ";
285      $q .= " deleted = 1 ";
286     
287      $db->query($q);
288      return true;
289  }
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] )[ currencycode_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
206  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
207  {
208      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
209      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
210      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
211 
212      $db = currencycode::db();
213      $data = array();
214      $q  = " SELECT $colstring ";
215      $q .= " FROM ifc_currencycode ";
216      $q .= " WHERE ifc_currencycode.deleted = 0 ";
217      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
218 
219      if (is_string($__order))
220      {
221          $q .= "ORDER BY " . $__order;
222      }
223      else if (is_array($__order) and count($__order)>0)
224      {
225          $orderings = array();
226          foreach ($__order as $col=>$dir)
227          {
228              $orderings[] = " $col $dir ";
229          }
230          $q .= "ORDER BY " . implode(", ", $orderings);
231      }
232      else if (is_object($__order))
233      {
234          $q .= "";
235      }
236      else
237      {
238          // THERE IS NO `order` COLUMN ON THIS OBJECT
239      }
240 
241      if (!is_null($__limit))
242      {
243          $q .= " LIMIT $__offset , $__limit ";
244      }
245 
246      $db->query($q);
247 
248      if (count($colarray)>1 || $colstring=="*")
249      {
250          while ($db->next_record())
251          {
252              $data[] = $db->record;
253          }
254      }
255      else
256      {
257          while ($db->next_record())
258          {
259              $data[] = $db->f(0);
260          }
261      }
262 
263      return $data;
264  }
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] )[ currencycode_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
266  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
267  {
268      return currencycode::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
269  }
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] )[ currencycode_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
271  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
272  {
273      $objects = array();
274      foreach (currencycode::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
275      {
276          $objects[] = new currencycode($id);
277      }
278      return $objects;
279  }
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 ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
135  protected function insert()
136  {
137      $db = currencycode::db();
138      $q  = " INSERT INTO ifc_currencycode ( ";
139      $q .= $db->param_string("name") . ", ";
140      $q .= $db->param_string("description") . ", ";
141      $q .= $db->param_string("abbreviation") . ", ";
142      $q .= $db->param_string("number") . ", ";
143      $q .= $db->param_string("mdate") . ", ";
144      $q .= $db->param_string("cdate") . ", ";
145      $q .= $db->param_string("deleted");
146      $q .= " ) VALUES ( ";
147      $q .= $db->value_string($this->_name) . ", ";
148      $q .= $db->value_string($this->_description) . ", ";
149      $q .= $db->value_string($this->_abbreviation) . ", ";
150      $q .= $db->value_string($this->_number) . ", ";
151      $q .= $db->value_string(timestamp()) . ", ";
152      $q .= $db->value_string(timestamp()) . ", ";
153      $q .= $this->deleted ? "'1'" : "'0'";
154      $q .= " ) ";
155      $db->query($q);
156      $this->_id = $db->insert_id;
157      return true;
158  }
publicmap ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
105  public function map()
106  {
107      $this->_name = array_key_exists("currencycode:name",$_REQUEST) ? reqval("currencycode:name") : $this->_name;
108      $this->_description = array_key_exists("currencycode:description",$_REQUEST) ? reqval("currencycode:description") : $this->_description;
109      $this->_abbreviation = array_key_exists("currencycode:abbreviation",$_REQUEST) ? reqval("currencycode:abbreviation") : $this->_abbreviation;
110      $this->_number = array_key_exists("currencycode:number",$_REQUEST) ? reqval("currencycode:number") : $this->_number;
111      $this->_mdate = array_key_exists("currencycode:mdate",$_REQUEST) ? reqval("currencycode:mdate") : $this->_mdate;
112      $this->_cdate = array_key_exists("currencycode:cdate",$_REQUEST) ? reqval("currencycode:cdate") : $this->_cdate;
113      $this->_deleted = array_key_exists("currencycode:deleted",$_REQUEST) ? reqval("currencycode:deleted") : $this->_deleted;
114  }
publicpurge ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
197  public function purge()
198  {
199      $db = currencycode::db();
200      $q  = " DELETE FROM ifc_currencycode ";
201      $q .= " WHERE id = " . $this->_id;
202      $db->query($q);
203      return true;
204  }
public staticsearch ( keyword )[ currencycode_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 ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
339  public function __toString()
340  {
341      return (is_null($this->name) ? "" : $this->name);
342  }
publicundelete ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
186  public function undelete()
187  {
188      $db = currencycode::db();
189      $q  = " UPDATE ifc_currencycode SET ";
190      $q .= " deleted = 0 ";
191      $q .= " WHERE id = " . $this->_id;
192      $db->query($q);
193      $this->deleted = false;
194      return true;
195  }
protectedupdate ( )[ currencycode_db ]
Parameters
No parameters for this method
Code
160  protected function update()
161  {
162      $db = currencycode::db();
163      $q  = " UPDATE ifc_currencycode SET ";
164      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
165      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
166      $q .= $db->param_string("abbreviation") . " = " . $db->value_string($this->_abbreviation) . ", ";
167      $q .= $db->param_string("number") . " = " . $db->value_string($this->_number) . ", ";
168      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
169      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
170      $q .= " WHERE id = " . $this->_id;
171      $db->query($q);
172      return true;
173  }
 
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[ currencycode_db ]
Code
206  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
207  {
208      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
209      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
210      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
211 
212      $db = currencycode::db();
213      $data = array();
214      $q  = " SELECT $colstring ";
215      $q .= " FROM ifc_currencycode ";
216      $q .= " WHERE ifc_currencycode.deleted = 0 ";
217      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
218 
219      if (is_string($__order))
220      {
221          $q .= "ORDER BY " . $__order;
222      }
223      else if (is_array($__order) and count($__order)>0)
224      {
225          $orderings = array();
226          foreach ($__order as $col=>$dir)
227          {
228              $orderings[] = " $col $dir ";
229          }
230          $q .= "ORDER BY " . implode(", ", $orderings);
231      }
232      else if (is_object($__order))
233      {
234          $q .= "";
235      }
236      else
237      {
238          // THERE IS NO `order` COLUMN ON THIS OBJECT
239      }
240 
241      if (!is_null($__limit))
242      {
243          $q .= " LIMIT $__offset , $__limit ";
244      }
245 
246      $db->query($q);
247 
248      if (count($colarray)>1 || $colstring=="*")
249      {
250          while ($db->next_record())
251          {
252              $data[] = $db->record;
253          }
254      }
255      else
256      {
257          while ($db->next_record())
258          {
259              $data[] = $db->f(0);
260          }
261      }
262 
263      return $data;
264  }
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[ currencycode_db ]
Code
266  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
267  {
268      return currencycode::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
269  }
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[ currencycode_db ]
Code
271  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
272  {
273      $objects = array();
274      foreach (currencycode::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
275      {
276          $objects[] = new currencycode($id);
277      }
278      return $objects;
279  }
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