Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
physical_folder.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset.inc';
18 
30 class Physical_Folder extends Asset
31 {
32 
37  var $_bridgeid = 0;
38 
43  var $_shadowid = 0;
44 
45 
53  function __construct($assetid=0, $data=Array())
54  {
55  parent::__construct();
56 
57  if (!$assetid) return;
58  list($this->_bridgeid, $this->_shadowid) = explode(':', $assetid);
59 
60  $bridge = $GLOBALS['SQ_SYSTEM']->am->getAsset($this->_bridgeid);
61  if (is_null($bridge)) return;
62 
63  // set the data paths
64  $this->data_path = $bridge->data_path.'/physical_folder';
65  $this->data_path_suffix = $bridge->data_path_suffix.'/physical_folder';
66  $this->data_path_public = $bridge->data_path_public.'/physical_folder';
67 
68  // if there is no shadowid then we haven't been created yet, so don't do anymore
69  if (!$this->_shadowid) return;
70 
71  $this->id = $assetid;
72 
73  foreach ($data as $attr_name => $attr_value) {
74  if (!isset($this->vars[$attr_name])) continue;
75  $this->vars[$attr_name]['value'] = ($this->vars[$attr_name]['type'] == 'serialise') ? unserialize($attr_value) : $attr_value;
76  }
77 
78  require_once (SQ_DATA_PATH.'/private/conf/file_bridge.inc');
79  $location = FILE_BRIDGE_PATH;
80  $location = rtrim('/', $location);
81  $full_path = $location.'/'.$this->_shadowid;
82  $name = basename($full_path);
83 
84  // set general object properties, now we have the name of the thing
85  $this->name = $name;
86  $this->short_name = $name;
87  $this->status = $bridge->status;
88  $this->version = '0.1';
89 
90  }//end constructor
91 
92 }//end class
93 ?>