Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class query_queryset extends query_queryset_ext

Hide Inherited MembersForm Builder
Description
No description.
 
Constants
constantTABLENAME ["qi_query_queryset"][ query_queryset ]
 
Properties
protected_cdate[ query_queryset_db ]
protected_cdate_dirty[ query_queryset_db ]
protected_deleted[ query_queryset_db ]
protected_deleted_dirty[ query_queryset_db ]
protected_dirty[ obj ]
protected_id[ query_queryset_db ]
protected_id_dirty[ query_queryset_db ]
protected_mdate[ query_queryset_db ]
protected_mdate_dirty[ query_queryset_db ]
protected_order[ query_queryset_db ]
protected_order_dirty[ query_queryset_db ]
protected_primary[ query_queryset_db ]
protected_primary_dirty[ query_queryset_db ]
publicproperty_objects_array[ obj ]
protected_query_id[ query_queryset_db ]
protected_query_id_dirty[ query_queryset_db ]
protected_query_queryset_type_id[ query_queryset_db ]
protected_query_queryset_type_id_dirty[ query_queryset_db ]
protected_querygroup_id[ query_queryset_ext ]
protected_queryset_id[ query_queryset_db ]
protected_queryset_id_dirty[ query_queryset_db ]
 
Methods
publiccommit ( )[ query_queryset_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 , query_id , queryset_id , query_queryset_type_id [0] )[ query_queryset_db ]
Parameters
optionalid
optionalquery_id
optionalqueryset_id
optionalquery_queryset_type_id [0]
Code
048  public function __construct($__id=null, $__query_id=null, $__queryset_id=null, $__query_queryset_type_id=0)
049  {
050      $this->_id = 0;
051      $this->_query_id = 0;
052      $this->_queryset_id = 0;
053      $this->_query_queryset_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->_query_id_dirty = false;
062      $this->_queryset_id_dirty = false;
063      $this->_query_queryset_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($__query_id) && is_null($__queryset_id) && is_null($__query_queryset_type_id) && is_null($__id))
071      {
072          return;
073      }
074 
075      $db = query_queryset::db();
076      $q  = " SELECT * ";
077      $q .= " FROM qi_query_queryset ";       
078      if (!is_null($__id))
079      {
080          $q .= " WHERE id = '$__id' ";
081      }
082      else if (!is_null($__query_id) && !is_null($__queryset_id) && !is_null($__query_queryset_type_id))
083      {
084          $this->query_id = $__query_id;
085          $this->queryset_id = $__queryset_id;
086          $this->query_queryset_type_id = $__query_queryset_type_id;
087          $q .= " WHERE query_id = '$__query_id' AND queryset_id = '$__queryset_id' AND query_queryset_type_id = '$__query_queryset_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->_query_id = $db->f("query_id");
095          $this->_queryset_id = $db->f("queryset_id");
096          $this->_query_queryset_type_id = $db->f("query_queryset_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 ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
555  protected static function db()
556  {
557      return new db();
558  }
publicdelete ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
169  public function delete()
170  {
171      $db = query_queryset::db();
172      $q  = " UPDATE qi_query_queryset SET ";
173      $q .= " deleted = 1 ";
174      $q .= " WHERE id = '" . $this->_id . "'";
175      $db->query($q);
176      return true;
177  }
public staticdelete_all ( query_id , queryset_id , query_queryset_type_id )[ query_queryset_db ]
Parameters
optionalquery_id
optionalqueryset_id
optionalquery_queryset_type_id
Code
276  public static function delete_all($__query_id=null, $__queryset_id=null, $__query_queryset_type_id=null)
277  {
278      $db = query_queryset::db();
279      $q  = " UPDATE qi_query_queryset SET ";
280      $q .= " deleted = 1 ";
281 
282      $filters = array();
283      if (!is_null($__query_id))
284      {
285          $filters[] = " query_id = '$__query_id' ";
286      }
287      if (!is_null($__queryset_id))
288      {
289          $filters[] = " queryset_id = '$__queryset_id' ";
290      }
291      if (!is_null($__query_queryset_type_id))
292      {
293          $filters[] = " query_queryset_type_id = '$__query_queryset_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 , query_id , queryset_id , query_queryset_type_id , order , limit , offset [0] )[ query_queryset_db ]
Parameters
requiredcolumns
optionalquery_id
optionalqueryset_id
optionalquery_queryset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
188  public static function get_columns($__columns, $__query_id=null, $__queryset_id=null, $__query_queryset_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 = query_queryset::db();
194      $data = array();
195      $q  = " SELECT $colstring ";
196      $q .= " FROM qi_query_queryset ";
197 
198      $filters = array();
199      if (!is_null($__query_id))
200      {
201          $filters[] = " query_id = '$__query_id' ";
202      }
203      if (!is_null($__queryset_id))
204      {
205          $filters[] = " queryset_id = '$__queryset_id' ";
206      }
207      if (!is_null($__query_queryset_type_id))
208      {
209          $filters[] = " query_queryset_type_id = '$__query_queryset_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 ( query_id , queryset_id , query_queryset_type_id , order , limit , offset [0] )[ query_queryset_db ]
Parameters
optionalquery_id
optionalqueryset_id
optionalquery_queryset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
261  public static function get_ids($__query_id=null, $__queryset_id=null, $__query_queryset_type_id=null, $__order=null, $__limit=null, $__offset=0)
262  {
263      return query_queryset::get_columns("id", $__query_id, $__queryset_id, $__query_queryset_type_id, $__order, $__limit, $__offset);
264  }
publicget_input ( type ["default"] )[ query_queryset_db ]
Parameters
optionaltype ["default"]
Code
355  public function get_input($__type="default")
356  {
357      $object = is_null(keyval($this->property_objects_array,"{$__type}_input")) ? new input($this->get_input_id($__type)) : $this->property_objects_array["{$__type}_input"];
358      $this->property_objects_array["{$__type}_input"] = $object;
359      return $object;
360  }
publicget_input_id ( type ["default"] )[ query_queryset_db ]
Parameters
optionaltype ["default"]
Code
361  public function get_input_id($__type="default")
362  {
363      $ids = $this->get_input_ids($__type, true);
364      return (count($ids)==1 ? $ids[0] : null);
365  }
publicget_input_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ query_queryset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
366  public function get_input_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
367  {
368      $input_ids = array();
369      $db = query_queryset::db();
370      $q  = " SELECT qi_input.id FROM qi_input_queryqueryset INNER JOIN qi_input ON qi_input_queryqueryset.input_id=qi_input.id AND qi_input_queryqueryset.deleted=0 AND qi_input.deleted=0 AND qi_input_queryqueryset.query_queryset_query_id,queryset_id,query_queryset_type_id='$this->id' " . (is_null($__type) ? "" : " AND qi_input_queryqueryset.input_queryqueryset_type_id='" . input_queryqueryset::type_id($__type) . "'") . ($__get_primary ? " AND qi_input_queryqueryset.primary=1 " : "");
371      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
372      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
373      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
374      $db->query($q);
375      while ($db->next_record())
376      {
377          $input_ids[] = $db->f("id");
378      }
379      return $input_ids;
380  }
publicget_input_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ query_queryset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
381  public function get_input_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
382  {
383      $ids = $this->get_input_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
384      $objects = array();
385      foreach ($ids as $index=>$id)
386      {
387          $objects[$index] = new input($id);
388      }
389      return $objects;
390  }
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 ( query_id , queryset_id , query_queryset_type_id , order , limit , offset [0] )[ query_queryset_db ]
Parameters
optionalquery_id
optionalqueryset_id
optionalquery_queryset_type_id
optionalorder
optionallimit
optionaloffset [0]
Code
266  public static function get_objects($__query_id=null, $__queryset_id=null, $__query_queryset_type_id=null, $__order=null, $__limit=null, $__offset=0)
267  {
268      $objects = array();
269      foreach (query_queryset::get_columns("id", $__query_id, $__queryset_id, $__query_queryset_type_id, $__order, $__limit, $__offset) as $id)
270      {
271          $objects[] = new query_queryset($id);
272      }
273      return $objects;
274  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_query ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
319  public function get_query()
320  {
321      return new query($this->query_id);
322  }
publicget_query_queryset_type ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
343  public function get_query_queryset_type()
344  {
345      return new query_queryset_type($this->query_queryset_type_id);
346  }
publicget_querygroup_id ( )[ query_queryset_ext ]
Parameters
No parameters for this method
Code
010  public function get_querygroup_id()
011  {
012      $this->_querygroup_id = 0;
013      foreach (queryqueryset_querygroupqueryset::get_ids($this->id,null) as $queryqueryset_querygroupqueryset_id)
014          {
015              $queryqueryset_querygroupqueryset = new queryqueryset_querygroupqueryset($queryqueryset_querygroupqueryset_id);
016              if ($queryqueryset_querygroupqueryset->deleted==0) {
017                  $querygroupqueryset = new querygroup_queryset($queryqueryset_querygroupqueryset->querygroup_queryset_id);
018                  if($querygroupqueryset->deleted==0)
019                  {
020                  $this->_querygroup_id = $querygroupqueryset->querygroup_id;
021                  }
022              }           
023          }
024          return $this->_querygroup_id;
025  }
publicget_querygroup_queryset ( type ["default"] )[ query_queryset_db ]
Parameters
optionaltype ["default"]
Code
454  public function get_querygroup_queryset($__type="default")
455  {
456      $object = is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")) ? new querygroup_queryset($this->get_querygroup_queryset_id($__type)) : $this->property_objects_array["{$__type}_querygroup_queryset"];
457      $this->property_objects_array["{$__type}_querygroup_queryset"] = $object;
458      return $object;
459  }
publicget_querygroup_queryset_id ( type ["default"] )[ query_queryset_db ]
Parameters
optionaltype ["default"]
Code
460  public function get_querygroup_queryset_id($__type="default")
461  {
462      $ids = $this->get_querygroup_queryset_ids($__type, true);
463      return (count($ids)==1 ? $ids[0] : null);
464  }
publicget_querygroup_queryset_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ query_queryset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
465  public function get_querygroup_queryset_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
466  {
467      $querygroup_queryset_ids = array();
468      $db = query_queryset::db();
469      $q  = " SELECT qi_querygroup_queryset.id FROM qi_queryqueryset_querygroupqueryset INNER JOIN qi_querygroup_queryset ON qi_queryqueryset_querygroupqueryset.querygroup_queryset_id=qi_querygroup_queryset.id AND qi_queryqueryset_querygroupqueryset.deleted=0 AND qi_querygroup_queryset.deleted=0 AND qi_queryqueryset_querygroupqueryset.query_queryset_query_id,queryset_id,query_queryset_type_id='$this->id' " . (is_null($__type) ? "" : " AND qi_queryqueryset_querygroupqueryset.queryqueryset_querygroupqueryset_type_id='" . queryqueryset_querygroupqueryset::type_id($__type) . "'") . ($__get_primary ? " AND qi_queryqueryset_querygroupqueryset.primary=1 " : "");
470      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
471      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
472      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
473      $db->query($q);
474      while ($db->next_record())
475      {
476          $querygroup_queryset_ids[] = $db->f("id");
477      }
478      return $querygroup_queryset_ids;
479  }
publicget_querygroup_queryset_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ query_queryset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
480  public function get_querygroup_queryset_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
481  {
482      $ids = $this->get_querygroup_queryset_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
483      $objects = array();
484      foreach ($ids as $index=>$id)
485      {
486          $objects[$index] = new querygroup_queryset($id);
487      }
488      return $objects;
489  }
publicget_queryset ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
331  public function get_queryset()
332  {
333      return new queryset($this->queryset_id);
334  }
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 ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
308  public function get_type()
309  {
310      $type = new query_queryset_type($this->_query_queryset_type_id);
311      return $type->name;
312  }
protectedinsert ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
126  protected function insert()
127  {
128      $db = query_queryset::db();
129      $q  = " INSERT INTO qi_query_queryset ( ";
130      $q .= $db->param_string("query_id") . ", ";
131      $q .= $db->param_string("queryset_id") . ", ";
132      $q .= $db->param_string("query_queryset_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->_query_id) . ", ";
140      $q .= $db->value_string($this->_queryset_id) . ", ";
141      $q .= $db->value_string($this->_query_queryset_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 ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
105  public function map()
106  {
107      $this->_primary = array_key_exists("query_queryset:primary",$_REQUEST) ? reqval("query_queryset:primary") : $this->_primary;
108      $this->_order = array_key_exists("query_queryset:order",$_REQUEST) ? reqval("query_queryset:order") : $this->_order;
109      $this->_mdate = array_key_exists("query_queryset:mdate",$_REQUEST) ? reqval("query_queryset:mdate") : $this->_mdate;
110      $this->_cdate = array_key_exists("query_queryset:cdate",$_REQUEST) ? reqval("query_queryset:cdate") : $this->_cdate;
111      $this->_deleted = array_key_exists("query_queryset:deleted",$_REQUEST) ? reqval("query_queryset:deleted") : $this->_deleted;
112  }
publicpurge ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
179  public function purge()
180  {
181      $db = query_queryset::db();
182      $q  = " DELETE FROM qi_query_queryset ";
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_input ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
392  public function set_input($__v, $__type="default")
393  {
394      $object = is_null(keyval($this->property_objects_array,"{$__type}_input")) ? new input($this->get_input_id($__type)) : $this->property_objects_array["{$__type}_input"];
395      if (is_null($__v))
396      {
397          $rel = new input_queryqueryset(null,$object->id,$this->id,input_queryqueryset::type_id($__type));
398          $rel->delete();
399          if (!is_null(keyval($this->property_objects_array,"{$__type}_input")))
400          {
401              $this->property_objects_array["{$__type}_input"] = null;
402          }
403      }
404      else
405      {
406          $id = $object->id;
407          $object = $__v;
408          $object->id = $__v->id>0 ? $__v->id : $id;
409          $object->commit();
410          $this->set_input_ids(array($object->id),$__type);
411      }
412  }
publicset_input_id ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
413  public function set_input_id($__v, $__type="default")
414  {
415      $this->set_input_ids(array($__v),$__type);
416  }
publicset_input_ids ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
417  public function set_input_ids($__v, $__type="default")
418  {
419      if ($this->id == 0)
420      {
421          $this->commit();
422      }
423      $type_id = input_queryqueryset::type_id($__type);
424      input_queryqueryset::delete_all(null,$this->id,$type_id);
425      if (is_array($__v))
426      {
427          foreach ($__v as $index=>$id)
428          {
429              $object = new input_queryqueryset(null,$id,$this->id,$type_id);
430              $object->deleted = false;
431              $object->input_queryqueryset_type_id = $type_id;
432              $object->commit();
433              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_input")))
434              {
435                  $this->property_objects_array["{$__type}_input"] = new input($object->input_id);
436              }
437          }
438          $this->_dirty = true;
439      }
440  }
publicset_input_list ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
441  public function set_input_list($__v, $__type="default")
442  {
443      if (is_array($__v))
444      {
445          $ids = array();
446          foreach ($__v as $index=>$object)
447          {
448              $ids[] = $object->id;
449          }
450          $this->set_input_ids($ids,$__type);
451      }
452  }
publicset_query ( v )[ query_queryset_db ]
Parameters
requiredv
Code
323  public function set_query($v)
324  {
325      if ($v->id > 0)
326      {
327          $this->query_id = $v->id;
328      }
329  }
publicset_query_queryset_type ( v )[ query_queryset_db ]
Parameters
requiredv
Code
347  public function set_query_queryset_type($v)
348  {
349      if ($v->id > 0)
350      {
351          $this->query_queryset_type_id = $v->id;
352      }
353  }
publicset_querygroup_queryset ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
491  public function set_querygroup_queryset($__v, $__type="default")
492  {
493      $object = is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")) ? new querygroup_queryset($this->get_querygroup_queryset_id($__type)) : $this->property_objects_array["{$__type}_querygroup_queryset"];
494      if (is_null($__v))
495      {
496          $rel = new queryqueryset_querygroupqueryset(null,$this->id,$object->id,queryqueryset_querygroupqueryset::type_id($__type));
497          $rel->delete();
498          if (!is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")))
499          {
500              $this->property_objects_array["{$__type}_querygroup_queryset"] = null;
501          }
502      }
503      else
504      {
505          $id = $object->id;
506          $object = $__v;
507          $object->id = $__v->id>0 ? $__v->id : $id;
508          $object->commit();
509          $this->set_querygroup_queryset_ids(array($object->id),$__type);
510      }
511  }
publicset_querygroup_queryset_id ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
512  public function set_querygroup_queryset_id($__v, $__type="default")
513  {
514      $this->set_querygroup_queryset_ids(array($__v),$__type);
515  }
publicset_querygroup_queryset_ids ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
516  public function set_querygroup_queryset_ids($__v, $__type="default")
517  {
518      if ($this->id == 0)
519      {
520          $this->commit();
521      }
522      $type_id = queryqueryset_querygroupqueryset::type_id($__type);
523      queryqueryset_querygroupqueryset::delete_all($this->id,null,$type_id);
524      $order = 0;
525      if (is_array($__v))
526      {
527          foreach ($__v as $index=>$id)
528          {
529              $object = new queryqueryset_querygroupqueryset(null,$this->id,$id,$type_id);
530              $object->deleted = false;
531              $object->order = (++$order);
532              $object->queryqueryset_querygroupqueryset_type_id = $type_id;
533              $object->commit();
534              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")))
535              {
536                  $this->property_objects_array["{$__type}_querygroup_queryset"] = new querygroup_queryset($object->querygroup_queryset_id);
537              }
538          }
539          $this->_dirty = true;
540      }
541  }
publicset_querygroup_queryset_list ( v , type ["default"] )[ query_queryset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
542  public function set_querygroup_queryset_list($__v, $__type="default")
543  {
544      if (is_array($__v))
545      {
546          $ids = array();
547          foreach ($__v as $index=>$object)
548          {
549              $ids[] = $object->id;
550          }
551          $this->set_querygroup_queryset_ids($ids,$__type);
552      }
553  }
publicset_queryset ( v )[ query_queryset_db ]
Parameters
requiredv
Code
335  public function set_queryset($v)
336  {
337      if ($v->id > 0)
338      {
339          $this->queryset_id = $v->id;
340      }
341  }
publicset_type ( v )[ query_queryset_db ]
Parameters
requiredv
Code
313  public function set_type($v)
314  {
315      $type = new query_queryset_type(null, $v);
316      $this->query_queryset_type_id = $type->id;
317  }
public statictype_id ( type_name )[ query_queryset_db ]
Parameters
requiredtype_name
Code
302  public static function type_id($__type_name)
303  {
304      $type = new query_queryset_type(null, $__type_name);
305      return $type->id;
306  }
protectedupdate ( )[ query_queryset_db ]
Parameters
No parameters for this method
Code
153  protected function update()
154  {
155      $db = query_queryset::db();
156      $q  = " UPDATE qi_query_queryset SET ";
157      $q .= $db->param_string("query_id") . " = " . $db->value_string($this->_query_id) . ", ";
158      $q .= $db->param_string("queryset_id") . " = " . $db->value_string($this->_queryset_id) . ", ";
159      $q .= $db->param_string("query_queryset_type_id") . " = " . $db->value_string($this->_query_queryset_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[ query_queryset_db ]
Code
188  public static function get_columns($__columns, $__query_id=null, $__queryset_id=null, $__query_queryset_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 = query_queryset::db();
194      $data = array();
195      $q  = " SELECT $colstring ";
196      $q .= " FROM qi_query_queryset ";
197 
198      $filters = array();
199      if (!is_null($__query_id))
200      {
201          $filters[] = " query_id = '$__query_id' ";
202      }
203      if (!is_null($__queryset_id))
204      {
205          $filters[] = " queryset_id = '$__queryset_id' ";
206      }
207      if (!is_null($__query_queryset_type_id))
208      {
209          $filters[] = " query_queryset_type_id = '$__query_queryset_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[ query_queryset_db ]
Code
261  public static function get_ids($__query_id=null, $__queryset_id=null, $__query_queryset_type_id=null, $__order=null, $__limit=null, $__offset=0)
262  {
263      return query_queryset::get_columns("id", $__query_id, $__queryset_id, $__query_queryset_type_id, $__order, $__limit, $__offset);
264  }
publicinput[ query_queryset_db ]
Code
355  public function get_input($__type="default")
356  {
357      $object = is_null(keyval($this->property_objects_array,"{$__type}_input")) ? new input($this->get_input_id($__type)) : $this->property_objects_array["{$__type}_input"];
358      $this->property_objects_array["{$__type}_input"] = $object;
359      return $object;
360  }
Code
392  public function set_input($__v, $__type="default")
393  {
394      $object = is_null(keyval($this->property_objects_array,"{$__type}_input")) ? new input($this->get_input_id($__type)) : $this->property_objects_array["{$__type}_input"];
395      if (is_null($__v))
396      {
397          $rel = new input_queryqueryset(null,$object->id,$this->id,input_queryqueryset::type_id($__type));
398          $rel->delete();
399          if (!is_null(keyval($this->property_objects_array,"{$__type}_input")))
400          {
401              $this->property_objects_array["{$__type}_input"] = null;
402          }
403      }
404      else
405      {
406          $id = $object->id;
407          $object = $__v;
408          $object->id = $__v->id>0 ? $__v->id : $id;
409          $object->commit();
410          $this->set_input_ids(array($object->id),$__type);
411      }
412  }
publicinput_id[ query_queryset_db ]
Code
361  public function get_input_id($__type="default")
362  {
363      $ids = $this->get_input_ids($__type, true);
364      return (count($ids)==1 ? $ids[0] : null);
365  }
Code
413  public function set_input_id($__v, $__type="default")
414  {
415      $this->set_input_ids(array($__v),$__type);
416  }
publicinput_ids[ query_queryset_db ]
Code
366  public function get_input_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
367  {
368      $input_ids = array();
369      $db = query_queryset::db();
370      $q  = " SELECT qi_input.id FROM qi_input_queryqueryset INNER JOIN qi_input ON qi_input_queryqueryset.input_id=qi_input.id AND qi_input_queryqueryset.deleted=0 AND qi_input.deleted=0 AND qi_input_queryqueryset.query_queryset_query_id,queryset_id,query_queryset_type_id='$this->id' " . (is_null($__type) ? "" : " AND qi_input_queryqueryset.input_queryqueryset_type_id='" . input_queryqueryset::type_id($__type) . "'") . ($__get_primary ? " AND qi_input_queryqueryset.primary=1 " : "");
371      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
372      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
373      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
374      $db->query($q);
375      while ($db->next_record())
376      {
377          $input_ids[] = $db->f("id");
378      }
379      return $input_ids;
380  }
Code
417  public function set_input_ids($__v, $__type="default")
418  {
419      if ($this->id == 0)
420      {
421          $this->commit();
422      }
423      $type_id = input_queryqueryset::type_id($__type);
424      input_queryqueryset::delete_all(null,$this->id,$type_id);
425      if (is_array($__v))
426      {
427          foreach ($__v as $index=>$id)
428          {
429              $object = new input_queryqueryset(null,$id,$this->id,$type_id);
430              $object->deleted = false;
431              $object->input_queryqueryset_type_id = $type_id;
432              $object->commit();
433              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_input")))
434              {
435                  $this->property_objects_array["{$__type}_input"] = new input($object->input_id);
436              }
437          }
438          $this->_dirty = true;
439      }
440  }
publicinput_list[ query_queryset_db ]
Code
381  public function get_input_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
382  {
383      $ids = $this->get_input_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
384      $objects = array();
385      foreach ($ids as $index=>$id)
386      {
387          $objects[$index] = new input($id);
388      }
389      return $objects;
390  }
Code
441  public function set_input_list($__v, $__type="default")
442  {
443      if (is_array($__v))
444      {
445          $ids = array();
446          foreach ($__v as $index=>$object)
447          {
448              $ids[] = $object->id;
449          }
450          $this->set_input_ids($ids,$__type);
451      }
452  }
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[ query_queryset_db ]
Code
266  public static function get_objects($__query_id=null, $__queryset_id=null, $__query_queryset_type_id=null, $__order=null, $__limit=null, $__offset=0)
267  {
268      $objects = array();
269      foreach (query_queryset::get_columns("id", $__query_id, $__queryset_id, $__query_queryset_type_id, $__order, $__limit, $__offset) as $id)
270      {
271          $objects[] = new query_queryset($id);
272      }
273      return $objects;
274  }
publicproperties[ obj ]
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicquery[ query_queryset_db ]
Code
319  public function get_query()
320  {
321      return new query($this->query_id);
322  }
Code
323  public function set_query($v)
324  {
325      if ($v->id > 0)
326      {
327          $this->query_id = $v->id;
328      }
329  }
publicquery_queryset_type[ query_queryset_db ]
Code
343  public function get_query_queryset_type()
344  {
345      return new query_queryset_type($this->query_queryset_type_id);
346  }
Code
347  public function set_query_queryset_type($v)
348  {
349      if ($v->id > 0)
350      {
351          $this->query_queryset_type_id = $v->id;
352      }
353  }
publicquerygroup_id[ query_queryset_ext ]
Code
010  public function get_querygroup_id()
011  {
012      $this->_querygroup_id = 0;
013      foreach (queryqueryset_querygroupqueryset::get_ids($this->id,null) as $queryqueryset_querygroupqueryset_id)
014          {
015              $queryqueryset_querygroupqueryset = new queryqueryset_querygroupqueryset($queryqueryset_querygroupqueryset_id);
016              if ($queryqueryset_querygroupqueryset->deleted==0) {
017                  $querygroupqueryset = new querygroup_queryset($queryqueryset_querygroupqueryset->querygroup_queryset_id);
018                  if($querygroupqueryset->deleted==0)
019                  {
020                  $this->_querygroup_id = $querygroupqueryset->querygroup_id;
021                  }
022              }           
023          }
024          return $this->_querygroup_id;
025  }
publicquerygroup_queryset[ query_queryset_db ]
Code
454  public function get_querygroup_queryset($__type="default")
455  {
456      $object = is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")) ? new querygroup_queryset($this->get_querygroup_queryset_id($__type)) : $this->property_objects_array["{$__type}_querygroup_queryset"];
457      $this->property_objects_array["{$__type}_querygroup_queryset"] = $object;
458      return $object;
459  }
Code
491  public function set_querygroup_queryset($__v, $__type="default")
492  {
493      $object = is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")) ? new querygroup_queryset($this->get_querygroup_queryset_id($__type)) : $this->property_objects_array["{$__type}_querygroup_queryset"];
494      if (is_null($__v))
495      {
496          $rel = new queryqueryset_querygroupqueryset(null,$this->id,$object->id,queryqueryset_querygroupqueryset::type_id($__type));
497          $rel->delete();
498          if (!is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")))
499          {
500              $this->property_objects_array["{$__type}_querygroup_queryset"] = null;
501          }
502      }
503      else
504      {
505          $id = $object->id;
506          $object = $__v;
507          $object->id = $__v->id>0 ? $__v->id : $id;
508          $object->commit();
509          $this->set_querygroup_queryset_ids(array($object->id),$__type);
510      }
511  }
publicquerygroup_queryset_id[ query_queryset_db ]
Code
460  public function get_querygroup_queryset_id($__type="default")
461  {
462      $ids = $this->get_querygroup_queryset_ids($__type, true);
463      return (count($ids)==1 ? $ids[0] : null);
464  }
Code
512  public function set_querygroup_queryset_id($__v, $__type="default")
513  {
514      $this->set_querygroup_queryset_ids(array($__v),$__type);
515  }
publicquerygroup_queryset_ids[ query_queryset_db ]
Code
465  public function get_querygroup_queryset_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
466  {
467      $querygroup_queryset_ids = array();
468      $db = query_queryset::db();
469      $q  = " SELECT qi_querygroup_queryset.id FROM qi_queryqueryset_querygroupqueryset INNER JOIN qi_querygroup_queryset ON qi_queryqueryset_querygroupqueryset.querygroup_queryset_id=qi_querygroup_queryset.id AND qi_queryqueryset_querygroupqueryset.deleted=0 AND qi_querygroup_queryset.deleted=0 AND qi_queryqueryset_querygroupqueryset.query_queryset_query_id,queryset_id,query_queryset_type_id='$this->id' " . (is_null($__type) ? "" : " AND qi_queryqueryset_querygroupqueryset.queryqueryset_querygroupqueryset_type_id='" . queryqueryset_querygroupqueryset::type_id($__type) . "'") . ($__get_primary ? " AND qi_queryqueryset_querygroupqueryset.primary=1 " : "");
470      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
471      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
472      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
473      $db->query($q);
474      while ($db->next_record())
475      {
476          $querygroup_queryset_ids[] = $db->f("id");
477      }
478      return $querygroup_queryset_ids;
479  }
Code
516  public function set_querygroup_queryset_ids($__v, $__type="default")
517  {
518      if ($this->id == 0)
519      {
520          $this->commit();
521      }
522      $type_id = queryqueryset_querygroupqueryset::type_id($__type);
523      queryqueryset_querygroupqueryset::delete_all($this->id,null,$type_id);
524      $order = 0;
525      if (is_array($__v))
526      {
527          foreach ($__v as $index=>$id)
528          {
529              $object = new queryqueryset_querygroupqueryset(null,$this->id,$id,$type_id);
530              $object->deleted = false;
531              $object->order = (++$order);
532              $object->queryqueryset_querygroupqueryset_type_id = $type_id;
533              $object->commit();
534              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_querygroup_queryset")))
535              {
536                  $this->property_objects_array["{$__type}_querygroup_queryset"] = new querygroup_queryset($object->querygroup_queryset_id);
537              }
538          }
539          $this->_dirty = true;
540      }
541  }
publicquerygroup_queryset_list[ query_queryset_db ]
Code
480  public function get_querygroup_queryset_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
481  {
482      $ids = $this->get_querygroup_queryset_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
483      $objects = array();
484      foreach ($ids as $index=>$id)
485      {
486          $objects[$index] = new querygroup_queryset($id);
487      }
488      return $objects;
489  }
Code
542  public function set_querygroup_queryset_list($__v, $__type="default")
543  {
544      if (is_array($__v))
545      {
546          $ids = array();
547          foreach ($__v as $index=>$object)
548          {
549              $ids[] = $object->id;
550          }
551          $this->set_querygroup_queryset_ids($ids,$__type);
552      }
553  }
publicqueryset[ query_queryset_db ]
Code
331  public function get_queryset()
332  {
333      return new queryset($this->queryset_id);
334  }
Code
335  public function set_queryset($v)
336  {
337      if ($v->id > 0)
338      {
339          $this->queryset_id = $v->id;
340      }
341  }
publicstring[ obj ]
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publictype[ query_queryset_db ]
Code
308  public function get_type()
309  {
310      $type = new query_queryset_type($this->_query_queryset_type_id);
311      return $type->name;
312  }
Code
313  public function set_type($v)
314  {
315      $type = new query_queryset_type(null, $v);
316      $this->query_queryset_type_id = $type->id;
317  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads