Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
squiz_suite_system.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset.inc';
19 
32 {
33 
34 
41  function __construct($assetid=0)
42  {
43  $this->_ser_attrs = TRUE;
44  parent::__construct($assetid);
45 
46  }//end constructor
47 
48 
59  protected function _preCreateCheck(Array &$link)
60  {
61  if (!parent::_preCreateCheck($link)) return FALSE;
62 
63  // if the short name hasn't been set then short and long names are the same to begin with
64  $name = trim($this->attr('name'));
65  if (trim($this->attr('short_name')) == '') {
66  $this->setAttrValue('short_name', $name);
67  }//end if
68 
69  return TRUE;
70 
71  }//end _preCreateCheck()
72 
73 
84  protected function _getName($short_name=FALSE, $contextid=NULL)
85  {
86  // No context specified, using the current context
87  if ($contextid === NULL) {
88  $contextid = $GLOBALS['SQ_SYSTEM']->getContextId();
89  }//end if
90 
91  // Obtain the attribute value for Name from the specified Context
92  $attr = ($short_name) ? 'short_name' : 'name';
93  $values = $GLOBALS['SQ_SYSTEM']->am->getAttributeValuesByName($attr, $this->type(), Array($this->id), $contextid);
94  if (empty($values) === TRUE) {
95  return parent::_getName($short_name, $contextid);
96  } else {
97  return $values[$this->id];
98  }
99 
100  }//end _getName()
101 
102 
103 }//end class
104 
105 ?>