Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class board extends board_ext

Hide Inherited MembersForum
Description
No description.
 
Constants
constantTABLENAME ["forum_board"][ board ]
 
Properties
protected_cdate[ board_db ]
protected_cdate_dirty[ board_db ]
protected_deleted[ board_db ]
protected_deleted_dirty[ board_db ]
protected_description[ board_db ]
protected_description_dirty[ board_db ]
protected_dirty[ obj ]
protected_id[ board_db ]
protected_id_dirty[ board_db ]
protected_mdate[ board_db ]
protected_mdate_dirty[ board_db ]
protected_name[ board_db ]
protected_name_dirty[ board_db ]
publicproperty_objects_array[ obj ]
protected_views[ board_db ]
protected_views_dirty[ board_db ]
 
Methods
publiccommit ( )[ board_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 )[ board_db ]
Parameters
optionalid
Code
044  public function __construct($__id=null)
045  {
046      $this->_id = 0;
047      $this->_name = "";
048      $this->_description = "";
049      $this->_views = 0;
050      $this->_mdate = null;
051      $this->_cdate = null;
052      $this->_deleted = false;
053 
054      $this->_id_dirty = false;
055      $this->_name_dirty = false;
056      $this->_description_dirty = false;
057      $this->_views_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 = board::db();
068      $q  = " SELECT forum_board.id,forum_board.name,forum_board.description,forum_board.views,forum_board.mdate,forum_board.cdate,forum_board.deleted ";
069      $q .= " FROM forum_board ";       
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->_name = $db->f("name");
080          $this->_description = $db->f("description");
081          $this->_views = $db->f("views");
082          $this->_mdate = $db->f("mdate");
083          $this->_cdate = $db->f("cdate");
084          $this->_deleted = $db->f("deleted");
085      }
086  }
protected staticdb ( )[ board_db ]
Parameters
No parameters for this method
Code
422  protected static function db()
423  {
424      return new db();
425  }
publicdelete ( )[ board_db ]
Parameters
No parameters for this method
Code
154  public function delete()
155  {
156      $db = board::db();
157      $q  = " UPDATE forum_board 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 ( )[ board_db ]
Parameters
No parameters for this method
Code
260  public static function delete_all()
261  {
262      $db = board::db();
263      $q  = " UPDATE forum_board SET ";
264      $q .= " deleted = 1 ";
265     
266      $db->query($q);
267      return true;
268  }
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] )[ board_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 = board::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM forum_board ";
195      $q .= " WHERE forum_board.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197 
198      if (is_string($__order))
199      {
200          $q .= "ORDER BY " . $__order;
201      }
202      else if (is_array($__order) and count($__order)>0)
203      {
204          $orderings = array();
205          foreach ($__order as $col=>$dir)
206          {
207              $orderings[] = " $col $dir ";
208          }
209          $q .= "ORDER BY " . implode(", ", $orderings);
210      }
211      else if (is_object($__order))
212      {
213          $q .= "";
214      }
215      else
216      {
217          // THERE IS NO `order` COLUMN ON THIS OBJECT
218      }
219 
220      if (!is_null($__limit))
221      {
222          $q .= " LIMIT $__offset , $__limit ";
223      }
224 
225      $db->query($q);
226 
227      if (count($colarray)>1 || $colstring=="*")
228      {
229          while ($db->next_record())
230          {
231              $data[] = $db->record;
232          }
233      }
234      else
235      {
236          while ($db->next_record())
237          {
238              $data[] = $db->f(0);
239          }
240      }
241 
242      return $data;
243  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ board_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
245  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
246  {
247      return board::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
248  }
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  }
publicget_last_post ( )[ board_ext ]
Parameters
No parameters for this method
Code
035  public function get_last_post()
036  {
037      return new post(max($this->post_ids));
038  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ board_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
250  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
251  {
252      $objects = array();
253      foreach (board::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
254      {
255          $objects[] = new board($id);
256      }
257      return $objects;
258  }
publicget_post_ids ( )[ board_ext ]
Parameters
No parameters for this method
Code
026  public function get_post_ids()
027  {
028      $post_ids = array();
029      foreach ($this->topic_list as $topic)
030      {
031          $post_ids = array_merge($post_ids,$topic->post_ids);
032      }
033      return $post_ids;
034  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
publicget_topic ( type ["default"] )[ board_db ]
Parameters
optionaltype ["default"]
Code
323  public function get_topic($__type="default")
324  {
325      $object = is_null(keyval($this->property_objects_array,"{$__type}_topic")) ? new topic($this->get_topic_id($__type)) : $this->property_objects_array["{$__type}_topic"];
326      $this->property_objects_array["{$__type}_topic"] = $object;
327      return $object;
328  }
publicget_topic_id ( type ["default"] )[ board_db ]
Parameters
optionaltype ["default"]
Code
329  public function get_topic_id($__type="default")
330  {
331      $ids = $this->get_topic_ids($__type, true);
332      return (count($ids)==1 ? $ids[0] : null);
333  }
publicget_topic_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ board_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
334  public function get_topic_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
335  {
336      $topic_ids = array();
337      $db = board::db();
338      $q  = " SELECT forum_topic.id FROM forum_board_topic INNER JOIN forum_topic ON forum_board_topic.topic_id=forum_topic.id AND forum_board_topic.deleted=0 AND forum_topic.deleted=0 AND forum_board_topic.board_id='$this->id' " . (is_null($__type) ? "" : " AND forum_board_topic.board_topic_type_id='" . board_topic::type_id($__type) . "'") . ($__get_primary ? " AND forum_board_topic.primary=1 " : "");
339      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
340      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
341      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
342      $db->query($q);
343      while ($db->next_record())
344      {
345          $topic_ids[] = $db->f("id");
346      }
347      return $topic_ids;
348  }
publicget_topic_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ board_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
349  public function get_topic_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
350  {
351      $ids = $this->get_topic_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
352      $objects = array();
353      foreach ($ids as $index=>$id)
354      {
355          $objects[$index] = new topic($id);
356      }
357      return $objects;
358  }
protectedinsert ( )[ board_db ]
Parameters
No parameters for this method
Code
117  protected function insert()
118  {
119      $db = board::db();
120      $q  = " INSERT INTO forum_board ( ";
121      $q .= $db->param_string("name") . ", ";
122      $q .= $db->param_string("description") . ", ";
123      $q .= $db->param_string("views") . ", ";
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->_name) . ", ";
129      $q .= $db->value_string($this->_description) . ", ";
130      $q .= $db->value_string($this->_views) . ", ";
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 ( )[ board_db ]
Parameters
No parameters for this method
Code
088  public function map()
089  {
090      $this->_name = array_key_exists("board:name",$_REQUEST) ? reqval("board:name") : $this->_name;
091      $this->_description = array_key_exists("board:description",$_REQUEST) ? reqval("board:description") : $this->_description;
092      $this->_views = array_key_exists("board:views",$_REQUEST) ? reqval("board:views") : $this->_views;
093      $this->_mdate = array_key_exists("board:mdate",$_REQUEST) ? reqval("board:mdate") : $this->_mdate;
094      $this->_cdate = array_key_exists("board:cdate",$_REQUEST) ? reqval("board:cdate") : $this->_cdate;
095      $this->_deleted = array_key_exists("board:deleted",$_REQUEST) ? reqval("board:deleted") : $this->_deleted;
096  }
publicpurge ( )[ board_db ]
Parameters
No parameters for this method
Code
176  public function purge()
177  {
178      $db = board::db();
179      $q  = " DELETE FROM forum_board ";
180      $q .= " WHERE id = " . $this->_id;
181      $db->query($q);
182      return true;
183  }
public staticsearch ( keyword )[ board_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_topic ( v , type ["default"] )[ board_db ]
Parameters
requiredv
optionaltype ["default"]
Code
360  public function set_topic($__v, $__type="default")
361  {
362      $object = is_null(keyval($this->property_objects_array,"{$__type}_topic")) ? new topic($this->get_topic_id($__type)) : $this->property_objects_array["{$__type}_topic"];
363      if (is_null($__v))
364      {
365          $rel = new board_topic(null,$this->id,$object->id,board_topic::type_id($__type));
366          $rel->delete();
367          if (!is_null(keyval($this->property_objects_array,"{$__type}_topic")))
368          {
369              $this->property_objects_array["{$__type}_topic"] = null;
370          }
371      }
372      else
373      {
374          $id = $object->id;
375          $object = $__v;
376          $object->id = $__v->id>0 ? $__v->id : $id;
377          $object->commit();
378          $this->set_topic_ids(array($object->id),$__type);
379      }
380  }
publicset_topic_id ( v , type ["default"] )[ board_db ]
Parameters
requiredv
optionaltype ["default"]
Code
381  public function set_topic_id($__v, $__type="default")
382  {
383      $this->set_topic_ids(array($__v),$__type);
384  }
publicset_topic_ids ( v , type ["default"] )[ board_db ]
Parameters
requiredv
optionaltype ["default"]
Code
385  public function set_topic_ids($__v, $__type="default")
386  {
387      if ($this->id == 0)
388      {
389          $this->commit();
390      }
391      $type_id = board_topic::type_id($__type);
392      board_topic::delete_all($this->id,null,$type_id);
393      if (is_array($__v))
394      {
395          foreach ($__v as $index=>$id)
396          {
397              $object = new board_topic(null,$this->id,$id,$type_id);
398              $object->deleted = false;
399              $object->board_topic_type_id = $type_id;
400              $object->commit();
401              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_topic")))
402              {
403                  $this->property_objects_array["{$__type}_topic"] = new topic($object->topic_id);
404              }
405          }
406          $this->_dirty = true;
407      }
408  }
publicset_topic_list ( v , type ["default"] )[ board_db ]
Parameters
requiredv
optionaltype ["default"]
Code
409  public function set_topic_list($__v, $__type="default")
410  {
411      if (is_array($__v))
412      {
413          $ids = array();
414          foreach ($__v as $index=>$object)
415          {
416              $ids[] = $object->id;
417          }
418          $this->set_topic_ids($ids,$__type);
419      }
420  }
public__toString ( )[ board_db ]
Parameters
No parameters for this method
Code
318  public function __toString()
319  {
320      return (is_null($this->name) ? "" : $this->name);
321  }
publicundelete ( )[ board_db ]
Parameters
No parameters for this method
Code
165  public function undelete()
166  {
167      $db = board::db();
168      $q  = " UPDATE forum_board SET ";
169      $q .= " deleted = 0 ";
170      $q .= " WHERE id = " . $this->_id;
171      $db->query($q);
172      $this->deleted = false;
173      return true;
174  }
protectedupdate ( )[ board_db ]
Parameters
No parameters for this method
Code
140  protected function update()
141  {
142      $db = board::db();
143      $q  = " UPDATE forum_board SET ";
144      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
145      $q .= $db->param_string("description") . " = " . $db->value_string($this->_description) . ", ";
146      $q .= $db->param_string("views") . " = " . $db->value_string($this->_views) . ", ";
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[ board_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 = board::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM forum_board ";
195      $q .= " WHERE forum_board.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197 
198      if (is_string($__order))
199      {
200          $q .= "ORDER BY " . $__order;
201      }
202      else if (is_array($__order) and count($__order)>0)
203      {
204          $orderings = array();
205          foreach ($__order as $col=>$dir)
206          {
207              $orderings[] = " $col $dir ";
208          }
209          $q .= "ORDER BY " . implode(", ", $orderings);
210      }
211      else if (is_object($__order))
212      {
213          $q .= "";
214      }
215      else
216      {
217          // THERE IS NO `order` COLUMN ON THIS OBJECT
218      }
219 
220      if (!is_null($__limit))
221      {
222          $q .= " LIMIT $__offset , $__limit ";
223      }
224 
225      $db->query($q);
226 
227      if (count($colarray)>1 || $colstring=="*")
228      {
229          while ($db->next_record())
230          {
231              $data[] = $db->record;
232          }
233      }
234      else
235      {
236          while ($db->next_record())
237          {
238              $data[] = $db->f(0);
239          }
240      }
241 
242      return $data;
243  }
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[ board_db ]
Code
245  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
246  {
247      return board::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
248  }
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  }
publiclast_post[ board_ext ]
Code
035  public function get_last_post()
036  {
037      return new post(max($this->post_ids));
038  }
publicobjects[ board_db ]
Code
250  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
251  {
252      $objects = array();
253      foreach (board::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
254      {
255          $objects[] = new board($id);
256      }
257      return $objects;
258  }
publicpost_ids[ board_ext ]
Code
026  public function get_post_ids()
027  {
028      $post_ids = array();
029      foreach ($this->topic_list as $topic)
030      {
031          $post_ids = array_merge($post_ids,$topic->post_ids);
032      }
033      return $post_ids;
034  }
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  }
publictopic[ board_db ]
Code
323  public function get_topic($__type="default")
324  {
325      $object = is_null(keyval($this->property_objects_array,"{$__type}_topic")) ? new topic($this->get_topic_id($__type)) : $this->property_objects_array["{$__type}_topic"];
326      $this->property_objects_array["{$__type}_topic"] = $object;
327      return $object;
328  }
Code
360  public function set_topic($__v, $__type="default")
361  {
362      $object = is_null(keyval($this->property_objects_array,"{$__type}_topic")) ? new topic($this->get_topic_id($__type)) : $this->property_objects_array["{$__type}_topic"];
363      if (is_null($__v))
364      {
365          $rel = new board_topic(null,$this->id,$object->id,board_topic::type_id($__type));
366          $rel->delete();
367          if (!is_null(keyval($this->property_objects_array,"{$__type}_topic")))
368          {
369              $this->property_objects_array["{$__type}_topic"] = null;
370          }
371      }
372      else
373      {
374          $id = $object->id;
375          $object = $__v;
376          $object->id = $__v->id>0 ? $__v->id : $id;
377          $object->commit();
378          $this->set_topic_ids(array($object->id),$__type);
379      }
380  }
publictopic_id[ board_db ]
Code
329  public function get_topic_id($__type="default")
330  {
331      $ids = $this->get_topic_ids($__type, true);
332      return (count($ids)==1 ? $ids[0] : null);
333  }
Code
381  public function set_topic_id($__v, $__type="default")
382  {
383      $this->set_topic_ids(array($__v),$__type);
384  }
publictopic_ids[ board_db ]
Code
334  public function get_topic_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
335  {
336      $topic_ids = array();
337      $db = board::db();
338      $q  = " SELECT forum_topic.id FROM forum_board_topic INNER JOIN forum_topic ON forum_board_topic.topic_id=forum_topic.id AND forum_board_topic.deleted=0 AND forum_topic.deleted=0 AND forum_board_topic.board_id='$this->id' " . (is_null($__type) ? "" : " AND forum_board_topic.board_topic_type_id='" . board_topic::type_id($__type) . "'") . ($__get_primary ? " AND forum_board_topic.primary=1 " : "");
339      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
340      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
341      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
342      $db->query($q);
343      while ($db->next_record())
344      {
345          $topic_ids[] = $db->f("id");
346      }
347      return $topic_ids;
348  }
Code
385  public function set_topic_ids($__v, $__type="default")
386  {
387      if ($this->id == 0)
388      {
389          $this->commit();
390      }
391      $type_id = board_topic::type_id($__type);
392      board_topic::delete_all($this->id,null,$type_id);
393      if (is_array($__v))
394      {
395          foreach ($__v as $index=>$id)
396          {
397              $object = new board_topic(null,$this->id,$id,$type_id);
398              $object->deleted = false;
399              $object->board_topic_type_id = $type_id;
400              $object->commit();
401              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_topic")))
402              {
403                  $this->property_objects_array["{$__type}_topic"] = new topic($object->topic_id);
404              }
405          }
406          $this->_dirty = true;
407      }
408  }
publictopic_list[ board_db ]
Code
349  public function get_topic_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
350  {
351      $ids = $this->get_topic_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
352      $objects = array();
353      foreach ($ids as $index=>$id)
354      {
355          $objects[$index] = new topic($id);
356      }
357      return $objects;
358  }
Code
409  public function set_topic_list($__v, $__type="default")
410  {
411      if (is_array($__v))
412      {
413          $ids = array();
414          foreach ($__v as $index=>$object)
415          {
416              $ids[] = $object->id;
417          }
418          $this->set_topic_ids($ids,$__type);
419      }
420  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads