Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class orgposition extends orgposition_ext

Hide Inherited MembersBusiness Management
Description
No description.
 
Constants
constantTABLENAME ["bus_orgposition"][ orgposition ]
 
Properties
protected_cdate[ orgposition_db ]
protected_cdate_dirty[ orgposition_db ]
protected_deleted[ orgposition_db ]
protected_deleted_dirty[ orgposition_db ]
protected_description[ orgposition_db ]
protected_description_dirty[ orgposition_db ]
protected_dirty[ obj ]
protected_id[ orgposition_db ]
protected_id_dirty[ orgposition_db ]
protected_mdate[ orgposition_db ]
protected_mdate_dirty[ orgposition_db ]
protected_name[ orgposition_db ]
protected_name_dirty[ orgposition_db ]
protected_orgposition_type_id[ orgposition_db ]
protected_orgposition_type_id_dirty[ orgposition_db ]
publicproperty_objects_array[ obj ]
 
Methods
publiccommit ( )[ orgposition_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 )[ orgposition_db ]
Parameters
optionalid
Code
044  public function __construct($__id=null)
045  {
046      $this->_id = 0;
047      $this->_name = "";
048      $this->_description = "";
049      $this->_orgposition_type_id = 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->_orgposition_type_id_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 = orgposition::db();
068      $q  = " SELECT bus_orgposition.id,bus_orgposition.name,bus_orgposition.description,bus_orgposition.orgposition_type_id,bus_orgposition.mdate,bus_orgposition.cdate,bus_orgposition.deleted ";
069      $q .= " FROM bus_orgposition ";       
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->_orgposition_type_id = $db->f("orgposition_type_id");
082          $this->_mdate = $db->f("mdate");
083          $this->_cdate = $db->f("cdate");
084          $this->_deleted = $db->f("deleted");
085      }
086  }
protected staticdb ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
947  protected static function db()
948  {
949      return new db();
950  }
publicdelete ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
154  public function delete()
155  {
156      $db = orgposition::db();
157      $q  = " UPDATE bus_orgposition 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 ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
261  public static function delete_all()
262  {
263      $db = orgposition::db();
264      $q  = " UPDATE bus_orgposition 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_ancestors ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
032  public function get_ancestors()
033  {
034      $ancestors = array();
035      $orgposition = $this;
036      while (!$orgposition->parent->is_root)
037      {
038          $ancestors[] = $orgposition->parent;
039          $orgposition = $orgposition->parent;
040      }
041      return $ancestors;
042  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_child_count ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
049  public function get_child_count()
050  {
051      return count(orgposition_orgposition::get_ids(null,$this->_id));
052  }
publicget_children ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
007  public function get_children()
008  {
009      $children = array();
010      foreach (orgposition_orgposition::get_ids(null,$this->_id) as $orgposition_orgposition_id)
011      {
012          $orgposition_orgposition = new orgposition_orgposition($orgposition_orgposition_id);
013          $children[] = new orgposition($orgposition_orgposition->child_id);
014      }
015      return $children;
016  }
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] )[ orgposition_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 = orgposition::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM bus_orgposition ";
195      $q .= " WHERE bus_orgposition.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197      $q .= array_key_exists("orgposition_type_id",$lookups) ? " AND bus_orgposition.orgposition_type_id='" . $lookups["orgposition_type_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_descendants ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
018  public function get_descendants()
019  {
020      $descendants = array();
021      foreach ($this->children as $child)
022      {
023          $descendants[] = $child;
024          if ($child->has_children)
025          {
026              $descendants = array_unique(array_merge($descendants, $child->descendants));
027          }
028      }
029      return $descendants;
030  }
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"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
452  public function get_entity($__type="default")
453  {
454      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
455      $this->property_objects_array["{$__type}_entity"] = $object;
456      return $object;
457  }
publicget_entity_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
458  public function get_entity_id($__type="default")
459  {
460      $ids = $this->get_entity_ids($__type, true);
461      return (count($ids)==1 ? $ids[0] : null);
462  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
463  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
464  {
465      $entity_ids = array();
466      $db = orgposition::db();
467      $q  = " SELECT cor_entity.id FROM bus_entity_orgposition INNER JOIN cor_entity ON bus_entity_orgposition.entity_id=cor_entity.id AND bus_entity_orgposition.deleted=0 AND cor_entity.deleted=0 AND bus_entity_orgposition.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND bus_entity_orgposition.entity_orgposition_type_id='" . entity_orgposition::type_id($__type) . "'") . ($__get_primary ? " AND bus_entity_orgposition.primary=1 " : "");
468      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
469      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
470      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
471      $db->query($q);
472      while ($db->next_record())
473      {
474          $entity_ids[] = $db->f("id");
475      }
476      return $entity_ids;
477  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
478  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
479  {
480      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
481      $objects = array();
482      foreach ($ids as $index=>$id)
483      {
484          $objects[$index] = new entity($id);
485      }
486      return $objects;
487  }
publicget_group ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
551  public function get_group($__type="default")
552  {
553      $object = is_null(keyval($this->property_objects_array,"{$__type}_group")) ? new group($this->get_group_id($__type)) : $this->property_objects_array["{$__type}_group"];
554      $this->property_objects_array["{$__type}_group"] = $object;
555      return $object;
556  }
publicget_group_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
557  public function get_group_id($__type="default")
558  {
559      $ids = $this->get_group_ids($__type, true);
560      return (count($ids)==1 ? $ids[0] : null);
561  }
publicget_group_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
562  public function get_group_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
563  {
564      $group_ids = array();
565      $db = orgposition::db();
566      $q  = " SELECT cor_group.id FROM bus_group_orgposition INNER JOIN cor_group ON bus_group_orgposition.group_id=cor_group.id AND bus_group_orgposition.deleted=0 AND cor_group.deleted=0 AND bus_group_orgposition.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND bus_group_orgposition.group_orgposition_type_id='" . group_orgposition::type_id($__type) . "'") . ($__get_primary ? " AND bus_group_orgposition.primary=1 " : "");
567      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
568      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
569      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
570      $db->query($q);
571      while ($db->next_record())
572      {
573          $group_ids[] = $db->f("id");
574      }
575      return $group_ids;
576  }
publicget_group_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
577  public function get_group_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
578  {
579      $ids = $this->get_group_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
580      $objects = array();
581      foreach ($ids as $index=>$id)
582      {
583          $objects[$index] = new group($id);
584      }
585      return $objects;
586  }
publicget_has_children ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
044  public function get_has_children()
045  {
046      return ($this->child_count > 0);
047  }
publicget_has_visible_children ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
101  public function get_has_visible_children()
102  {
103      global $perm;
104      foreach ($this->descendants as $orgposition)
105      {
106          if ($sess->user->check_perms($orgposition->page->perms))
107          {
108              return true;
109          }
110      }
111      return false;
112  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ orgposition_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 orgposition::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
249  }
publicget_is_root ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
082  public function get_is_root()
083  {
084      return ($this->parent->id == 0);
085  }
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_level ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
054  public function get_level()
055  {
056      if ($this->is_root)
057      {
058          return 0;
059      }
060      $level = 1;
061      $parent = $this->parent;
062      while (!$parent->is_root)
063      {
064          $parent = $parent->parent;
065          $level++;
066      }
067      return $level;
068  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ orgposition_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 (orgposition::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
255      {
256          $objects[] = new orgposition($id);
257      }
258      return $objects;
259  }
publicget_orgchart ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
353  public function get_orgchart($__type="default")
354  {
355      $object = is_null(keyval($this->property_objects_array,"{$__type}_orgchart")) ? new orgchart($this->get_orgchart_id($__type)) : $this->property_objects_array["{$__type}_orgchart"];
356      $this->property_objects_array["{$__type}_orgchart"] = $object;
357      return $object;
358  }
publicget_orgchart_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
359  public function get_orgchart_id($__type="default")
360  {
361      $ids = $this->get_orgchart_ids($__type, true);
362      return (count($ids)==1 ? $ids[0] : null);
363  }
publicget_orgchart_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
364  public function get_orgchart_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
365  {
366      $orgchart_ids = array();
367      $db = orgposition::db();
368      $q  = " SELECT bus_orgchart.id FROM bus_orgchart_orgposition INNER JOIN bus_orgchart ON bus_orgchart_orgposition.orgchart_id=bus_orgchart.id AND bus_orgchart_orgposition.deleted=0 AND bus_orgchart.deleted=0 AND bus_orgchart_orgposition.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND bus_orgchart_orgposition.orgchart_orgposition_type_id='" . orgchart_orgposition::type_id($__type) . "'") . ($__get_primary ? " AND bus_orgchart_orgposition.primary=1 " : "");
369      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
370      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
371      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
372      $db->query($q);
373      while ($db->next_record())
374      {
375          $orgchart_ids[] = $db->f("id");
376      }
377      return $orgchart_ids;
378  }
publicget_orgchart_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
379  public function get_orgchart_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
380  {
381      $ids = $this->get_orgchart_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
382      $objects = array();
383      foreach ($ids as $index=>$id)
384      {
385          $objects[$index] = new orgchart($id);
386      }
387      return $objects;
388  }
publicget_orgposition_type ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
341  public function get_orgposition_type()
342  {
343      return new orgposition_type($this->orgposition_type_id);
344  }
publicget_parent ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
070  public function get_parent()
071  {
072      $parent = new orgposition();
073      foreach (orgposition_orgposition::get_ids($this->_id,null) as $orgposition_orgposition_id)
074      {
075          $orgposition_orgposition = new orgposition_orgposition($orgposition_orgposition_id);
076          $parent = new orgposition($orgposition_orgposition->parent_id);
077          break;
078      }
079      return $parent;
080  }
publicget_process ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
848  public function get_process($__type="default")
849  {
850      $object = is_null(keyval($this->property_objects_array,"{$__type}_process")) ? new process($this->get_process_id($__type)) : $this->property_objects_array["{$__type}_process"];
851      $this->property_objects_array["{$__type}_process"] = $object;
852      return $object;
853  }
publicget_process_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
854  public function get_process_id($__type="default")
855  {
856      $ids = $this->get_process_ids($__type, true);
857      return (count($ids)==1 ? $ids[0] : null);
858  }
publicget_process_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
859  public function get_process_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
860  {
861      $process_ids = array();
862      $db = orgposition::db();
863      $q  = " SELECT wfm_process.id FROM wfm_orgposition_process INNER JOIN wfm_process ON wfm_orgposition_process.process_id=wfm_process.id AND wfm_orgposition_process.deleted=0 AND wfm_process.deleted=0 AND wfm_orgposition_process.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND wfm_orgposition_process.orgposition_process_type_id='" . orgposition_process::type_id($__type) . "'") . ($__get_primary ? " AND wfm_orgposition_process.primary=1 " : "");
864      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
865      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
866      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
867      $db->query($q);
868      while ($db->next_record())
869      {
870          $process_ids[] = $db->f("id");
871      }
872      return $process_ids;
873  }
publicget_process_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
874  public function get_process_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
875  {
876      $ids = $this->get_process_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
877      $objects = array();
878      foreach ($ids as $index=>$id)
879      {
880          $objects[$index] = new process($id);
881      }
882      return $objects;
883  }
publicget_project ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
650  public function get_project($__type="default")
651  {
652      $object = is_null(keyval($this->property_objects_array,"{$__type}_project")) ? new project($this->get_project_id($__type)) : $this->property_objects_array["{$__type}_project"];
653      $this->property_objects_array["{$__type}_project"] = $object;
654      return $object;
655  }
publicget_project_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
656  public function get_project_id($__type="default")
657  {
658      $ids = $this->get_project_ids($__type, true);
659      return (count($ids)==1 ? $ids[0] : null);
660  }
publicget_project_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
661  public function get_project_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
662  {
663      $project_ids = array();
664      $db = orgposition::db();
665      $q  = " SELECT prj_project.projectentity_id FROM bus_orgposition_project INNER JOIN prj_project ON bus_orgposition_project.project_projectentity_id=prj_project.projectentity_id AND bus_orgposition_project.deleted=0 AND prj_project.deleted=0 AND bus_orgposition_project.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND bus_orgposition_project.orgposition_project_type_id='" . orgposition_project::type_id($__type) . "'") . ($__get_primary ? " AND bus_orgposition_project.primary=1 " : "");
666      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
667      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
668      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
669      $db->query($q);
670      while ($db->next_record())
671      {
672          $project_ids[] = $db->f("projectentity_id");
673      }
674      return $project_ids;
675  }
publicget_project_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
676  public function get_project_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
677  {
678      $ids = $this->get_project_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
679      $objects = array();
680      foreach ($ids as $index=>$id)
681      {
682          $objects[$index] = new project($id);
683      }
684      return $objects;
685  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
public staticget_root_orgpositions ( )[ orgposition_ext ]
Parameters
No parameters for this method
Code
087  public static function get_root_orgpositions()
088  {
089      $root_orgpositions = array();
090      foreach (self::get_ids() as $orgposition_id)
091      {
092          $orgposition = new orgposition($orgposition_id);
093          if ($orgposition->is_root)
094          {
095              $root_orgpositions[] = $orgposition;
096          }
097      }
098      return $root_orgpositions;
099  }
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_task ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
749  public function get_task($__type="default")
750  {
751      $object = is_null(keyval($this->property_objects_array,"{$__type}_task")) ? new task($this->get_task_id($__type)) : $this->property_objects_array["{$__type}_task"];
752      $this->property_objects_array["{$__type}_task"] = $object;
753      return $object;
754  }
publicget_task_id ( type ["default"] )[ orgposition_db ]
Parameters
optionaltype ["default"]
Code
755  public function get_task_id($__type="default")
756  {
757      $ids = $this->get_task_ids($__type, true);
758      return (count($ids)==1 ? $ids[0] : null);
759  }
publicget_task_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
760  public function get_task_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
761  {
762      $task_ids = array();
763      $db = orgposition::db();
764      $q  = " SELECT prj_task.id FROM prj_orgposition_task INNER JOIN prj_task ON prj_orgposition_task.task_id=prj_task.id AND prj_orgposition_task.deleted=0 AND prj_task.deleted=0 AND prj_orgposition_task.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND prj_orgposition_task.orgposition_task_type_id='" . orgposition_task::type_id($__type) . "'") . ($__get_primary ? " AND prj_orgposition_task.primary=1 " : "");
765      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
766      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
767      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
768      $db->query($q);
769      while ($db->next_record())
770      {
771          $task_ids[] = $db->f("id");
772      }
773      return $task_ids;
774  }
publicget_task_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ orgposition_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
775  public function get_task_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
776  {
777      $ids = $this->get_task_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
778      $objects = array();
779      foreach ($ids as $index=>$id)
780      {
781          $objects[$index] = new task($id);
782      }
783      return $objects;
784  }
publicget_type ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
330  public function get_type()
331  {
332      $type = new orgposition_type($this->_orgposition_type_id);
333      return $type->name;
334  }
protectedinsert ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
117  protected function insert()
118  {
119      $db = orgposition::db();
120      $q  = " INSERT INTO bus_orgposition ( ";
121      $q .= $db->param_string("name") . ", ";
122      $q .= $db->param_string("description") . ", ";
123      $q .= $db->param_string("orgposition_type_id") . ", ";
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->_orgposition_type_id) . ", ";
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 ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
088  public function map()
089  {
090      $this->_name = array_key_exists("orgposition:name",$_REQUEST) ? reqval("orgposition:name") : $this->_name;
091      $this->_description = array_key_exists("orgposition:description",$_REQUEST) ? reqval("orgposition:description") : $this->_description;
092      $this->_orgposition_type_id = array_key_exists("orgposition:orgposition_type_id",$_REQUEST) ? reqval("orgposition:orgposition_type_id") : $this->_orgposition_type_id;
093      $this->_mdate = array_key_exists("orgposition:mdate",$_REQUEST) ? reqval("orgposition:mdate") : $this->_mdate;
094      $this->_cdate = array_key_exists("orgposition:cdate",$_REQUEST) ? reqval("orgposition:cdate") : $this->_cdate;
095      $this->_deleted = array_key_exists("orgposition:deleted",$_REQUEST) ? reqval("orgposition:deleted") : $this->_deleted;
096  }
publicpurge ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
176  public function purge()
177  {
178      $db = orgposition::db();
179      $q  = " DELETE FROM bus_orgposition ";
180      $q .= " WHERE id = " . $this->_id;
181      $db->query($q);
182      return true;
183  }
public staticsearch ( keyword )[ orgposition_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"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
489  public function set_entity($__v, $__type="default")
490  {
491      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
492      if (is_null($__v))
493      {
494          $rel = new entity_orgposition(null,$object->id,$this->id,entity_orgposition::type_id($__type));
495          $rel->delete();
496          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
497          {
498              $this->property_objects_array["{$__type}_entity"] = null;
499          }
500      }
501      else
502      {
503          $id = $object->id;
504          $object = $__v;
505          $object->id = $__v->id>0 ? $__v->id : $id;
506          $object->commit();
507          $this->set_entity_ids(array($object->id),$__type);
508      }
509  }
publicset_entity_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
510  public function set_entity_id($__v, $__type="default")
511  {
512      $this->set_entity_ids(array($__v),$__type);
513  }
publicset_entity_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
514  public function set_entity_ids($__v, $__type="default")
515  {
516      if ($this->id == 0)
517      {
518          $this->commit();
519      }
520      $type_id = entity_orgposition::type_id($__type);
521      entity_orgposition::delete_all(null,$this->id,$type_id);
522      if (is_array($__v))
523      {
524          foreach ($__v as $index=>$id)
525          {
526              $object = new entity_orgposition(null,$id,$this->id,$type_id);
527              $object->deleted = false;
528              $object->entity_orgposition_type_id = $type_id;
529              $object->commit();
530              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
531              {
532                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
533              }
534          }
535          $this->_dirty = true;
536      }
537  }
publicset_entity_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
538  public function set_entity_list($__v, $__type="default")
539  {
540      if (is_array($__v))
541      {
542          $ids = array();
543          foreach ($__v as $index=>$object)
544          {
545              $ids[] = $object->id;
546          }
547          $this->set_entity_ids($ids,$__type);
548      }
549  }
publicset_group ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
588  public function set_group($__v, $__type="default")
589  {
590      $object = is_null(keyval($this->property_objects_array,"{$__type}_group")) ? new group($this->get_group_id($__type)) : $this->property_objects_array["{$__type}_group"];
591      if (is_null($__v))
592      {
593          $rel = new group_orgposition(null,$object->id,$this->id,group_orgposition::type_id($__type));
594          $rel->delete();
595          if (!is_null(keyval($this->property_objects_array,"{$__type}_group")))
596          {
597              $this->property_objects_array["{$__type}_group"] = null;
598          }
599      }
600      else
601      {
602          $id = $object->id;
603          $object = $__v;
604          $object->id = $__v->id>0 ? $__v->id : $id;
605          $object->commit();
606          $this->set_group_ids(array($object->id),$__type);
607      }
608  }
publicset_group_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
609  public function set_group_id($__v, $__type="default")
610  {
611      $this->set_group_ids(array($__v),$__type);
612  }
publicset_group_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
613  public function set_group_ids($__v, $__type="default")
614  {
615      if ($this->id == 0)
616      {
617          $this->commit();
618      }
619      $type_id = group_orgposition::type_id($__type);
620      group_orgposition::delete_all(null,$this->id,$type_id);
621      if (is_array($__v))
622      {
623          foreach ($__v as $index=>$id)
624          {
625              $object = new group_orgposition(null,$id,$this->id,$type_id);
626              $object->deleted = false;
627              $object->group_orgposition_type_id = $type_id;
628              $object->commit();
629              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_group")))
630              {
631                  $this->property_objects_array["{$__type}_group"] = new group($object->group_id);
632              }
633          }
634          $this->_dirty = true;
635      }
636  }
publicset_group_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
637  public function set_group_list($__v, $__type="default")
638  {
639      if (is_array($__v))
640      {
641          $ids = array();
642          foreach ($__v as $index=>$object)
643          {
644              $ids[] = $object->id;
645          }
646          $this->set_group_ids($ids,$__type);
647      }
648  }
publicset_orgchart ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
390  public function set_orgchart($__v, $__type="default")
391  {
392      $object = is_null(keyval($this->property_objects_array,"{$__type}_orgchart")) ? new orgchart($this->get_orgchart_id($__type)) : $this->property_objects_array["{$__type}_orgchart"];
393      if (is_null($__v))
394      {
395          $rel = new orgchart_orgposition(null,$object->id,$this->id,orgchart_orgposition::type_id($__type));
396          $rel->delete();
397          if (!is_null(keyval($this->property_objects_array,"{$__type}_orgchart")))
398          {
399              $this->property_objects_array["{$__type}_orgchart"] = null;
400          }
401      }
402      else
403      {
404          $id = $object->id;
405          $object = $__v;
406          $object->id = $__v->id>0 ? $__v->id : $id;
407          $object->commit();
408          $this->set_orgchart_ids(array($object->id),$__type);
409      }
410  }
publicset_orgchart_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
411  public function set_orgchart_id($__v, $__type="default")
412  {
413      $this->set_orgchart_ids(array($__v),$__type);
414  }
publicset_orgchart_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
415  public function set_orgchart_ids($__v, $__type="default")
416  {
417      if ($this->id == 0)
418      {
419          $this->commit();
420      }
421      $type_id = orgchart_orgposition::type_id($__type);
422      orgchart_orgposition::delete_all(null,$this->id,$type_id);
423      if (is_array($__v))
424      {
425          foreach ($__v as $index=>$id)
426          {
427              $object = new orgchart_orgposition(null,$id,$this->id,$type_id);
428              $object->deleted = false;
429              $object->orgchart_orgposition_type_id = $type_id;
430              $object->commit();
431              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_orgchart")))
432              {
433                  $this->property_objects_array["{$__type}_orgchart"] = new orgchart($object->orgchart_id);
434              }
435          }
436          $this->_dirty = true;
437      }
438  }
publicset_orgchart_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
439  public function set_orgchart_list($__v, $__type="default")
440  {
441      if (is_array($__v))
442      {
443          $ids = array();
444          foreach ($__v as $index=>$object)
445          {
446              $ids[] = $object->id;
447          }
448          $this->set_orgchart_ids($ids,$__type);
449      }
450  }
publicset_orgposition_type ( v )[ orgposition_db ]
Parameters
requiredv
Code
345  public function set_orgposition_type($v)
346  {
347      if ($v->id > 0)
348      {
349          $this->orgposition_type_id = $v->id;
350      }
351  }
publicset_process ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
885  public function set_process($__v, $__type="default")
886  {
887      $object = is_null(keyval($this->property_objects_array,"{$__type}_process")) ? new process($this->get_process_id($__type)) : $this->property_objects_array["{$__type}_process"];
888      if (is_null($__v))
889      {
890          $rel = new orgposition_process(null,$this->id,$object->id,orgposition_process::type_id($__type));
891          $rel->delete();
892          if (!is_null(keyval($this->property_objects_array,"{$__type}_process")))
893          {
894              $this->property_objects_array["{$__type}_process"] = null;
895          }
896      }
897      else
898      {
899          $id = $object->id;
900          $object = $__v;
901          $object->id = $__v->id>0 ? $__v->id : $id;
902          $object->commit();
903          $this->set_process_ids(array($object->id),$__type);
904      }
905  }
publicset_process_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
906  public function set_process_id($__v, $__type="default")
907  {
908      $this->set_process_ids(array($__v),$__type);
909  }
publicset_process_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
910  public function set_process_ids($__v, $__type="default")
911  {
912      if ($this->id == 0)
913      {
914          $this->commit();
915      }
916      $type_id = orgposition_process::type_id($__type);
917      orgposition_process::delete_all($this->id,null,$type_id);
918      if (is_array($__v))
919      {
920          foreach ($__v as $index=>$id)
921          {
922              $object = new orgposition_process(null,$this->id,$id,$type_id);
923              $object->deleted = false;
924              $object->orgposition_process_type_id = $type_id;
925              $object->commit();
926              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_process")))
927              {
928                  $this->property_objects_array["{$__type}_process"] = new process($object->process_id);
929              }
930          }
931          $this->_dirty = true;
932      }
933  }
publicset_process_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
934  public function set_process_list($__v, $__type="default")
935  {
936      if (is_array($__v))
937      {
938          $ids = array();
939          foreach ($__v as $index=>$object)
940          {
941              $ids[] = $object->id;
942          }
943          $this->set_process_ids($ids,$__type);
944      }
945  }
publicset_project ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
687  public function set_project($__v, $__type="default")
688  {
689      $object = is_null(keyval($this->property_objects_array,"{$__type}_project")) ? new project($this->get_project_id($__type)) : $this->property_objects_array["{$__type}_project"];
690      if (is_null($__v))
691      {
692          $rel = new orgposition_project(null,$this->id,$object->id,orgposition_project::type_id($__type));
693          $rel->delete();
694          if (!is_null(keyval($this->property_objects_array,"{$__type}_project")))
695          {
696              $this->property_objects_array["{$__type}_project"] = null;
697          }
698      }
699      else
700      {
701          $id = $object->id;
702          $object = $__v;
703          $object->id = $__v->id>0 ? $__v->id : $id;
704          $object->commit();
705          $this->set_project_ids(array($object->id),$__type);
706      }
707  }
publicset_project_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
708  public function set_project_id($__v, $__type="default")
709  {
710      $this->set_project_ids(array($__v),$__type);
711  }
publicset_project_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
712  public function set_project_ids($__v, $__type="default")
713  {
714      if ($this->id == 0)
715      {
716          $this->commit();
717      }
718      $type_id = orgposition_project::type_id($__type);
719      orgposition_project::delete_all($this->id,null,$type_id);
720      if (is_array($__v))
721      {
722          foreach ($__v as $index=>$id)
723          {
724              $object = new orgposition_project(null,$this->id,$id,$type_id);
725              $object->deleted = false;
726              $object->orgposition_project_type_id = $type_id;
727              $object->commit();
728              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_project")))
729              {
730                  $this->property_objects_array["{$__type}_project"] = new project($object->project_id);
731              }
732          }
733          $this->_dirty = true;
734      }
735  }
publicset_project_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
736  public function set_project_list($__v, $__type="default")
737  {
738      if (is_array($__v))
739      {
740          $ids = array();
741          foreach ($__v as $index=>$object)
742          {
743              $ids[] = $object->id;
744          }
745          $this->set_project_ids($ids,$__type);
746      }
747  }
publicset_task ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
786  public function set_task($__v, $__type="default")
787  {
788      $object = is_null(keyval($this->property_objects_array,"{$__type}_task")) ? new task($this->get_task_id($__type)) : $this->property_objects_array["{$__type}_task"];
789      if (is_null($__v))
790      {
791          $rel = new orgposition_task(null,$this->id,$object->id,orgposition_task::type_id($__type));
792          $rel->delete();
793          if (!is_null(keyval($this->property_objects_array,"{$__type}_task")))
794          {
795              $this->property_objects_array["{$__type}_task"] = null;
796          }
797      }
798      else
799      {
800          $id = $object->id;
801          $object = $__v;
802          $object->id = $__v->id>0 ? $__v->id : $id;
803          $object->commit();
804          $this->set_task_ids(array($object->id),$__type);
805      }
806  }
publicset_task_id ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
807  public function set_task_id($__v, $__type="default")
808  {
809      $this->set_task_ids(array($__v),$__type);
810  }
publicset_task_ids ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
811  public function set_task_ids($__v, $__type="default")
812  {
813      if ($this->id == 0)
814      {
815          $this->commit();
816      }
817      $type_id = orgposition_task::type_id($__type);
818      orgposition_task::delete_all($this->id,null,$type_id);
819      if (is_array($__v))
820      {
821          foreach ($__v as $index=>$id)
822          {
823              $object = new orgposition_task(null,$this->id,$id,$type_id);
824              $object->deleted = false;
825              $object->orgposition_task_type_id = $type_id;
826              $object->commit();
827              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_task")))
828              {
829                  $this->property_objects_array["{$__type}_task"] = new task($object->task_id);
830              }
831          }
832          $this->_dirty = true;
833      }
834  }
publicset_task_list ( v , type ["default"] )[ orgposition_db ]
Parameters
requiredv
optionaltype ["default"]
Code
835  public function set_task_list($__v, $__type="default")
836  {
837      if (is_array($__v))
838      {
839          $ids = array();
840          foreach ($__v as $index=>$object)
841          {
842              $ids[] = $object->id;
843          }
844          $this->set_task_ids($ids,$__type);
845      }
846  }
publicset_type ( v )[ orgposition_db ]
Parameters
requiredv
Code
335  public function set_type($v)
336  {
337      $type = new orgposition_type(null, $v);
338      $this->orgposition_type_id = $type->id;
339  }
public__toString ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
319  public function __toString()
320  {
321      return (is_null($this->name) ? "" : $this->name);
322  }
public statictype_id ( type_name )[ orgposition_db ]
Parameters
requiredtype_name
Code
324  public static function type_id($__type_name)
325  {
326      $type = new orgposition_type(null, $__type_name);
327      return $type->id;
328  }
publicundelete ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
165  public function undelete()
166  {
167      $db = orgposition::db();
168      $q  = " UPDATE bus_orgposition SET ";
169      $q .= " deleted = 0 ";
170      $q .= " WHERE id = " . $this->_id;
171      $db->query($q);
172      $this->deleted = false;
173      return true;
174  }
protectedupdate ( )[ orgposition_db ]
Parameters
No parameters for this method
Code
140  protected function update()
141  {
142      $db = orgposition::db();
143      $q  = " UPDATE bus_orgposition 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("orgposition_type_id") . " = " . $db->value_string($this->_orgposition_type_id) . ", ";
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
publicancestors[ orgposition_ext ]
Code
032  public function get_ancestors()
033  {
034      $ancestors = array();
035      $orgposition = $this;
036      while (!$orgposition->parent->is_root)
037      {
038          $ancestors[] = $orgposition->parent;
039          $orgposition = $orgposition->parent;
040      }
041      return $ancestors;
042  }
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicchild_count[ orgposition_ext ]
Code
049  public function get_child_count()
050  {
051      return count(orgposition_orgposition::get_ids(null,$this->_id));
052  }
publicchildren[ orgposition_ext ]
Code
007  public function get_children()
008  {
009      $children = array();
010      foreach (orgposition_orgposition::get_ids(null,$this->_id) as $orgposition_orgposition_id)
011      {
012          $orgposition_orgposition = new orgposition_orgposition($orgposition_orgposition_id);
013          $children[] = new orgposition($orgposition_orgposition->child_id);
014      }
015      return $children;
016  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ orgposition_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 = orgposition::db();
192      $data = array();
193      $q  = " SELECT $colstring ";
194      $q .= " FROM bus_orgposition ";
195      $q .= " WHERE bus_orgposition.deleted = 0 ";
196      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
197      $q .= array_key_exists("orgposition_type_id",$lookups) ? " AND bus_orgposition.orgposition_type_id='" . $lookups["orgposition_type_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  }
publicdescendants[ orgposition_ext ]
Code
018  public function get_descendants()
019  {
020      $descendants = array();
021      foreach ($this->children as $child)
022      {
023          $descendants[] = $child;
024          if ($child->has_children)
025          {
026              $descendants = array_unique(array_merge($descendants, $child->descendants));
027          }
028      }
029      return $descendants;
030  }
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[ orgposition_db ]
Code
452  public function get_entity($__type="default")
453  {
454      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
455      $this->property_objects_array["{$__type}_entity"] = $object;
456      return $object;
457  }
Code
489  public function set_entity($__v, $__type="default")
490  {
491      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
492      if (is_null($__v))
493      {
494          $rel = new entity_orgposition(null,$object->id,$this->id,entity_orgposition::type_id($__type));
495          $rel->delete();
496          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
497          {
498              $this->property_objects_array["{$__type}_entity"] = null;
499          }
500      }
501      else
502      {
503          $id = $object->id;
504          $object = $__v;
505          $object->id = $__v->id>0 ? $__v->id : $id;
506          $object->commit();
507          $this->set_entity_ids(array($object->id),$__type);
508      }
509  }
publicentity_id[ orgposition_db ]
Code
458  public function get_entity_id($__type="default")
459  {
460      $ids = $this->get_entity_ids($__type, true);
461      return (count($ids)==1 ? $ids[0] : null);
462  }
Code
510  public function set_entity_id($__v, $__type="default")
511  {
512      $this->set_entity_ids(array($__v),$__type);
513  }
publicentity_ids[ orgposition_db ]
Code
463  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
464  {
465      $entity_ids = array();
466      $db = orgposition::db();
467      $q  = " SELECT cor_entity.id FROM bus_entity_orgposition INNER JOIN cor_entity ON bus_entity_orgposition.entity_id=cor_entity.id AND bus_entity_orgposition.deleted=0 AND cor_entity.deleted=0 AND bus_entity_orgposition.orgposition_id='$this->id' " . (is_null($__type) ? "" : " AND bus_entity_orgposition.entity_orgposition_type_id='" . entity_orgposition::type_id($__type) . "'") . ($__get_primary ? " AND bus_entity_orgposition.primary=1 " : "");
468      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
469      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
470      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
471      $db->query($q);
472      while ($db->next_record())
473      {
474          $entity_ids[] = $db->f("id");
475      }
476      return $entity_ids;
477  }
Code
514  public function set_entity_ids($__v, $__type="default")
515  {
516      if ($this->id == 0)
517      {
518          $this->commit();
519      }
520      $type_id = entity_orgposition::type_id($__type);
521      entity_orgposition::delete_all(null,$this->id,$type_id);
522      if (is_array($__v))
523      {
524          foreach ($__v as $index=>$id)
525          {
526              $object = new entity_orgposition(null,$id,$this->id,$type_id);
527              $object->deleted = false;
528              $object->entity_orgposition_type_id = $type_id;
529              $object->commit();
530              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
531              {
532                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
533              }
534          }
535          $this->_dirty = true;
536      }
537  }
publicentity_list[ orgposition_db ]
Code
478  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
479  {
480      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
481      $objects = array();
482      foreach ($ids as $index=>$id)
483      {
484          $objects[$index] = new entity($id);
485      }
486      return $objects;
487  }
Code
538  public function set_entity_list($__v, $__type="default")
539  {
540      if (is_array($__v))
541      {
542          $ids = array();
543          foreach ($__v as $index=>$object)
544          {
545              $ids[] = $object->id;
546          }
547          $this->set_entity_ids($ids,$__type);
548      }
549  }
publicgroup[ orgposition_db ]
Code
551  public function get_group($__type="default")
552  {
553      $object = is_null(keyval($this->property_objects_array,"{$__type}_group")) ? new group($this->get_group_id($__type)) : $this->property_objects_array["{$__type}_group"];
554      $this->property_objects_array["{$__type}_group"] = $object;
555      return $object;
556  }
Code
588  public function set_group($__v, $__type="default")
589  {
590      $object = is_null(keyval($this->property_objects_array,"{$__type}_group")) ? new group($this->get_group_id($__type)) : $this->property_objects_array["{$__type}_group"];
591      if (is_null($__v))
592      {
593          $rel = new group_orgposition(null,$object->id,$this->id,group_orgposition::type_id($__type));
594          $rel->delete();
595          if (!is_null(keyval($this->property_objects_array,"{$__type}_group")))
596          {
597              $this->property_objects_array["{$__type}_group"] = null;
598          }
599      }
600      else
601      {
602          $id = $object->id;
603          $object = $__v