Exemple #1
0
 public function process()
 {
     $radio_block = Phpfox::getService('radio.callback')->query("is_active=1", " (total_members*10+total_views) DESC", false, 3);
     foreach ($radio_block[1] as $key => $item) {
         $radio_block[1][$key]["link"] = PHPFOX::permalink('radio.radio', $item["radio_id"], $item['title']);
     }
     $this->template()->assign(array('radio_block' => $radio_block[1]));
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 public function process()
 {
     if ($this->request()->get('req2') == 'radio') {
         $radio_id = $this->request()->getInt('req3');
         $radio = Phpfox::getService('radio.callback')->query("is_active=1 AND radio.radio_id={$radio_id}");
         if (!$radio[1][0]["title"]) {
             $this->url()->send('radio');
         }
         //MAKE VIEW
         Phpfox::getService('radio.callback')->makeview($radio_id, $radio[1][0]["total_views"]);
         $radio[1][0]["total_views"]++;
     }
     //GET PLAYED USERS
     $users = Phpfox::getService('radio.callback')->getusers($radio_id);
     foreach ($users as &$item) {
         $pUsersInfo = array('title' => $item['full_name'], 'path' => 'core.url_user', 'file' => $item['user_image'], 'suffix' => '_75_square', 'width' => 50, 'height' => 50, 'no_default' => Phpfox::getUserId() == $item['user_id'] ? false : true, 'thickbox' => true, 'class' => 'profile_user_image', 'no_link' => true);
         $item['profile_image'] = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true, $item)), $pUsersInfo));
     }
     //GET SIMILAR GAMES
     $cat_array = explode(",", $radio[1][0]["category"]);
     $sql = "";
     $i = 0;
     foreach ($cat_array as $cat) {
         $i++;
         $sql .= " radio.category LIKE '%{$cat}%' ";
         if ($i != count($cat_array)) {
             $sql .= " OR ";
         }
     }
     $radios = Phpfox::getService('radio.callback')->query("radio.radio_id<>{$radio_id} AND is_active=1 AND ({$sql})", "RAND()", 0, 3);
     foreach ($radios[1] as $key => $game_vasa) {
         $radios[1][$key]["link"] = PHPFOX::permalink('radio.radio', $game_vasa["radio_id"], $game_vasa['title']);
     }
     $this->template()->setTitle($radio[1][0]["title"])->setHeader('cache', array('feed.js' => 'module_feed', 'comment.css' => 'style_css', 'quick_edit.js' => 'static_script', 'index.css' => 'module_radio'))->setBreadcrumb($radio[1][0]["title"])->assign(array('radio' => $radio[1][0], 'radios' => $radios[1], 'users' => $users));
     //COMMENTS
     $this->setParam('aFeed', array('comment_type_id' => 'radio', 'like_type_id' => 'radio', 'feed_is_liked' => isset($radio[1][0]['is_liked']) ? $radio[1][0]['is_liked'] : false, 'feed_is_friend' => 1, 'item_id' => $radio[1][0]['radio_id'], 'user_id' => $radio[1][0]['user_id'], 'total_comment' => $radio[1][0]['total_comment'], 'total_like' => $radio[1][0]['total_like'], 'feed_link' => Phpfox::getLib('url')->makeUrl('radio', array('radio' => $radio[1][0]['game_id'])), 'feed_title' => $radio[1][0]['title'], 'feed_display' => 'view', 'feed_total_like' => $radio[1][0]['total_like'], 'report_module' => 'radio', 'report_phrase' => Phpfox::getPhrase('radio.radio_not_work')));
 }
Exemple #4
0
 public function query($where, $order = "radio.radio_id DESC", $page = "", $limit = "")
 {
     $num = $this->database()->select('count(radio_id)')->from($this->_sTable, "radio")->where($where)->order($order)->limit($page, $limit, $page)->execute('getSlaveField');
     $fetchs = $this->database()->select('l.like_id AS is_liked, p.radio_id AS is_played,f.radio_id AS is_favourite, radio.*')->from($this->_sTable, "radio")->where($where)->order($order)->leftJoin(Phpfox::getT('like'), 'l', "l.type_id = 'radio' AND l.item_id = radio.radio_id AND l.user_id = " . Phpfox::getUserId())->leftJoin(Phpfox::getT('radio_plays'), 'p', "p.radio_id = radio.radio_id AND p.user_id =" . Phpfox::getUserId())->leftJoin(Phpfox::getT('radio_favourite'), 'f', "f.radio_id = radio.radio_id AND f.user_id =" . Phpfox::getUserId())->limit($page, $limit, $num)->execute('getSlaveRows');
     foreach ($fetchs as &$fetch) {
         if (!$fetch["image"]) {
             $fetch["image"] = Phpfox::getParam('core.path') . "module/radio/static/image/nophoto.png";
         }
         $i = 0;
         $cat_array = explode(",", $fetch["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 .= ", ";
             }
         }
         $fetch["category_links"] = $cats;
     }
     return array($num, $fetchs);
 }