Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset.inc';
19 
31 class Page extends Asset
32 {
33 
34 
41  function __construct($assetid=0)
42  {
43  parent::__construct($assetid);
44 
45  }//end constructor
46 
47 
58  protected function _preCreateCheck(Array &$link)
59  {
60  if (!parent::_preCreateCheck($link)) return FALSE;
61 
62  $name = trim($this->attr('name'));
63  if ($name == '') {
64  trigger_localised_error('CORE0083', E_USER_WARNING, $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($this->type(), 'name'));
65  return FALSE;
66  }
67 
68  // if the short name hasn't been set then short and long names are the same to begin with
69  if (trim($this->attr('short_name')) == '') {
70  $this->setAttrValue('short_name', $name);
71  }
72 
73  return TRUE;
74 
75  }//end _preCreateCheck()
76 
77 
88  protected function _createAdditional(Array &$link)
89  {
90  if (!parent::_createAdditional($link)) return FALSE;
91 
92  return $this->makeAndSaveInitialWebPath(strtolower($this->attr('name')), $link);
93 
94  }//end _createAdditional()
95 
96 
104  public function _getAllowedLinks()
105  {
106  $allowed = parent::_getAllowedLinks();
107  $allowed[SQ_LINK_TYPE_1]['page'] = Array('card' => 'M', 'exclusive' => FALSE);
108  $allowed[SQ_LINK_TYPE_1]['file'] = Array('card' => 'M', 'exclusive' => FALSE);
109  $allowed[SQ_LINK_TYPE_1]['folder'] = Array('card' => 'M', 'exclusive' => FALSE);
110  $allowed[SQ_LINK_TYPE_1]['data_source'] = Array('card' => 'M', 'exclusive' => FALSE);
111  $allowed[SQ_LINK_TYPE_1]['link'] = Array('card' => 'M', 'exclusive' => FALSE);
112 
113  $allowed[SQ_LINK_TYPE_2]['page'] = Array('card' => 'M', 'exclusive' => FALSE);
114  $allowed[SQ_LINK_TYPE_2]['file'] = Array('card' => 'M', 'exclusive' => FALSE);
115  $allowed[SQ_LINK_TYPE_2]['folder'] = Array('card' => 'M', 'exclusive' => FALSE);
116  $allowed[SQ_LINK_TYPE_2]['data_source'] = Array('card' => 'M', 'exclusive' => FALSE);
117  $allowed[SQ_LINK_TYPE_2]['link'] = Array('card' => 'M', 'exclusive' => FALSE);
118 
119  $allowed[SQ_LINK_TYPE_3]['page'] = Array('card' => 'M', 'exclusive' => FALSE);
120 
121  $allowed[SQ_LINK_NOTICE]['page'] = Array('card' => 'M', 'exclusive' => FALSE);
122  $allowed[SQ_LINK_NOTICE]['link'] = Array('card' => 'M', 'exclusive' => FALSE);
123 
124  return $allowed;
125 
126  }//end _getAllowedLinks()
127 
128 
137  public function printBody()
138  {
139 
140  }//end printBody()
141 
142 
152  protected function _getName($short_name=FALSE)
153  {
154  $am = $GLOBALS['SQ_SYSTEM']->am;
155  $attr_name = ($short_name === TRUE) ? 'short_name' : 'name';
156  $values = $am->getAttributeValuesByName($attr_name, $this->type(), Array($this->id), 0);
157  if (empty($values) === TRUE) {
158  return parent::_getName($short_name);
159  } else {
160  return $values[$this->id];
161  }
162 
163  }//end _getName()
164 
165 
166 }//end class
167 
168 ?>