Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class software extends software_ext

Hide Inherited MembersAsset Management
Description
No description.
 
Constants
constantTABLENAME ["am_software"][ software ]
 
Properties
protected_asset_id[ software_db ]
protected_asset_id_dirty[ software_db ]
protected_asset_type_id[ asset_db ]
protected_asset_type_id_dirty[ asset_db ]
protected_assetstatus_id[ asset_db ]
protected_assetstatus_id_dirty[ asset_db ]
protected_capex[ asset_db ]
protected_capex_dirty[ asset_db ]
protected_cdate[ software_db ]
protected_cdate_dirty[ software_db ]
protected_deleted[ software_db ]
protected_deleted_dirty[ software_db ]
protected_department_id[ asset_db ]
protected_department_id_dirty[ asset_db ]
protected_description[ asset_db ]
protected_description_dirty[ asset_db ]
protected_dirty[ obj ]
protected_id[ asset_db ]
protected__id[ software_db ]
protected__id_dirty[ software_db ]
protected_id_dirty[ asset_db ]
protected_mdate[ software_db ]
protected_mdate_dirty[ software_db ]
protected_model[ asset_db ]
protected_model_dirty[ asset_db ]
protected_name[ asset_db ]
protected_name_dirty[ asset_db ]
protected_part_number[ asset_db ]
protected_part_number_dirty[ asset_db ]
publicproperty_objects_array[ obj ]
protected_purpose[ software_db ]
protected_purpose_dirty[ software_db ]
protected_quantity[ asset_db ]
protected_quantity_dirty[ asset_db ]
protected_requirements[ software_db ]
protected_requirements_dirty[ software_db ]
protected_serial_number[ asset_db ]
protected_serial_number_dirty[ asset_db ]
protected_sku[ asset_db ]
protected_sku_dirty[ asset_db ]
protected_unit_price[ asset_db ]
protected_unit_price_dirty[ asset_db ]
protected_version[ software_db ]
protected_version_dirty[ software_db ]
 
Methods
publiccommit ( )[ software_db ]
Parameters
No parameters for this method
Code
152  public function commit()
153  {
154      if ($this->_asset_id > 0)
155      {
156          $this->update();
157      }
158      else
159      {
160          $this->insert();
161      }
162 
163      foreach ($this->property_objects_array as $property=>$object)
164      {
165          $this->{$property} = $object;
166      }
167 
168      return true;
169  }
public__construct ( asset_id )[ software_db ]
Parameters
optionalasset_id
Code
046  public function __construct($__asset_id=null)
047  {
048      $this->__id = 0;
049      $this->_asset_id = 0;
050      $this->_version = "";
051      $this->_purpose = "";
052      $this->_requirements = "";
053      $this->_mdate = null;
054      $this->_cdate = null;
055      $this->_deleted = false;
056      $this->_id = 0;
057      $this->_name = "";
058      $this->_description = "";
059      $this->_asset_type_id = 0;
060      $this->_assetstatus_id = 0;
061      $this->_department_id = 0;
062      $this->_sku = "";
063      $this->_model = "";
064      $this->_part_number = "";
065      $this->_serial_number = "";
066      $this->_unit_price = 0;
067      $this->_quantity = 0;
068      $this->_capex = false;
069 
070      $this->__id_dirty = false;
071      $this->_asset_id_dirty = false;
072      $this->_version_dirty = false;
073      $this->_purpose_dirty = false;
074      $this->_requirements_dirty = false;
075      $this->_mdate_dirty = false;
076      $this->_cdate_dirty = false;
077      $this->_deleted_dirty = false;
078      $this->_id_dirty = false;
079      $this->_name_dirty = false;
080      $this->_description_dirty = false;
081      $this->_asset_type_id_dirty = false;
082      $this->_assetstatus_id_dirty = false;
083      $this->_department_id_dirty = false;
084      $this->_sku_dirty = false;
085      $this->_model_dirty = false;
086      $this->_part_number_dirty = false;
087      $this->_serial_number_dirty = false;
088      $this->_unit_price_dirty = false;
089      $this->_quantity_dirty = false;
090      $this->_capex_dirty = false;
091 
092      if (is_null($__asset_id))
093      {
094          return;
095      }
096 
097      $db = software::db();
098      $q  = " SELECT am_asset.id,am_asset.name,am_asset.description,am_asset.asset_type_id,am_asset.assetstatus_id,am_asset.department_id,am_asset.sku,am_asset.model,am_asset.part_number,am_asset.serial_number,am_asset.unit_price,am_asset.quantity,am_asset.capex,am_software._id,am_software.asset_id,am_software.version,am_software.purpose,am_software.requirements,am_software.mdate,am_software.cdate,am_software.deleted ";
099      $q .= " FROM am_software ";
100      $q .= " INNER JOIN am_asset ON am_software.asset_id=am_asset.id ";
101      $q .= is_null($__asset_id) ? "" : " AND am_asset.id='$__asset_id' ";       
102 
103      $db->query($q);
104      if ($db->next_record() && $db->num_rows() == 1)
105      {
106          $this->_id = $db->f("id");
107          $this->_name = $db->f("name");
108          $this->_description = $db->f("description");
109          $this->_asset_type_id = $db->f("asset_type_id");
110          $this->_assetstatus_id = $db->f("assetstatus_id");
111          $this->_department_id = $db->f("department_id");
112          $this->_sku = $db->f("sku");
113          $this->_model = $db->f("model");
114          $this->_part_number = $db->f("part_number");
115          $this->_serial_number = $db->f("serial_number");
116          $this->_unit_price = $db->f("unit_price");
117          $this->_quantity = $db->f("quantity");
118          $this->_capex = $db->f("capex");
119          $this->__id = $db->f("_id");
120          $this->_asset_id = $db->f("asset_id");
121          $this->_version = $db->f("version");
122          $this->_purpose = $db->f("purpose");
123          $this->_requirements = $db->f("requirements");
124          $this->_mdate = $db->f("mdate");
125          $this->_cdate = $db->f("cdate");
126          $this->_deleted = $db->f("deleted");
127      }
128  }
protected staticdb ( )[ software_db ]
Parameters
No parameters for this method
Code
501  protected static function db()
502  {
503      return new db();
504  }
publicdelete ( )[ software_db ]
Parameters
No parameters for this method
Code
213  public function delete()
214  {
215      parent::delete();
216      $db = software::db();
217      $q  = " UPDATE am_software SET ";
218      $q .= " deleted = 1 ";
219      $q .= " WHERE asset_id = " . $this->_asset_id;
220      $db->query($q);
221      $this->deleted = true;
222      return true;
223  }
public staticdelete_all ( )[ software_db ]
Parameters
No parameters for this method
Code
326  public static function delete_all()
327  {
328      $db = software::db();
329      $q  = " UPDATE am_software SET ";
330      $q .= " deleted = 1 ";
331     
332      $db->query($q);
333      return true;
334  }
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_asset ( )[ software_db ]
Parameters
No parameters for this method
Code
390  public function get_asset()
391  {
392      return new asset($this->asset_id);
393  }
publicget_asset_type ( )[ asset_db ]
Parameters
No parameters for this method
Code
424  public function get_asset_type()
425  {
426      return new asset_type($this->asset_type_id);
427  }
publicget_assetdate ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
460  public function get_assetdate($__type="default")
461  {
462      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
463      $this->property_objects_array["{$__type}_assetdate"] = $object;
464      return $object;
465  }
publicget_assetdate_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
466  public function get_assetdate_id($__type="default")
467  {
468      $ids = $this->get_assetdate_ids($__type, true);
469      return (count($ids)==1 ? $ids[0] : null);
470  }
publicget_assetdate_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
471  public function get_assetdate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
472  {
473      $assetdate_ids = array();
474      $db = asset::db();
475      $q  = " SELECT am_assetdate.id FROM am_asset_assetdate INNER JOIN am_assetdate ON am_asset_assetdate.assetdate_id=am_assetdate.id AND am_asset_assetdate.deleted=0 AND am_assetdate.deleted=0 AND am_asset_assetdate.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_assetdate.asset_assetdate_type_id='" . asset_assetdate::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_assetdate.primary=1 " : "");
476      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
477      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
478      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
479      $db->query($q);
480      while ($db->next_record())
481      {
482          $assetdate_ids[] = $db->f("id");
483      }
484      return $assetdate_ids;
485  }
publicget_assetdate_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
486  public function get_assetdate_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
487  {
488      $ids = $this->get_assetdate_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
489      $objects = array();
490      foreach ($ids as $index=>$id)
491      {
492          $objects[$index] = new assetdate($id);
493      }
494      return $objects;
495  }
publicget_assetstatus ( )[ asset_db ]
Parameters
No parameters for this method
Code
436  public function get_assetstatus()
437  {
438      return new assetstatus($this->assetstatus_id);
439  }
publicget_business ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
657  public function get_business($__type="default")
658  {
659      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
660      $this->property_objects_array["{$__type}_business"] = $object;
661      return $object;
662  }
publicget_business_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
663  public function get_business_id($__type="default")
664  {
665      $ids = $this->get_business_ids($__type, true);
666      return (count($ids)==1 ? $ids[0] : null);
667  }
publicget_business_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
668  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
669  {
670      $business_ids = array();
671      $db = asset::db();
672      $q  = " SELECT bus_business.entity_id FROM am_asset_business INNER JOIN bus_business ON am_asset_business.business_entity_id=bus_business.entity_id AND am_asset_business.deleted=0 AND bus_business.deleted=0 AND am_asset_business.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_business.asset_business_type_id='" . asset_business::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_business.primary=1 " : "");
673      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
674      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
675      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
676      $db->query($q);
677      while ($db->next_record())
678      {
679          $business_ids[] = $db->f("entity_id");
680      }
681      return $business_ids;
682  }
publicget_business_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
683  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
684  {
685      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
686      $objects = array();
687      foreach ($ids as $index=>$id)
688      {
689          $objects[$index] = new business($id);
690      }
691      return $objects;
692  }
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] )[ software_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
247  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
248  {
249      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
250      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
251      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
252 
253      $db = software::db();
254      $data = array();
255      $q  = " SELECT $colstring ";
256      $q .= " FROM am_software ";
257      $q .= " INNER JOIN am_asset ON am_software.asset_id=am_asset.id ";
258      $q .= array_key_exists("asset_type_id",$lookups) ? " AND am_asset.asset_type_id='" . $lookups["asset_type_id"] . "' " : "";
259      $q .= array_key_exists("assetstatus_id",$lookups) ? " AND am_asset.assetstatus_id='" . $lookups["assetstatus_id"] . "' " : "";
260      $q .= array_key_exists("department_id",$lookups) ? " AND am_asset.department_id='" . $lookups["department_id"] . "' " : "";
261      $q .= " WHERE am_software.deleted = 0 ";
262      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
263 
264      if (is_string($__order))
265      {
266          $q .= "ORDER BY " . $__order;
267      }
268      else if (is_array($__order) and count($__order)>0)
269      {
270          $orderings = array();
271          foreach ($__order as $col=>$dir)
272          {
273              $orderings[] = " $col $dir ";
274          }
275          $q .= "ORDER BY " . implode(", ", $orderings);
276      }
277      else if (is_object($__order))
278      {
279          $q .= "";
280      }
281      else
282      {
283          // THERE IS NO `order` COLUMN ON THIS OBJECT
284      }
285 
286      if (!is_null($__limit))
287      {
288          $q .= " LIMIT $__offset , $__limit ";
289      }
290 
291      $db->query($q);
292 
293      if (count($colarray)>1 || $colstring=="*")
294      {
295          while ($db->next_record())
296          {
297              $data[] = $db->record;
298          }
299      }
300      else
301      {
302          while ($db->next_record())
303          {
304              $data[] = $db->f(0);
305          }
306      }
307 
308      return $data;
309  }
publicget_department ( )[ asset_db ]
Parameters
No parameters for this method
Code
448  public function get_department()
449  {
450      return new department($this->department_id);
451  }
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] )[ software_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
311  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
312  {
313      return software::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
314  }
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_license ( type ["default"] )[ software_db ]
Parameters
optionaltype ["default"]
Code
402  public function get_license($__type="default")
403  {
404      $object = is_null(keyval($this->property_objects_array,"{$__type}_license")) ? new license($this->get_license_id($__type)) : $this->property_objects_array["{$__type}_license"];
405      $this->property_objects_array["{$__type}_license"] = $object;
406      return $object;
407  }
publicget_license_id ( type ["default"] )[ software_db ]
Parameters
optionaltype ["default"]
Code
408  public function get_license_id($__type="default")
409  {
410      $ids = $this->get_license_ids($__type, true);
411      return (count($ids)==1 ? $ids[0] : null);
412  }
publicget_license_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ software_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
413  public function get_license_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
414  {
415      $license_ids = array();
416      $db = software::db();
417      $q  = " SELECT am_license.asset_id FROM am_license_software INNER JOIN am_license ON am_license_software.license_asset_id=am_license.asset_id AND am_license_software.deleted=0 AND am_license.deleted=0 AND am_license_software.software_asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_license_software.license_software_type_id='" . license_software::type_id($__type) . "'") . ($__get_primary ? " AND am_license_software.primary=1 " : "");
418      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
419      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
420      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
421      $db->query($q);
422      while ($db->next_record())
423      {
424          $license_ids[] = $db->f("asset_id");
425      }
426      return $license_ids;
427  }
publicget_license_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ software_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
428  public function get_license_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
429  {
430      $ids = $this->get_license_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
431      $objects = array();
432      foreach ($ids as $index=>$id)
433      {
434          $objects[$index] = new license($id);
435      }
436      return $objects;
437  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ software_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
316  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
317  {
318      $objects = array();
319      foreach (software::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
320      {
321          $objects[] = new software($id);
322      }
323      return $objects;
324  }
publicget_office ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
558  public function get_office($__type="default")
559  {
560      $object = is_null(keyval($this->property_objects_array,"{$__type}_office")) ? new office($this->get_office_id($__type)) : $this->property_objects_array["{$__type}_office"];
561      $this->property_objects_array["{$__type}_office"] = $object;
562      return $object;
563  }
publicget_office_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
564  public function get_office_id($__type="default")
565  {
566      $ids = $this->get_office_ids($__type, true);
567      return (count($ids)==1 ? $ids[0] : null);
568  }
publicget_office_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
569  public function get_office_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
570  {
571      $office_ids = array();
572      $db = asset::db();
573      $q  = " SELECT bus_office.entity_id FROM am_asset_office INNER JOIN bus_office ON am_asset_office.office_entity_id=bus_office.entity_id AND am_asset_office.deleted=0 AND bus_office.deleted=0 AND am_asset_office.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_office.asset_office_type_id='" . asset_office::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_office.primary=1 " : "");
574      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
575      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
576      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
577      $db->query($q);
578      while ($db->next_record())
579      {
580          $office_ids[] = $db->f("entity_id");
581      }
582      return $office_ids;
583  }
publicget_office_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
584  public function get_office_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
585  {
586      $ids = $this->get_office_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
587      $objects = array();
588      foreach ($ids as $index=>$id)
589      {
590          $objects[$index] = new office($id);
591      }
592      return $objects;
593  }
publicget_person ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
756  public function get_person($__type="default")
757  {
758      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
759      $this->property_objects_array["{$__type}_person"] = $object;
760      return $object;
761  }
publicget_person_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
762  public function get_person_id($__type="default")
763  {
764      $ids = $this->get_person_ids($__type, true);
765      return (count($ids)==1 ? $ids[0] : null);
766  }
publicget_person_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
767  public function get_person_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
768  {
769      $person_ids = array();
770      $db = asset::db();
771      $q  = " SELECT cor_person.entity_id FROM am_asset_person INNER JOIN cor_person ON am_asset_person.person_entity_id=cor_person.entity_id AND am_asset_person.deleted=0 AND cor_person.deleted=0 AND am_asset_person.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_person.asset_person_type_id='" . asset_person::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_person.primary=1 " : "");
772      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
773      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
774      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
775      $db->query($q);
776      while ($db->next_record())
777      {
778          $person_ids[] = $db->f("entity_id");
779      }
780      return $person_ids;
781  }
publicget_person_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
782  public function get_person_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
783  {
784      $ids = $this->get_person_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
785      $objects = array();
786      foreach ($ids as $index=>$id)
787      {
788          $objects[$index] = new person($id);
789      }
790      return $objects;
791  }
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 ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
953  public function get_resource($__type="default")
954  {
955      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
956      $this->property_objects_array["{$__type}_resource"] = $object;
957      return $object;
958  }
publicget_resource_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
959  public function get_resource_id($__type="default")
960  {
961      $ids = $this->get_resource_ids($__type, true);
962      return (count($ids)==1 ? $ids[0] : null);
963  }
publicget_resource_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
964  public function get_resource_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
965  {
966      $resource_ids = array();
967      $db = asset::db();
968      $q  = " SELECT cor_resource.id FROM am_asset_resource INNER JOIN cor_resource ON am_asset_resource.resource_id=cor_resource.id AND am_asset_resource.deleted=0 AND cor_resource.deleted=0 AND am_asset_resource.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_resource.asset_resource_type_id='" . asset_resource::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_resource.primary=1 " : "");
969      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
970      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
971      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
972      $db->query($q);
973      while ($db->next_record())
974      {
975          $resource_ids[] = $db->f("id");
976      }
977      return $resource_ids;
978  }
publicget_resource_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
979  public function get_resource_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
980  {
981      $ids = $this->get_resource_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
982      $objects = array();
983      foreach ($ids as $index=>$id)
984      {
985          $objects[$index] = new resource($id);
986      }
987      return $objects;
988  }
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 ( )[ asset_db ]
Parameters
No parameters for this method
Code
413  public function get_type()
414  {
415      $type = new asset_type($this->_asset_type_id);
416      return $type->name;
417  }
publicget_url ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
855  public function get_url($__type="default")
856  {
857      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
858      $this->property_objects_array["{$__type}_url"] = $object;
859      return $object;
860  }
publicget_url_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
861  public function get_url_id($__type="default")
862  {
863      $ids = $this->get_url_ids($__type, true);
864      return (count($ids)==1 ? $ids[0] : null);
865  }
publicget_url_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
866  public function get_url_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
867  {
868      $url_ids = array();
869      $db = asset::db();
870      $q  = " SELECT cor_url.id FROM am_asset_url INNER JOIN cor_url ON am_asset_url.url_id=cor_url.id AND am_asset_url.deleted=0 AND cor_url.deleted=0 AND am_asset_url.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_url.asset_url_type_id='" . asset_url::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_url.primary=1 " : "");
871      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
872      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
873      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
874      $db->query($q);
875      while ($db->next_record())
876      {
877          $url_ids[] = $db->f("id");
878      }
879      return $url_ids;
880  }
publicget_url_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
881  public function get_url_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
882  {
883      $ids = $this->get_url_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
884      $objects = array();
885      foreach ($ids as $index=>$id)
886      {
887          $objects[$index] = new url($id);
888      }
889      return $objects;
890  }
protectedinsert ( )[ software_db ]
Parameters
No parameters for this method
Code
171  protected function insert()
172  {
173      parent::insert();
174      $this->_asset_id = $this->id;
175      $db = software::db();
176      $q  = " INSERT INTO am_software ( ";
177      $q .= $db->param_string("asset_id") . ", ";
178      $q .= $db->param_string("version") . ", ";
179      $q .= $db->param_string("purpose") . ", ";
180      $q .= $db->param_string("requirements") . ", ";
181      $q .= $db->param_string("mdate") . ", ";
182      $q .= $db->param_string("cdate") . ", ";
183      $q .= $db->param_string("deleted");
184      $q .= " ) VALUES ( ";
185      $q .= $db->value_string($this->_asset_id) . ", ";
186      $q .= $db->value_string($this->_version) . ", ";
187      $q .= $db->value_string($this->_purpose) . ", ";
188      $q .= $db->value_string($this->_requirements) . ", ";
189      $q .= $db->value_string(timestamp()) . ", ";
190      $q .= $db->value_string(timestamp()) . ", ";
191      $q .= $this->deleted ? "'1'" : "'0'";
192      $q .= " ) ";
193      $db->query($q);
194      return true;
195  }
publicmap ( )[ software_db ]
Parameters
No parameters for this method
Code
130  public function map()
131  {
132      $this->_name = array_key_exists("software:name",$_REQUEST) ? reqval("software:name") : $this->_name;
133      $this->_description = array_key_exists("software:description",$_REQUEST) ? reqval("software:description") : $this->_description;
134      $this->_asset_type_id = array_key_exists("software:asset_type_id",$_REQUEST) ? reqval("software:asset_type_id") : $this->_asset_type_id;
135      $this->_assetstatus_id = array_key_exists("software:assetstatus_id",$_REQUEST) ? reqval("software:assetstatus_id") : $this->_assetstatus_id;
136      $this->_department_id = array_key_exists("software:department_id",$_REQUEST) ? reqval("software:department_id") : $this->_department_id;
137      $this->_sku = array_key_exists("software:sku",$_REQUEST) ? reqval("software:sku") : $this->_sku;
138      $this->_model = array_key_exists("software:model",$_REQUEST) ? reqval("software:model") : $this->_model;
139      $this->_part_number = array_key_exists("software:part_number",$_REQUEST) ? reqval("software:part_number") : $this->_part_number;
140      $this->_serial_number = array_key_exists("software:serial_number",$_REQUEST) ? reqval("software:serial_number") : $this->_serial_number;
141      $this->_unit_price = array_key_exists("software:unit_price",$_REQUEST) ? reqval("software:unit_price") : $this->_unit_price;
142      $this->_quantity = array_key_exists("software:quantity",$_REQUEST) ? reqval("software:quantity") : $this->_quantity;
143      $this->_capex = array_key_exists("software:capex",$_REQUEST) ? reqval("software:capex") : $this->_capex;
144      $this->_version = array_key_exists("software:version",$_REQUEST) ? reqval("software:version") : $this->_version;
145      $this->_purpose = array_key_exists("software:purpose",$_REQUEST) ? reqval("software:purpose") : $this->_purpose;
146      $this->_requirements = array_key_exists("software:requirements",$_REQUEST) ? reqval("software:requirements") : $this->_requirements;
147      $this->_mdate = array_key_exists("software:mdate",$_REQUEST) ? reqval("software:mdate") : $this->_mdate;
148      $this->_cdate = array_key_exists("software:cdate",$_REQUEST) ? reqval("software:cdate") : $this->_cdate;
149      $this->_deleted = array_key_exists("software:deleted",$_REQUEST) ? reqval("software:deleted") : $this->_deleted;
150  }
publicpurge ( )[ software_db ]
Parameters
No parameters for this method
Code
237  public function purge()
238  {
239      parent::purge();
240      $db = software::db();
241      $q  = " DELETE FROM am_software ";
242      $q .= " WHERE asset_id = " . $this->_asset_id;
243      $db->query($q);
244      return true;
245  }
public staticsearch ( keyword )[ software_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_asset ( v )[ software_db ]
Parameters
requiredv
Code
394  public function set_asset($v)
395  {
396      if ($v->id > 0)
397      {
398          $this->asset_id = $v->id;
399      }
400  }
publicset_asset_type ( v )[ asset_db ]
Parameters
requiredv
Code
428  public function set_asset_type($v)
429  {
430      if ($v->id > 0)
431      {
432          $this->asset_type_id = $v->id;
433      }
434  }
publicset_assetdate ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
497  public function set_assetdate($__v, $__type="default")
498  {
499      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
500      if (is_null($__v))
501      {
502          $rel = new asset_assetdate(null,$this->id,$object->id,asset_assetdate::type_id($__type));
503          $rel->delete();
504          $object->delete();
505          if (!is_null(keyval($this->property_objects_array,"{$__type}_assetdate")))
506          {
507              $this->property_objects_array["{$__type}_assetdate"] = null;
508          }
509      }
510      else
511      {
512          $object->value = is_object($__v) ? $__v->value : $__v;
513          $object->commit();
514          $this->set_assetdate_ids(array($object->id),$__type);
515      }
516  }
publicset_assetdate_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
517  public function set_assetdate_id($__v, $__type="default")
518  {
519      $this->set_assetdate_ids(array($__v),$__type);
520  }
publicset_assetdate_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
521  public function set_assetdate_ids($__v, $__type="default")
522  {
523      if ($this->id == 0)
524      {
525          $this->commit();
526      }
527      $type_id = asset_assetdate::type_id($__type);
528      asset_assetdate::delete_all($this->id,null,$type_id);
529      if (is_array($__v))
530      {
531          foreach ($__v as $index=>$id)
532          {
533              $object = new asset_assetdate(null,$this->id,$id,$type_id);
534              $object->deleted = false;
535              $object->asset_assetdate_type_id = $type_id;
536              $object->commit();
537              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_assetdate")))
538              {
539                  $this->property_objects_array["{$__type}_assetdate"] = new assetdate($object->assetdate_id);
540              }
541          }
542          $this->_dirty = true;
543      }
544  }
publicset_assetdate_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
545  public function set_assetdate_list($__v, $__type="default")
546  {
547      if (is_array($__v))
548      {
549          $ids = array();
550          foreach ($__v as $index=>$object)
551          {
552              $ids[] = $object->id;
553          }
554          $this->set_assetdate_ids($ids,$__type);
555      }
556  }
publicset_assetstatus ( v )[ asset_db ]
Parameters
requiredv
Code
440  public function set_assetstatus($v)
441  {
442      if ($v->id > 0)
443      {
444          $this->assetstatus_id = $v->id;
445      }
446  }
publicset_business ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
694  public function set_business($__v, $__type="default")
695  {
696      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
697      if (is_null($__v))
698      {
699          $rel = new asset_business(null,$this->id,$object->id,asset_business::type_id($__type));
700          $rel->delete();
701          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
702          {
703              $this->property_objects_array["{$__type}_business"] = null;
704          }
705      }
706      else
707      {
708          $id = $object->id;
709          $object = $__v;
710          $object->id = $__v->id>0 ? $__v->id : $id;
711          $object->commit();
712          $this->set_business_ids(array($object->id),$__type);
713      }
714  }
publicset_business_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
715  public function set_business_id($__v, $__type="default")
716  {
717      $this->set_business_ids(array($__v),$__type);
718  }
publicset_business_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
719  public function set_business_ids($__v, $__type="default")
720  {
721      if ($this->id == 0)
722      {
723          $this->commit();
724      }
725      $type_id = asset_business::type_id($__type);
726      asset_business::delete_all($this->id,null,$type_id);
727      if (is_array($__v))
728      {
729          foreach ($__v as $index=>$id)
730          {
731              $object = new asset_business(null,$this->id,$id,$type_id);
732              $object->deleted = false;
733              $object->asset_business_type_id = $type_id;
734              $object->commit();
735              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
736              {
737                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
738              }
739          }
740          $this->_dirty = true;
741      }
742  }
publicset_business_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
743  public function set_business_list($__v, $__type="default")
744  {
745      if (is_array($__v))
746      {
747          $ids = array();
748          foreach ($__v as $index=>$object)
749          {
750              $ids[] = $object->id;
751          }
752          $this->set_business_ids($ids,$__type);
753      }
754  }
publicset_department ( v )[ asset_db ]
Parameters
requiredv
Code
452  public function set_department($v)
453  {
454      if ($v->id > 0)
455      {
456          $this->department_id = $v->id;
457      }
458  }
publicset_license ( v , type ["default"] )[ software_db ]
Parameters
requiredv
optionaltype ["default"]
Code
439  public function set_license($__v, $__type="default")
440  {
441      $object = is_null(keyval($this->property_objects_array,"{$__type}_license")) ? new license($this->get_license_id($__type)) : $this->property_objects_array["{$__type}_license"];
442      if (is_null($__v))
443      {
444          $rel = new license_software(null,$object->id,$this->id,license_software::type_id($__type));
445          $rel->delete();
446          if (!is_null(keyval($this->property_objects_array,"{$__type}_license")))
447          {
448              $this->property_objects_array["{$__type}_license"] = null;
449          }
450      }
451      else
452      {
453          $id = $object->id;
454          $object = $__v;
455          $object->id = $__v->id>0 ? $__v->id : $id;
456          $object->commit();
457          $this->set_license_ids(array($object->id),$__type);
458      }
459  }
publicset_license_id ( v , type ["default"] )[ software_db ]
Parameters
requiredv
optionaltype ["default"]
Code
460  public function set_license_id($__v, $__type="default")
461  {
462      $this->set_license_ids(array($__v),$__type);
463  }
publicset_license_ids ( v , type ["default"] )[ software_db ]
Parameters
requiredv
optionaltype ["default"]
Code
464  public function set_license_ids($__v, $__type="default")
465  {
466      if ($this->id == 0)
467      {
468          $this->commit();
469      }
470      $type_id = license_software::type_id($__type);
471      license_software::delete_all(null,$this->id,$type_id);
472      if (is_array($__v))
473      {
474          foreach ($__v as $index=>$id)
475          {
476              $object = new license_software(null,$id,$this->id,$type_id);
477              $object->deleted = false;
478              $object->license_software_type_id = $type_id;
479              $object->commit();
480              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_license")))
481              {
482                  $this->property_objects_array["{$__type}_license"] = new license($object->license_id);
483              }
484          }
485          $this->_dirty = true;
486      }
487  }
publicset_license_list ( v , type ["default"] )[ software_db ]
Parameters
requiredv
optionaltype ["default"]
Code
488  public function set_license_list($__v, $__type="default")
489  {
490      if (is_array($__v))
491      {
492          $ids = array();
493          foreach ($__v as $index=>$object)
494          {
495              $ids[] = $object->id;
496          }
497          $this->set_license_ids($ids,$__type);
498      }
499  }
publicset_office ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
595  public function set_office($__v, $__type="default")
596  {
597      $object = is_null(keyval($this->property_objects_array,"{$__type}_office")) ? new office($this->get_office_id($__type)) : $this->property_objects_array["{$__type}_office"];
598      if (is_null($__v))
599      {
600          $rel = new asset_office(null,$this->id,$object->id,asset_office::type_id($__type));
601          $rel->delete();
602          if (!is_null(keyval($this->property_objects_array,"{$__type}_office")))
603          {
604              $this->property_objects_array["{$__type}_office"] = null;
605          }
606      }
607      else
608      {
609          $id = $object->id;
610          $object = $__v;
611          $object->id = $__v->id>0 ? $__v->id : $id;
612          $object->commit();
613          $this->set_office_ids(array($object->id),$__type);
614      }
615  }
publicset_office_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
616  public function set_office_id($__v, $__type="default")
617  {
618      $this->set_office_ids(array($__v),$__type);
619  }
publicset_office_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
620  public function set_office_ids($__v, $__type="default")
621  {
622      if ($this->id == 0)
623      {
624          $this->commit();
625      }
626      $type_id = asset_office::type_id($__type);
627      asset_office::delete_all($this->id,null,$type_id);
628      if (is_array($__v))
629      {
630          foreach ($__v as $index=>$id)
631          {
632              $object = new asset_office(null,$this->id,$id,$type_id);
633              $object->deleted = false;
634              $object->asset_office_type_id = $type_id;
635              $object->commit();
636              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_office")))
637              {
638                  $this->property_objects_array["{$__type}_office"] = new office($object->office_id);
639              }
640          }
641          $this->_dirty = true;
642      }
643  }
publicset_office_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
644  public function set_office_list($__v, $__type="default")
645  {
646      if (is_array($__v))
647      {
648          $ids = array();
649          foreach ($__v as $index=>$object)
650          {
651              $ids[] = $object->id;
652          }
653          $this->set_office_ids($ids,$__type);
654      }
655  }
publicset_person ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
793  public function set_person($__v, $__type="default")
794  {
795      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
796      if (is_null($__v))
797      {
798          $rel = new asset_person(null,$this->id,$object->id,asset_person::type_id($__type));
799          $rel->delete();
800          if (!is_null(keyval($this->property_objects_array,"{$__type}_person")))
801          {
802              $this->property_objects_array["{$__type}_person"] = null;
803          }
804      }
805      else
806      {
807          $id = $object->id;
808          $object = $__v;
809          $object->id = $__v->id>0 ? $__v->id : $id;
810          $object->commit();
811          $this->set_person_ids(array($object->id),$__type);
812      }
813  }
publicset_person_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
814  public function set_person_id($__v, $__type="default")
815  {
816      $this->set_person_ids(array($__v),$__type);
817  }
publicset_person_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
818  public function set_person_ids($__v, $__type="default")
819  {
820      if ($this->id == 0)
821      {
822          $this->commit();
823      }
824      $type_id = asset_person::type_id($__type);
825      asset_person::delete_all($this->id,null,$type_id);
826      if (is_array($__v))
827      {
828          foreach ($__v as $index=>$id)
829          {
830              $object = new asset_person(null,$this->id,$id,$type_id);
831              $object->deleted = false;
832              $object->asset_person_type_id = $type_id;
833              $object->commit();
834              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_person")))
835              {
836                  $this->property_objects_array["{$__type}_person"] = new person($object->person_id);
837              }
838          }
839          $this->_dirty = true;
840      }
841  }
publicset_person_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
842  public function set_person_list($__v, $__type="default")
843  {
844      if (is_array($__v))
845      {
846          $ids = array();
847          foreach ($__v as $index=>$object)
848          {
849              $ids[] = $object->id;
850          }
851          $this->set_person_ids($ids,$__type);
852      }
853  }
publicset_resource ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
990  public function set_resource($__v, $__type="default")
991  {
992      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
993      if (is_null($__v))
994      {
995          $rel = new asset_resource(null,$this->id,$object->id,asset_resource::type_id($__type));
996          $rel->delete();
997          if (!is_null(keyval($this->property_objects_array,"{$__type}_resource")))
998          {
999              $this->property_objects_array["{$__type}_resource"] = null;
1000          }
1001      }
1002      else
1003      {
1004          $hash = $object->hash;
1005          $id = $object->id;
1006          $object = $__v;
1007          $object->hash = $__v->id>0 ? $__v->hash : $hash;
1008          $object->id = $__v->id>0 ? $__v->id : $id;
1009          $object->commit();
1010          $this->set_resource_ids(array($object->id),$__type);
1011      }
1012  }
publicset_resource_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1013  public function set_resource_id($__v, $__type="default")
1014  {
1015      $this->set_resource_ids(array($__v),$__type);
1016  }
publicset_resource_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1017  public function set_resource_ids($__v, $__type="default")
1018  {
1019      if ($this->id == 0)
1020      {
1021          $this->commit();
1022      }
1023      $type_id = asset_resource::type_id($__type);
1024      asset_resource::delete_all($this->id,null,$type_id);
1025      if (is_array($__v))
1026      {
1027          foreach ($__v as $index=>$id)
1028          {
1029              $object = new asset_resource(null,$this->id,$id,$type_id);
1030              $object->deleted = false;
1031              $object->asset_resource_type_id = $type_id;
1032              $object->commit();
1033              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_resource")))
1034              {
1035                  $this->property_objects_array["{$__type}_resource"] = new resource($object->resource_id);
1036              }
1037          }
1038          $this->_dirty = true;
1039      }
1040  }
publicset_resource_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1041  public function set_resource_list($__v, $__type="default")
1042  {
1043      if (is_array($__v))
1044      {
1045          $ids = array();
1046          foreach ($__v as $index=>$object)
1047          {
1048              $ids[] = $object->id;
1049          }
1050          $this->set_resource_ids($ids,$__type);
1051      }
1052  }
publicset_type ( v )[ asset_db ]
Parameters
requiredv
Code
418  public function set_type($v)
419  {
420      $type = new asset_type(null, $v);
421      $this->asset_type_id = $type->id;
422  }
publicset_url ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
892  public function set_url($__v, $__type="default")
893  {
894      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
895      if (is_null($__v))
896      {
897          $rel = new asset_url(null,$this->id,$object->id,asset_url::type_id($__type));
898          $rel->delete();
899          $object->delete();
900          if (!is_null(keyval($this->property_objects_array,"{$__type}_url")))
901          {
902              $this->property_objects_array["{$__type}_url"] = null;
903          }
904      }
905      else
906      {
907          $object->value = is_object($__v) ? $__v->value : $__v;
908          $object->commit();
909          $this->set_url_ids(array($object->id),$__type);
910      }
911  }
publicset_url_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
912  public function set_url_id($__v, $__type="default")
913  {
914      $this->set_url_ids(array($__v),$__type);
915  }
publicset_url_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
916  public function set_url_ids($__v, $__type="default")
917  {
918      if ($this->id == 0)
919      {
920          $this->commit();
921      }
922      $type_id = asset_url::type_id($__type);
923      asset_url::delete_all($this->id,null,$type_id);
924      if (is_array($__v))
925      {
926          foreach ($__v as $index=>$id)
927          {
928              $object = new asset_url(null,$this->id,$id,$type_id);
929              $object->deleted = false;
930              $object->asset_url_type_id = $type_id;
931              $object->commit();
932              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_url")))
933              {
934                  $this->property_objects_array["{$__type}_url"] = new url($object->url_id);
935              }
936          }
937          $this->_dirty = true;
938      }
939  }
publicset_url_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
940  public function set_url_list($__v, $__type="default")
941  {
942      if (is_array($__v))
943      {
944          $ids = array();
945          foreach ($__v as $index=>$object)
946          {
947              $ids[] = $object->id;
948          }
949          $this->set_url_ids($ids,$__type);
950      }
951  }
public__toString ( )[ software_db ]
Parameters
No parameters for this method
Code
385  public function __toString()
386  {
387      return (is_null($this->id) ? "" : $this->id);
388  }
public statictype_id ( type_name )[ asset_db ]
Parameters
requiredtype_name
Code
407  public static function type_id($__type_name)
408  {
409      $type = new asset_type(null, $__type_name);
410      return $type->id;
411  }
publicundelete ( )[ software_db ]
Parameters
No parameters for this method
Code
225  public function undelete()
226  {
227      parent::undelete();
228      $db = software::db();
229      $q  = " UPDATE am_software SET ";
230      $q .= " deleted = 0 ";
231      $q .= " WHERE asset_id = " . $this->_asset_id;
232      $db->query($q);
233      $this->deleted = false;
234      return true;
235  }
protectedupdate ( )[ software_db ]
Parameters
No parameters for this method
Code
197  protected function update()
198  {
199      parent::update();
200      $db = software::db();
201      $q  = " UPDATE am_software SET ";
202      $q .= $db->param_string("asset_id") . " = " . $db->value_string($this->_asset_id) . ", ";
203      $q .= $db->param_string("version") . " = " . $db->value_string($this->_version) . ", ";
204      $q .= $db->param_string("purpose") . " = " . $db->value_string($this->_purpose) . ", ";
205      $q .= $db->param_string("requirements") . " = " . $db->value_string($this->_requirements) . ", ";
206      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
207      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
208      $q .= " WHERE asset_id = " . $this->_asset_id;
209      $db->query($q);
210      return true;
211  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicasset[ software_db ]
Code
390  public function get_asset()
391  {
392      return new asset($this->asset_id);
393  }
Code
394  public function set_asset($v)
395  {
396      if ($v->id > 0)
397      {
398          $this->asset_id = $v->id;
399      }
400  }
publicasset_type[ asset_db ]
Code
424  public function get_asset_type()
425  {
426      return new asset_type($this->asset_type_id);
427  }
Code
428  public function set_asset_type($v)
429  {
430      if ($v->id > 0)
431      {
432          $this->asset_type_id = $v->id;
433      }
434  }
publicassetdate[ asset_db ]
Code
460  public function get_assetdate($__type="default")
461  {
462      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
463      $this->property_objects_array["{$__type}_assetdate"] = $object;
464      return $object;
465  }
Code
497  public function set_assetdate($__v, $__type="default")
498  {
499      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
500      if (is_null($__v))