public function process() { //CHECK PRIVACY if (!Phpfox::getUserParam('radio.can_view_radio')) { $this->url()->send('subscribe'); return; } $aSort = array('latest' => array('radio.radio_id', PHPFOX::getPhrase('photo.latest')), 'most-used' => array('radio.total_members', Phpfox::getPhrase('radio.most_listened')), 'most-viewed' => array('radio.total_views', Phpfox::getPhrase('radio.most_viewed')), 'most-commented' => array('radio.total_comment', Phpfox::getPhrase('radio.most_commented'))); $this->search()->set(array('type' => 'radio', 'field' => 'radio.radio_id', 'search_tool' => array('table_alias' => 'radio', 'search' => array('action' => $this->url()->makeUrl('radio.favourite'), 'default_value' => PHPFOX::getPhrase('radio.search'), 'name' => 'search', 'field' => 'radio.title'), 'sort' => $aSort, 'show' => array(8, 16, 32), 'when' => array()))); $aBrowseParams = array('module_id' => 'radio', 'alias' => 'radio', 'field' => 'radio_id', 'table' => PHPFOX::getT('radio')); if ($this->request()->get('req2') == 'category') { $sCategory = $iCategory = str_replace("-", " ", mysql_escape_string($this->request()->get('req3'))); $sWhere = "AND radio.category LIKE '%{$sCategory}%'"; $this->search()->setCondition($sWhere); } $this->search()->setCondition(" AND f.user_id=" . PHPFOX::getUserId()); $this->search()->setCondition(" AND is_active=1 "); $this->search()->browse()->params($aBrowseParams)->execute(); $radios = $this->search()->browse()->getRows(); foreach ($radios as &$radio) { $radio["link"] = PHPFOX::permalink('radio.radio', $radio["radio_id"], $radio['title']); if (!$radio["image"]) { $radio["image"] = Phpfox::getParam('core.path') . "module/radio/static/image/nophoto.png"; } $i = 0; $cat_array = explode(",", $radio["category"]); $count = count($cat_array); $cats = ""; foreach ($cat_array as $cat) { $link = PHPFOX::permalink('radio', "category", $cat); $cats .= "<a href='{$link}' >" . trim($cat) . "</a>"; $i++; if ($i != $count) { $cats .= ", "; } } $radio["category_links"] = $cats; } $aPager = array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()); PHPFOX::getLib('pager')->set($aPager); $this->template()->setTitle(Phpfox::getPhrase('radio.radios'))->setBreadcrumb(Phpfox::getPhrase('radio.radios'))->assign(array('radios' => $radios, 'current_category' => $sCategory, 'aCount' => $this->search()->browse()->getCount()))->setHeader('cache', array('index.css' => 'module_radio', 'pager.css' => 'style_css')); if (Phpfox::isUser()) { $aFilterMenu = array(Phpfox::getPhrase('radio.browse_radios') => 'radio/', Phpfox::getPhrase('radio.favourites_radios') => 'radio.favourite', Phpfox::getPhrase('radio.featured_radios') => 'radio.featured'); } else { $aFilterMenu = array(Phpfox::getPhrase('radio.browse_radios') => 'radio/', Phpfox::getPhrase('radio.featured_radios') => 'radio.featured'); } $this->template()->buildSectionMenu('radio', $aFilterMenu); }
public function getQueryJoins() { $this->database()->leftJoin(PHPFOX::getT('radio_favourite'), 'f', 'f.radio_id = radio.radio_id'); }