Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class resource extends resource_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_resource"][ resource ]
 
Properties
protected_bytes[ resource_ext ]
protected_bytes_dirty[ resource_ext ]
protected_cdate[ resource_ext ]
protected_cdate_dirty[ resource_ext ]
protected_deleted[ resource_ext ]
protected_deleted_dirty[ resource_ext ]
protected_description[ resource_ext ]
protected_description_dirty[ resource_ext ]
protected_dirty[ obj ]
protected_expirationdate[ resource_ext ]
protected_expirationdate_dirty[ resource_ext ]
protected_hash[ resource_ext ]
protected_hash_dirty[ resource_ext ]
protected_id[ resource_ext ]
protected_id_dirty[ resource_ext ]
protected_import_path[ resource_ext ]
protected_mdate[ resource_ext ]
protected_mdate_dirty[ resource_ext ]
protected_mimetype_id[ resource_ext ]
protected_mimetype_id_dirty[ resource_ext ]
protected_name[ resource_ext ]
protected_name_dirty[ resource_ext ]
publicproperty_objects_array[ obj ]
protected_resource_dir[ resource_ext ]
protected_resource_type_id[ resource_ext ]
protected_resource_type_id_dirty[ resource_ext ]
protected_thumbnail_height[ resource_ext ]
protected_thumbnail_width[ resource_ext ]
protected_tmp_name[ resource_ext ]
 
Methods
publiccommit ( write_resource [true] )[ resource_ext ]
Parameters
optionalwrite_resource [true]
Code
316  public function commit($__write_resource=true)
317  {
318      if ($this->_id > 0)
319      {
320          $this->update($__write_resource);
321      }
322      else
323      {
324          $this->insert($__write_resource);
325      }
326 
327      foreach ($this->property_objects_array as $property=>$object)
328      {
329          $this->{$property} = $object;
330      }
331 
332      return true;
333  }
public__construct ( id , hash , file_array , path )[ resource_ext ]
Parameters
optionalid
optionalhash
optionalfile_array
optionalpath
Code
036  public function __construct($__id=null, $__hash=null, $__file_array=null, $__path=null)
037  {
038      $this->_id = 0;
039      $this->_name = "";
040      $this->_hash = unique();
041      $this->_description = "";
042      $this->_bytes = 0;
043      $this->_mimetype_id = 0;
044      $this->_resource_type_id = 0;
045      $this->_expirationdate = null;
046      $this->_mdate = null;
047      $this->_cdate = null;
048      $this->_deleted = false;
049 
050      $this->_id_dirty = false;
051      $this->_name_dirty = false;
052      $this->_hash_dirty = false;
053      $this->_description_dirty = false;
054      $this->_bytes_dirty = false;
055      $this->_mimetype_id_dirty = false;
056      $this->_resource_type_id_dirty = false;
057      $this->_expirationdate_dirty = false;
058      $this->_mdate_dirty = false;
059      $this->_cdate_dirty = false;
060      $this->_deleted_dirty = false;
061 
062      $this->resource_dir = "data";
063      $this->thumbnail_width = 100;
064      $this->thumbnail_height = 100;
065      $this->tmp_name ="";
066      $this->import_path = null;
067 
068      $db = resource::db();
069      $q  = " SELECT * ";
070      $q .= " FROM cor_resource ";
071 
072      $run_query = false;
073 
074      if (!is_null($__id))
075      {
076          $q .= " WHERE id = '$__id' ";
077          $run_query = true;
078      }
079      else if (!is_null($__hash))
080      {
081          $q .= " WHERE hash = '$__hash' ";
082          $run_query = true;
083      }
084 
085      if ($run_query)
086      {
087          $db->query($q);
088          if ($db->next_record() && $db->num_rows() == 1)
089          {
090          $this->_id = $db->f("id");
091          $this->_name = $db->f("name");
092          $this->_hash = $db->f("hash");
093          $this->_description = $db->f("description");
094          $this->_bytes = $db->f("bytes");
095          $this->_mimetype_id = $db->f("mimetype_id");
096          $this->_resource_type_id = $db->f("resource_type_id");
097          $this->_expirationdate = $db->f("expirationdate");
098          $this->_mdate = $db->f("mdate");
099          $this->_cdate = $db->f("cdate");
100          $this->_deleted = $db->f("deleted");
101          }
102      }
103 
104      if (is_array($__file_array))
105      {
106          $this->name = $__file_array["name"];
107          $this->tmp_name = $__file_array["tmp_name"];
108          $this->bytes = $__file_array["size"];
109      }
110      else if (file_exists($__path))
111      {
112          $this->import_path = $__path;
113          $this->name = basename($__path);
114          $this->bytes = filesize($__path);
115      }
116  }
protected staticdb ( )[ resource_db ]
Parameters
No parameters for this method
Code
1495  protected static function db()
1496  {
1497      return new db();
1498  }
publicdelete ( )[ resource_db ]
Parameters
No parameters for this method
Code
194  public function delete()
195  {
196      $db = resource::db();
197      $q  = " UPDATE cor_resource SET ";
198      $q .= " deleted = 1 ";
199      $q .= " WHERE id = " . $this->_id;
200      $db->query($q);
201      $this->deleted = true;
202      return true;
203  }
public staticdelete_all ( )[ resource_db ]
Parameters
No parameters for this method
Code
302  public static function delete_all()
303  {
304      $db = resource::db();
305      $q  = " UPDATE cor_resource SET ";
306      $q .= " deleted = 1 ";
307     
308      $db->query($q);
309      return true;
310  }
publicdelete_resource ( )[ resource_ext ]
Parameters
No parameters for this method
Code
219  public function delete_resource()
220  {
221      if (file_exists($this->path))
222      {
223          unlink($this->path);
224      }
225  }
publicdelete_thumbnail ( )[ resource_ext ]
Parameters
No parameters for this method
Code
227  public function delete_thumbnail()
228  {
229      if (file_exists($this->thumbpath))
230      {
231          unlink($this->thumbpath);
232      }
233  }
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 ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
406  public function get_asset($__type="default")
407  {
408      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
409      $this->property_objects_array["{$__type}_asset"] = $object;
410      return $object;
411  }
publicget_asset_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
412  public function get_asset_id($__type="default")
413  {
414      $ids = $this->get_asset_ids($__type, true);
415      return (count($ids)==1 ? $ids[0] : null);
416  }
publicget_asset_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
417  public function get_asset_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
418  {
419      $asset_ids = array();
420      $db = resource::db();
421      $q  = " SELECT am_asset.id FROM am_asset_resource INNER JOIN am_asset ON am_asset_resource.asset_id=am_asset.id AND am_asset_resource.deleted=0 AND am_asset.deleted=0 AND am_asset_resource.resource_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 " : "");
422      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
423      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
424      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
425      $db->query($q);
426      while ($db->next_record())
427      {
428          $asset_ids[] = $db->f("id");
429      }
430      return $asset_ids;
431  }
publicget_asset_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
432  public function get_asset_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
433  {
434      $ids = $this->get_asset_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
435      $objects = array();
436      foreach ($ids as $index=>$id)
437      {
438          $objects[$index] = new asset($id);
439      }
440      return $objects;
441  }
publicget_atime ( )[ resource_ext ]
Parameters
No parameters for this method
Code
133  public function get_atime()
134  {
135      return $this->exists ? fileatime($this->path) : 0;
136  }
publicget_business_comment ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
901  public function get_business_comment($__type="default")
902  {
903      $object = is_null(keyval($this->property_objects_array,"{$__type}_business_comment")) ? new business_comment($this->get_business_comment_id($__type)) : $this->property_objects_array["{$__type}_business_comment"];
904      $this->property_objects_array["{$__type}_business_comment"] = $object;
905      return $object;
906  }
publicget_business_comment_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
907  public function get_business_comment_id($__type="default")
908  {
909      $ids = $this->get_business_comment_ids($__type, true);
910      return (count($ids)==1 ? $ids[0] : null);
911  }
publicget_business_comment_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
912  public function get_business_comment_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
913  {
914      $business_comment_ids = array();
915      $db = resource::db();
916      $q  = " SELECT crm_business_comment.id FROM crm_businesscomment_resource INNER JOIN crm_business_comment ON crm_businesscomment_resource.business_comment_id=crm_business_comment.id AND crm_businesscomment_resource.deleted=0 AND crm_business_comment.deleted=0 AND crm_businesscomment_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND crm_businesscomment_resource.businesscomment_resource_type_id='" . businesscomment_resource::type_id($__type) . "'") . ($__get_primary ? " AND crm_businesscomment_resource.primary=1 " : "");
917      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
918      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
919      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
920      $db->query($q);
921      while ($db->next_record())
922      {
923          $business_comment_ids[] = $db->f("id");
924      }
925      return $business_comment_ids;
926  }
publicget_business_comment_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
927  public function get_business_comment_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
928  {
929      $ids = $this->get_business_comment_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
930      $objects = array();
931      foreach ($ids as $index=>$id)
932      {
933          $objects[$index] = new business_comment($id);
934      }
935      return $objects;
936  }
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] )[ resource_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
225  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
226  {
227      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
228      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
229      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
230 
231      $db = resource::db();
232      $data = array();
233      $q  = " SELECT $colstring ";
234      $q .= " FROM cor_resource ";
235      $q .= " WHERE cor_resource.deleted = 0 ";
236      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
237      $q .= array_key_exists("mimetype_id",$lookups) ? " AND cor_resource.mimetype_id='" . $lookups["mimetype_id"] . "' " : "";
238      $q .= array_key_exists("resource_type_id",$lookups) ? " AND cor_resource.resource_type_id='" . $lookups["resource_type_id"] . "' " : "";
239 
240      if (is_string($__order))
241      {
242          $q .= "ORDER BY " . $__order;
243      }
244      else if (is_array($__order) and count($__order)>0)
245      {
246          $orderings = array();
247          foreach ($__order as $col=>$dir)
248          {
249              $orderings[] = " $col $dir ";
250          }
251          $q .= "ORDER BY " . implode(", ", $orderings);
252      }
253      else if (is_object($__order))
254      {
255          $q .= "";
256      }
257      else
258      {
259          // THERE IS NO `order` COLUMN ON THIS OBJECT
260      }
261 
262      if (!is_null($__limit))
263      {
264          $q .= " LIMIT $__offset , $__limit ";
265      }
266 
267      $db->query($q);
268 
269      if (count($colarray)>1 || $colstring=="*")
270      {
271          while ($db->next_record())
272          {
273              $data[] = $db->record;
274          }
275      }
276      else
277      {
278          while ($db->next_record())
279          {
280              $data[] = $db->f(0);
281          }
282      }
283 
284      return $data;
285  }
publicget_comment_contact ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1099  public function get_comment_contact($__type="default")
1100  {
1101      $object = is_null(keyval($this->property_objects_array,"{$__type}_comment_contact")) ? new comment_contact($this->get_comment_contact_id($__type)) : $this->property_objects_array["{$__type}_comment_contact"];
1102      $this->property_objects_array["{$__type}_comment_contact"] = $object;
1103      return $object;
1104  }
publicget_comment_contact_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1105  public function get_comment_contact_id($__type="default")
1106  {
1107      $ids = $this->get_comment_contact_ids($__type, true);
1108      return (count($ids)==1 ? $ids[0] : null);
1109  }
publicget_comment_contact_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1110  public function get_comment_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1111  {
1112      $comment_contact_ids = array();
1113      $db = resource::db();
1114      $q  = " SELECT crm_comment_contact.id FROM crm_commentcontact_resource INNER JOIN crm_comment_contact ON crm_commentcontact_resource.comment_contact_id=crm_comment_contact.id AND crm_commentcontact_resource.deleted=0 AND crm_comment_contact.deleted=0 AND crm_commentcontact_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND crm_commentcontact_resource.commentcontact_resource_type_id='" . commentcontact_resource::type_id($__type) . "'") . ($__get_primary ? " AND crm_commentcontact_resource.primary=1 " : "");
1115      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1116      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1117      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1118      $db->query($q);
1119      while ($db->next_record())
1120      {
1121          $comment_contact_ids[] = $db->f("id");
1122      }
1123      return $comment_contact_ids;
1124  }
publicget_comment_contact_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1125  public function get_comment_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1126  {
1127      $ids = $this->get_comment_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1128      $objects = array();
1129      foreach ($ids as $index=>$id)
1130      {
1131          $objects[$index] = new comment_contact($id);
1132      }
1133      return $objects;
1134  }
publicget_contact ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1000  public function get_contact($__type="default")
1001  {
1002      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
1003      $this->property_objects_array["{$__type}_contact"] = $object;
1004      return $object;
1005  }
publicget_contact_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1006  public function get_contact_id($__type="default")
1007  {
1008      $ids = $this->get_contact_ids($__type, true);
1009      return (count($ids)==1 ? $ids[0] : null);
1010  }
publicget_contact_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1011  public function get_contact_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1012  {
1013      $contact_ids = array();
1014      $db = resource::db();
1015      $q  = " SELECT crm_contact.person_entity_id FROM crm_contact_resource INNER JOIN crm_contact ON crm_contact_resource.contact_person_entity_id=crm_contact.person_entity_id AND crm_contact_resource.deleted=0 AND crm_contact.deleted=0 AND crm_contact_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND crm_contact_resource.contact_resource_type_id='" . contact_resource::type_id($__type) . "'") . ($__get_primary ? " AND crm_contact_resource.primary=1 " : "");
1016      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1017      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1018      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1019      $db->query($q);
1020      while ($db->next_record())
1021      {
1022          $contact_ids[] = $db->f("person_entity_id");
1023      }
1024      return $contact_ids;
1025  }
publicget_contact_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1026  public function get_contact_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1027  {
1028      $ids = $this->get_contact_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1029      $objects = array();
1030      foreach ($ids as $index=>$id)
1031      {
1032          $objects[$index] = new contact($id);
1033      }
1034      return $objects;
1035  }
publicget_content ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
505  public function get_content($__type="default")
506  {
507      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
508      $this->property_objects_array["{$__type}_content"] = $object;
509      return $object;
510  }
publicget_content_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
511  public function get_content_id($__type="default")
512  {
513      $ids = $this->get_content_ids($__type, true);
514      return (count($ids)==1 ? $ids[0] : null);
515  }
publicget_content_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
516  public function get_content_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
517  {
518      $content_ids = array();
519      $db = resource::db();
520      $q  = " SELECT cms_content.id FROM cms_content_resource INNER JOIN cms_content ON cms_content_resource.content_id=cms_content.id AND cms_content_resource.deleted=0 AND cms_content.deleted=0 AND cms_content_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND cms_content_resource.content_resource_type_id='" . content_resource::type_id($__type) . "'") . ($__get_primary ? " AND cms_content_resource.primary=1 " : "");
521      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
522      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
523      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
524      $db->query($q);
525      while ($db->next_record())
526      {
527          $content_ids[] = $db->f("id");
528      }
529      return $content_ids;
530  }
publicget_content_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
531  public function get_content_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
532  {
533      $ids = $this->get_content_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
534      $objects = array();
535      foreach ($ids as $index=>$id)
536      {
537          $objects[$index] = new content($id);
538      }
539      return $objects;
540  }
publicget_current_path ( )[ resource_ext ]
Parameters
No parameters for this method
Code
193  public function get_current_path()
194  {
195      if (file_exists($this->tmp_name))
196      {
197          return $this->tmp_name;
198      }
199      else if (file_exists($this->path))
200      {
201          return $this->path;
202      }
203      else
204      {
205          return null;
206      }
207  }
publicget_dir ( )[ resource_ext ]
Parameters
No parameters for this method
Code
158  public function get_dir()
159  {
160      return SITE . "resources/{$this->resource_dir}/";
161  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicget_document ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1198  public function get_document($__type="default")
1199  {
1200      $object = is_null(keyval($this->property_objects_array,"{$__type}_document")) ? new document($this->get_document_id($__type)) : $this->property_objects_array["{$__type}_document"];
1201      $this->property_objects_array["{$__type}_document"] = $object;
1202      return $object;
1203  }
publicget_document_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1204  public function get_document_id($__type="default")
1205  {
1206      $ids = $this->get_document_ids($__type, true);
1207      return (count($ids)==1 ? $ids[0] : null);
1208  }
publicget_document_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1209  public function get_document_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1210  {
1211      $document_ids = array();
1212      $db = resource::db();
1213      $q  = " SELECT doc_document.id FROM doc_document_resource INNER JOIN doc_document ON doc_document_resource.document_id=doc_document.id AND doc_document_resource.deleted=0 AND doc_document.deleted=0 AND doc_document_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND doc_document_resource.document_resource_type_id='" . document_resource::type_id($__type) . "'") . ($__get_primary ? " AND doc_document_resource.primary=1 " : "");
1214      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1215      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1216      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1217      $db->query($q);
1218      while ($db->next_record())
1219      {
1220          $document_ids[] = $db->f("id");
1221      }
1222      return $document_ids;
1223  }
publicget_document_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1224  public function get_document_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1225  {
1226      $ids = $this->get_document_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1227      $objects = array();
1228      foreach ($ids as $index=>$id)
1229      {
1230          $objects[$index] = new document($id);
1231      }
1232      return $objects;
1233  }
publicget_employee ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1297  public function get_employee($__type="default")
1298  {
1299      $object = is_null(keyval($this->property_objects_array,"{$__type}_employee")) ? new employee($this->get_employee_id($__type)) : $this->property_objects_array["{$__type}_employee"];
1300      $this->property_objects_array["{$__type}_employee"] = $object;
1301      return $object;
1302  }
publicget_employee_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1303  public function get_employee_id($__type="default")
1304  {
1305      $ids = $this->get_employee_ids($__type, true);
1306      return (count($ids)==1 ? $ids[0] : null);
1307  }
publicget_employee_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1308  public function get_employee_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1309  {
1310      $employee_ids = array();
1311      $db = resource::db();
1312      $q  = " SELECT hr_employee.person_entity_id FROM hr_employee_resource INNER JOIN hr_employee ON hr_employee_resource.employee_person_entity_id=hr_employee.person_entity_id AND hr_employee_resource.deleted=0 AND hr_employee.deleted=0 AND hr_employee_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND hr_employee_resource.employee_resource_type_id='" . employee_resource::type_id($__type) . "'") . ($__get_primary ? " AND hr_employee_resource.primary=1 " : "");
1313      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1314      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1315      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1316      $db->query($q);
1317      while ($db->next_record())
1318      {
1319          $employee_ids[] = $db->f("person_entity_id");
1320      }
1321      return $employee_ids;
1322  }
publicget_employee_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1323  public function get_employee_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1324  {
1325      $ids = $this->get_employee_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1326      $objects = array();
1327      foreach ($ids as $index=>$id)
1328      {
1329          $objects[$index] = new employee($id);
1330      }
1331      return $objects;
1332  }
publicget_entity ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
703  public function get_entity($__type="default")
704  {
705      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
706      $this->property_objects_array["{$__type}_entity"] = $object;
707      return $object;
708  }
publicget_entity_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
709  public function get_entity_id($__type="default")
710  {
711      $ids = $this->get_entity_ids($__type, true);
712      return (count($ids)==1 ? $ids[0] : null);
713  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
714  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
715  {
716      $entity_ids = array();
717      $db = resource::db();
718      $q  = " SELECT cor_entity.id FROM cor_entity_resource INNER JOIN cor_entity ON cor_entity_resource.entity_id=cor_entity.id AND cor_entity_resource.deleted=0 AND cor_entity.deleted=0 AND cor_entity_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND cor_entity_resource.entity_resource_type_id='" . entity_resource::type_id($__type) . "'") . ($__get_primary ? " AND cor_entity_resource.primary=1 " : "");
719      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
720      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
721      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
722      $db->query($q);
723      while ($db->next_record())
724      {
725          $entity_ids[] = $db->f("id");
726      }
727      return $entity_ids;
728  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
729  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
730  {
731      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
732      $objects = array();
733      foreach ($ids as $index=>$id)
734      {
735          $objects[$index] = new entity($id);
736      }
737      return $objects;
738  }
publicget_exists ( )[ resource_ext ]
Parameters
No parameters for this method
Code
118  public function get_exists()
119  {
120      return file_exists($this->path);
121  }
publicget_ext ( )[ resource_ext ]
Parameters
No parameters for this method
Code
143  public function get_ext()
144  {
145      return strtolower(ext($this->name));
146  }
publicget_filename ( )[ resource_ext ]
Parameters
No parameters for this method
Code
148  public function get_filename()
149  {
150      return "{$this->hash}.{$this->ext}";
151  }
publicget_full_thumburl ( )[ resource_ext ]
Parameters
No parameters for this method
Code
178  public function get_full_thumburl()
179  {
180      return CURRENT_URL . "{$this->resource_dir}/{$this->thumbfile}";
181  }
publicget_full_url ( )[ resource_ext ]
Parameters
No parameters for this method
Code
168  public function get_full_url()
169  {
170      return CURRENT_URL . "{$this->resource_dir}/{$this->filename}";
171  }
publicget_group ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
802  public function get_group($__type="default")
803  {
804      $object = is_null(keyval($this->property_objects_array,"{$__type}_group")) ? new group($this->get_group_id($__type)) : $this->property_objects_array["{$__type}_group"];
805      $this->property_objects_array["{$__type}_group"] = $object;
806      return $object;
807  }
publicget_group_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
808  public function get_group_id($__type="default")
809  {
810      $ids = $this->get_group_ids($__type, true);
811      return (count($ids)==1 ? $ids[0] : null);
812  }
publicget_group_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
813  public function get_group_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
814  {
815      $group_ids = array();
816      $db = resource::db();
817      $q  = " SELECT cor_group.id FROM cor_group_resource INNER JOIN cor_group ON cor_group_resource.group_id=cor_group.id AND cor_group_resource.deleted=0 AND cor_group.deleted=0 AND cor_group_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND cor_group_resource.group_resource_type_id='" . group_resource::type_id($__type) . "'") . ($__get_primary ? " AND cor_group_resource.primary=1 " : "");
818      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
819      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
820      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
821      $db->query($q);
822      while ($db->next_record())
823      {
824          $group_ids[] = $db->f("id");
825      }
826      return $group_ids;
827  }
publicget_group_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
828  public function get_group_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
829  {
830      $ids = $this->get_group_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
831      $objects = array();
832      foreach ($ids as $index=>$id)
833      {
834          $objects[$index] = new group($id);
835      }
836      return $objects;
837  }
publicget_height ( )[ resource_ext ]
Parameters
No parameters for this method
Code
214  public function get_height()
215  {
216      return keyval(getimagesize($this->path),1);
217  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ resource_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
287  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
288  {
289      return resource::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
290  }
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_mime ( )[ resource_ext ]
Parameters
No parameters for this method
Code
128  public function get_mime()
129  {
130      return mime($this->name);
131  }
publicget_mimetype ( )[ resource_db ]
Parameters
No parameters for this method
Code
382  public function get_mimetype()
383  {
384      return new mimetype($this->mimetype_id);
385  }
publicget_mtime ( )[ resource_ext ]
Parameters
No parameters for this method
Code
138  public function get_mtime()
139  {
140      return $this->exists ? filemtime($this->path) : 0;
141  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ resource_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
292  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
293  {
294      $objects = array();
295      foreach (resource::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
296      {
297          $objects[] = new resource($id);
298      }
299      return $objects;
300  }
publicget_path ( )[ resource_ext ]
Parameters
No parameters for this method
Code
183  public function get_path()
184  {
185      return $this->dir . $this->filename;
186  }
publicget_projectentity ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1396  public function get_projectentity($__type="default")
1397  {
1398      $object = is_null(keyval($this->property_objects_array,"{$__type}_projectentity")) ? new projectentity($this->get_projectentity_id($__type)) : $this->property_objects_array["{$__type}_projectentity"];
1399      $this->property_objects_array["{$__type}_projectentity"] = $object;
1400      return $object;
1401  }
publicget_projectentity_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
1402  public function get_projectentity_id($__type="default")
1403  {
1404      $ids = $this->get_projectentity_ids($__type, true);
1405      return (count($ids)==1 ? $ids[0] : null);
1406  }
publicget_projectentity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1407  public function get_projectentity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1408  {
1409      $projectentity_ids = array();
1410      $db = resource::db();
1411      $q  = " SELECT prj_projectentity.id FROM prj_projectentity_resource INNER JOIN prj_projectentity ON prj_projectentity_resource.projectentity_id=prj_projectentity.id AND prj_projectentity_resource.deleted=0 AND prj_projectentity.deleted=0 AND prj_projectentity_resource.resource_id='$this->id' " . (is_null($__type) ? "" : " AND prj_projectentity_resource.projectentity_resource_type_id='" . projectentity_resource::type_id($__type) . "'") . ($__get_primary ? " AND prj_projectentity_resource.primary=1 " : "");
1412      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
1413      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
1414      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
1415      $db->query($q);
1416      while ($db->next_record())
1417      {
1418          $projectentity_ids[] = $db->f("id");
1419      }
1420      return $projectentity_ids;
1421  }
publicget_projectentity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
1422  public function get_projectentity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
1423  {
1424      $ids = $this->get_projectentity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
1425      $objects = array();
1426      foreach ($ids as $index=>$id)
1427      {
1428          $objects[$index] = new projectentity($id);
1429      }
1430      return $objects;
1431  }
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 ( )[ resource_db ]
Parameters
No parameters for this method
Code
394  public function get_resource_type()
395  {
396      return new resource_type($this->resource_type_id);
397  }
publicget_saleitem ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
604  public function get_saleitem($__type="default")
605  {
606      $object = is_null(keyval($this->property_objects_array,"{$__type}_saleitem")) ? new saleitem($this->get_saleitem_id($__type)) : $this->property_objects_array["{$__type}_saleitem"];
607      $this->property_objects_array["{$__type}_saleitem"] = $object;
608      return $object;
609  }
publicget_saleitem_id ( type ["default"] )[ resource_db ]
Parameters
optionaltype ["default"]
Code
610  public function get_saleitem_id($__type="default")
611  {
612      $ids = $this->get_saleitem_ids($__type, true);
613      return (count($ids)==1 ? $ids[0] : null);
614  }
publicget_saleitem_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
615  public function get_saleitem_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
616  {
617      $saleitem_ids = array();
618      $db = resource::db();
619      $q  = " SELECT com_saleitem.id FROM com_resource_saleitem INNER JOIN com_saleitem ON com_resource_saleitem.saleitem_id=com_saleitem.id AND com_resource_saleitem.deleted=0 AND com_saleitem.deleted=0 AND com_resource_saleitem.resource_id='$this->id' " . (is_null($__type) ? "" : " AND com_resource_saleitem.resource_saleitem_type_id='" . resource_saleitem::type_id($__type) . "'") . ($__get_primary ? " AND com_resource_saleitem.primary=1 " : "");
620      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
621      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
622      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
623      $db->query($q);
624      while ($db->next_record())
625      {
626          $saleitem_ids[] = $db->f("id");
627      }
628      return $saleitem_ids;
629  }
publicget_saleitem_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ resource_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
630  public function get_saleitem_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
631  {
632      $ids = $this->get_saleitem_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
633      $objects = array();
634      foreach ($ids as $index=>$id)
635      {
636          $objects[$index] = new saleitem($id);
637      }
638      return $objects;
639  }
publicget_size ( )[ resource_ext ]
Parameters
No parameters for this method
Code
123  public function get_size()
124  {
125      return $this->exists ? filesize($this->path) : $this->bytes;
126  }
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_thumbfile ( )[ resource_ext ]
Parameters
No parameters for this method
Code
153  public function get_thumbfile()
154  {
155      return "tn.{$this->filename}";
156  }
publicget_thumbpath ( )[ resource_ext ]
Parameters
No parameters for this method
Code
188  public function get_thumbpath()
189  {
190      return $this->dir . $this->thumbfile;
191  }
publicget_thumburl ( )[ resource_ext ]
Parameters
No parameters for this method
Code
173  public function get_thumburl()
174  {
175      return WEBROOT . "{$this->resource_dir}/{$this->thumbfile}";
176  }
publicget_type ( )[ resource_db ]
Parameters
No parameters for this method
Code
371  public function get_type()
372  {
373      $type = new resource_type($this->_resource_type_id);
374      return $type->name;
375  }
publicget_url ( )[ resource_ext ]
Parameters
No parameters for this method
Code
163  public function get_url()
164  {
165      return WEBROOT . "{$this->resource_dir}/{$this->filename}";
166  }
publicget_width ( )[ resource_ext ]
Parameters
No parameters for this method
Code
209  public function get_width()
210  {
211      return keyval(getimagesize($this->path),0);
212  }
protectedinsert ( write_resource [true] )[ resource_ext ]
Parameters
optionalwrite_resource [true]
Code
335  protected function insert($__write_resource=true)
336  {
337      $db = resource::db();
338      $q  = " INSERT INTO cor_resource ( ";
339      $q .= $db->param_string("name") . ", ";
340      $q .= $db->param_string("hash") . ", ";
341      $q .= $db->param_string("description") . ", ";
342      $q .= $db->param_string("bytes") . ", ";
343      $q .= $db->param_string("mimetype_id") . ", ";
344      $q .= $db->param_string("resource_type_id") . ", ";
345      $q .= $db->param_string("expirationdate") . ", ";
346      $q .= $db->param_string("mdate") . ", ";
347      $q .= $db->param_string("cdate") . ", ";
348      $q .= $db->param_string("deleted");
349      $q .= " ) VALUES ( ";
350      $q .= $db->value_string($this->_name) . ", ";
351      $q .= $db->value_string($this->_hash) . ", ";
352      $q .= $db->value_string($this->_description) . ", ";
353      $q .= $db->value_string($this->_bytes) . ", ";
354      $q .= $db->value_string($this->_mimetype_id) . ", ";
355      $q .= $db->value_string($this->_resource_type_id) . ", ";
356      $q .= $db->value_string($this->_expirationdate) . ", ";
357      $q .= $db->value_string(timestamp()) . ", ";
358      $q .= $db->value_string(timestamp()) . ", ";
359      $q .= $this->deleted ? "'1'" : "'0'";
360      $q .= " ) ";
361      $db->query($q);
362      $this->_id = $db->insert_id;
363 
364      if ($__write_resource)
365      {
366          $this->write_resource();
367      }
368 
369      return true;
370  }
publicmap ( )[ resource_db ]
Parameters
No parameters for this method
Code
112  public function map()
113  {
114      $this->_name = array_key_exists("resource:name",$_REQUEST) ? reqval("resource:name") : $this->_name;
115      $this->_hash = array_key_exists("resource:hash",$_REQUEST) ? reqval("resource:hash") : $this->_hash;
116      $this->_description = array_key_exists("resource:description",$_REQUEST) ? reqval("resource:description") : $this->_description;
117      $this->_bytes = array_key_exists("resource:bytes",$_REQUEST) ? reqval("resource:bytes") : $this->_bytes;
118      $this->_mimetype_id = array_key_exists("resource:mimetype_id",$_REQUEST) ? reqval("resource:mimetype_id") : $this->_mimetype_id;
119      $this->_resource_type_id = array_key_exists("resource:resource_type_id",$_REQUEST) ? reqval("resource:resource_type_id") : $this->_resource_type_id;
120      $this->_expirationdate = array_key_exists("resource:expirationdate",$_REQUEST) ? reqval("resource:expirationdate") : $this->_expirationdate;
121      $this->_mdate = array_key_exists("resource:mdate",$_REQUEST) ? reqval("resource:mdate") : $this->_mdate;
122      $this->_cdate = array_key_exists("resource:cdate",$_REQUEST) ? reqval("resource:cdate") : $this->_cdate;
123      $this->_deleted = array_key_exists("resource:deleted",$_REQUEST) ? reqval("resource:deleted") : $this->_deleted;
124  }
publicpurge ( )[ resource_db ]
Parameters
No parameters for this method
Code
216  public function purge()
217  {
218      $db = resource::db();
219      $q  = " DELETE FROM cor_resource ";
220      $q .= " WHERE id = " . $this->_id;
221      $db->query($q);
222      return true;
223  }
public staticsearch ( keyword )[ resource_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 , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
443  public function set_asset($__v, $__type="default")
444  {
445      $object = is_null(keyval($this->property_objects_array,"{$__type}_asset")) ? new asset($this->get_asset_id($__type)) : $this->property_objects_array["{$__type}_asset"];
446      if (is_null($__v))
447      {
448          $rel = new asset_resource(null,$object->id,$this->id,asset_resource::type_id($__type));
449          $rel->delete();
450          if (!is_null(keyval($this->property_objects_array,"{$__type}_asset")))
451          {
452              $this->property_objects_array["{$__type}_asset"] = null;
453          }
454      }
455      else
456      {
457          $id = $object->id;
458          $object = $__v;
459          $object->id = $__v->id>0 ? $__v->id : $id;
460          $object->commit();
461          $this->set_asset_ids(array($object->id),$__type);
462      }
463  }
publicset_asset_id ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
464  public function set_asset_id($__v, $__type="default")
465  {
466      $this->set_asset_ids(array($__v),$__type);
467  }
publicset_asset_ids ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
468  public function set_asset_ids($__v, $__type="default")
469  {
470      if ($this->id == 0)
471      {
472          $this->commit();
473      }
474      $type_id = asset_resource::type_id($__type);
475      asset_resource::delete_all(null,$this->id,$type_id);
476      if (is_array($__v))
477      {
478          foreach ($__v as $index=>$id)
479          {
480              $object = new asset_resource(null,$id,$this->id,$type_id);
481              $object->deleted = false;
482              $object->asset_resource_type_id = $type_id;
483              $object->commit();
484              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_asset")))
485              {
486                  $this->property_objects_array["{$__type}_asset"] = new asset($object->asset_id);
487              }
488          }
489          $this->_dirty = true;
490      }
491  }
publicset_asset_list ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
492  public function set_asset_list($__v, $__type="default")
493  {
494      if (is_array($__v))
495      {
496          $ids = array();
497          foreach ($__v as $index=>$object)
498          {
499              $ids[] = $object->id;
500          }
501          $this->set_asset_ids($ids,$__type);
502      }
503  }
publicset_business_comment ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
938  public function set_business_comment($__v, $__type="default")
939  {
940      $object = is_null(keyval($this->property_objects_array,"{$__type}_business_comment")) ? new business_comment($this->get_business_comment_id($__type)) : $this->property_objects_array["{$__type}_business_comment"];
941      if (is_null($__v))
942      {
943          $rel = new businesscomment_resource(null,$object->id,$this->id,businesscomment_resource::type_id($__type));
944          $rel->delete();
945          if (!is_null(keyval($this->property_objects_array,"{$__type}_business_comment")))
946          {
947              $this->property_objects_array["{$__type}_business_comment"] = null;
948          }
949      }
950      else
951      {
952          $id = $object->id;
953          $object = $__v;
954          $object->id = $__v->id>0 ? $__v->id : $id;
955          $object->commit();
956          $this->set_business_comment_ids(array($object->id),$__type);
957      }
958  }
publicset_business_comment_id ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
959  public function set_business_comment_id($__v, $__type="default")
960  {
961      $this->set_business_comment_ids(array($__v),$__type);
962  }
publicset_business_comment_ids ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
963  public function set_business_comment_ids($__v, $__type="default")
964  {
965      if ($this->id == 0)
966      {
967          $this->commit();
968      }
969      $type_id = businesscomment_resource::type_id($__type);
970      businesscomment_resource::delete_all(null,$this->id,$type_id);
971      if (is_array($__v))
972      {
973          foreach ($__v as $index=>$id)
974          {
975              $object = new businesscomment_resource(null,$id,$this->id,$type_id);
976              $object->deleted = false;
977              $object->businesscomment_resource_type_id = $type_id;
978              $object->commit();
979              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business_comment")))
980              {
981                  $this->property_objects_array["{$__type}_business_comment"] = new business_comment($object->business_comment_id);
982              }
983          }
984          $this->_dirty = true;
985      }
986  }
publicset_business_comment_list ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
987  public function set_business_comment_list($__v, $__type="default")
988  {
989      if (is_array($__v))
990      {
991          $ids = array();
992          foreach ($__v as $index=>$object)
993          {
994              $ids[] = $object->id;
995          }
996          $this->set_business_comment_ids($ids,$__type);
997      }
998  }
publicset_comment_contact ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1136  public function set_comment_contact($__v, $__type="default")
1137  {
1138      $object = is_null(keyval($this->property_objects_array,"{$__type}_comment_contact")) ? new comment_contact($this->get_comment_contact_id($__type)) : $this->property_objects_array["{$__type}_comment_contact"];
1139      if (is_null($__v))
1140      {
1141          $rel = new commentcontact_resource(null,$object->id,$this->id,commentcontact_resource::type_id($__type));
1142          $rel->delete();
1143          if (!is_null(keyval($this->property_objects_array,"{$__type}_comment_contact")))
1144          {
1145              $this->property_objects_array["{$__type}_comment_contact"] = null;
1146          }
1147      }
1148      else
1149      {
1150          $id = $object->id;
1151          $object = $__v;
1152          $object->id = $__v->id>0 ? $__v->id : $id;
1153          $object->commit();
1154          $this->set_comment_contact_ids(array($object->id),$__type);
1155      }
1156  }
publicset_comment_contact_id ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1157  public function set_comment_contact_id($__v, $__type="default")
1158  {
1159      $this->set_comment_contact_ids(array($__v),$__type);
1160  }
publicset_comment_contact_ids ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1161  public function set_comment_contact_ids($__v, $__type="default")
1162  {
1163      if ($this->id == 0)
1164      {
1165          $this->commit();
1166      }
1167      $type_id = commentcontact_resource::type_id($__type);
1168      commentcontact_resource::delete_all(null,$this->id,$type_id);
1169      if (is_array($__v))
1170      {
1171          foreach ($__v as $index=>$id)
1172          {
1173              $object = new commentcontact_resource(null,$id,$this->id,$type_id);
1174              $object->deleted = false;
1175              $object->commentcontact_resource_type_id = $type_id;
1176              $object->commit();
1177              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_comment_contact")))
1178              {
1179                  $this->property_objects_array["{$__type}_comment_contact"] = new comment_contact($object->comment_contact_id);
1180              }
1181          }
1182          $this->_dirty = true;
1183      }
1184  }
publicset_comment_contact_list ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1185  public function set_comment_contact_list($__v, $__type="default")
1186  {
1187      if (is_array($__v))
1188      {
1189          $ids = array();
1190          foreach ($__v as $index=>$object)
1191          {
1192              $ids[] = $object->id;
1193          }
1194          $this->set_comment_contact_ids($ids,$__type);
1195      }
1196  }
publicset_contact ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1037  public function set_contact($__v, $__type="default")
1038  {
1039      $object = is_null(keyval($this->property_objects_array,"{$__type}_contact")) ? new contact($this->get_contact_id($__type)) : $this->property_objects_array["{$__type}_contact"];
1040      if (is_null($__v))
1041      {
1042          $rel = new contact_resource(null,$object->id,$this->id,contact_resource::type_id($__type));
1043          $rel->delete();
1044          if (!is_null(keyval($this->property_objects_array,"{$__type}_contact")))
1045          {
1046              $this->property_objects_array["{$__type}_contact"] = null;
1047          }
1048      }
1049      else
1050      {
1051          $id = $object->id;
1052          $object = $__v;
1053          $object->id = $__v->id>0 ? $__v->id : $id;
1054          $object->commit();
1055          $this->set_contact_ids(array($object->id),$__type);
1056      }
1057  }
publicset_contact_id ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1058  public function set_contact_id($__v, $__type="default")
1059  {
1060      $this->set_contact_ids(array($__v),$__type);
1061  }
publicset_contact_ids ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1062  public function set_contact_ids($__v, $__type="default")
1063  {
1064      if ($this->id == 0)
1065      {
1066          $this->commit();
1067      }
1068      $type_id = contact_resource::type_id($__type);
1069      contact_resource::delete_all(null,$this->id,$type_id);
1070      if (is_array($__v))
1071      {
1072          foreach ($__v as $index=>$id)
1073          {
1074              $object = new contact_resource(null,$id,$this->id,$type_id);
1075              $object->deleted = false;
1076              $object->contact_resource_type_id = $type_id;
1077              $object->commit();
1078              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_contact")))
1079              {
1080                  $this->property_objects_array["{$__type}_contact"] = new contact($object->contact_id);
1081              }
1082          }
1083          $this->_dirty = true;
1084      }
1085  }
publicset_contact_list ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1086  public function set_contact_list($__v, $__type="default")
1087  {
1088      if (is_array($__v))
1089      {
1090          $ids = array();
1091          foreach ($__v as $index=>$object)
1092          {
1093              $ids[] = $object->id;
1094          }
1095          $this->set_contact_ids($ids,$__type);
1096      }
1097  }
publicset_content ( v , type ["default"] )[ resource_db ]
Parameters
requiredv
optionaltype ["default"]
Code
542  public function set_content($__v, $__type="default")
543  {
544      $object = is_null(keyval($this->property_objects_array,"{$__type}_content")) ? new content($this->get_content_id($__type)) : $this->property_objects_array["{$__type}_content"];
545      if (is_null($__v))
546      {
547          $rel = new content_resource(null,$object->id,$this->id,content_resource::type_id($__type));
548          $rel->delete();
549          if (!is_null(keyval($this->property_objects_array,"{$__type}_content")))
550          {
551              $this->property_objects_array["{$__type}_content"] = null;
552          }
553      }
554      else
555      {
556&n