/** * Load the data, don't forget to validate the incoming data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // get by URL $this->record = FrontendFaqModel::get($this->URL->getParameter(1)); // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // overwrite URLs $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['category_url']; $this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Detail') . '/' . $this->record['url']; // get tags $this->record['tags'] = FrontendTagsModel::getForItem('Faq', $this->record['id']); // get settings $this->settings = $this->get('fork.settings')->getForModule('Faq'); // reset allow comments if (!$this->settings['allow_feedback']) { $this->record['allow_feedback'] = false; } // ge status $this->status = $this->URL->getParameter(2); if ($this->status == FL::getAction('Success')) { $this->status = 'success'; } if ($this->status == FL::getAction('Spam')) { $this->status = 'spam'; } }
/** * Get tags for current "page" */ private function getTags() { // get page id $pageId = $this->getContainer()->get('page')->getId(); // array of excluded records $this->exclude[] = array('module' => 'Pages', 'other_id' => $pageId); // get tags for page $tags = (array) FrontendTagsModel::getForItem('pages', $pageId); foreach ($tags as $tag) { $this->tags = array_merge((array) $this->tags, (array) $tag['name']); } // get page record $record = (array) FrontendNavigation::getPageInfo($pageId); // loop blocks foreach ((array) $record['extra_blocks'] as $block) { // set module class $class = 'Frontend\\Modules\\' . $block['module'] . '\\Engine\\Model'; if (is_callable(array($class, 'getIdForTags'))) { // get record for module $record = FrontendTagsModel::callFromInterface($block['module'], $class, 'getIdForTags', $this->URL); // check if record exists if (!$record) { continue; } // add to excluded records $this->exclude[] = array('module' => $block['module'], 'other_id' => $record['id']); // get record's tags $tags = (array) FrontendTagsModel::getForItem($block['module'], $record['id']); foreach ($tags as $tag) { $this->tags = array_merge((array) $this->tags, (array) $tag['name']); } } } }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // load revision if ($this->URL->getParameter('revision', 'int') != 0) { // get data $this->record = FrontendBlogModel::getRevision($this->URL->getParameter(1), $this->URL->getParameter('revision', 'int')); // add no-index, so the draft won't get accidentally indexed $this->header->addMetaData(array('name' => 'robots', 'content' => 'noindex, nofollow'), true); } else { // get by URL $this->record = FrontendBlogModel::get($this->URL->getParameter(1)); } // anything found? if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } // get comments $this->comments = FrontendBlogModel::getComments($this->record['id']); // get tags $this->record['tags'] = FrontendTagsModel::getForItem('Blog', $this->record['id']); // get settings $this->settings = $this->get('fork.settings')->getForModule('Blog'); // overwrite URLs $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Category') . '/' . $this->record['category_url']; $this->record['full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Detail') . '/' . $this->record['url']; $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y'; $this->record['comments_count'] = count($this->comments); // reset allow comments if (!$this->settings['allow_comments']) { $this->record['allow_comments'] = false; } }
/** * Get the data */ private function getData() { // validate incoming parameters if ($this->URL->getParameter(1) === null) { $this->redirect(FrontendNavigation::getURL(404)); } // get information $this->record = FrontendCatalogModel::get($this->URL->getParameter(1)); $this->comments = FrontendCatalogModel::getComments($this->record['id']); $this->specifications = FrontendCatalogModel::getProductSpecifications($this->record['id']); $this->tags = FrontendTagsModel::getForItem('Catalog', $this->record['id']); $this->settings = $this->get('fork.settings')->getForModule('Catalog'); $this->files = FrontendCatalogModel::getFiles($this->record['id']); $this->videos = FrontendCatalogModel::getVideos($this->record['id']); $this->relatedProducts = FrontendCatalogModel::getRelatedProducts($this->record['id']); $this->brand = FrontendCatalogModel::getBrand($this->record['brand_id']); $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y'; $this->record['brand'] = $this->brand; $this->record['image'] = FrontendMediaHelper::getFromModule('Catalog', $this->record['id'], 0, 1, 'product'); $this->record['images'] = FrontendMediaHelper::getFromModule('Catalog', $this->record['id'], 0, 0, 'product'); // reset allow comments if (!$this->settings['allow_comments']) { $this->record['allow_comments'] = false; } // check if record is not empty if (empty($this->record)) { $this->redirect(FrontendNavigation::getURL(404)); } //--Get all the categories $this->categoriesTree = FrontendCatalogModel::getCategoriesTree(0, $this->record['category_id']); }