Ejemplo n.º 1
0
 function listKeywords($info = '')
 {
     $userId = isLoggedIn();
     $websiteController = new WebsiteController();
     $websiteId = empty($info['website_id']) ? "" : intval($info['website_id']);
     $this->set('websiteList', $websiteController->__getAllWebsites($userId, true));
     $this->set('websiteId', $websiteId);
     $conditions = empty($websiteId) ? "" : " and k.website_id={$websiteId}";
     $sql = "select k.*,w.name website,w.status webstatus from keywords k,websites w where k.website_id=w.id";
     $sql .= isAdmin() ? "" : " and w.user_id={$userId}";
     $sql .= " {$conditions} order by k.name";
     # pagination setup
     $this->db->query($sql, true);
     $this->paging->setDivClass('pagingdiv');
     $this->paging->loadPaging($this->db->noRows, SP_PAGINGNO);
     $pagingDiv = $this->paging->printPages('keywords.php', '', 'scriptDoLoad', 'content', 'website_id=' . $websiteId);
     $this->set('pagingDiv', $pagingDiv);
     $sql .= " limit " . $this->paging->start . "," . $this->paging->per_page;
     # set keywords list
     $keywordList = $this->db->select($sql);
     $this->set('pageNo', $_GET['pageno']);
     $langCtrler = new LanguageController();
     $countryCtrler = new CountryController();
     foreach ($keywordList as $i => $keyInfo) {
         $info = $langCtrler->__getLanguageInfo($keyInfo['lang_code']);
         $keywordList[$i]['lang_name'] = $info['lang_name'];
         $info = $countryCtrler->__getCountryInfo($keyInfo['country_code']);
         $keywordList[$i]['country_name'] = $info['country_name'];
     }
     $this->set('list', $keywordList);
     $this->render('keyword/list');
 }
Ejemplo n.º 2
0
 function listKeywords($info = '')
 {
     $userId = isLoggedIn();
     $websiteController = new WebsiteController();
     $urlParams = "";
     $websiteId = empty($info['website_id']) ? "" : intval($info['website_id']);
     $this->set('websiteList', $websiteController->__getAllWebsites($userId, true));
     $this->set('websiteId', $websiteId);
     if ($websiteId) {
         $conditions = " and k.website_id={$websiteId}";
         $urlParams = "website_id={$websiteId}";
     } else {
         $conditions = "";
     }
     if (isset($info['status'])) {
         if ($info['status'] == 'active' || $info['status'] == 'inactive') {
             $statVal = $info['status'] == 'active' ? 1 : 0;
             $conditions .= " and k.status={$statVal}";
             $urlParams .= "&status=" . $info['status'];
         }
     } else {
         $info['status'] = '';
     }
     $this->set('statVal', $info['status']);
     if (empty($info['keyword'])) {
         $info['keyword'] = '';
     } else {
         $info['keyword'] = urldecode($info['keyword']);
         $conditions .= " and k.name like '%" . addslashes($info['keyword']) . "%'";
         $urlParams .= "&keyword=" . urlencode($info['keyword']);
     }
     $this->set('keyword', $info['keyword']);
     $sql = "select k.*,w.name website,w.status webstatus from keywords k,websites w where k.website_id=w.id and w.status=1";
     $sql .= isAdmin() ? "" : " and w.user_id={$userId}";
     $sql .= " {$conditions} order by k.name";
     # pagination setup
     $this->db->query($sql, true);
     $this->paging->setDivClass('pagingdiv');
     $this->paging->loadPaging($this->db->noRows, SP_PAGINGNO);
     $pagingDiv = $this->paging->printPages('keywords.php', '', 'scriptDoLoad', 'content', $urlParams);
     $this->set('pagingDiv', $pagingDiv);
     $sql .= " limit " . $this->paging->start . "," . $this->paging->per_page;
     # set keywords list
     $keywordList = $this->db->select($sql);
     $this->set('pageNo', $info['pageno']);
     $langCtrler = new LanguageController();
     $countryCtrler = new CountryController();
     foreach ($keywordList as $i => $keyInfo) {
         $info = $langCtrler->__getLanguageInfo($keyInfo['lang_code']);
         $keywordList[$i]['lang_name'] = $info['lang_name'];
         $info = $countryCtrler->__getCountryInfo($keyInfo['country_code']);
         $keywordList[$i]['country_name'] = $info['country_name'];
     }
     $this->set('list', $keywordList);
     $this->render('keyword/list');
 }