getRestParams())) { foreach ($items as $k => $v) { if ($v['type'] == 'HtmlBlock_') { unset($items[$k]); } } } return $this; } public function exec() { $this->doc->setHeader(''); $params = $this->getRestParams(); $paramsCount = count($params); if (0 != $paramsCount && (is_numeric($params[0]) || $params[0] == self::PRODUCT_DISPOSAL_ALIAS) && $paramsCount <= 2) { if (is_numeric($params[0])) { if ($params[0] == self::PRODUCT_DISPOSAL_ID) { Qs_Http::redirect(BASE_URL . '/' . CURRENT_PAGE_FINAL . '/' . self::PRODUCT_DISPOSAL_ALIAS); } else { $this->dataObj->setPrimaryKey(intval($params[0])); } } else { $this->dataObj->setPrimaryKey(self::PRODUCT_DISPOSAL_ID); } if (!$this->dataObj->getData()) { $this->doc->display404(); } if ($paramsCount >= 2) { if (in_array($params[1], $this->_tabAliases)) { $this->_tabAlias = $params[1]; } else { $this->doc->display404(); } } $this->_defaultAction = 'view'; } elseif (!empty($params)) { $this->doc->display404(); } return parent::exec(); } protected function _doView() { $item = $this->dataObj->getData(); if (empty($item)) { $this->doc->display404(); } $form = $this->_getBaseForm(); $form->addElement('select', 'productId', array( 'label' => 'Other Products:', 'value' => $item['id'], 'multioptions' => array('' => '---Utility Poles---') + $this->dataObj->getProduct4Select( array('id', 'name'), null, '`type` = "' . App_Product_AbstractObj::UTILITY_POLE . '"') + array('0' => '---Other Products---') + $this->dataObj->getProduct4Select(array('id', 'name'), null, '`type` = "other"') )); $item['form'] = $form; $item['tabAlias'] = $this->_tabAlias; $item['tpl'] = $this->getTemplate('view.tpl'); $this->_addItem($item); $this->doc->addScript('js/app/product.js'); $this->doc->addInitFunction('App_Product.init', array()); return $this; } protected function _doViewAjax() { if ($this->_tabAlias == 'overview') { $this->_displayJson(array('content' => $this->dataObj->getData('description'))); } else { $this->_displayJson(array('content' => $this->dataObj->getData($this->_tabAlias))); } return $this; } }