Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class hitreward extends hitreward_ext

Hide Inherited MembersAmazon Web Services
Description
No description.
 
Constants
constantTABLENAME ["aws_hitreward"][ hitreward ]
 
Properties
protected_amount[ hitreward_db ]
protected_amount_dirty[ hitreward_db ]
protected_cdate[ hitreward_db ]
protected_cdate_dirty[ hitreward_db ]
protected_currencycode_id[ hitreward_db ]
protected_currencycode_id_dirty[ hitreward_db ]
protected_deleted[ hitreward_db ]
protected_deleted_dirty[ hitreward_db ]
protected_dirty[ obj ]
protected_formattedprice[ hitreward_db ]
protected_formattedprice_dirty[ hitreward_db ]
protected_id[ hitreward_db ]
protected_id_dirty[ hitreward_db ]
protected_mdate[ hitreward_db ]
protected_mdate_dirty[ hitreward_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
098  public function commit()
099  {
100      if ($this->_id > 0)
101      {
102          $this->update();
103      }
104      else
105      {
106          $this->insert();
107      }
108 
109      foreach ($this->property_objects_array as $property=>$object)
110      {
111          $this->{$property} = $object;
112      }
113 
114      return true;
115  }
public__construct ( id )[ hitreward_db ]
Parameters
optionalid
Code
044  public function __construct($__id=null)
045  {
046      $this->_id = 0;
047      $this->_amount = 0;
048      $this->_currencycode_id = 0;
049      $this->_formattedprice = "";
050      $this->_mdate = null;
051      $this->_cdate = null;
052      $this->_deleted = false;
053 
054      $this->_id_dirty = false;
055      $this->_amount_dirty = false;
056      $this->_currencycode_id_dirty = false;
057      $this->_formattedprice_dirty = false;
058      $this->_mdate_dirty = false;
059      $this->_cdate_dirty = false;
060      $this->_deleted_dirty = false;
061 
062      if (is_null($__id))
063      {
064          return;
065      }
066 
067      $db = hitreward::db();
068      $q  = " SELECT aws_hitreward.id,aws_hitreward.amount,aws_hitreward.currencycode_id,aws_hitreward.formattedprice,aws_hitreward.mdate,aws_hitreward.cdate,aws_hitreward.deleted ";
069      $q .= " FROM aws_hitreward ";       
070      if (!is_null($__id))
071      {
072          $q .= " WHERE id = '$__id' ";
073      }
074 
075      $db->query($q);
076      if ($db->next_record() && $db->num_rows() == 1)
077      {
078          $this->_id = $db->f("id");
079          $this->_amount = $db->f("amount");
080          $this->_currencycode_id = $db->f("currencycode_id");
081          $this->_formattedprice = $db->f("formattedprice");
082          $this->_mdate = $db->f("mdate");
083          $this->_cdate = $db->f("cdate");
084          $this->_deleted = $db->f("deleted");
085      }
086  }
protected staticdb ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
534  protected static function db()
535  {
536      return new db();
537  }
publicdelete ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
154  public function delete()
155  {
156      $db = hitreward::db();
157      $q  = " UPDATE aws_hitreward SET ";
158      $q .= " deleted = 1 ";
159      $q .= " WHERE id = " . $this->_id;
160      $db->query($q);
161      $this->deleted = true;
162      return true;
163  }
public staticdelete_all ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
261  public static function delete_all()
262  {
263      $db = hitreward::db();
264      $q  = " UPDATE aws_hitreward SET ";
265      $q .= " deleted = 1 ";
266     
267      $db->query($q);
268      return true;
269  }
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] )[ hitreward_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
185  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
186  {
187      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
188      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
189      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
190 
191      $db = hitreward::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM aws_hitreward ";
195      $q .= " WHERE aws_hitreward.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197      $q .= array_key_exists("currencycode_id",$lookups) ? " AND aws_hitreward.currencycode_id='" . $lookups["currencycode_id"] . "' " : "";
198 
199      if (is_string($__order))
200      {
201          $q .= "ORDER BY " . $__order;
202      }
203      else if (is_array($__order) and count($__order)>0)
204      {
205          $orderings = array();
206          foreach ($__order as $col=>$dir)
207          {
208              $orderings[] = " $col $dir ";
209          }
210          $q .= "ORDER BY " . implode(", ", $orderings);
211      }
212      else if (is_object($__order))
213      {
214          $q .= "";
215      }
216      else
217      {
218          // THERE IS NO `order` COLUMN ON THIS OBJECT
219      }
220 
221      if (!is_null($__limit))
222      {
223          $q .= " LIMIT $__offset , $__limit ";
224      }
225 
226      $db->query($q);
227 
228      if (count($colarray)>1 || $colstring=="*")
229      {
230          while ($db->next_record())
231          {
232              $data[] = $db->record;
233          }
234      }
235      else
236      {
237          while ($db->next_record())
238          {
239              $data[] = $db->f(0);
240          }
241      }
242 
243      return $data;
244  }
publicget_currencycode ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
324  public function get_currencycode()
325  {
326      return new currencycode($this->currencycode_id);
327  }
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  }
publicget_hit ( type ["default"] )[ hitreward_db ]
Parameters
optionaltype ["default"]
Code
435  public function get_hit($__type="default")
436  {
437      $object = is_null(keyval($this->property_objects_array,"{$__type}_hit")) ? new hit($this->get_hit_id($__type)) : $this->property_objects_array["{$__type}_hit"];
438      $this->property_objects_array["{$__type}_hit"] = $object;
439      return $object;
440  }
publicget_hit_id ( type ["default"] )[ hitreward_db ]
Parameters
optionaltype ["default"]
Code
441  public function get_hit_id($__type="default")
442  {
443      $ids = $this->get_hit_ids($__type, true);
444      return (count($ids)==1 ? $ids[0] : null);
445  }
publicget_hit_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ hitreward_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
446  public function get_hit_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
447  {
448      $hit_ids = array();
449      $db = hitreward::db();
450      $q  = " SELECT aws_hit.id FROM aws_hit_hitreward INNER JOIN aws_hit ON aws_hit_hitreward.hit_id=aws_hit.id AND aws_hit_hitreward.deleted=0 AND aws_hit.deleted=0 AND aws_hit_hitreward.hitreward_id='$this->id' " . (is_null($__type) ? "" : " AND aws_hit_hitreward.hit_hitreward_type_id='" . hit_hitreward::type_id($__type) . "'") . ($__get_primary ? " AND aws_hit_hitreward.primary=1 " : "");
451      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
452      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
453      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
454      $db->query($q);
455      while ($db->next_record())
456      {
457          $hit_ids[] = $db->f("id");
458      }
459      return $hit_ids;
460  }
publicget_hit_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ hitreward_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
461  public function get_hit_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
462  {
463      $ids = $this->get_hit_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
464      $objects = array();
465      foreach ($ids as $index=>$id)
466      {
467          $objects[$index] = new hit($id);
468      }
469      return $objects;
470  }
publicget_hittemplate ( type ["default"] )[ hitreward_db ]
Parameters
optionaltype ["default"]
Code
336  public function get_hittemplate($__type="default")
337  {
338      $object = is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")) ? new hittemplate($this->get_hittemplate_id($__type)) : $this->property_objects_array["{$__type}_hittemplate"];
339      $this->property_objects_array["{$__type}_hittemplate"] = $object;
340      return $object;
341  }
publicget_hittemplate_id ( type ["default"] )[ hitreward_db ]
Parameters
optionaltype ["default"]
Code
342  public function get_hittemplate_id($__type="default")
343  {
344      $ids = $this->get_hittemplate_ids($__type, true);
345      return (count($ids)==1 ? $ids[0] : null);
346  }
publicget_hittemplate_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ hitreward_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
347  public function get_hittemplate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
348  {
349      $hittemplate_ids = array();
350      $db = hitreward::db();
351      $q  = " SELECT aws_hittemplate.id FROM aws_hitreward_hittemplate INNER JOIN aws_hittemplate ON aws_hitreward_hittemplate.hittemplate_id=aws_hittemplate.id AND aws_hitreward_hittemplate.deleted=0 AND aws_hittemplate.deleted=0 AND aws_hitreward_hittemplate.hitreward_id='$this->id' " . (is_null($__type) ? "" : " AND aws_hitreward_hittemplate.hitreward_hittemplate_type_id='" . hitreward_hittemplate::type_id($__type) . "'") . ($__get_primary ? " AND aws_hitreward_hittemplate.primary=1 " : "");
352      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
353      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
354      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
355      $db->query($q);
356      while ($db->next_record())
357      {
358          $hittemplate_ids[] = $db->f("id");
359      }
360      return $hittemplate_ids;
361  }
publicget_hittemplate_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ hitreward_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
362  public function get_hittemplate_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
363  {
364      $ids = $this->get_hittemplate_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
365      $objects = array();
366      foreach ($ids as $index=>$id)
367      {
368          $objects[$index] = new hittemplate($id);
369      }
370      return $objects;
371  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ hitreward_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
246  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
247  {
248      return hitreward::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
249  }
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] )[ hitreward_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
251  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
252  {
253      $objects = array();
254      foreach (hitreward::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
255      {
256          $objects[] = new hitreward($id);
257      }
258      return $objects;
259  }
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 ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
117  protected function insert()
118  {
119      $db = hitreward::db();
120      $q  = " INSERT INTO aws_hitreward ( ";
121      $q .= $db->param_string("amount") . ", ";
122      $q .= $db->param_string("currencycode_id") . ", ";
123      $q .= $db->param_string("formattedprice") . ", ";
124      $q .= $db->param_string("mdate") . ", ";
125      $q .= $db->param_string("cdate") . ", ";
126      $q .= $db->param_string("deleted");
127      $q .= " ) VALUES ( ";
128      $q .= $db->value_string($this->_amount) . ", ";
129      $q .= $db->value_string($this->_currencycode_id) . ", ";
130      $q .= $db->value_string($this->_formattedprice) . ", ";
131      $q .= $db->value_string(timestamp()) . ", ";
132      $q .= $db->value_string(timestamp()) . ", ";
133      $q .= $this->deleted ? "'1'" : "'0'";
134      $q .= " ) ";
135      $db->query($q);
136      $this->_id = $db->insert_id;
137      return true;
138  }
publicmap ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
088  public function map()
089  {
090      $this->_amount = array_key_exists("hitreward:amount",$_REQUEST) ? reqval("hitreward:amount") : $this->_amount;
091      $this->_currencycode_id = array_key_exists("hitreward:currencycode_id",$_REQUEST) ? reqval("hitreward:currencycode_id") : $this->_currencycode_id;
092      $this->_formattedprice = array_key_exists("hitreward:formattedprice",$_REQUEST) ? reqval("hitreward:formattedprice") : $this->_formattedprice;
093      $this->_mdate = array_key_exists("hitreward:mdate",$_REQUEST) ? reqval("hitreward:mdate") : $this->_mdate;
094      $this->_cdate = array_key_exists("hitreward:cdate",$_REQUEST) ? reqval("hitreward:cdate") : $this->_cdate;
095      $this->_deleted = array_key_exists("hitreward:deleted",$_REQUEST) ? reqval("hitreward:deleted") : $this->_deleted;
096  }
publicpurge ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
176  public function purge()
177  {
178      $db = hitreward::db();
179      $q  = " DELETE FROM aws_hitreward ";
180      $q .= " WHERE id = " . $this->_id;
181      $db->query($q);
182      return true;
183  }
public staticsearch ( keyword )[ hitreward_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  }
publicset_currencycode ( v )[ hitreward_db ]
Parameters
requiredv
Code
328  public function set_currencycode($v)
329  {
330      if ($v->id > 0)
331      {
332          $this->currencycode_id = $v->id;
333      }
334  }
publicset_hit ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
472  public function set_hit($__v, $__type="default")
473  {
474      $object = is_null(keyval($this->property_objects_array,"{$__type}_hit")) ? new hit($this->get_hit_id($__type)) : $this->property_objects_array["{$__type}_hit"];
475      if (is_null($__v))
476      {
477          $rel = new hit_hitreward(null,$object->id,$this->id,hit_hitreward::type_id($__type));
478          $rel->delete();
479          if (!is_null(keyval($this->property_objects_array,"{$__type}_hit")))
480          {
481              $this->property_objects_array["{$__type}_hit"] = null;
482          }
483      }
484      else
485      {
486          $id = $object->id;
487          $object = $__v;
488          $object->id = $__v->id>0 ? $__v->id : $id;
489          $object->commit();
490          $this->set_hit_ids(array($object->id),$__type);
491      }
492  }
publicset_hit_id ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
493  public function set_hit_id($__v, $__type="default")
494  {
495      $this->set_hit_ids(array($__v),$__type);
496  }
publicset_hit_ids ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
497  public function set_hit_ids($__v, $__type="default")
498  {
499      if ($this->id == 0)
500      {
501          $this->commit();
502      }
503      $type_id = hit_hitreward::type_id($__type);
504      hit_hitreward::delete_all(null,$this->id,$type_id);
505      if (is_array($__v))
506      {
507          foreach ($__v as $index=>$id)
508          {
509              $object = new hit_hitreward(null,$id,$this->id,$type_id);
510              $object->deleted = false;
511              $object->hit_hitreward_type_id = $type_id;
512              $object->commit();
513              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_hit")))
514              {
515                  $this->property_objects_array["{$__type}_hit"] = new hit($object->hit_id);
516              }
517          }
518          $this->_dirty = true;
519      }
520  }
publicset_hit_list ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
521  public function set_hit_list($__v, $__type="default")
522  {
523      if (is_array($__v))
524      {
525          $ids = array();
526          foreach ($__v as $index=>$object)
527          {
528              $ids[] = $object->id;
529          }
530          $this->set_hit_ids($ids,$__type);
531      }
532  }
publicset_hittemplate ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
373  public function set_hittemplate($__v, $__type="default")
374  {
375      $object = is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")) ? new hittemplate($this->get_hittemplate_id($__type)) : $this->property_objects_array["{$__type}_hittemplate"];
376      if (is_null($__v))
377      {
378          $rel = new hitreward_hittemplate(null,$this->id,$object->id,hitreward_hittemplate::type_id($__type));
379          $rel->delete();
380          if (!is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")))
381          {
382              $this->property_objects_array["{$__type}_hittemplate"] = null;
383          }
384      }
385      else
386      {
387          $id = $object->id;
388          $object = $__v;
389          $object->id = $__v->id>0 ? $__v->id : $id;
390          $object->commit();
391          $this->set_hittemplate_ids(array($object->id),$__type);
392      }
393  }
publicset_hittemplate_id ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
394  public function set_hittemplate_id($__v, $__type="default")
395  {
396      $this->set_hittemplate_ids(array($__v),$__type);
397  }
publicset_hittemplate_ids ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
398  public function set_hittemplate_ids($__v, $__type="default")
399  {
400      if ($this->id == 0)
401      {
402          $this->commit();
403      }
404      $type_id = hitreward_hittemplate::type_id($__type);
405      hitreward_hittemplate::delete_all($this->id,null,$type_id);
406      if (is_array($__v))
407      {
408          foreach ($__v as $index=>$id)
409          {
410              $object = new hitreward_hittemplate(null,$this->id,$id,$type_id);
411              $object->deleted = false;
412              $object->hitreward_hittemplate_type_id = $type_id;
413              $object->commit();
414              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")))
415              {
416                  $this->property_objects_array["{$__type}_hittemplate"] = new hittemplate($object->hittemplate_id);
417              }
418          }
419          $this->_dirty = true;
420      }
421  }
publicset_hittemplate_list ( v , type ["default"] )[ hitreward_db ]
Parameters
requiredv
optionaltype ["default"]
Code
422  public function set_hittemplate_list($__v, $__type="default")
423  {
424      if (is_array($__v))
425      {
426          $ids = array();
427          foreach ($__v as $index=>$object)
428          {
429              $ids[] = $object->id;
430          }
431          $this->set_hittemplate_ids($ids,$__type);
432      }
433  }
public__toString ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
319  public function __toString()
320  {
321      return (is_null($this->id) ? "" : $this->id);
322  }
publicundelete ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
165  public function undelete()
166  {
167      $db = hitreward::db();
168      $q  = " UPDATE aws_hitreward SET ";
169      $q .= " deleted = 0 ";
170      $q .= " WHERE id = " . $this->_id;
171      $db->query($q);
172      $this->deleted = false;
173      return true;
174  }
protectedupdate ( )[ hitreward_db ]
Parameters
No parameters for this method
Code
140  protected function update()
141  {
142      $db = hitreward::db();
143      $q  = " UPDATE aws_hitreward SET ";
144      $q .= $db->param_string("amount") . " = " . $db->value_string($this->_amount) . ", ";
145      $q .= $db->param_string("currencycode_id") . " = " . $db->value_string($this->_currencycode_id) . ", ";
146      $q .= $db->param_string("formattedprice") . " = " . $db->value_string($this->_formattedprice) . ", ";
147      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
148      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
149      $q .= " WHERE id = " . $this->_id;
150      $db->query($q);
151      return true;
152  }
 
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[ hitreward_db ]
Code
185  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
186  {
187      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
188      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
189      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
190 
191      $db = hitreward::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM aws_hitreward ";
195      $q .= " WHERE aws_hitreward.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197      $q .= array_key_exists("currencycode_id",$lookups) ? " AND aws_hitreward.currencycode_id='" . $lookups["currencycode_id"] . "' " : "";
198 
199      if (is_string($__order))
200      {
201          $q .= "ORDER BY " . $__order;
202      }
203      else if (is_array($__order) and count($__order)>0)
204      {
205          $orderings = array();
206          foreach ($__order as $col=>$dir)
207          {
208              $orderings[] = " $col $dir ";
209          }
210          $q .= "ORDER BY " . implode(", ", $orderings);
211      }
212      else if (is_object($__order))
213      {
214          $q .= "";
215      }
216      else
217      {
218          // THERE IS NO `order` COLUMN ON THIS OBJECT
219      }
220 
221      if (!is_null($__limit))
222      {
223          $q .= " LIMIT $__offset , $__limit ";
224      }
225 
226      $db->query($q);
227 
228      if (count($colarray)>1 || $colstring=="*")
229      {
230          while ($db->next_record())
231          {
232              $data[] = $db->record;
233          }
234      }
235      else
236      {
237          while ($db->next_record())
238          {
239              $data[] = $db->f(0);
240          }
241      }
242 
243      return $data;
244  }
publiccurrencycode[ hitreward_db ]
Code
324  public function get_currencycode()
325  {
326      return new currencycode($this->currencycode_id);
327  }
Code
328  public function set_currencycode($v)
329  {
330      if ($v->id > 0)
331      {
332          $this->currencycode_id = $v->id;
333      }
334  }
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  }
publichit[ hitreward_db ]
Code
435  public function get_hit($__type="default")
436  {
437      $object = is_null(keyval($this->property_objects_array,"{$__type}_hit")) ? new hit($this->get_hit_id($__type)) : $this->property_objects_array["{$__type}_hit"];
438      $this->property_objects_array["{$__type}_hit"] = $object;
439      return $object;
440  }
Code
472  public function set_hit($__v, $__type="default")
473  {
474      $object = is_null(keyval($this->property_objects_array,"{$__type}_hit")) ? new hit($this->get_hit_id($__type)) : $this->property_objects_array["{$__type}_hit"];
475      if (is_null($__v))
476      {
477          $rel = new hit_hitreward(null,$object->id,$this->id,hit_hitreward::type_id($__type));
478          $rel->delete();
479          if (!is_null(keyval($this->property_objects_array,"{$__type}_hit")))
480          {
481              $this->property_objects_array["{$__type}_hit"] = null;
482          }
483      }
484      else
485      {
486          $id = $object->id;
487          $object = $__v;
488          $object->id = $__v->id>0 ? $__v->id : $id;
489          $object->commit();
490          $this->set_hit_ids(array($object->id),$__type);
491      }
492  }
publichit_id[ hitreward_db ]
Code
441  public function get_hit_id($__type="default")
442  {
443      $ids = $this->get_hit_ids($__type, true);
444      return (count($ids)==1 ? $ids[0] : null);
445  }
Code
493  public function set_hit_id($__v, $__type="default")
494  {
495      $this->set_hit_ids(array($__v),$__type);
496  }
publichit_ids[ hitreward_db ]
Code
446  public function get_hit_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
447  {
448      $hit_ids = array();
449      $db = hitreward::db();
450      $q  = " SELECT aws_hit.id FROM aws_hit_hitreward INNER JOIN aws_hit ON aws_hit_hitreward.hit_id=aws_hit.id AND aws_hit_hitreward.deleted=0 AND aws_hit.deleted=0 AND aws_hit_hitreward.hitreward_id='$this->id' " . (is_null($__type) ? "" : " AND aws_hit_hitreward.hit_hitreward_type_id='" . hit_hitreward::type_id($__type) . "'") . ($__get_primary ? " AND aws_hit_hitreward.primary=1 " : "");
451      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
452      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
453      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
454      $db->query($q);
455      while ($db->next_record())
456      {
457          $hit_ids[] = $db->f("id");
458      }
459      return $hit_ids;
460  }
Code
497  public function set_hit_ids($__v, $__type="default")
498  {
499      if ($this->id == 0)
500      {
501          $this->commit();
502      }
503      $type_id = hit_hitreward::type_id($__type);
504      hit_hitreward::delete_all(null,$this->id,$type_id);
505      if (is_array($__v))
506      {
507          foreach ($__v as $index=>$id)
508          {
509              $object = new hit_hitreward(null,$id,$this->id,$type_id);
510              $object->deleted = false;
511              $object->hit_hitreward_type_id = $type_id;
512              $object->commit();
513              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_hit")))
514              {
515                  $this->property_objects_array["{$__type}_hit"] = new hit($object->hit_id);
516              }
517          }
518          $this->_dirty = true;
519      }
520  }
publichit_list[ hitreward_db ]
Code
461  public function get_hit_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
462  {
463      $ids = $this->get_hit_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
464      $objects = array();
465      foreach ($ids as $index=>$id)
466      {
467          $objects[$index] = new hit($id);
468      }
469      return $objects;
470  }
Code
521  public function set_hit_list($__v, $__type="default")
522  {
523      if (is_array($__v))
524      {
525          $ids = array();
526          foreach ($__v as $index=>$object)
527          {
528              $ids[] = $object->id;
529          }
530          $this->set_hit_ids($ids,$__type);
531      }
532  }
publichittemplate[ hitreward_db ]
Code
336  public function get_hittemplate($__type="default")
337  {
338      $object = is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")) ? new hittemplate($this->get_hittemplate_id($__type)) : $this->property_objects_array["{$__type}_hittemplate"];
339      $this->property_objects_array["{$__type}_hittemplate"] = $object;
340      return $object;
341  }
Code
373  public function set_hittemplate($__v, $__type="default")
374  {
375      $object = is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")) ? new hittemplate($this->get_hittemplate_id($__type)) : $this->property_objects_array["{$__type}_hittemplate"];
376      if (is_null($__v))
377      {
378          $rel = new hitreward_hittemplate(null,$this->id,$object->id,hitreward_hittemplate::type_id($__type));
379          $rel->delete();
380          if (!is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")))
381          {
382              $this->property_objects_array["{$__type}_hittemplate"] = null;
383          }
384      }
385      else
386      {
387          $id = $object->id;
388          $object = $__v;
389          $object->id = $__v->id>0 ? $__v->id : $id;
390          $object->commit();
391          $this->set_hittemplate_ids(array($object->id),$__type);
392      }
393  }
publichittemplate_id[ hitreward_db ]
Code
342  public function get_hittemplate_id($__type="default")
343  {
344      $ids = $this->get_hittemplate_ids($__type, true);
345      return (count($ids)==1 ? $ids[0] : null);
346  }
Code
394  public function set_hittemplate_id($__v, $__type="default")
395  {
396      $this->set_hittemplate_ids(array($__v),$__type);
397  }
publichittemplate_ids[ hitreward_db ]
Code
347  public function get_hittemplate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
348  {
349      $hittemplate_ids = array();
350      $db = hitreward::db();
351      $q  = " SELECT aws_hittemplate.id FROM aws_hitreward_hittemplate INNER JOIN aws_hittemplate ON aws_hitreward_hittemplate.hittemplate_id=aws_hittemplate.id AND aws_hitreward_hittemplate.deleted=0 AND aws_hittemplate.deleted=0 AND aws_hitreward_hittemplate.hitreward_id='$this->id' " . (is_null($__type) ? "" : " AND aws_hitreward_hittemplate.hitreward_hittemplate_type_id='" . hitreward_hittemplate::type_id($__type) . "'") . ($__get_primary ? " AND aws_hitreward_hittemplate.primary=1 " : "");
352      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
353      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
354      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
355      $db->query($q);
356      while ($db->next_record())
357      {
358          $hittemplate_ids[] = $db->f("id");
359      }
360      return $hittemplate_ids;
361  }
Code
398  public function set_hittemplate_ids($__v, $__type="default")
399  {
400      if ($this->id == 0)
401      {
402          $this->commit();
403      }
404      $type_id = hitreward_hittemplate::type_id($__type);
405      hitreward_hittemplate::delete_all($this->id,null,$type_id);
406      if (is_array($__v))
407      {
408          foreach ($__v as $index=>$id)
409          {
410              $object = new hitreward_hittemplate(null,$this->id,$id,$type_id);
411              $object->deleted = false;
412              $object->hitreward_hittemplate_type_id = $type_id;
413              $object->commit();
414              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_hittemplate")))
415              {
416                  $this->property_objects_array["{$__type}_hittemplate"] = new hittemplate($object->hittemplate_id);
417              }
418          }
419          $this->_dirty = true;
420      }
421  }
publichittemplate_list[ hitreward_db ]
Code
362  public function get_hittemplate_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
363  {
364      $ids = $this->get_hittemplate_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
365      $objects = array();
366      foreach ($ids as $index=>$id)
367      {
368          $objects[$index] = new hittemplate($id);
369      }
370      return $objects;
371  }
Code
422  public function set_hittemplate_list($__v, $__type="default")
423  {
424      if (is_array($__v))
425      {
426          $ids = array();
427          foreach ($__v as $index=>$object)
428          {
429              $ids[] = $object->id;
430          }
431          $this->set_hittemplate_ids($ids,$__type);
432      }
433  }
publicids[ hitreward_db ]
Code
246  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
247  {
248      return hitreward::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
249  }
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[ hitreward_db ]
Code
251  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
252  {
253      $objects = array();
254      foreach (hitreward::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
255      {
256          $objects[] = new hitreward($id);
257      }
258      return $objects;
259  }
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