public static function getForItem($module, $otherId)
{
$module = (string) $module;
$otherId = (int) $otherId;
// init var
$return = array();
// get tags
$linkedTags = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT t.tag AS name, t.url
FROM modules_tags AS mt
INNER JOIN tags AS t ON mt.tag_id = t.id
WHERE mt.module = ? AND mt.other_id = ?', array($module, $otherId));
// return
if (empty($linkedTags)) {
return $return;
}
// create link
$tagLink = FrontendNavigation::getURLForBlock('Tags', 'Detail');
// loop tags
foreach ($linkedTags as $row) {
// add full URL
$row['full_url'] = $tagLink . '/' . $row['url'];
// add
$return[] = $row;
}
// return
return $return;
}
/** * 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'; } }