Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class option_optionset extends option_optionset_ext

Hide Inherited MembersForm Builder
Description
No description.
 
Constants
constantTABLENAME ["qi_option_optionset"][ option_optionset ]
 
Properties
protected_cdate[ option_optionset_db ]
protected_cdate_dirty[ option_optionset_db ]
protected_deleted[ option_optionset_db ]
protected_deleted_dirty[ option_optionset_db ]
protected_dirty[ obj ]
protected_id[ option_optionset_db ]
protected_id_dirty[ option_optionset_db ]
protected_mdate[ option_optionset_db ]
protected_mdate_dirty[ option_optionset_db ]
protected_option_id[ option_optionset_db ]
protected_option_id_dirty[ option_optionset_db ]
protected_option_optionset_type_id[ option_optionset_db ]
protected_option_optionset_type_id_dirty[ option_optionset_db ]
protected_optionset_id[ option_optionset_db ]
protected_optionset_id_dirty[ option_optionset_db ]
protected_order[ option_optionset_db ]
protected_order_dirty[ option_optionset_db ]
protected_primary[ option_optionset_db ]
protected_primary_dirty[ option_optionset_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
114  public function commit()
115  {
116      if ($this->_id > 0)
117      {
118          return $this->update();
119      }
120      else
121      {
122          return $this->insert();
123      }
124  }
public__construct ( id , option_id , optionset_id , option_optionset_type_id [0] )[ option_optionset_db ]
Parameters
optionalid
optionaloption_id
optionaloptionset_id
optionaloption_optionset_type_id [0]
Code
048  public function __construct($__id=null, $__option_id=null, $__optionset_id=null, $__option_optionset_type_id=0)
049  {
050      $this->_id = 0;
051      $this->_option_id = 0;
052      $this->_optionset_id = 0;
053      $this->_option_optionset_type_id = 0;
054      $this->_primary = false;
055      $this->_order = 0;
056      $this->_mdate = null;
057      $this->_cdate = null;
058      $this->_deleted = false;
059 
060      $this->_id_dirty = false;
061      $this->_option_id_dirty = false;
062      $this->_optionset_id_dirty = false;
063      $this->_option_optionset_type_id_dirty = false;
064      $this->_primary_dirty = false;
065      $this->_order_dirty = false;
066      $this->_mdate_dirty = false;
067      $this->_cdate_dirty = false;
068      $this->_deleted_dirty = false;
069 
070      if (is_null($__option_id) && is_null($__optionset_id) && is_null($__option_optionset_type_id) && is_null($__id))
071      {
072          return;
073      }
074 
075      $db = option_optionset::db();
076      $q  = " SELECT * ";
077      $q .= " FROM qi_option_optionset ";       
078      if (!is_null($__id))
079      {
080          $q .= " WHERE id = '$__id' ";
081      }
082      else if (!is_null($__option_id) && !is_null($__optionset_id) && !is_null($__option_optionset_type_id))
083      {
084          $this->option_id = $__option_id;
085          $this->optionset_id = $__optionset_id;
086          $this->option_optionset_type_id = $__option_optionset_type_id;
087          $q .= " WHERE option_id = '$__option_id' AND optionset_id = '$__optionset_id' AND option_optionset_type_id = '$__option_optionset_type_id' ";
088      }
089 
090      $db->query($q);
091      if ($db->next_record() && $db->num_rows() == 1)
092      {
093          $this->_id = $db->f("id");
094          $this->_option_id = $db->f("option_id");
095          $this->_optionset_id = $db->f("optionset_id");
096          $this->_option_optionset_type_id = $db->f("option_optionset_type_id");
097          $this->_primary = $db->f("primary");
098          $this->_order = $db->f("order");
099          $this->_mdate = $db->f("mdate");
100          $this->_cdate = $db->f("cdate");
101          $this->_deleted = $db->f("deleted");
102      }
103  }
protected staticdb ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
355  protected static function db()
356  {
357      return new db();
358  }
publicdelete ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
169  public function delete()
170  {
171      $db = option_optionset::db();
172      $q  = " UPDATE qi_option_optionset SET ";
173      $q .= " deleted = 1 ";
174      $q .= " WHERE id = '" . $this->_id . "'";
175      $db->query($q);
176      return true;
177  }
public staticdelete_all ( option_id , optionset_id , option_optionset_type_id )[ option_optionset_db ]
Parameters
optionaloption_id
optionaloptionset_id
optionaloption_optionset_type_id
Code
276  public static function delete_all($__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null)
277  {
278      $db = option_optionset::db();
279      $q  = " UPDATE qi_option_optionset SET ";
280      $q .= " deleted = 1 ";
281 
282      $filters = array();
283      if (!is_null($__option_id))
284      {
285          $filters[] = " option_id = '$__option_id' ";
286      }
287      if (!is_null($__optionset_id))
288      {
289          $filters[] = " optionset_id = '$__optionset_id' ";
290      }
291      if (!is_null($__option_optionset_type_id))
292      {
293          $filters[] = " option_optionset_type_id = '$__option_optionset_type_id' ";
294      }
295 
296      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
297 
298      $db->query($q);
299      return true;
300  }
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 , option_id , optionset_id , option_optionset_type_id , order , limit , offset [0] )[ option_optionset_db ]
Parameters
requiredcolumns
optionaloption_id
optionaloptionset_id
optionaloption_optionset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
188  public static function get_columns($__columns, $__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
189  {
190      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
191      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
192 
193      $db = option_optionset::db();
194      $data = array();
195      $q  = " SELECT $colstring ";
196      $q .= " FROM qi_option_optionset ";
197 
198      $filters = array();
199      if (!is_null($__option_id))
200      {
201          $filters[] = " option_id = '$__option_id' ";
202      }
203      if (!is_null($__optionset_id))
204      {
205          $filters[] = " optionset_id = '$__optionset_id' ";
206      }
207      if (!is_null($__option_optionset_type_id))
208      {
209          $filters[] = " option_optionset_type_id = '$__option_optionset_type_id' ";
210      }
211 
212      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
213 
214      if (is_string($__order))
215      {
216          $q .= "ORDER BY " . $__order;
217      }
218      else if (is_array($__order) and count($__order)>0)
219      {
220          $orderings = array();
221          foreach ($__order as $col=>$dir)
222          {
223              $orderings[] = " $col $dir ";
224          }
225          $q .= "ORDER BY " . implode(", ", $orderings);
226      }
227      else if (is_object($__order))
228      {
229          $q .= "";
230      }
231      else
232      {
233          $q .= " ORDER BY " . $db->param_string("order");
234      }
235 
236      if (!is_null($__limit))
237      {
238          $q .= " LIMIT $__offset , $__limit ";
239      }
240 
241      $db->query($q);
242 
243      if (count($colarray)>1 || $colstring=="*")
244      {
245          while ($db->next_record())
246          {
247              $data[] = $db->record;
248          }
249      }
250      else
251      {
252          while ($db->next_record())
253          {
254              $data[] = $db->f(0);
255          }
256      }
257 
258      return $data;
259  }
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 ( option_id , optionset_id , option_optionset_type_id , order , limit , offset [0] )[ option_optionset_db ]
Parameters
optionaloption_id
optionaloptionset_id
optionaloption_optionset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
261  public static function get_ids($__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
262  {
263      return option_optionset::get_columns("id", $__option_id, $__optionset_id, $__option_optionset_type_id, $__order, $__limit, $__offset);
264  }
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 ( option_id , optionset_id , option_optionset_type_id , order , limit , offset [0] )[ option_optionset_db ]
Parameters
optionaloption_id
optionaloptionset_id
optionaloption_optionset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
266  public static function get_objects($__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
267  {
268      $objects = array();
269      foreach (option_optionset::get_columns("id", $__option_id, $__optionset_id, $__option_optionset_type_id, $__order, $__limit, $__offset) as $id)
270      {
271          $objects[] = new option_optionset($id);
272      }
273      return $objects;
274  }
publicget_option ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
319  public function get_option()
320  {
321      return new option($this->option_id);
322  }
publicget_option_optionset_type ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
343  public function get_option_optionset_type()
344  {
345      return new option_optionset_type($this->option_optionset_type_id);
346  }
publicget_optionset ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
331  public function get_optionset()
332  {
333      return new optionset($this->optionset_id);
334  }
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 ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
308  public function get_type()
309  {
310      $type = new option_optionset_type($this->_option_optionset_type_id);
311      return $type->name;
312  }
protectedinsert ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
126  protected function insert()
127  {
128      $db = option_optionset::db();
129      $q  = " INSERT INTO qi_option_optionset ( ";
130      $q .= $db->param_string("option_id") . ", ";
131      $q .= $db->param_string("optionset_id") . ", ";
132      $q .= $db->param_string("option_optionset_type_id") . ", ";
133      $q .= $db->param_string("primary") . ", ";
134      $q .= $db->param_string("order") . ", ";
135      $q .= $db->param_string("mdate") . ", ";
136      $q .= $db->param_string("cdate") . ", ";
137      $q .= $db->param_string("deleted");
138      $q .= " ) VALUES ( ";
139      $q .= $db->value_string($this->_option_id) . ", ";
140      $q .= $db->value_string($this->_optionset_id) . ", ";
141      $q .= $db->value_string($this->_option_optionset_type_id) . ", ";
142      $q .= ($this->_primary ? "'1'" : "'0'") . ", ";
143      $q .= $db->value_string($this->_order) . ", ";
144      $q .= $db->value_string(timestamp()) . ", ";
145      $q .= $db->value_string(timestamp()) . ", ";
146      $q .= $this->deleted ? "'1'" : "'0'";
147      $q .= " ) ";
148      $db->query($q);
149      $this->_id = $db->insert_id;
150      return true;
151  }
publicmap ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
105  public function map()
106  {
107      $this->_primary = array_key_exists("option_optionset:primary",$_REQUEST) ? reqval("option_optionset:primary") : $this->_primary;
108      $this->_order = array_key_exists("option_optionset:order",$_REQUEST) ? reqval("option_optionset:order") : $this->_order;
109      $this->_mdate = array_key_exists("option_optionset:mdate",$_REQUEST) ? reqval("option_optionset:mdate") : $this->_mdate;
110      $this->_cdate = array_key_exists("option_optionset:cdate",$_REQUEST) ? reqval("option_optionset:cdate") : $this->_cdate;
111      $this->_deleted = array_key_exists("option_optionset:deleted",$_REQUEST) ? reqval("option_optionset:deleted") : $this->_deleted;
112  }
publicpurge ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
179  public function purge()
180  {
181      $db = option_optionset::db();
182      $q  = " DELETE FROM qi_option_optionset ";
183      $q .= " WHERE id = '" . $this->_id . "'";
184      $db->query($q);
185      return true;
186  }
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_option ( v )[ option_optionset_db ]
Parameters
requiredv
Code
323  public function set_option($v)
324  {
325      if ($v->id > 0)
326      {
327          $this->option_id = $v->id;
328      }
329  }
publicset_option_optionset_type ( v )[ option_optionset_db ]
Parameters
requiredv
Code
347  public function set_option_optionset_type($v)
348  {
349      if ($v->id > 0)
350      {
351          $this->option_optionset_type_id = $v->id;
352      }
353  }
publicset_optionset ( v )[ option_optionset_db ]
Parameters
requiredv
Code
335  public function set_optionset($v)
336  {
337      if ($v->id > 0)
338      {
339          $this->optionset_id = $v->id;
340      }
341  }
publicset_type ( v )[ option_optionset_db ]
Parameters
requiredv
Code
313  public function set_type($v)
314  {
315      $type = new option_optionset_type(null, $v);
316      $this->option_optionset_type_id = $type->id;
317  }
public statictype_id ( type_name )[ option_optionset_db ]
Parameters
requiredtype_name
Code
302  public static function type_id($__type_name)
303  {
304      $type = new option_optionset_type(null, $__type_name);
305      return $type->id;
306  }
protectedupdate ( )[ option_optionset_db ]
Parameters
No parameters for this method
Code
153  protected function update()
154  {
155      $db = option_optionset::db();
156      $q  = " UPDATE qi_option_optionset SET ";
157      $q .= $db->param_string("option_id") . " = " . $db->value_string($this->_option_id) . ", ";
158      $q .= $db->param_string("optionset_id") . " = " . $db->value_string($this->_optionset_id) . ", ";
159      $q .= $db->param_string("option_optionset_type_id") . " = " . $db->value_string($this->_option_optionset_type_id) . ", ";
160      $q .= $db->param_string("primary") . " = " . ($this->_primary ? "'1'" : "'0'") . ", ";
161      $q .= $db->param_string("order") . " = " . $db->value_string($this->_order) . ", ";
162      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
163      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
164      $q .= " WHERE id = " . $this->_id;
165      $db->query($q);
166      return true;
167  }
 
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[ option_optionset_db ]
Code
188  public static function get_columns($__columns, $__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
189  {
190      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
191      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
192 
193      $db = option_optionset::db();
194      $data = array();
195      $q  = " SELECT $colstring ";
196      $q .= " FROM qi_option_optionset ";
197 
198      $filters = array();
199      if (!is_null($__option_id))
200      {
201          $filters[] = " option_id = '$__option_id' ";
202      }
203      if (!is_null($__optionset_id))
204      {
205          $filters[] = " optionset_id = '$__optionset_id' ";
206      }
207      if (!is_null($__option_optionset_type_id))
208      {
209          $filters[] = " option_optionset_type_id = '$__option_optionset_type_id' ";
210      }
211 
212      $q .= count($filters)>0 ? " WHERE " . implode(" AND ",$filters) . " AND deleted = 0 " : " WHERE deleted=0 ";
213 
214      if (is_string($__order))
215      {
216          $q .= "ORDER BY " . $__order;
217      }
218      else if (is_array($__order) and count($__order)>0)
219      {
220          $orderings = array();
221          foreach ($__order as $col=>$dir)
222          {
223              $orderings[] = " $col $dir ";
224          }
225          $q .= "ORDER BY " . implode(", ", $orderings);
226      }
227      else if (is_object($__order))
228      {
229          $q .= "";
230      }
231      else
232      {
233          $q .= " ORDER BY " . $db->param_string("order");
234      }
235 
236      if (!is_null($__limit))
237      {
238          $q .= " LIMIT $__offset , $__limit ";
239      }
240 
241      $db->query($q);
242 
243      if (count($colarray)>1 || $colstring=="*")
244      {
245          while ($db->next_record())
246          {
247              $data[] = $db->record;
248          }
249      }
250      else
251      {
252          while ($db->next_record())
253          {
254              $data[] = $db->f(0);
255          }
256      }
257 
258      return $data;
259  }
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[ option_optionset_db ]
Code
261  public static function get_ids($__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
262  {
263      return option_optionset::get_columns("id", $__option_id, $__optionset_id, $__option_optionset_type_id, $__order, $__limit, $__offset);
264  }
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[ option_optionset_db ]
Code
266  public static function get_objects($__option_id=null, $__optionset_id=null, $__option_optionset_type_id=null, $__order=null, $__limit=null, $__offset=0)
267  {
268      $objects = array();
269      foreach (option_optionset::get_columns("id", $__option_id, $__optionset_id, $__option_optionset_type_id, $__order, $__limit, $__offset) as $id)
270      {
271          $objects[] = new option_optionset($id);
272      }
273      return $objects;
274  }
publicoption[ option_optionset_db ]
Code
319  public function get_option()
320  {
321      return new option($this->option_id);
322  }
Code
323  public function set_option($v)
324  {
325      if ($v->id > 0)
326      {
327          $this->option_id = $v->id;
328      }
329  }
publicoption_optionset_type[ option_optionset_db ]
Code
343  public function get_option_optionset_type()
344  {
345      return new option_optionset_type($this->option_optionset_type_id);
346  }
Code
347  public function set_option_optionset_type($v)
348  {
349      if ($v->id > 0)
350      {
351          $this->option_optionset_type_id = $v->id;
352      }
353  }
publicoptionset[ option_optionset_db ]
Code
331  public function get_optionset()
332  {
333      return new optionset($this->optionset_id);
334  }
Code
335  public function set_optionset($v)
336  {
337      if ($v->id > 0)
338      {
339          $this->optionset_id = $v->id;
340      }
341  }
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[ option_optionset_db ]
Code
308  public function get_type()
309  {
310      $type = new option_optionset_type($this->_option_optionset_type_id);
311      return $type->name;
312  }
Code
313  public function set_type($v)
314  {
315      $type = new option_optionset_type(null, $v);
316      $this->option_optionset_type_id = $type->id;
317  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads