public function parse(&$f_pszViewType = null) { if (0 == count($this->details)) { $arrViewType = array('shopIndex'); } else { if (0 < preg_match('/^p\\d+$/', $this->details[count($this->details) - 1])) { $arrViewType = array('productDetails'); } else { $arrViewType = array('productCategory', 'productCategory_' . count($this->details)); } } $f_pszViewType = $arrViewType[0]; $objView = AROView::getView($arrViewType, $this->id); if (!is_object($objView)) { throw new NoTemplateFoundException($arrViewType); } switch ($arrViewType[0]) { case 'productDetails': $arrUrl = $this->details; $iProductID = substr(array_pop($arrUrl), 1); try { $product = AROShopProduct::finder()->byPK($iProductID); } catch (Exception $ex) { return -2; } $parent = $this; foreach ($arrUrl as $szCatID) { $parent = $parent->getCategory($szCatID)->init($parent); if (!is_object($parent)) { return -2; } } $product->init($parent); $product->parseView($objView); break; case 'productCategory': $parent = $this; $arrUrl = $this->details; $lvl = count($arrUrl) + 1; foreach ($arrUrl as $szCatID) { $obj = $parent->getCategory($szCatID); $obj->level = $lvl--; if (!is_object($obj)) { return -2; } $obj->init($parent); $parent = $obj; } $parent->parseView($objView); break; case 'shopIndex': $this->parseView($objView); break; } return true; }
public function parse(&$f_pszViewType = null) { $szViewType = 'menu'; $f_pszViewType = $szViewType; $objView = AROView::getView($szViewType, $this->id); if (!is_object($objView)) { throw new NoTemplateFoundException(array($szViewType)); } $this->parseView($objView); return true; }
public function parse(&$f_pszViewType = null) { if (0 == count($this->details) || 1 == count($this->details) && 'submit' == $this->details[0]) { $szViewType = 'guestbook'; } else { $szViewType = 'guestbookEntry'; } $f_pszViewType = $szViewType; $objView = AROView::getView($szViewType, $this->id); if (!is_object($objView)) { throw new NoTemplateFoundException(array($szViewType)); } $this->guestbook = $this; switch ($szViewType) { case 'guestbook': if (0 < count($this->details) && 'submit' == $this->details[0] && 'POST' == $_SERVER['REQUEST_METHOD']) { $arrShow = self::$m_arrFields; $arrErrors = $arrInsert = array(); foreach ($arrShow as $szField) { if ('message' === $szField || '1' === $this->{'use_' . $szField}) { if (('message' == $szField || '1' === $this->{'mandatory_' . $szField}) && (empty($_POST['gb_' . $szField]) || 'email' == $szField && $this->check_email_regexp && !preg_match('/^[a-z0-9\\-_.]{2,}@[a-z0-9\\-_.]{2,}\\.[a-z]{2,10}$/i', $_POST['gb_' . $szField]))) { $arrErrors[$szField] = 'Invalid value'; } else { $arrInsert[$szField] = isset($_POST['gb_' . $szField]) ? $_POST['gb_' . $szField] : ''; } } } if (0 == count($arrErrors)) { // Insert! $arrInsert['guestbook_implementation_id'] = $this->implementation_id; $arrInsert['utc'] = time(); $arrInsert['ip'] = $_SERVER['REMOTE_ADDR']; $arrInsert['o'] = (int) $this->getDbObject()->select_one('guestbook_entries', 'MAX(o)', 'guestbook_implementation_id = ' . $this->implementation_id) + 1; $this->getDbObject()->insert('guestbook_entries', $arrInsert); header('Location: ' . $this->return_url); exit; } $this->errors = $arrErrors; } $this->parseView($objView); break; case 'guestbookEntry': $entry = $this->getEntry($this->details[0]); $entry->parseView($objView); break; } return true; }
public function parse(&$f_pszViewType = null) { $szViewType = 'page'; $f_pszViewType = $szViewType; $objView = AROView::getView($szViewType, $this->id); if (!is_object($objView)) { throw new NoTemplateFoundException(array($szViewType)); } $this->init(); $o = $this; $o->root = $this; foreach ($this->details as $id) { $o = $o->getPage($id); } $GLOBALS['page'] = $o; $o->parseView($objView); return true; }
public function parse(&$f_pszViewType = null) { if (0 < preg_match('#^(\\d+)(?:\\/[^\\/]+)?\\/(\\d+)(?:\\/[^\\/]+)?$#', implode('/', $this->details), $parrMatches)) { $szViewType = 'newsItemImage'; $item = $this->getNewsItem($parrMatches[1])->init($this); $object = $item->getImage($parrMatches[2])->init($item); } else { if (0 < preg_match('#^(\\d+)#', implode('/', $this->details), $parrMatches)) { $szViewType = 'newsItem'; $object = $this->getNewsItem($parrMatches[1])->init($this); } else { $szViewType = 'newsIndex'; $object = $this; } } $f_pszViewType = $szViewType; $objView = AROView::getView($szViewType, $this->id); if (!is_object($objView)) { throw new NoTemplateFoundException(array($szViewType)); } $object->parseView($objView); return true; }