Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class video extends video_ext

Hide Inherited MembersVideo Gallery
Description
No description.
 
Constants
constantTABLENAME ["vid_video"][ video ]
 
Properties
protected_cdate[ video_db ]
protected_cdate_dirty[ video_db ]
protected_deleted[ video_db ]
protected_deleted_dirty[ video_db ]
protected_description[ video_db ]
protected_description_dirty[ video_db ]
protected_dirty[ obj ]
protected_duration[ video_db ]
protected_duration_dirty[ video_db ]
protected_id[ video_db ]
protected_id_dirty[ video_db ]
protected_mdate[ video_db ]
protected_mdate_dirty[ video_db ]
protected_name[ video_db ]
protected_name_dirty[ video_db ]
publicproperty_objects_array[ obj ]
protected_video_type_id[ video_db ]
protected_video_type_id_dirty[ video_db ]
 
Methods
publiccommit ( )[ video_db ]
Parameters
No parameters for this method
Code
108  public function commit()
109  {
110      if ($this->_id > 0)
111      {
112          $this->update();
113      }
114      else
115      {
116          $this->insert();
117      }
118 
119      foreach ($this->property_objects_array as $property=>$object)
120      {
121          $this->{$property} = $object;
122      }
123 
124      return true;
125  }
public__construct ( id , name )[ video_db ]
Parameters
optionalid
optionalname
Code
046  public function __construct($__id=null, $__name=null)
047  {
048      $this->_id = 0;
049      $this->_name = $__name;
050      $this->_description = "";
051      $this->_video_type_id = 0;
052      $this->_duration = 0;
053      $this->_mdate = null;
054      $this->_cdate = null;
055      $this->_deleted = false;
056 
057      $this->_id_dirty = false;
058      $this->_name_dirty = false;
059      $this->_description_dirty = false;
060      $this->_video_type_id_dirty = false;
061      $this->_duration_dirty = false;
062      $this->_mdate_dirty = false;
063      $this->_cdate_dirty = false;
064      $this->_deleted_dirty = false;
065 
066      if (is_null($__id) && is_null($__name))
067      {
068          return;
069      }
070 
071      $db = video::db();
072      $q  = " SELECT vid_video.id,vid_video.name,vid_video.description,vid_video.video_type_id,vid_video.duration,vid_video.mdate,vid_video.cdate,vid_video.deleted ";
073      $q .= " FROM vid_video ";       
074      if (!is_null($__id))
075      {
076          $q .= " WHERE id = '$__id' ";
077      }
078      else if (!is_null($__name))
079      {
080          $q .= " WHERE name = '$__name' ";
081      }
082 
083      $db->query($q);
084      if ($db->next_record() && $db->num_rows() == 1)
085      {
086          $this->_id = $db->f("id");
087          $this->_name = $db->f("name");
088          $this->_description = $db->f("description");
089          $this->_video_type_id = $db->f("video_type_id");
090          $this->_duration = $db->f("duration");
091          $this->_mdate = $db->f("mdate");
092          $this->_cdate = $db->f("cdate");
093          $this->_deleted = $db->f("deleted");
094      }
095  }
protected staticdb ( )[ video_db ]
Parameters
No parameters for this method
Code
465  protected static function db()
466  {
467      return new db();
468  }
publicdelete ( )[ video_db ]
Parameters
No parameters for this method
Code
167  public function delete()
168  {
169      $db = video::db();
170      $q  = " UPDATE vid_video SET ";
171      $q .= " deleted = 1 ";
172      $q .= " WHERE id = " . $this->_id;
173      $db->query($q);
174      $this->deleted = true;
175      return true;
176  }
public staticdelete_all ( )[ video_db ]
Parameters
No parameters for this method
Code
274  public static function delete_all()
275  {
276      $db = video::db();
277      $q  = " UPDATE vid_video SET ";
278      $q .= " deleted = 1 ";
279     
280      $db->query($q);
281      return true;
282  }
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] )[ video_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
198  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
199  {
200      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
201      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
202      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
203 
204      $db = video::db();
205      $data = array();
206      $q  = " SELECT $colstring ";
207      $q .= " FROM vid_video ";
208      $q .= " WHERE vid_video.deleted = 0 ";
209      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
210      $q .= array_key_exists("video_type_id",$lookups) ? " AND vid_video.video_type_id='" . $lookups["video_type_id"] . "' " : "";
211 
212      if (is_string($__order))
213      {
214          $q .= "ORDER BY " . $__order;
215      }
216      else if (is_array($__order) and count($__order)>0)
217      {
218          $orderings = array();
219          foreach ($__order as $col=>$dir)
220          {
221              $orderings[] = " $col $dir ";
222          }
223          $q .= "ORDER BY " . implode(", ", $orderings);
224      }
225      else if (is_object($__order))
226      {
227          $q .= "";
228      }
229      else
230      {
231          // THERE IS NO `order` COLUMN ON THIS OBJECT
232      }
233 
234      if (!is_null($__limit))
235      {
236          $q .= " LIMIT $__offset , $__limit ";
237      }
238 
239      $db->query($q);
240 
241      if (count($colarray)>1 || $colstring=="*")
242      {
243          while ($db->next_record())
244          {
245              $data[] = $db->record;
246          }
247      }
248      else
249      {
250          while ($db->next_record())
251          {
252              $data[] = $db->f(0);
253          }
254      }
255 
256      return $data;
257  }
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_entity ( type ["default"] )[ video_db ]
Parameters
optionaltype ["default"]
Code
366  public function get_entity($__type="default")
367  {
368      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
369      $this->property_objects_array["{$__type}_entity"] = $object;
370      return $object;
371  }
publicget_entity_id ( type ["default"] )[ video_db ]
Parameters
optionaltype ["default"]
Code
372  public function get_entity_id($__type="default")
373  {
374      $ids = $this->get_entity_ids($__type, true);
375      return (count($ids)==1 ? $ids[0] : null);
376  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ video_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
377  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
378  {
379      $entity_ids = array();
380      $db = video::db();
381      $q  = " SELECT cor_entity.id FROM vid_entity_video INNER JOIN cor_entity ON vid_entity_video.entity_id=cor_entity.id AND vid_entity_video.deleted=0 AND cor_entity.deleted=0 AND vid_entity_video.video_id='$this->id' " . (is_null($__type) ? "" : " AND vid_entity_video.entity_video_type_id='" . entity_video::type_id($__type) . "'") . ($__get_primary ? " AND vid_entity_video.primary=1 " : "");
382      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
383      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
384      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
385      $db->query($q);
386      while ($db->next_record())
387      {
388          $entity_ids[] = $db->f("id");
389      }
390      return $entity_ids;
391  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ video_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
392  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
393  {
394      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
395      $objects = array();
396      foreach ($ids as $index=>$id)
397      {
398          $objects[$index] = new entity($id);
399      }
400      return $objects;
401  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ video_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
259  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
260  {
261      return video::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
262  }
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] )[ video_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
264  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
265  {
266      $objects = array();
267      foreach (video::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
268      {
269          $objects[] = new video($id);
270      }
271      return $objects;
272  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_resource_type ( )[ video_db ]
Parameters
No parameters for this method
Code
354  public function get_resource_type()
355  {
356      return new resource_type($this->resource_type_id);
357  }
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 ( )[ video_db ]
Parameters
No parameters for this method
Code
343  public function get_type()
344  {
345      $type = new video_type($this->_video_type_id);
346      return $type->name;
347  }
protectedinsert ( )[ video_db ]
Parameters
No parameters for this method
Code
127  protected function insert()
128  {
129      $db = video::db();
130      $q  = " INSERT INTO vid_video ( ";
131      $q .= $db->param_string("name") . ", ";
132      $q .= $db->param_string("description") . ", ";
133      $q .= $db->param_string("video_type_id") . ", ";
134      $q .= $db->param_string("duration") . ", ";
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->_name) . ", ";
140      $q .= $db->value_string($this->_description) . ", ";
141      $q .= $db->value_string($this->_video_type_id) . ", ";
142      $q .= $db->value_string($this->_duration) . ", ";
143      $q .= $db->value_string(timestamp()) . ", ";
144      $q .= $db->value_string(timestamp()) . ", ";
145      $q .= $this->deleted ? "'1'" : "'0'";
146      $q .= " ) ";
147      $db->query($q);
148      $this->_id = $db->insert_id;
149      return true;
150  }
publicmap ( )[ video_db ]
Parameters
No parameters for this method
Code
097  public function map()
098  {
099      $this->_name = array_key_exists("video:name",$_REQUEST) ? reqval("video:name") : $this->_name;
100      $this->_description = array_key_exists("video:description",$_REQUEST) ? reqval("video:description") : $this->_description;
101      $this->_video_type_id = array_key_exists("video:video_type_id",$_REQUEST) ? reqval("video:video_type_id") : $this->_video_type_id;
102      $this->_duration = array_key_exists("video:duration",$_REQUEST) ? reqval("video:duration") : $this->_duration;
103      $this->_mdate = array_key_exists("video:mdate",$_REQUEST) ? reqval("video:mdate") : $this->_mdate;
104      $this->_cdate = array_key_exists("video:cdate",$_REQUEST) ? reqval("video:cdate") : $this->_cdate;
105      $this->_deleted = array_key_exists("video:deleted",$_REQUEST) ? reqval("video:deleted") : $this->_deleted;
106  }
publicpurge ( )[ video_db ]
Parameters
No parameters for this method
Code
189  public function purge()
190  {
191      $db = video::db();
192      $q  = " DELETE FROM vid_video ";
193      $q .= " WHERE id = " . $this->_id;
194      $db->query($q);
195      return true;
196  }
public staticsearch ( keyword )[ video_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_entity ( v , type ["default"] )[ video_db ]
Parameters
requiredv
optionaltype ["default"]
Code
403  public function set_entity($__v, $__type="default")
404  {
405      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
406      if (is_null($__v))
407      {
408          $rel = new entity_video(null,$object->id,$this->id,entity_video::type_id($__type));
409          $rel->delete();
410          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
411          {
412              $this->property_objects_array["{$__type}_entity"] = null;
413          }
414      }
415      else
416      {
417          $id = $object->id;
418          $object = $__v;
419          $object->id = $__v->id>0 ? $__v->id : $id;
420          $object->commit();
421          $this->set_entity_ids(array($object->id),$__type);
422      }
423  }
publicset_entity_id ( v , type ["default"] )[ video_db ]
Parameters
requiredv
optionaltype ["default"]
Code
424  public function set_entity_id($__v, $__type="default")
425  {
426      $this->set_entity_ids(array($__v),$__type);
427  }
publicset_entity_ids ( v , type ["default"] )[ video_db ]
Parameters
requiredv
optionaltype ["default"]
Code
428  public function set_entity_ids($__v, $__type="default")
429  {
430      if ($this->id == 0)
431      {
432          $this->commit();
433      }
434      $type_id = entity_video::type_id($__type);
435      entity_video::delete_all(null,$this->id,$type_id);
436      if (is_array($__v))
437      {
438          foreach ($__v as $index=>$id)
439          {
440              $object = new entity_video(null,$id,$this->id,$type_id);
441              $object->deleted = false;
442              $object->entity_video_type_id = $type_id;
443              $object->commit();
444              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
445              {
446                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
447              }
448          }
449          $this->_dirty = true;
450      }
451  }
publicset_entity_list ( v , type ["default"] )[ video_db ]
Parameters
requiredv
optionaltype ["default"]
Code
452  public function set_entity_list($__v, $__type="default")
453  {
454      if (is_array($__v))
455      {
456          $ids = array();
457          foreach ($__v as $index=>$object)
458          {
459              $ids[] = $object->id;
460          }
461          $this->set_entity_ids($ids,$__type);
462      }
463  }
publicset_resource_type ( v )[ video_db ]
Parameters
requiredv
Code
358  public function set_resource_type($v)
359  {
360      if ($v->id > 0)
361      {
362          $this->resource_type_id = $v->id;
363      }
364  }
publicset_type ( v )[ video_db ]
Parameters
requiredv
Code
348  public function set_type($v)
349  {
350      $type = new video_type(null, $v);
351      $this->video_type_id = $type->id;
352  }
public__toString ( )[ video_db ]
Parameters
No parameters for this method
Code
332  public function __toString()
333  {
334      return (is_null($this->name) ? "" : $this->name);
335  }
public statictype_id ( type_name )[ video_db ]
Parameters
requiredtype_name
Code
337  public static function type_id($__type_name)
338  {
339      $type = new video_type(null, $__type_name);
340      return $type->id;
341  }
publicundelete ( )[ video_db ]
Parameters
No parameters for this method
Code
178  public function undelete()
179  {
180      $db = video::db();
181      $q  = " UPDATE vid_video SET ";
182      $q .= " deleted = 0 ";
183      $q .= " WHERE id = " . $this->_id;
184      $db->query($q);
185      $this->deleted = false;
186      return true;
187  }
protectedupdate ( )[ video_db ]
Parameters
No parameters for this method
Code
152  protected function update()
153  {
154      $db = video::db();
155      $q  = " UPDATE vid_video SET ";
156      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
157      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
158      $q .= $db->param_string("video_type_id") . " = " . $db->value_string($this->_video_type_id) . ", ";
159      $q .= $db->param_string("duration") . " = " . $db->value_string($this->_duration) . ", ";
160      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
161      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
162      $q .= " WHERE id = " . $this->_id;
163      $db->query($q);
164      return true;
165  }
 
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[ video_db ]
Code
198  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
199  {
200      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
201      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
202      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
203 
204      $db = video::db();
205      $data = array();
206      $q  = " SELECT $colstring ";
207      $q .= " FROM vid_video ";
208      $q .= " WHERE vid_video.deleted = 0 ";
209      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
210      $q .= array_key_exists("video_type_id",$lookups) ? " AND vid_video.video_type_id='" . $lookups["video_type_id"] . "' " : "";
211 
212      if (is_string($__order))
213      {
214          $q .= "ORDER BY " . $__order;
215      }
216      else if (is_array($__order) and count($__order)>0)
217      {
218          $orderings = array();
219          foreach ($__order as $col=>$dir)
220          {
221              $orderings[] = " $col $dir ";
222          }
223          $q .= "ORDER BY " . implode(", ", $orderings);
224      }
225      else if (is_object($__order))
226      {
227          $q .= "";
228      }
229      else
230      {
231          // THERE IS NO `order` COLUMN ON THIS OBJECT
232      }
233 
234      if (!is_null($__limit))
235      {
236          $q .= " LIMIT $__offset , $__limit ";
237      }
238 
239      $db->query($q);
240 
241      if (count($colarray)>1 || $colstring=="*")
242      {
243          while ($db->next_record())
244          {
245              $data[] = $db->record;
246          }
247      }
248      else
249      {
250          while ($db->next_record())
251          {
252              $data[] = $db->f(0);
253          }
254      }
255 
256      return $data;
257  }
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  }
publicentity[ video_db ]
Code
366  public function get_entity($__type="default")
367  {
368      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
369      $this->property_objects_array["{$__type}_entity"] = $object;
370      return $object;
371  }
Code
403  public function set_entity($__v, $__type="default")
404  {
405      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
406      if (is_null($__v))
407      {
408          $rel = new entity_video(null,$object->id,$this->id,entity_video::type_id($__type));
409          $rel->delete();
410          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
411          {
412              $this->property_objects_array["{$__type}_entity"] = null;
413          }
414      }
415      else
416      {
417          $id = $object->id;
418          $object = $__v;
419          $object->id = $__v->id>0 ? $__v->id : $id;
420          $object->commit();
421          $this->set_entity_ids(array($object->id),$__type);
422      }
423  }
publicentity_id[ video_db ]
Code
372  public function get_entity_id($__type="default")
373  {
374      $ids = $this->get_entity_ids($__type, true);
375      return (count($ids)==1 ? $ids[0] : null);
376  }
Code
424  public function set_entity_id($__v, $__type="default")
425  {
426      $this->set_entity_ids(array($__v),$__type);
427  }
publicentity_ids[ video_db ]
Code
377  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
378  {
379      $entity_ids = array();
380      $db = video::db();
381      $q  = " SELECT cor_entity.id FROM vid_entity_video INNER JOIN cor_entity ON vid_entity_video.entity_id=cor_entity.id AND vid_entity_video.deleted=0 AND cor_entity.deleted=0 AND vid_entity_video.video_id='$this->id' " . (is_null($__type) ? "" : " AND vid_entity_video.entity_video_type_id='" . entity_video::type_id($__type) . "'") . ($__get_primary ? " AND vid_entity_video.primary=1 " : "");
382      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
383      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
384      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
385      $db->query($q);
386      while ($db->next_record())
387      {
388          $entity_ids[] = $db->f("id");
389      }
390      return $entity_ids;
391  }
Code
428  public function set_entity_ids($__v, $__type="default")
429  {
430      if ($this->id == 0)
431      {
432          $this->commit();
433      }
434      $type_id = entity_video::type_id($__type);
435      entity_video::delete_all(null,$this->id,$type_id);
436      if (is_array($__v))
437      {
438          foreach ($__v as $index=>$id)
439          {
440              $object = new entity_video(null,$id,$this->id,$type_id);
441              $object->deleted = false;
442              $object->entity_video_type_id = $type_id;
443              $object->commit();
444              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
445              {
446                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
447              }
448          }
449          $this->_dirty = true;
450      }
451  }
publicentity_list[ video_db ]
Code
392  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
393  {
394      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
395      $objects = array();
396      foreach ($ids as $index=>$id)
397      {
398          $objects[$index] = new entity($id);
399      }
400      return $objects;
401  }
Code
452  public function set_entity_list($__v, $__type="default")
453  {
454      if (is_array($__v))
455      {
456          $ids = array();
457          foreach ($__v as $index=>$object)
458          {
459              $ids[] = $object->id;
460          }
461          $this->set_entity_ids($ids,$__type);
462      }
463  }
publicids[ video_db ]
Code
259  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
260  {
261      return video::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
262  }
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[ video_db ]
Code
264  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
265  {
266      $objects = array();
267      foreach (video::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
268      {
269          $objects[] = new video($id);
270      }
271      return $objects;
272  }
publicproperties[ obj ]
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicresource_type[ video_db ]
Code
354  public function get_resource_type()
355  {
356      return new resource_type($this->resource_type_id);
357  }
Code
358  public function set_resource_type($v)
359  {
360      if ($v->id > 0)
361      {
362          $this->resource_type_id = $v->id;
363      }
364  }
publicstring[ obj ]
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publictype[ video_db ]
Code
343  public function get_type()
344  {
345      $type = new video_type($this->_video_type_id);
346      return $type->name;
347  }
Code
348  public function set_type($v)
349  {
350      $type = new video_type(null, $v);
351      $this->video_type_id = $type->id;
352  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads