Пример #1
0
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultUser = $database->db_query("SELECT * FROM users_client");
     $pagin = new Pagination();
     $pagin->nr = $database->dbNumRows($resultUser);
     $pagin->itemsPerPage = 20;
     $users = User::find_by_sql("SELECT * FROM users_client WHERE company_id=" . $_SESSION['client_ident'] . " " . $pagin->pgLimit($pn));
     $index_array = array("myusers" => $users, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
Пример #2
0
 public function index()
 {
     $this->load->model('video/video');
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $limit = PAGESIZE;
     //get certificates
     $data = array('start' => ($page - 1) * $limit, 'limit' => $limit);
     $this->data['video'] = $this->model_video_video->getvideoList($data);
     $items_count = $this->model_video_video->getvideoCount();
     //pagination
     $route = $this->request->get['route'];
     $pagination = new Pagination();
     $pagination->total = $items_count;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $pagination->url = $this->url->link($route, 'page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     // var_dump($this->data);
     $this->template = 'video/video.tpl';
     $this->children = array('common/footer', 'common/header', 'common/banner', 'common/contentleft');
     $this->response->setOutput($this->render());
 }
Пример #3
0
 function listEncuestas()
 {
     global $uid, $uperms;
     $where = "";
     if (!$uperms['encuestas_w']) {
         $where = "WHERE publicado = 's'";
     }
     $db = new DB();
     $sql = "SELECT  * FROM encuestas {$where}";
     if (isset($_GET['starting'])) {
         $starting = $_GET['starting'];
     } else {
         $starting = 0;
     }
     $objpag = new Pagination($sql, $starting, 20, 'index2.php?com=encuestas&do=list');
     $res = $objpag->result;
     $data = array();
     $x = 0;
     while ($line = $objpag->fetchNextObject($res)) {
         $data[$x]['id'] = $line->id;
         $data[$x]['titulo'] = $line->titulo;
         $data[$x]['observaciones'] = $line->observaciones;
         $data[$x]['fecha'] = $line->fecha;
         $x++;
     }
     $anchors = $objpag->anchors;
     $total = $objpag->total;
     $tpl = new Elfic_Smarty();
     $tpl->assign('lista', $data);
     $tpl->assign('anchors', $anchors);
     $tpl->assign('total', $total);
     $tpl->display('encuestas/encuestasList.tpl');
 }
Пример #4
0
/**
 * function plugins_update to get
 * plugins updates from the Database using pagination object.
 *
 * @author shubham meena mentored by Matthew Lagoe
 */
function plugins_update()
{
    if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
        $pagination = new Pagination("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache");
        $pageResult['plug'] = Gui_Elements::make_table($pagination->getElements(), array("getId", "getPluginName", "getPluginInfo", "getUpdateInfo"), array("id", "plugin_name", "plugin_info", "update_info"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        // check if shard is online
        try {
            $dbs = new DBLayer("shard");
            $pageResult['shard'] = "online";
        } catch (PDOException $e) {
            $pageResult['shard'] = "offline";
        }
        return $pageResult;
    } else {
        // ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
Пример #5
0
 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM vendors");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Vendor::find_by_sql("SELECT * FROM vendors " . $pagin->pgLimit($pn));
     $index_array = array("vendors" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
Пример #6
0
 /**
  * 权限组列表
  */
 public function action_default()
 {
     $this->quick_menu = array('administrator/group/add' => '添加权限组', 'administrator/' => '管理员列表', 'administrator/add' => '添加管理员');
     if (!$this->session()->member()->perm()->is_own('administrator.view_group_info')) {
         if ($this->session()->member()->perm()->is_own('administrator.can_edit_group')) {
             $groups = $this->session()->member()->groups();
         } else {
             $this->message('抱歉,您无此权限');
         }
     }
     $view = new View('admin/administrator/group_list');
     if (isset($groups)) {
         $view->list = $groups;
         $view->group_manager = true;
     } else {
         if ($this->session()->member()->perm()->is_super_perm()) {
             # 超级管理员列出所有组
             $project = null;
         } else {
             $project = Core::$project;
         }
         $model_administrator = new Model_Admin_Administrator();
         $count = $model_administrator->total_group_count($project);
         if ($count) {
             $pageconfig = Core::config('admin/pagination');
             $pageconfig['total_items'] = $count;
             $pagination = new Pagination($pageconfig);
             $list = $model_administrator->get_group_list($project, $pagination->get_offset(), $pagination->get_items_per_page());
             $view->list = $list;
             $view->pagehtml = $pagination->render();
         }
     }
     $view->render();
 }
Пример #7
0
 public function box()
 {
     if (!isset($this->params['type'])) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     $type = $this->params['type'];
     try {
         $mailBox = new MailBox(User::getInstance(), $type);
     } catch (MailBoxNullException $e) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     $count = isset($this->params['url']['count']) ? $this->params['url']['count'] : Configure::read("pagination.mail");
     if (($count = intval($count)) <= 0) {
         $count = Configure::read('pagination.mail');
     }
     if ($count > Configure::read('plugins.api.page_item_limit')) {
         $count = Configure::read('pagination.mail');
     }
     $page = isset($this->params['url']['page']) ? $this->params['url']['page'] : 1;
     $page = intval($page);
     $pagination = new Pagination($mailBox, $count);
     $mails = $pagination->getPage($page);
     $wrapper = Wrapper::getInstance();
     $info = array();
     foreach ($mails as $v) {
         $info[] = $wrapper->mail($v);
     }
     $data['description'] = $mailBox->desc;
     $data['pagination'] = $wrapper->page($pagination);
     $data['mail'] = $info;
     $this->set('data', $data);
     $this->set('root', 'mailbox');
 }
 protected function compile()
 {
     if (\Input::get('isAjax') == '1') {
         return;
     }
     $objFilter = new Articlefilter($this->getRootIdFromUrl(), $this->imgSize);
     $objFilter->selectedFilter = \Input::get('articlefilter_filter');
     $objFilter->afstype = \Input::get('afstype');
     $objFilter->sorting = $this->articlefilter_sorting;
     $objFilter->showAll = true;
     $objFilter->run();
     /* search articles matching filter */
     if ($objFilter->resultCount > 0) {
         $resultCount = $objFilter->resultCount;
         $results = $objFilter->results;
         if ($this->perPage > 0 && $resultCount > $this->perPage) {
             $objPagination = new \Pagination($resultCount, $this->perPage);
             $this->Template->pagination = $objPagination->generate();
             $page = \Input::get('page');
             if ($page == '' || $page < 1) {
                 $page = 1;
             }
             $offset = ($page - 1) * $this->perPage;
             $results = array_slice($results, $offset, $this->perPage);
         }
         $this->Template->resultCount = $resultCount;
         $this->Template->results = $results;
         $this->Template->showFilter = $this->articlefilter_showfilter;
         $this->Template->selectedFilter = $objFilter->searchStrings;
         $this->Template->selectedFilterHeadline = sprintf($GLOBALS['TL_LANG']['articlefilter']['selectedFilterHeadline'], $resultCount);
     } else {
         $this->Template->no_filter = true;
     }
 }
Пример #9
0
 function launch()
 {
     global $interface;
     global $configArray;
     global $library;
     global $locationSingleton;
     global $timer;
     global $user;
     $currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
     //Pagination
     $pag = new Pagination();
     $pag->setPagination($currentPage, 30);
     //Most Popular
     $listAPI = new ListAPI();
     $listTitlesFE = $listAPI->getListTitles('freeEbooks', $pag);
     $interface->assign('LIST', !empty($listTitlesFE['titles']) ? $listTitlesFE['titles'] : "");
     $pag->setPagination($currentPage + 1, 30);
     $moreTitles = $listAPI->getListTitles('freeEbooks', $pag);
     if (!empty($moreTitles['titles'])) {
         $interface->assign('NEXTPAGE', $currentPage + 1);
         $interface->assign('ACTION', "FreeEbooks");
     }
     $interface->assign('ButtonBack', true);
     $interface->assign('ButtonHome', true);
     $interface->caching = 0;
     $cacheId = 'homepage|' . $interface->lang;
     //Disable Home page caching for now.
     if (!$interface->is_cached('layout.tpl', $cacheId)) {
         $interface->setPageTitle('Free eBooks');
         $interface->assign('MobileTitle', 'Free eBooks');
         $interface->setTemplate('listecontents.tpl');
     }
     $interface->display('layout.tpl', $cacheId);
 }
Пример #10
0
 protected function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REVIEW')));
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data = array('start' => ($page - 1) * $this->config->get('admin_limit'), 'limit' => $this->config->get('admin_limit'));
     $reviewTotal = $this->model_catalog_review->getTotalReviews();
     $pagination = new Pagination();
     $pagination->total = $reviewTotal;
     $pagination->page = $page;
     $pagination->limit = $this->config->get('admin_limit');
     $pagination->text = '';
     $pagination->url = $this->url->link('catalog/review', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data = array_merge($this->data, array('reviews' => array(), 'insert' => $this->url->link('catalog/review/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('catalog/review/delete', 'token=' . $this->session->data['token'], 'SSL'), 'pagination' => $pagination->renderAdmin()));
     foreach ($this->model_catalog_review->getReviews($data) as $result) {
         $this->data['reviews'][] = array_merge($result, array('status' => $result['status'] ? Language::getVar('SUMO_NOUN_ENABLED') : Language::getVar('SUMO_NOUN_DISABLED'), 'date_added' => Formatter::date($result['date_added']), 'edit' => $this->url->link('catalog/review/update', 'token=' . $this->session->data['token'] . '&review_id=' . $result['review_id'], 'SSL')));
     }
     $this->template = 'catalog/review_list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
 function generate_inner_html()
 {
     $Pagination = new Pagination();
     $Pagination->setPaging($this->Paging);
     $this->page_prev = $Pagination->getPreviousPage();
     $this->page_next = $Pagination->getNextPage();
     $this->page_links = $Pagination->getPageLinks();
     $inner_template = NULL;
     switch ($this->mode) {
         case 'relations':
         case 'in_relations':
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
             break;
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
     }
     $obj_inner_template = new Template($inner_template, $this);
     $obj_inner_template->set_object('links', $this->links);
     $obj_inner_template->set_object('gid', @$this->gid);
     $obj_inner_template->set('sub_title', @$this->sub_title);
     $obj_inner_template->set('total', $this->Paging['count']);
     $obj_inner_template->set('reciprocated_relationship_set', @$this->reciprocated_relationship_set);
     $obj_inner_template->set('relations', @$this->relations);
     $obj_inner_template->set('in_relations', @$this->in_relations);
     $obj_inner_template->set('user_name', $this->page_user);
     $obj_inner_template->set('page_prev', $this->page_prev);
     $obj_inner_template->set('page_next', $this->page_next);
     $obj_inner_template->set('page_links', $this->page_links);
     $obj_inner_template->set('view_type', $this->view_type);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
Пример #12
0
/**
* This function is beign used to load info that's needed for the syncing page.
* this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here
* so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function syncing()
{
    if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
        //return a paginated version of all unsynced changes.
        $pagination = new Pagination("SELECT * FROM ams_querycache", "lib", 5, "Querycache");
        $pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements(), array("getSID", "getType"), array("id", "type"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        //check if shard is online
        try {
            $dbs = new DBLayer("shard");
            $pageResult['shard'] = "online";
        } catch (PDOException $e) {
            $pageResult['shard'] = "offline";
        }
        return $pageResult;
    } else {
        //ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
 public function results()
 {
     $id = $this->getParam(0, 0);
     $type_label = $this->getParam(1, 0);
     $page = !empty($this->getParam(2, 0)) ? (int) $this->getParam(2, 0) : 1;
     //$search_query = $this->request->get('q', '');
     $labels = Info::$type_labels;
     $type_label = ucfirst(str_replace('-', ' ', $type_label));
     $type = array_search($type_label, $labels);
     //$infos = Info::getElements($id, $type);
     /*
     $vars = array (
     	'id' => $id,
     	'type_label' => $type_label,
     	'infos' => $infos,
     	'labels' => $labels
     );
     */
     $sql = 'SELECT id, quarter_id, name, type, description, url, rating, theme FROM info WHERE quarter_id = :quarter_id AND type = :type ORDER BY id ASC';
     $bindings = array('quarter_id' => $id, 'type' => $type);
     $pagination = new Pagination($sql, $bindings, 16, $page - 1);
     $results = $pagination->getResults();
     foreach ($results as $result) {
         $infos[] = new Info($result);
     }
     //foreach ($infos as $key => $info) {
     //	$info->description=substr($info->description,0, 50);
     //}
     $vars = array('id' => $id, 'type_label' => $type_label, 'infos' => $infos, 'labels' => $labels, 'page' => $page, 'count_pages' => $pagination->getPagesCount(), 'count_total' => $pagination->getTotalCount());
     $this->render('elements', $vars);
 }
Пример #14
0
 protected function getList()
 {
     error_reporting(E_ALL);
     ini_set('display_errors', 'On');
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $url = '';
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('sale/link', 'token=' . $this->session->data['token'] . $url, 'SSL'), 'separator' => ' :: ');
     $this->data['insert'] = $this->url->link('sale/link/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
     $this->data['delete'] = $this->url->link('sale/link/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
     $this->data['user_groups'] = array();
     $data = array('sort' => "ASC", 'order' => "link_order", 'start' => ($page - 1) * $this->config->get('config_admin_limit'), 'limit' => $this->config->get('config_admin_limit'));
     $user_group_total = $this->model_sale_link->getTotalLinks();
     $results = $this->model_sale_link->getTotalLink($data);
     foreach ($results as &$result) {
         $action = array();
         $action[] = array('text' => $this->language->get('text_edit'), 'href' => $this->url->link('sale/link/update&id=' . $result['id'], 'token=' . $this->session->data['token'] . $url, 'SSL'));
         $result['action'] = $action;
     }
     $this->data['results'] = $results;
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_no_results'] = $this->language->get('text_no_results');
     $this->data['column_name'] = $this->language->get('column_name');
     $this->data['column_action'] = $this->language->get('column_action');
     $this->data['button_insert'] = $this->language->get('button_insert');
     $this->data['button_delete'] = $this->language->get('button_delete');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $url = '';
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     $pagination = new Pagination();
     $pagination->total = $user_group_total;
     $pagination->page = $page;
     $pagination->limit = $this->config->get('config_admin_limit');
     $pagination->text = $this->language->get('text_pagination');
     $pagination->url = $this->url->link('sale/link', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->template = 'sale/link.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Пример #15
0
 private function getData()
 {
     $modelToolImage = $this->load->model('tool/image');
     $urlParameters = $this->buildUrlParameterString($this->parameters);
     $this->data['invoice'] = $this->url->link('sale/invoice/showForm', $urlParameters, 'SSL');
     $this->data['print'] = $this->url->link('sale/repurchaseOrders/printPage', $urlParameters, 'SSL');
     $this->data['orders'] = array();
     $data = array('start' => ($this->parameters['page'] - 1) * $this->config->get('config_admin_limit'), 'limit' => $this->config->get('config_admin_limit'));
     $data = array_merge($data, $this->parameters);
     $order_items = RepurchaseOrderDAO::getInstance()->getOrders($data);
     $showedCustomerIds = array();
     $this->data['customers'] = array();
     foreach ($order_items as $order_item) {
         if (!in_array($order_item['customerId'], $showedCustomerIds)) {
             $this->data['customers'][] = array('id' => $order_item['customerId'], 'name' => $order_item['customerName'] . '/' . $order_item['customerNick']);
             $showedCustomerIds[] = $order_item['customerId'];
         }
         $actions = array();
         $actions[] = array('text' => $this->getLanguage()->get('GOTO_ITEM'), 'href' => $order_item['itemUrl']);
         $actions[] = array('text' => $this->getLanguage()->get('CHANGE_PICTURE'), 'href' => '', 'onclick' => 'imageManager(' . $order_item['orderItemId'] . ', $(this).parent().parent().find(\'img\'))');
         /// Check if item URL is valid
         if (preg_match('/https?:\\/\\/([\\w\\-\\.]+)/', $order_item['itemUrl'], $matches)) {
             $siteName = $matches[1];
         } else {
             $siteName = 'Wrong URL format';
         }
         /// Get image path or URL
         if (file_exists(DIR_IMAGE . $order_item['imagePath'])) {
             $image = $modelToolImage->resize($order_item['imagePath'], 100, 100);
             $hint = '';
         } else {
             $image = $modelToolImage->resize('no_image.jpg', 100, 100);
             $hint = $this->getLanguage()->get('WARNING_HTML_PAGE_PROVIDED');
         }
         $this->data['orders'][] = array('privateComment' => $order_item['privateComment'], 'orderId' => $order_item['orderItemId'], 'underlyingOrderId' => $order_item['orderId'], 'hint' => $hint, 'imagePath' => $image, 'itemName' => $order_item['itemName'], 'itemUrl' => $order_item['itemUrl'], 'shopName' => $order_item['shopName'], 'siteName' => $siteName, 'customerName' => $order_item['customerName'], 'customerNick' => $order_item['customerNick'], 'customerUrl' => $this->url->link('sale/customer/update', 'token=' . $this->session->data['token'] . '&customer_id=' . $order_item['customerId'], 'SSL'), 'options' => nl2br(RepurchaseOrderDAO::getInstance()->getOptionsString($order_item['orderItemId'])), 'originalImagePath' => file_exists(DIR_IMAGE . $order_item['imagePath']) ? HTTP_IMAGE . $order_item['imagePath'] : $order_item['imagePath'], 'comment' => $order_item['comment'], 'publicComment' => $order_item['comment'], 'status' => $order_item['status'] ? Status::getStatus($order_item['status'], $this->config->get('config_language_id')) : "", 'quantity' => $order_item['quantity'], 'price' => (double) $order_item['price'], 'whiteprice' => (double) $order_item['whiteprice'], 'shipping' => (double) $order_item['shipping'], 'amount' => (double) $order_item['total'], 'actions' => $actions, 'whoOrders' => $order_item['whoOrders']);
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $pagination = new Pagination();
     $pagination->total = RepurchaseOrderDAO::getInstance()->getOrdersCount($data);
     $pagination->page = $this->parameters['page'];
     $pagination->limit = $this->config->get('config_admin_limit');
     $pagination->text = $this->getLanguage()->get('text_pagination');
     $pagination->url = $this->url->link('sale/repurchaseOrders', $urlParameters . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->data['currencyCode'] = $this->config->get('config_currency');
     $this->data['invoiceUrl'] = $this->url->link('sale/invoice/showForm', 'token=' . $this->session->data['token'], 'SSL');
     $this->data['urlImageChange'] = $this->url->link('sale/repurchaseOrders/setProperty', 'propName=image&token=' . $this->parameters['token'], 'SSL');
     $this->data['urlImageManager'] = $this->url->link('common/filemanager', 'field=image&token=' . $this->parameters['token'], 'SSL');
     $this->data = array_merge($this->data, $this->parameters);
 }
Пример #16
0
 public function index()
 {
     $this->document->setTitle(Language::getVar('SUMO_ADMIN_SALE_ORDER'));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_DASHBOARD'), 'href' => $this->url->link('sale/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALE_ORDER')));
     $this->load->model('sale/orders');
     $filters = array();
     $page = 1;
     if (!empty($this->request->get['page'])) {
         $page = (int) $this->request->get['page'];
     }
     $total = $this->model_sale_orders->getOrdersTotal();
     $filters['start'] = ($page - 1) * 25;
     $filters['limit'] = 25;
     $this->data['orders'] = $this->model_sale_orders->getOrders($filters);
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $page;
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('sale/orders', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->renderAdmin();
     $this->template = 'sale/orders/list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Пример #17
0
 /**
  * Displays the last X registered users.
  *
  * @return string
  */
 public function indexSection()
 {
     $this->setTitle(t('User management'));
     $this->setOutputType(self::_OT_CONFIG);
     // Check user has correct permission
     if (!$this->_acl->checkMulti(array('users_add', 'users_edit', 'users_delete'))) {
         throw new Module_NoPermission();
     }
     try {
         $curPage = abs($this->_input->get('page') - 1);
     } catch (Input_KeyNoExist $e) {
         $curPage = 0;
     }
     /**
      * Configure Pagination, build and output the main view file
      */
     $pagination = new Pagination($this->_ugmanager->userCount() - 1, self::_PER_PAGE);
     $view = $this->loadView('config/main.html');
     $view->assign(array('USERS' => $this->_ugmanager->getAllUsers(null, self::_PER_PAGE, $curPage * self::_PER_PAGE)));
     $view->assignHtml(array('CSRF' => $this->_input->createToken(true), 'PAGINATION' => $pagination->build()));
     // Autocomplete/suggest feature
     $this->_theme->addJsFile('jquery.autocomplete');
     $this->_theme->addCssFile('jquery.autocomplete.css');
     $this->addAsset('js/autocomplete.js');
     return $view->getOutput();
 }
Пример #18
0
 public function index()
 {
     if (!isset($this->params['type'])) {
         $this->error(ECode::$REFER_NONE);
     }
     $type = $this->params['type'];
     try {
         $refer = new Refer(User::getInstance(), $type);
     } catch (ReferNullException $e) {
         $this->error(ECode::$REFER_NONE);
     }
     $count = isset($this->params['url']['count']) ? $this->params['url']['count'] : Configure::read("pagination.mail");
     if (($count = intval($count)) <= 0) {
         $count = Configure::read('pagination.mail');
     }
     if ($count > Configure::read('plugins.api.page_item_limit')) {
         $count = Configure::read('pagination.mail');
     }
     $page = isset($this->params['url']['page']) ? $this->params['url']['page'] : 1;
     $page = intval($page);
     $pagination = new Pagination($refer, $count);
     $articles = $pagination->getPage($page);
     $wrapper = Wrapper::getInstance();
     $info = array();
     foreach ($articles as $v) {
         $info[] = $wrapper->refer($v);
     }
     $data['description'] = $refer->getDesc();
     $data['pagination'] = $wrapper->page($pagination);
     $data['article'] = $info;
     $this->set('data', $data);
 }
Пример #19
0
 /**
  * Lista de comunicados enviados (SENT)
  */
 function listEnviados()
 {
     global $uid;
     $db = new DB();
     $sql = "SELECT consecu, fecha, asunto, tipmens, fecvence, categoria, documto_id, borrado ";
     $sql .= "FROM mensajes WHERE documto_id = '{$uid}' AND borrado = '0' ORDER BY consecu DESC ";
     if (isset($_GET['starting'])) {
         $starting = $_GET['starting'];
     } else {
         $starting = 0;
     }
     $objpag = new Pagination($sql, $starting, 20, 'index2.php?com=comunicados&do=list');
     $res = $objpag->result;
     $data = array();
     $x = 0;
     while ($line = $objpag->fetchNextObject($res)) {
         $data[$x]['consecu'] = $line->consecu;
         $data[$x]['fecha'] = $line->fecha;
         $data[$x]['asunto'] = $line->asunto;
         $data[$x]['tipmens'] = $line->tipmens;
         $data[$x]['fecvence'] = $line->fecvence;
         $data[$x]['categoria'] = $line->categoria;
         $x++;
     }
     $anchors = $objpag->anchors;
     $total = $objpag->total;
     $tpl = new Erudio_Smarty();
     $tpl->assign('com', $data);
     $tpl->assign('anchors', $anchors);
     $tpl->assign('total', $total);
     $tpl->display('comunicados/comunicadosEnviados.tpl');
 }
Пример #20
0
 public function index()
 {
     $this->data['http'] = __WEBURL__;
     $this->assign('sitename', 'blog example');
     //在字符串情况下$this->data,$this->lable,$this->assign等效
     $this->data['form_list'] = array();
     $this->data['head_list'] = array();
     $this->model('blog/data');
     $test = $this->M['blog/data']->test();
     $page = isset($this->request->get['page']) ? $this->request->get['page'] : 1;
     $count = 3;
     $data = array('limit' => ($page - 1) * $count . ',' . $count);
     $this->data['form_list'] = $this->M['blog/data']->getFormList($data);
     $total = $this->M['blog/data']->getFormTotal();
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $page;
     $pagination->limit = $count;
     $pagination->text = "从 {start} 起到 {end} 页 总 {total}个 总 ({pages} 页)";
     $pagination->url = $this->url->link('home/index', '&page={page}');
     $this->data['pagination'] = $pagination->render();
     $this->language('blog/data');
     $sitename = $this->language->get('sitename');
     $this->lable('title', $sitename);
     $this->data['test'] = $test;
     //在模板中$this->data的健值即为变量名
     $this->data['header'] = $this->view('public/header');
     $this->data['footer'] = $this->view('public/footer');
     $this->data['right'] = $this->view('public/right');
     //调用右边的controller
     $this->display();
     //可指定模板,模认为当前controll的名字+方法
 }
Пример #21
0
 /**
  * Used to display the index page but also uses a jquery and the pagination to do preload of next pages
  * of the news articles. Which are then displaye don scroll 
  * @param integer $page the page number  (Matt are you sure this is needed, the pagination is smart enough not to need this). 
  */
 public function index($page = 1)
 {
     $total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
     $paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
     $articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
     $view = new View(url::location());
     $view->articles = $articles;
     $view->pagination = $paging->render();
     $view->page_number = $paging->page_number();
     // If the request is an ajax request, then the page is attempting to autoupdate
     // the items with in the news, so just send through the news items.
     if (request::is_ajax()) {
         // if the ajax is attempting to get a page which doesnt exist, send 404
         if ($page > $paging->total_pages) {
             Event::run('system.404');
         } else {
             $this->ajax['view'] = $view;
         }
     } else {
         // otherwise its a http request, send throught he entire page with template.
         $this->template->title = 'About Us &rsaquo; News &amp; Updates Archive';
         $this->breadcrumbs->add()->url(false)->title('Archive');
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     }
 }
Пример #22
0
 function generate_inner_html()
 {
     global $current_blockmodule_path;
     global $number_user;
     $msg = @$this->msg;
     $Pagination = new Pagination();
     $Pagination->setPaging($this->Paging);
     $this->page_first = $Pagination->getFirstPage($this->search_data);
     $this->page_last = $Pagination->getLastPage($this->search_data);
     $this->page_links = $Pagination->getPageLinks($this->search_data);
     switch ($this->mode) {
         default:
             //$tmp_file = dirname(__FILE__).'/center_inner_public.tpl';
             $tmp_file = dirname(__FILE__) . '/facewall.tpl';
     }
     $inner_html_gen =& new Template($tmp_file);
     $inner_html_gen->set('links', $this->users_data);
     $inner_html_gen->set('error_msg', $msg);
     $inner_html_gen->set('page_first', $this->page_first);
     $inner_html_gen->set('page_last', $this->page_last);
     $inner_html_gen->set('page_links', $this->page_links);
     $inner_html_gen->set('people_count', $this->Paging["count"]);
     $row_count = ceil($this->Paging["count"] / FACEWALL_COLUMN_COUNT) > 10 ? 10 : ceil($this->Paging["count"] / FACEWALL_COLUMN_COUNT);
     $number_user = $this->Paging["count"];
     $inner_html_gen->set("row_count", $row_count);
     $inner_html_gen->set('show_advance_search_options', $this->show_advance_search_options);
     $inner_html_gen->set('search_data', $this->search_data);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
Пример #23
0
 public function action_default()
 {
     $this->quick_menu = array('administrator/add' => '添加管理员', 'administrator/group/' => '权限组列表', 'administrator/group/add' => '添加权限组');
     $view = new View('admin/administrator/list');
     $model_administrator = new Model_Admin_Administrator();
     $only_list_self_group_user = false;
     $is_super = $this->session()->member()->perm()->is_super_perm();
     if ($is_super) {
         $project = null;
         $list_groups = null;
     } else {
         $project = Core::$project;
         if (!$this->session()->member()->perm()->is_own('administrator.view_user_info')) {
             $list_groups = $this->session()->member()->has_own_perm_groups('view_users')->ids();
             if (!count($list_groups)) {
                 $this->message('您不具备此权限', -1);
             }
         }
     }
     if ($_GET['k']) {
         # 搜索模式
         $list = $model_administrator->search_aministrator_list($project, $list_groups, $_GET['k']);
         $view->list = $list;
     } else {
         $list_type = null;
         if ($is_super && $_GET['list']) {
             if ($_GET['list'] == 'supadmin') {
                 $list_type = 1;
             } elseif ($_GET['list'] == 'groupmanager') {
                 $list_type = 2;
             } elseif ($_GET['list'] == 'zdy') {
                 $list_type = 3;
             }
         } else {
             if (isset($_GET['group_id'])) {
                 $group_id = (int) $_GET['group_id'];
             }
             if (!$group_id > 0) {
                 $group_id = 0;
             }
             if ($group_id > 0) {
                 if (!$this->session()->member()->is_own_group_perm($group_id, 'view_users')) {
                     $this->message('您不具备查看此权限组用户的权限', -1);
                 }
                 $list_groups = array($group_id);
             }
         }
         $count = $model_administrator->total_count($project, $list_groups, $list_type);
         if ($count) {
             $pageconfig = Core::config('admin/pagination');
             $pageconfig['total_items'] = $count;
             $pagination = new Pagination($pageconfig);
             $list = $model_administrator->get_aministrator_list($project, $list_groups, $pagination->get_offset(), $pagination->get_items_per_page(), $list_type);
             $view->list = $list;
             $view->pagehtml = $pagination->render();
         }
     }
     $view->is_super = $is_super;
     $view->render();
 }
Пример #24
0
 protected function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_SPECIAL')));
     $this->data = array_merge($this->data, array('delete' => $this->url->link('catalog/special/delete', 'token=' . $this->session->data['token'], 'SSL'), 'specials' => array(), 'error' => isset($this->data['error']) ? $this->data['error'] : ''));
     // Initiate pagination
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data = array('start' => ($page - 1) * 25, 'limit' => 25);
     $special_total = $this->model_catalog_special->getTotalSpecials();
     foreach ($this->model_catalog_special->getSpecials($data) as $special) {
         $this->data['specials'][] = array_merge($special, array('product_special_no' => 'SID.' . str_pad($special['product_special_id'], 5, 0, STR_PAD_LEFT), 'price' => Formatter::currency($special['price']), 'product_price' => Formatter::currency($special['product_price']), 'edit' => $this->url->link('catalog/special/update', 'token=' . $this->session->data['token'] . '&product_special_id=' . $special['product_special_id'], 'SSL')));
     }
     $pagination = new Pagination();
     $pagination->total = $special_total;
     $pagination->page = $page;
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('catalog/special', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->renderAdmin();
     $this->getForm();
     $this->template = 'catalog/special.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Пример #25
0
 protected function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_DASHBOARD'), 'href' => $this->url->link('sale/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SUPPLIER_DASHBOARD')));
     $this->data = array_merge($this->data, array('creditors' => array(), 'insert' => $this->url->link('sale/creditor/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('sale/creditor/delete', 'token=' . $this->session->data['token'], 'SSL')));
     // Initiate pagination
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data = array('start' => ($page - 1) * 25, 'limit' => 25);
     $creditorTotal = $this->model_sale_creditor->getTotalCreditors();
     foreach ($this->model_sale_creditor->getCreditors($data) as $creditor) {
         $this->data['creditors'][] = array_merge($creditor, array('update' => $this->url->link('sale/creditor/update', 'token=' . $this->session->data['token'] . '&creditor_id=' . $creditor['creditor_id'], 'SSL')));
     }
     $pagination = new Pagination();
     $pagination->total = $creditorTotal;
     $pagination->page = $page;
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('sale/creditor', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->renderAdmin();
     $this->template = 'sale/creditor_list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Пример #26
0
 /**
  * Displays an overview of pages for a user to manage. Only the parent
  * will be shown, non of the children will be.
  *
  * @return string
  */
 public function indexSection()
 {
     $this->setTitle(t('Manage pages'));
     $this->setOutputType(self::_OT_CONFIG);
     if (!$this->_acl->check('page_manage')) {
         throw new Module_NoPermission();
     }
     // Check what pagination page we are on, and get all pages
     try {
         $curPage = abs($this->_input->get('page') - 1);
     } catch (Input_KeyNoExist $e) {
         $curPage = 0;
     }
     $pages = $this->_model()->getAllPages(self::_PER_PAGE, $curPage * self::_PER_PAGE, 0);
     $pageCount = $this->_model()->getCount();
     if ($pageCount > 0) {
         $pagination = new Pagination($pageCount, self::_PER_PAGE);
     }
     // Build and return view
     $view = $this->loadView('config/overview.html');
     $view->assign(array('PAGES' => $pages));
     $view->assignHtml(array('PAGINATION' => isset($pagination) ? $pagination->build() : '', 'CSRF' => $this->_input->createToken(true)));
     // Autocomplete/suggest feature
     $this->_theme->addJsFile('jquery.autocomplete');
     $this->_theme->addCssFile('jquery.autocomplete.css');
     $this->addAsset('js/autocomplete.js');
     return $view->getOutput();
 }
Пример #27
0
/**
* This function is beign used to load info that's needed for the userlist page.
* this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function userlist()
{
    if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
        $pagination = new Pagination(WebUsers::getAllUsersQuery(), "web", 10, "WebUsers");
        $pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements(), array("getUId", "getUsername", "getEmail"), array("id", "username", "email"));
        $pageResult['links'] = $pagination->getLinks(5);
        $pageResult['lastPage'] = $pagination->getLast();
        $pageResult['currentPage'] = $pagination->getCurrent();
        $i = 0;
        foreach ($pageResult['userlist'] as $user) {
            $pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
            $i++;
        }
        if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
            $pageResult['isAdmin'] = "TRUE";
        }
        global $INGAME_WEBPATH;
        $pageResult['ingame_webpath'] = $INGAME_WEBPATH;
        global $BASE_WEBPATH;
        $pageResult['base_webpath'] = $BASE_WEBPATH;
        return $pageResult;
    } else {
        //ERROR: No access!
        $_SESSION['error_code'] = "403";
        header("Cache-Control: max-age=1");
        header("Location: index.php?page=error");
        throw new SystemExit();
    }
}
Пример #28
0
 public function index()
 {
     $this->document->setTitle("ÂÃÓÎ×ÊѶ");
     $this->load->model('informations/informations');
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $limit = 10;
     //get informations
     $data = array('start' => ($page - 1) * $limit, 'limit' => $limit);
     $this->data['informations'] = $this->model_informations_informations->getInformations($data);
     $items_count = $this->model_informations_informations->getInformationsCount();
     //pagination
     $route = $this->request->get['route'];
     $pagination = new Pagination();
     $pagination->total = $items_count;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $pagination->url = $this->url->link($route, 'page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->template = 'informations/informations.tpl';
     $this->children = array('common/footer', 'common/header', 'common/column_left_information');
     $this->response->setOutput($this->render());
 }
Пример #29
0
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/order', '', 'SSL');
         $this->response->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->load->language('account/order');
     $this->document->setTitle($this->language->get('heading_title'));
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $url = '';
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('account/order', $url, 'SSL'));
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_empty'] = $this->language->get('text_empty');
     $data['column_order_id'] = $this->language->get('column_order_id');
     $data['column_status'] = $this->language->get('column_status');
     $data['column_date_added'] = $this->language->get('column_date_added');
     $data['column_customer'] = $this->language->get('column_customer');
     $data['column_product'] = $this->language->get('column_product');
     $data['column_total'] = $this->language->get('column_total');
     $data['button_view'] = $this->language->get('button_view');
     $data['button_continue'] = $this->language->get('button_continue');
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data['orders'] = array();
     $this->load->model('account/order');
     $order_total = $this->model_account_order->getTotalOrders();
     $results = $this->model_account_order->getOrders(($page - 1) * 10, 10);
     foreach ($results as $result) {
         $product_total = $this->model_account_order->getTotalOrderProductsByOrderId($result['order_id']);
         $voucher_total = $this->model_account_order->getTotalOrderVouchersByOrderId($result['order_id']);
         $data['orders'][] = array('order_id' => $result['order_id'], 'name' => $result['firstname'] . ' ' . $result['lastname'], 'status' => $result['status'], 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'products' => $product_total + $voucher_total, 'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']), 'href' => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], 'SSL'));
     }
     $pagination = new Pagination();
     $pagination->total = $order_total;
     $pagination->page = $page;
     $pagination->limit = 10;
     $pagination->url = $this->url->link('account/order', 'page={page}', 'SSL');
     $data['pagination'] = $pagination->render();
     $data['results'] = sprintf($this->language->get('text_pagination'), $order_total ? ($page - 1) * 10 + 1 : 0, ($page - 1) * 10 > $order_total - 10 ? $order_total : ($page - 1) * 10 + 10, $order_total, ceil($order_total / 10));
     $data['continue'] = $this->url->link('account/account', '', 'SSL');
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['column_right'] = $this->load->controller('common/column_right');
     $data['content_top'] = $this->load->controller('common/content_top');
     $data['content_bottom'] = $this->load->controller('common/content_bottom');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/order_list.tpl')) {
         $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/account/order_list.tpl', $data));
     } else {
         $this->response->setOutput($this->load->view('default/template/account/order_list.tpl', $data));
     }
 }
Пример #30
0
 /**
  * this index is a little differnt from normal, it will filter the results by the group params and show the
  * page with only thoes values, further more 
  * @param $group
  */
 public function index($group = NULL)
 {
     if ($this->access->allowed('news', 'read')) {
         $this->breadcrumbs->add()->url('news/index/' . $group)->title('News');
         // add the group filter to the crumb
         $news = ORM::factory('news')->where('status !=', 'deleted');
         if ($group != NULL) {
             $news->where('group', $group);
         }
         $paging = new Pagination(array('total_items' => $news->count_all()));
         $view = new view(url::location());
         // re add the clauses we need
         $news->where('status !=', 'deleted');
         if ($group != NULL) {
             $news->where('group', $group);
         }
         $view->news = $news->find_all($paging->items_per_page, $paging->sql_offset);
         $view->group = $group;
         // used tos end to the add page so we know what group to return to.
         $view->pagination = $paging->render();
         $view->page_number = $paging->page_number();
         $this->template->title = 'News';
         $this->template->content = $view;
     } else {
         Kohana::log('debug', 'User failed constructor security check');
         url::failed();
     }
 }