View file modules/catalog/system/catalog.php

File size: 1.47Kb
<?
defined('IN_ACCESS') or die('<b>Доступ закрыт =)</b>');

class Catalog_Controller extends Controller{
        function  __construct() {
                $config = Registry :: get('config');
                $this->page_rows = $config['page_rows'];
                parent::__construct();
        }

        public function action_index(){
                $this->action_viewcatalog();
        }

        private function action_viewcatalog(){
                $total = DB :: $dbh->querySingle('SELECT COUNT(*) FROM `files` WHERE `file_id`');
                $getfiles = DB :: $dbh->query('SELECT `file_name`,`file_size`,`file_id` FROM `files`ORDER BY `file_id` DESC LIMIT ' . $this->start . ',' . $this->page_rows . '');

                # Постраничная навигация
                f_import('lib/pagination.php');
                $pg_conf['base_url'] = p_url('catalog', 'start=');
                $pg_conf['total_rows'] = $total;
                $pg_conf['per_page'] = $this->page_rows;
                $pg = new CI_Pagination($pg_conf);

                f_import('modules/index_page/helpers/index_page_helper.php');

                $tpl_data = array(
                        'getfiles'      => $getfiles,
                        'total' => $total,
                        'pagenvg'       => $pg->create_links()
                );

                $this->tpl->assign($tpl_data);
                $this->tpl->display('index');
        }
}
?>