Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
google_map_location.inc
1 <?php
21 require_once SQ_INCLUDE_PATH.'/asset.inc';
22 
35 {
36 
37 
44  function __construct($assetid=0)
45  {
46  parent::__construct($assetid);
47 
48  }//end constructor
49 
50 
61  protected function _getName($short_name=FALSE, $contextid=NULL)
62  {
63  // No context specified, using the current context
64  if ($contextid === NULL) {
65  $contextid = $GLOBALS['SQ_SYSTEM']->getContextId();
66  }//end if
67 
68  // Obtain the attribute value for Name from the specified Context
69  $attr = ($short_name) ? 'short_name' : 'name';
70  $values = $GLOBALS['SQ_SYSTEM']->am->getAttributeValuesByName($attr, $this->type(), Array($this->id), $contextid);
71  if (empty($values) === TRUE) {
72  return parent::_getName($short_name, $contextid);
73  } else {
74  return $values[$this->id];
75  }
76 
77  }//end _getName()
78 
79 
90  function _preCreateCheck(&$link)
91  {
92  if (!parent::_preCreateCheck($link)) return FALSE;
93 
94  $name = trim($this->attr('name'));
95  if ($name == '') {
96  trigger_localised_error('CORE0083', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
97  return FALSE;
98  }
99 
100  // if the short name hasn't been set then short and long names are the same to begin with
101  if (trim($this->attr('short_name')) == '') {
102  $this->setAttrValue('short_name', $name);
103  }
104 
105  return TRUE;
106 
107  }//end _preCreateCheck()
108 
109 
110 }//end class
111 ?>