Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class license extends license_ext

Hide Inherited MembersAsset Management
Description
No description.
 
Constants
constantTABLENAME ["am_license"][ license ]
 
Properties
protected_asset_id[ license_db ]
protected_asset_id_dirty[ license_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[ license_db ]
protected_cdate_dirty[ license_db ]
protected_deleted[ license_db ]
protected_deleted_dirty[ license_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[ license_db ]
protected_id[ asset_db ]
protected__id_dirty[ license_db ]
protected_id_dirty[ asset_db ]
protected_key[ license_db ]
protected_key_dirty[ license_db ]
protected_mdate[ license_db ]
protected_mdate_dirty[ license_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_quantity[ asset_db ]
protected_quantity_dirty[ asset_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 ]
 
Methods
publiccommit ( )[ license_db ]
Parameters
No parameters for this method
Code
140  public function commit()
141  {
142      if ($this->_asset_id > 0)
143      {
144          $this->update();
145      }
146      else
147      {
148          $this->insert();
149      }
150 
151      foreach ($this->property_objects_array as $property=>$object)
152      {
153          $this->{$property} = $object;
154      }
155 
156      return true;
157  }
public__construct ( asset_id )[ license_db ]
Parameters
optionalasset_id
Code
042  public function __construct($__asset_id=null)
043  {
044      $this->__id = 0;
045      $this->_asset_id = 0;
046      $this->_key = "";
047      $this->_mdate = null;
048      $this->_cdate = null;
049      $this->_deleted = false;
050      $this->_id = 0;
051      $this->_name = "";
052      $this->_description = "";
053      $this->_asset_type_id = 0;
054      $this->_assetstatus_id = 0;
055      $this->_department_id = 0;
056      $this->_sku = "";
057      $this->_model = "";
058      $this->_part_number = "";
059      $this->_serial_number = "";
060      $this->_unit_price = 0;
061      $this->_quantity = 0;
062      $this->_capex = false;
063 
064      $this->__id_dirty = false;
065      $this->_asset_id_dirty = false;
066      $this->_key_dirty = false;
067      $this->_mdate_dirty = false;
068      $this->_cdate_dirty = false;
069      $this->_deleted_dirty = false;
070      $this->_id_dirty = false;
071      $this->_name_dirty = false;
072      $this->_description_dirty = false;
073      $this->_asset_type_id_dirty = false;
074      $this->_assetstatus_id_dirty = false;
075      $this->_department_id_dirty = false;
076      $this->_sku_dirty = false;
077      $this->_model_dirty = false;
078      $this->_part_number_dirty = false;
079      $this->_serial_number_dirty = false;
080      $this->_unit_price_dirty = false;
081      $this->_quantity_dirty = false;
082      $this->_capex_dirty = false;
083 
084      if (is_null($__asset_id))
085      {
086          return;
087      }
088 
089      $db = license::db();
090      $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_license._id,am_license.asset_id,am_license.key,am_license.mdate,am_license.cdate,am_license.deleted ";
091      $q .= " FROM am_license ";
092      $q .= " INNER JOIN am_asset ON am_license.asset_id=am_asset.id ";
093      $q .= is_null($__asset_id) ? "" : " AND am_asset.id='$__asset_id' ";       
094 
095      $db->query($q);
096      if ($db->next_record() && $db->num_rows() == 1)
097      {
098          $this->_id = $db->f("id");
099          $this->_name = $db->f("name");
100          $this->_description = $db->f("description");
101          $this->_asset_type_id = $db->f("asset_type_id");
102          $this->_assetstatus_id = $db->f("assetstatus_id");
103          $this->_department_id = $db->f("department_id");
104          $this->_sku = $db->f("sku");
105          $this->_model = $db->f("model");
106          $this->_part_number = $db->f("part_number");
107          $this->_serial_number = $db->f("serial_number");
108          $this->_unit_price = $db->f("unit_price");
109          $this->_quantity = $db->f("quantity");
110          $this->_capex = $db->f("capex");
111          $this->__id = $db->f("_id");
112          $this->_asset_id = $db->f("asset_id");
113          $this->_key = $db->f("key");
114          $this->_mdate = $db->f("mdate");
115          $this->_cdate = $db->f("cdate");
116          $this->_deleted = $db->f("deleted");
117      }
118  }
protected staticdb ( )[ license_db ]
Parameters
No parameters for this method
Code
483  protected static function db()
484  {
485      return new db();
486  }
publicdelete ( )[ license_db ]
Parameters
No parameters for this method
Code
195  public function delete()
196  {
197      parent::delete();
198      $db = license::db();
199      $q  = " UPDATE am_license SET ";
200      $q .= " deleted = 1 ";
201      $q .= " WHERE asset_id = " . $this->_asset_id;
202      $db->query($q);
203      $this->deleted = true;
204      return true;
205  }
public staticdelete_all ( )[ license_db ]
Parameters
No parameters for this method
Code
308  public static function delete_all()
309  {
310      $db = license::db();
311      $q  = " UPDATE am_license SET ";
312      $q .= " deleted = 1 ";
313     
314      $db->query($q);
315      return true;
316  }
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 ( )[ license_db ]
Parameters
No parameters for this method
Code
372  public function get_asset()
373  {
374      return new asset($this->asset_id);
375  }
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] )[ license_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
229  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
230  {
231      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
232      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
233      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
234 
235      $db = license::db();
236      $data = array();
237      $q  = " SELECT $colstring ";
238      $q .= " FROM am_license ";
239      $q .= " INNER JOIN am_asset ON am_license.asset_id=am_asset.id ";
240      $q .= array_key_exists("asset_type_id",$lookups) ? " AND am_asset.asset_type_id='" . $lookups["asset_type_id"] . "' " : "";
241      $q .= array_key_exists("assetstatus_id",$lookups) ? " AND am_asset.assetstatus_id='" . $lookups["assetstatus_id"] . "' " : "";
242      $q .= array_key_exists("department_id",$lookups) ? " AND am_asset.department_id='" . $lookups["department_id"] . "' " : "";
243      $q .= " WHERE am_license.deleted = 0 ";
244      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
245 
246      if (is_string($__order))
247      {
248          $q .= "ORDER BY " . $__order;
249      }
250      else if (is_array($__order) and count($__order)>0)
251      {
252          $orderings = array();
253          foreach ($__order as $col=>$dir)
254          {
255              $orderings[] = " $col $dir ";
256          }
257          $q .= "ORDER BY " . implode(", ", $orderings);
258      }
259      else if (is_object($__order))
260      {
261          $q .= "";
262      }
263      else
264      {
265          // THERE IS NO `order` COLUMN ON THIS OBJECT
266      }
267 
268      if (!is_null($__limit))
269      {
270          $q .= " LIMIT $__offset , $__limit ";
271      }
272 
273      $db->query($q);
274 
275      if (count($colarray)>1 || $colstring=="*")
276      {
277          while ($db->next_record())
278          {
279              $data[] = $db->record;
280          }
281      }
282      else
283      {
284          while ($db->next_record())
285          {
286              $data[] = $db->f(0);
287          }
288      }
289 
290      return $data;
291  }
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] )[ license_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
293  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
294  {
295      return license::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
296  }
publicget_json ( )[ obj ]
Parameters
No parameters for this method
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ license_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
298  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
299  {
300      $objects = array();
301      foreach (license::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
302      {
303          $objects[] = new license($id);
304      }
305      return $objects;
306  }
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  }
publicget_software ( type ["default"] )[ license_db ]
Parameters
optionaltype ["default"]
Code
384  public function get_software($__type="default")
385  {
386      $object = is_null(keyval($this->property_objects_array,"{$__type}_software")) ? new software($this->get_software_id($__type)) : $this->property_objects_array["{$__type}_software"];
387      $this->property_objects_array["{$__type}_software"] = $object;
388      return $object;
389  }
publicget_software_id ( type ["default"] )[ license_db ]
Parameters
optionaltype ["default"]
Code
390  public function get_software_id($__type="default")
391  {
392      $ids = $this->get_software_ids($__type, true);
393      return (count($ids)==1 ? $ids[0] : null);
394  }
publicget_software_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ license_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
395  public function get_software_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
396  {
397      $software_ids = array();
398      $db = license::db();
399      $q  = " SELECT am_software.asset_id FROM am_license_software INNER JOIN am_software ON am_license_software.software_asset_id=am_software.asset_id AND am_license_software.deleted=0 AND am_software.deleted=0 AND am_license_software.license_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 " : "");
400      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
401      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
402      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
403      $db->query($q);
404      while ($db->next_record())
405      {
406          $software_ids[] = $db->f("asset_id");
407      }
408      return $software_ids;
409  }
publicget_software_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ license_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
410  public function get_software_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
411  {
412      $ids = $this->get_software_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
413      $objects = array();
414      foreach ($ids as $index=>$id)
415      {
416          $objects[$index] = new software($id);
417      }
418      return $objects;
419  }
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 ( )[ license_db ]
Parameters
No parameters for this method
Code
159  protected function insert()
160  {
161      parent::insert();
162      $this->_asset_id = $this->id;
163      $db = license::db();
164      $q  = " INSERT INTO am_license ( ";
165      $q .= $db->param_string("asset_id") . ", ";
166      $q .= $db->param_string("key") . ", ";
167      $q .= $db->param_string("mdate") . ", ";
168      $q .= $db->param_string("cdate") . ", ";
169      $q .= $db->param_string("deleted");
170      $q .= " ) VALUES ( ";
171      $q .= $db->value_string($this->_asset_id) . ", ";
172      $q .= $db->value_string($this->_key) . ", ";
173      $q .= $db->value_string(timestamp()) . ", ";
174      $q .= $db->value_string(timestamp()) . ", ";
175      $q .= $this->deleted ? "'1'" : "'0'";
176      $q .= " ) ";
177      $db->query($q);
178      return true;
179  }
publicmap ( )[ license_db ]
Parameters
No parameters for this method
Code
120  public function map()
121  {
122      $this->_name = array_key_exists("license:name",$_REQUEST) ? reqval("license:name") : $this->_name;
123      $this->_description = array_key_exists("license:description",$_REQUEST) ? reqval("license:description") : $this->_description;
124      $this->_asset_type_id = array_key_exists("license:asset_type_id",$_REQUEST) ? reqval("license:asset_type_id") : $this->_asset_type_id;
125      $this->_assetstatus_id = array_key_exists("license:assetstatus_id",$_REQUEST) ? reqval("license:assetstatus_id") : $this->_assetstatus_id;
126      $this->_department_id = array_key_exists("license:department_id",$_REQUEST) ? reqval("license:department_id") : $this->_department_id;
127      $this->_sku = array_key_exists("license:sku",$_REQUEST) ? reqval("license:sku") : $this->_sku;
128      $this->_model = array_key_exists("license:model",$_REQUEST) ? reqval("license:model") : $this->_model;
129      $this->_part_number = array_key_exists("license:part_number",$_REQUEST) ? reqval("license:part_number") : $this->_part_number;
130      $this->_serial_number = array_key_exists("license:serial_number",$_REQUEST) ? reqval("license:serial_number") : $this->_serial_number;
131      $this->_unit_price = array_key_exists("license:unit_price",$_REQUEST) ? reqval("license:unit_price") : $this->_unit_price;
132      $this->_quantity = array_key_exists("license:quantity",$_REQUEST) ? reqval("license:quantity") : $this->_quantity;
133      $this->_capex = array_key_exists("license:capex",$_REQUEST) ? reqval("license:capex") : $this->_capex;
134      $this->_key = array_key_exists("license:key",$_REQUEST) ? reqval("license:key") : $this->_key;
135      $this->_mdate = array_key_exists("license:mdate",$_REQUEST) ? reqval("license:mdate") : $this->_mdate;
136      $this->_cdate = array_key_exists("license:cdate",$_REQUEST) ? reqval("license:cdate") : $this->_cdate;
137      $this->_deleted = array_key_exists("license:deleted",$_REQUEST) ? reqval("license:deleted") : $this->_deleted;
138  }
publicpurge ( )[ license_db ]
Parameters
No parameters for this method
Code
219  public function purge()
220  {
221      parent::purge();
222      $db = license::db();
223      $q  = " DELETE FROM am_license ";
224      $q .= " WHERE asset_id = " . $this->_asset_id;
225      $db->query($q);
226      return true;
227  }
public staticsearch ( keyword )[ license_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 )[ license_db ]
Parameters
requiredv
Code
376  public function set_asset($v)
377  {
378      if ($v->id > 0)
379      {
380          $this->asset_id = $v->id;
381      }
382  }
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_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_software ( v , type ["default"] )[ license_db ]
Parameters
requiredv
optionaltype ["default"]
Code
421  public function set_software($__v, $__type="default")
422  {
423      $object = is_null(keyval($this->property_objects_array,"{$__type}_software")) ? new software($this->get_software_id($__type)) : $this->property_objects_array["{$__type}_software"];
424      if (is_null($__v))
425      {
426          $rel = new license_software(null,$this->id,$object->id,license_software::type_id($__type));
427          $rel->delete();
428          if (!is_null(keyval($this->property_objects_array,"{$__type}_software")))
429          {
430              $this->property_objects_array["{$__type}_software"] = null;
431          }
432      }
433      else
434      {
435          $id = $object->id;
436          $object = $__v;
437          $object->id = $__v->id>0 ? $__v->id : $id;
438          $object->commit();
439          $this->set_software_ids(array($object->id),$__type);
440      }
441  }
publicset_software_id ( v , type ["default"] )[ license_db ]
Parameters
requiredv
optionaltype ["default"]
Code
442  public function set_software_id($__v, $__type="default")
443  {
444      $this->set_software_ids(array($__v),$__type);
445  }
publicset_software_ids ( v , type ["default"] )[ license_db ]
Parameters
requiredv
optionaltype ["default"]
Code
446  public function set_software_ids($__v, $__type="default")
447  {
448      if ($this->id == 0)
449      {
450          $this->commit();
451      }
452      $type_id = license_software::type_id($__type);
453      license_software::delete_all($this->id,null,$type_id);
454      if (is_array($__v))
455      {
456          foreach ($__v as $index=>$id)
457          {
458              $object = new license_software(null,$this->id,$id,$type_id);
459              $object->deleted = false;
460              $object->license_software_type_id = $type_id;
461              $object->commit();
462              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_software")))
463              {
464                  $this->property_objects_array["{$__type}_software"] = new software($object->software_id);
465              }
466          }
467          $this->_dirty = true;
468      }
469  }
publicset_software_list ( v , type ["default"] )[ license_db ]
Parameters
requiredv
optionaltype ["default"]
Code
470  public function set_software_list($__v, $__type="default")
471  {
472      if (is_array($__v))
473      {
474          $ids = array();
475          foreach ($__v as $index=>$object)
476          {
477              $ids[] = $object->id;
478          }
479          $this->set_software_ids($ids,$__type);
480      }
481  }
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 ( )[ license_db ]
Parameters
No parameters for this method
Code
367  public function __toString()
368  {
369      return (is_null($this->id) ? "" : $this->id);
370  }
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 ( )[ license_db ]
Parameters
No parameters for this method
Code
207  public function undelete()
208  {
209      parent::undelete();
210      $db = license::db();
211      $q  = " UPDATE am_license SET ";
212      $q .= " deleted = 0 ";
213      $q .= " WHERE asset_id = " . $this->_asset_id;
214      $db->query($q);
215      $this->deleted = false;
216      return true;
217  }
protectedupdate ( )[ license_db ]
Parameters
No parameters for this method
Code
181  protected function update()
182  {
183      parent::update();
184      $db = license::db();
185      $q  = " UPDATE am_license SET ";
186      $q .= $db->param_string("asset_id") . " = " . $db->value_string($this->_asset_id) . ", ";
187      $q .= $db->param_string("key") . " = " . $db->value_string($this->_key) . ", ";
188      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
189      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
190      $q .= " WHERE asset_id = " . $this->_asset_id;
191      $db->query($q);
192      return true;
193  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicasset[ license_db ]
Code
372  public function get_asset()
373  {
374      return new asset($this->asset_id);
375  }
Code
376  public function set_asset($v)
377  {
378      if ($v->id > 0)
379      {
380          $this->asset_id = $v->id;
381      }
382  }
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))
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  }
publicassetdate_id[ asset_db ]
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  }
Code
517  public function set_assetdate_id($__v, $__type="default")
518  {
519      $this->set_assetdate_ids(array($__v),$__type);
520  }
public