User: fish Date: 2015/12/12 Time: 19:45
Esempio n. 1
0
 function exeAlbum()
 {
     if (Session::get('user') != null) {
         Document::setTitle('Album ảnh');
         Document::setJs(array('image', 'jquery.form'));
         $data = array();
         $display = 15;
         $totalPage = ceil($this->model->total("`username` = '" . Session::get('user')['username'] . "'") / $display);
         if ((int) Request::get('page') > 0) {
             $page = Request::get('page');
             if ($totalPage < $page) {
                 $page = $totalPage;
             }
         } else {
             $page = 1;
         }
         $pageLink = new Paging($page, $totalPage);
         $data['pagination'] = $pageLink->pagination('?');
         $data['images'] = $this->model->selectUser(Session::get('user')['username'], ($page - 1) * $display, $display);
         $data['url'] = BASE_URL . '/';
         $data['action'] = BASE_URL . '/image/add';
         $this->view->render('album', $data);
     } else {
         Until::redirectTo();
     }
 }
Esempio n. 2
0
 public function exeDefault()
 {
     Document::setTitle('Quản lý ảnh');
     Document::setJs(array('jquery-1.8.3.min', 'image-admin'));
     $data = array();
     $keySearch = Request::get('keySearch');
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         $condition = 'LOWER(`username`)="' . strtolower($keySearch) . '"';
     }
     $display = 20;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['title'] = BASE_URL_ADMIN . '/image';
     $data['pagination'] = $pageLink->pagination($link);
     $data['images'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $data['ajax'] = BASE_URL_ADMIN . '/image/load';
     $data['imageLoad'] = BASE_URL . '/public/css/images/loading.gif';
     $data['url'] = BASE_URL . '/';
     $this->view->render('index', $data);
 }
Esempio n. 3
0
 public function find($string = '')
 {
     $this->searchTerms = array_filter(explode(' ', $string));
     if ($this->autocompleteField !== '') {
         $this->params['facet'] = 'on';
         if (!isset($this->params['facet.field'])) {
             $this->params['facet.field'] = array($this->autocompleteField);
         } else {
             $this->params['facet.field'][] = $this->autocompleteField;
         }
         $this->params['f.' . $this->autocompleteField . '.facet.sort'] = $this->autocompleteSort;
         $this->params['f.' . $this->autocompleteField . '.facet.limit'] = $this->autocompleteLimit;
         $this->params['f.' . $this->autocompleteField . '.facet.prefix'] = end($this->searchTerms);
         $this->params['f.' . $this->autocompleteField . '.facet.mincount'] = 1;
     }
     $response = $this->exec($this->buildQuery('standardQuery'));
     // PREPAIR PAGING
     if (isset($response->count) && isset($response->offset)) {
         $paging = new Paging($response->count, $this->params['rows'], null, $response->offset);
         foreach ($paging->calculate() as $key => $val) {
             $response->{$key} = $val;
         }
     }
     return $response;
 }
Esempio n. 4
0
 /**
  * 首页
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-04-28 17:14:18
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $page_size = 60;
     $total = $this->_model->table(TB_TAG)->count('DISTINCT tag');
     $page_info = Filter::page($total, 'page', $page_size);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $tag_arr = $this->_model->table(TB_TAG)->order('searches DESC')->field('DISTINCT `tag`')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'tag/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => $page_size));
     $o = $this->getViewTemplate()->assign(array('web_title' => L('TAG'), 'tag_arr' => $tag_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $this->_display(null, null, $page);
 }
Esempio n. 5
0
function news_admin_main()
{
    $paging = new Paging('p', _result_per_page(), 1, 9);
    $paging->sCurrentPageClass = 'current';
    $paging->sPageNextClass = 'next';
    $sqlOrder = 'news_id desc';
    if (!empty($_GET['sortby'])) {
        $sortby = $_GET['sortby'];
        $sort = $_GET['sort'];
        if ($sort == 'asc') {
            $sqlOrder = $sortby . ' asc';
        } else {
            if ($sort == 'desc') {
                $sqlOrder = $sortby . ' desc';
            }
        }
    }
    $sqlOrder = 'ordering DESC,is_category desc,' . $sqlOrder;
    $data = array();
    $db = _db();
    $pid = 0;
    $parent = null;
    if (!empty($_GET['pid'])) {
        $pid = $_GET['pid'];
        if ($pid != 0) {
            $db->prepare('SELECT news_id, parent_id FROM `_prefix_news` WHERE news_id=:ID');
            $db->bindValue(':ID', $pid, PARAM_INT);
            $db->execute();
            if ($parent = $db->fetch()) {
                $data['parent'] = $parent;
            } else {
                $pid = 0;
            }
        }
    }
    $cats[0] = '-- Không thuộc nhóm --';
    getCategoryList($cats);
    $data['category'] = $cats;
    $db->prepare('SELECT SQL_CALC_FOUND_ROWS ordering ,is_quantam, is_tieudiem,news_id, news_created, news_title, is_category, is_enabled, is_showintroimage,introimage FROM `_prefix_news` WHERE parent_id=:PARENT_ID ORDER BY :ORDER LIMIT :OFFSET, :TOTAL');
    $db->bindValue(':PARENT_ID', $pid, PARAM_INT);
    $db->bindValue(':ORDER', $sqlOrder, PARAM_NONE);
    $db->bindValue(':OFFSET', $paging->getResultRowStart(), PARAM_INT);
    $db->bindValue(':TOTAL', _result_per_page(), PARAM_INT);
    $db->execute();
    die('xyz');
    if ($items = $db->fetchAll()) {
        $data['items'] = $items;
    }
    //Lay tong cong so record
    $paging->nTotalRow = $db->total_last_limit_query();
    $data['paging'] = $paging;
    return $data;
}
Esempio n. 6
0
 function exeDefault()
 {
     Document::setTitle('Liên hệ');
     Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery', 'jquery.msgBox'));
     $data = array();
     $keySearch = Request::get('keySearch');
     $find = Request::get('find');
     $searchName = '';
     $searchEmail = '';
     if ($find == 'name') {
         $searchName = 'selected="selected"';
     } elseif ($find == 'email') {
         $searchEmail = 'selected="selected"';
     }
     $data['searchName'] = $searchName;
     $data['searchEmail'] = $searchEmail;
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         if ($searchEmail != '') {
             $condition = "LOWER(`email`) like '%" . strtolower($keySearch) . "%'";
         } else {
             $condition = "LOWER(`fullname`) like '%" . strtolower($keySearch) . "%'";
         }
         if ($find == 'email') {
             $link .= 'find=' . $find . '&';
         }
     }
     $display = 15;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['title'] = BASE_URL_ADMIN . '/feedback';
     $data['pagination'] = $pageLink->pagination($link);
     $data['actionDelete'] = BASE_URL_ADMIN . '/feedback/delete';
     $data['delete'] = BASE_URL_ADMIN . '/feedback/delete?id=';
     $data['detail'] = BASE_URL_ADMIN . '/feedback/detail?id=';
     $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png';
     $data['feedback'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $this->view->render('index', $data);
 }
Esempio n. 7
0
 /**
  * 渲染博客列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-04-28 16:55:45
  *
  * @param string|array $cate_info 数组为分类,否则为标签
  *
  * @return void 无返回值
  */
 private function _fetchBlog($cate_info = null)
 {
     if (is_array($cate_info)) {
         //分类
         $is_tag = false;
         $cate_id = $cate_info['cate_id'];
         $table = TB_BLOG;
         $where = array('b.is_delete' => 0, 'b.is_issue' => 1);
         if ($cate_id) {
             //category.shtml
             $where['b.cate_id'] = array('IN', $this->_getChildrenIds($cate_id));
         }
         $url_tpl = str_replace('.shtml', '/page/\\1.shtml', $cate_info['link_url']);
         $cache_flag = $cate_id;
         $total = $this->_model->table(TB_BLOG)->alias('b')->where($where)->count();
         $this->_model->alias('b');
         //b.title
     } else {
         //标签
         $this->_model->table(TB_TAG)->where(array('tag' => $cate_info))->setInc('searches');
         //搜索次数+1
         $is_tag = true;
         $table = TB_BLOG . ' AS b JOIN ' . TB_TAG . ' AS t ON t.blog_id=b.blog_id';
         $where = array('t.tag' => array('IN', $cate_info), 'b.is_delete' => 0, 'b.is_issue' => 1);
         $url_tpl = BASE_SITE_URL . 'tag/' . urlencode($cate_info) . '/page/\\1.shtml';
         $cache_flag = md5(strtolower($cate_info));
         $total = $this->_model->table(TB_BLOG)->alias('b')->join(' JOIN ' . TB_TAG . ' AS t ON b.blog_id=t.blog_id')->where($where)->count('DISTINCT b.blog_id');
     }
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $blog_arr = $this->_model->table($table)->where($where)->order('b.blog_id DESC')->limit($page_info['limit'])->field('b.blog_id,b.title,b.link_url,b.cate_id,b.add_time,b.summary,b.seo_keyword,b.seo_description')->select();
     $paging = new Paging(array('_url_tpl' => $url_tpl, '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one && !$is_tag ? 'build_html' : null)->assign(array('blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     if ($is_tag) {
         //标签
         $o->assign(array('web_title' => $cate_info . TITLE_SEPARATOR . L('TAG'), 'tag' => $cate_info, 'seo_keywords' => $cate_info));
     } else {
         //分类
         $o->assign(array('web_title' => $cate_id ? $this->nav($cate_id, 'cate_name', null, TITLE_SEPARATOR) : $cate_info['cate_name'], 'cate_info' => $cate_info, 'tag' => ''));
     }
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $cache_flag . '-' . $page);
     if ($page_one && !$is_tag) {
         $filename = str_replace(BASE_SITE_URL, WWWROOT, $cate_info['link_url']);
         new_mkdir(dirname($filename));
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
Esempio n. 8
0
 function exeDefault()
 {
     Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery', 'role', 'type_user'));
     Document::setTitle('Quản lý thành viên');
     $data = array();
     $keySearch = Request::get('keySearch');
     $find = Request::get('find');
     $searchName = '';
     $searchEmail = '';
     if ($find == 'name') {
         $searchName = 'selected="selected"';
     } elseif ($find == 'email') {
         $searchEmail = 'selected="selected"';
     }
     $data['title'] = BASE_URL_ADMIN . '/user';
     $data['searchName'] = $searchName;
     $data['searchEmail'] = $searchEmail;
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         if ($searchEmail != '') {
             $condition = "LOWER(`email`) like '%" . strtolower($keySearch) . "%'";
         } else {
             $condition = "LOWER(`username`) like '%" . strtolower($keySearch) . "%'";
         }
         if ($find == 'email') {
             $link .= 'find=' . $find . '&';
         }
     }
     $display = 20;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['pagination'] = $pageLink->pagination($link);
     $data['user'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $data['action'] = '';
     $this->view->render('index', $data);
 }
Esempio n. 9
0
 /**
  * 首页
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-02-21 13:44:11
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $total = $this->_model->table(TB_COMMENTS)->where($where = 'type=' . COMMENT_TYPE_GUESTBOOK . ' AND status=' . COMMENT_STATUS_PASS . ' AND parent_id=0')->count();
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $guestbook_arr = $this->_model->table(TB_COMMENTS)->where($where)->order('last_reply_time DESC')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'guestbook/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('GUESTBOOK'), 'guestbook_html' => $this->_getRecurrsiveComments($guestbook_arr), 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
     if ($page_one) {
         $filename = WWWROOT . 'guestbook.shtml';
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
Esempio n. 10
0
function getTrashCommentsWithPagingForOwner($blogid, $category, $name, $ip, $search, $page, $count)
{
    global $database;
    $sql = "SELECT c.*, e.title, c2.name AS parentName \n\t\tFROM {$database['prefix']}Comments c \n\t\tLEFT JOIN {$database['prefix']}Entries e ON c.blogid = e.blogid AND c.entry = e.id AND e.draft = 0 \n\t\tLEFT JOIN {$database['prefix']}Comments c2 ON c.parent = c2.id AND c.blogid = c2.blogid \n\t\tWHERE c.blogid = {$blogid} AND c.isfiltered > 0";
    $postfix = '';
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE parent = {$category}");
        array_push($categories, $category);
        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
        $postfix .= '&amp;category=' . rawurlencode($category);
    } else {
        $sql .= ' AND (e.category >= 0 OR c.entry = 0)';
    }
    if (!empty($name)) {
        $sql .= ' AND c.name = \'' . POD::escapeString($name) . '\'';
        $postfix .= '&amp;name=' . rawurlencode($name);
    }
    if (!empty($ip)) {
        $sql .= ' AND c.ip = \'' . POD::escapeString($ip) . '\'';
        $postfix .= '&amp;ip=' . rawurlencode($ip);
    }
    if (!empty($search)) {
        $search = escapeSearchString($search);
        $sql .= " AND (c.name LIKE '%{$search}%' OR c.homepage LIKE '%{$search}%' OR c.comment LIKE '%{$search}%')";
        $postfix .= '&amp;search=' . rawurlencode($search);
    }
    $sql .= ' ORDER BY c.written DESC';
    list($comments, $paging) = Paging::fetch($sql, $page, $count);
    if (strlen($postfix) > 0) {
        $paging['postfix'] .= $postfix . '&amp;withSearch=on';
    }
    return array($comments, $paging);
}
Esempio n. 11
0
 /**
  * 首页
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-02-21 13:30:55
  *
  * @return void 无返回值
  */
 public function indexAction()
 {
     $total = $this->_model->count();
     $page_info = Filter::page($total, 'page', PAGE_SIZE);
     $page = $page_info['page'];
     $page_one = $page < 2;
     $blog_arr = $this->_model->order('blog_id DESC')->limit($page_info['limit'])->select();
     $paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'miniblog/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
     $o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('MINIBLOG'), 'blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
     $content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
     if ($page_one) {
         $filename = WWWROOT . 'miniblog.shtml';
         //file_put_contents($filename, $content);
     }
     echo $content;
 }
Esempio n. 12
0
 /**
  * 构造查询对象
  * @param null $paging
  */
 function __constructor($paging = null)
 {
     $this->isPaging = isset($paging);
     $this->paging = isset($paging) ? $paging : Paging::create();
     $this->parameters = array();
     $this->operators = array();
 }
Esempio n. 13
0
 public function prepare($db)
 {
     $this->paging = Paging::getFromUrl();
     $this->paging->limit = $this->page_size;
     Paging::$max_pages_links = $this->max_pages_links;
     $this->search = isset($_GET['s']) ? $_GET['s'] : '';
     // add filtering logic here
     $this->data = ModelBase::select($db, $this->name, $this->where, $this->bindings, $this->types, $this->paging, $this->orderby);
 }
Esempio n. 14
0
function getNoticesWithPaging($blogid, $search, $page, $count)
{
    $context = Model_Context::getInstance();
    $pool = getDefaultDBModelOnNotice($blogid);
    if ($search !== true && $search) {
        $search = escapeSearchString($search);
        $pool->setQualifierSet(array("title", "like", $search, true), "OR", array("content", "like", $search, true));
    }
    return Paging::fetch($pool, $page, $count, $context->getProperty("uri.folder") . "/" . $context->getProperty("suri.value"));
}
Esempio n. 15
0
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
    global $database, $folderURL, $suri;
    $aux = '';
    if ($search !== true && $search) {
        $search = POD::escapeString($search);
        $aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')";
    }
    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
    $sql = "SELECT * \n\t\tFROM {$database['prefix']}Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC";
    return Paging::fetch($sql, $page, $count, "{$folderURL}/{$suri['value']}");
}
Esempio n. 16
0
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
    $ctx = Model_Context::getInstance();
    $aux = '';
    if ($search !== true && $search) {
        $search = POD::escapeString($search);
        $aux = "AND (title LIKE '%{$search}%' OR content LIKE '%{$search}%')";
    }
    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
    $sql = "SELECT * \n\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries \n\t\tWHERE blogid = {$blogid} \n\t\t\tAND draft = 0 {$visibility} \n\t\t\tAND category = -1 {$aux} \n\t\tORDER BY published DESC";
    return Paging::fetch($sql, $page, $count, $ctx->getProperty('uri.folder') . "/" . $ctx->getProperty('suri.value'));
}
Esempio n. 17
0
 public function showBlog()
 {
     //Get the page that we are on
     $page = Input::get('page') ? Input::get('page') : 1;
     $records_per_page = 10;
     //Get the artivles that we are going to display
     $data['articles'] = Tools::getBlogPosts($page, $records_per_page);
     // instantiate the pagination object
     $pagination = new Paging();
     // the number of total records is the number of records in the array
     $pagination->records(count($data['articles']));
     //$pagination->records(500);
     // records per page
     $pagination->records_per_page($records_per_page);
     $data['pagination'] = $pagination;
     //Create the view
     $this->layout->content = View::make('blog.blog', $data);
     $this->layout->header = View::make('includes.header');
     $headerData = array('title' => isset($this->metaData['blog_title']) ? $this->metaData['blog_title'] : null, 'description' => isset($this->metaData['blog_desc']) ? $this->metaData['blog_desc'] : null);
     $this->layout->header = View::make('includes.header', $headerData);
 }
Esempio n. 18
0
function getLinksWithPagingForOwner($blogid, $page, $count)
{
    $pool = DBModel::getInstance();
    $pool->init("Links");
    $pool->setAlias("Links", "l");
    $pool->setAlias("LinkCategories", "lc");
    $pool->join("LinkCategories", "left", array(array("lc.blogid", "eq", "l.blogid"), array("lc.id", "eq", "l.category")));
    $pool->setQualifier("l.blogid", "eq", $blogid);
    $pool->setOrder("l.name", "desc");
    $pool->setProjection("l.*", "lc.name AS categoryName");
    return Paging::fetch($pool, $page, $count);
}
Esempio n. 19
0
File: Yase.php Progetto: virdun/yase
 public function page($sQuery, $iPage)
 {
     $oPaging = new Paging("yase.php?account=" . $this->sAccount . "&query=" . $sQuery);
     $sQuery = utf8_decode($sQuery);
     $iTotal = $this->oSearcher->iSearch($sQuery);
     if (!isset($_REQUEST['page']) || $_GET['page'] < 1) {
         $iPage = 1;
     }
     $aRes = $this->oSearcher->aSearch($sQuery, $iPage);
     $iPages = (int) (($iTotal - 1) / $this->oSearcher->iLimit) + 1;
     print '<div class="summary_info">The search for  <b>' . $sQuery . '</b> returned <b>' . $iTotal . '</b> results </div>';
     print '<div class="navigation">';
     $oPaging->sNavigationFloat($iPage, $iPages, 'account=' . $this->sName . '&query=' . $sQuery, $this->oSearcher->iLimit);
     print '</div>';
     foreach ($aRes as $oRes) {
         print '<div class="title"><a href="' . $oRes->sUrl . '" target="_parent">' . $oRes->sTitle . '</a></div>';
         print '<div class="content">' . $oRes->sContent . '</div>';
     }
     print '<div class="navigation">';
     $oPaging->sNavigationFloat($iPage, $iPages, '&query=' . $sQuery, $this->oSearcher->iLimit);
     print '</div>';
 }
Esempio n. 20
0
 public static function getLists($user_id, $page, $page_size)
 {
     $user_id = (int) $user_id;
     if (!$user_id) {
         return array();
     }
     $table = self::table();
     $sku_table = ProductsSku::table();
     $item_table = ProductsItem::table();
     $sql = " SELECT a.id, b.id AS skuid, c.title, b.sku, b.sku_name, b.current_price FROM {$table} AS a, {$sku_table} AS b, {$item_table} AS c WHERE b.item=c.item AND a.sku_id=b.id AND a.user_id='{$user_id}' ORDER BY a.id DESC";
     $lists = Paging::bySQL($sql, $page, $page_size, 'a');
     ProductsSku::getProductsPic($lists['data']);
     return $lists;
 }
Esempio n. 21
0
 function exeDefault()
 {
     Document::setTitle('Hoá đơn');
     Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery'));
     $data = array();
     $keySearch = Request::get('keySearch');
     $data['keySearch'] = $keySearch;
     $condition = '';
     if ($keySearch == null) {
         $link = '?';
     } else {
         $link = '?keySearch=' . $keySearch . '&';
         $condition = 'LOWER(`username`)="' . strtolower($keySearch) . '"';
     }
     $display = 20;
     $totalPage = ceil($this->model->total($condition) / $display);
     if ((int) Request::get('page') > 0) {
         $page = Request::get('page');
         if ($totalPage < $page) {
             $page = $totalPage;
         }
     } else {
         $page = 1;
     }
     $pageLink = new Paging($page, $totalPage);
     $data['pagination'] = $pageLink->pagination($link);
     $data['title'] = BASE_URL_ADMIN . '/bill';
     $recharge = $this->LoadRecharge();
     $data['recharge'] = $recharge->selectAll();
     $data['actionDelete'] = BASE_URL_ADMIN . '/bill/delete';
     $data['delete'] = BASE_URL_ADMIN . '/bill/delete?id=';
     $data['detail'] = BASE_URL_ADMIN . '/bill/detail?id=';
     $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png';
     $data['detailRecharge'] = BASE_URL_ADMIN . '/recharge';
     $data['bill'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
     $this->view->render('index', $data);
 }
Esempio n. 22
0
function getKeywordsWithPaging($blogid, $search, $page, $count)
{
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    $pool->init("Entries");
    $aux = '';
    if ($search !== true && $search) {
        $pool->setQualifierSet(array(array("title", "like", $search, true), "OR", array("content", "like", $search, true)));
    }
    if (!doesHaveOwnership()) {
        $pool->setQualifier("visibility", ">", 0);
    }
    $pool->setQualifier("blogid", "eq", $blogid);
    $pool->setQualifier("draft", "eq", 0);
    $pool->setQualifier("category", "eq", -1);
    $pool->setOrder("published", "desc");
    return Paging::fetch($pool, $page, $count, $context->getProperty('uri.folder') . "/" . $context->getProperty('suri.value'));
}
Esempio n. 23
0
<?php

$aksi = "modul/mod_jurusan/aksi_jurusan.php";
$act = @$_GET['act'];
switch ($act) {
    // Tampil Jurusan
    default:
        echo "<h2>Jurusan</h2>\n<input type=button value='Tambah Jurusan' onclick=\"window.location.href='?module=jurusan&act=tambahjurusan';\">\n<table>\n<tr>\n\t<th>No.</th>\n\t<th>Kode Jurusan</th>\n\t<th>Nama Jurusan</th>\n\t<th>Kode Fakultas</th>\n\t<th>Nama Ketua</th>\n\t<th>Alamat Jurusan</th>\n\t<th>Aksi</th>\n</tr>";
        $p = new Paging();
        $batas = 10;
        $posisi = $p->cariposisi($batas);
        $tampil = mysql_query("SELECT * FROM jurusan ORDER BY kdjur limit {$posisi},{$batas}");
        $no = $posisi + 1;
        while ($r = mysql_fetch_array($tampil)) {
            echo "<tr>\n\t\t\t<td>{$no}</td>\n\t\t\t<td>{$r['kdjur']}</td>\n\t\t\t<td>{$r['nmjur']}</td>\n\t\t\t<td>{$r['kdfak']}</td>\n\t\t\t<td>{$r['nmketua']}</td>\n\t\t\t<td>{$r['almtjur']}</td>\n\t\t\t<td><a href=?module=jurusan&act=editjurusan&id={$r['kdjur']}><img src='images/edit-icon.gif' alt='edit' /></a>\n\t\t\t<a href={$aksi}?module=jurusan&act=hapus&id={$r['kdjur']}><img src='images/hapus-icon.gif' alt='hapus' /></a>\n\t\t\t</td>\n\t\t</tr>";
            $no++;
        }
        echo "</table>";
        $tampil2 = mysql_query("select * from jurusan");
        $jmldata = mysql_num_rows($tampil2);
        $jmlhalaman = $p->jumlahHalaman($jmldata, $batas);
        $linkHalaman = $p->navHalaman(@$_GET[halaman], $jmlhalaman);
        echo "<p>{$linkHalaman}</p>";
        break;
    case "tambahjurusan":
        echo "<h2>Form Jurusan</h2>\n<form name=form1 method=POST action='{$aksi}?module=jurusan&act=input'>\n<table>\n\t<tr>\n\t\t<td>Fakultas</td>\n\t\t<td> : <select name=kdfak>\n\t\t<option value=0 selected>- Pilih Fakultas -</option>";
        $sql = mysql_query("SELECT * FROM fakultas ORDER BY kdfak");
        while ($data = mysql_fetch_array($sql)) {
            echo "<option value={$data['kdfak']}>{$data['nmfak']}</option>";
        }
        echo "</select></td>\n\t</tr>\n\t<tr>\n\t\t<td>Kode Jurusan</td>\n\t\t<td> : <input type=text name=kdjur size=23 maxlength=15></td>\n\t</tr>\n\t<tr>\n\t\t<td>Nama Jurusan</td>\n\t\t<td> : <input type=text name=nmjur size=50 maxlength=100></td>\n\t</tr>\n\t<tr>\n\t\t<td>NIP Ketua</td>\n\t\t<td> : <input type=text name=nipketua size=50 maxlength=100></td>\n\t</tr>\n\t<tr>\n\t\t<td>Nama Ketua</td>\n\t\t<td> : <input type=text name=nmketua size=50 maxlength=100></td>\n\t</tr>\n\t<tr>\n\t\t<td>Alamat Jurusan</td>\n\t\t<td> : <input type=text name=almtjur size=50 maxlength=100></textarea>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2><input type=submit value=Simpan>\n\t\t<input type=button value=Batal onclick=self.history.back()></td>\n\t</tr>\n</table>\n</form>";
Esempio n. 24
0
        <div class="subject">
          <?php echo $v['check']?$v['check']:''?>
          <?php echo $v['category']?'<span class="category">'.$v['category'].'</span>':''; //분류출력?>
          <?php if($v['subject']['href']){?><a href="<?php echo $v['subject']['href']?>"><?php }?>
          <?php echo $v['subject']['text']?>
          <?php if($v['subject']['href']){?></a><?php }?>
        </div>
        <div class="datetime">
          <?php echo $v['datetime']?>
        </div>
      </li>
    <?php }?>
    <li class="last_line"></li>
  </ul>
</div>

<!-- 페이징 -->
<?php echo Paging::Inst(
	)->rows($rows*$cols
	)->tot($this->Sql('list_cnt')
	)->html(
)?>

<!-- 검색 및 버튼 -->
<div id="search_line">
  <div class="buttons"><?php include $this->path_view('buttons.php')?></div>
  <?php echo Search::Inst()->Html()?>
</div>


Esempio n. 25
0
include "html/header.php";
$arrAllForests = $common->getAllForests();
$arrAllForests[-1] = 'Common To All';
$arrRecords = array();
$table = 'm_forest_points';
$whereClause = "";
$start = 0;
$recNo = 0;
$recsPerPage = REC_PER_PAGE;
$showPages = SHOW_PAGES;
$orderBy = 'i_forest_id';
$selectColumns = '*';
if (isset($_REQUEST['recNo'])) {
    $recNo = $_REQUEST['recNo'];
}
$paging = new Paging();
$paging->whereClause = $whereClause;
$paging->recsPerPage = $recsPerPage;
$paging->showPages = $showPages;
$paging->orderBy = $orderBy;
$paging->table = $table;
$paging->recordNo = $recNo;
// starting record No.
$paging->startRow = $recNo;
$paging->selectColumns = $selectColumns;
$paging->path = BASE_URL . "cpanel/forest_points.php";
$totalRecords = $paging->getTotalRecords();
if ($totalRecords > 0) {
    $paging->recordNo = $recNo;
    // starting record No.
    $paging->startRow = $recNo;
Esempio n. 26
0
     $int_cur_position = $_REQUEST['int_cur_position'];
 }
 // Number of result to display on the page, will be in the LIMIT of the sql query also
 $int_num_result = is_numeric($_REQUEST['nrresults']) ? $_REQUEST['nrresults'] : $number_of_logs;
 $extargv = "&a=13&searchuser="******"&action=" . $_REQUEST['action'] . "&itemid=" . $_REQUEST['itemid'] . "&itemname=" . $_REQUEST['itemname'] . "&message=" . $_REQUEST['message'] . "&dateto=" . $_REQUEST['dateto'] . "&datefrom=" . $_REQUEST['datefrom'] . "&nrresults=" . $int_num_result . "&log_submit=" . $_REQUEST['log_submit'];
 // extra argv here (could be anything depending on your page)
 // build the sql
 $limit = $num_rows = $modx->db->getValue($modx->db->select('COUNT(*)', $modx->getFullTableName('manager_log'), !empty($sqladd) ? implode(' AND ', $sqladd) : ''));
 $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), !empty($sqladd) ? implode(' AND ', $sqladd) : '', 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
 if ($limit < 1) {
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
 } else {
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
     include_once "paginate.inc.php";
     // New instance of the Paging class, you can modify the color and the width of the html table
     $p = new Paging($num_rows, $int_cur_position, $int_num_result, $extargv);
     // Load up the 2 array in order to display result
     $array_paging = $p->getPagingArray();
     $array_row_paging = $p->getPagingRowArray();
     $current_row = $int_cur_position / $int_num_result;
     // Display the result as you like...
     print "<p>" . $_lang["paging_showing"] . " " . $array_paging['lower'];
     print " " . $_lang["paging_to"] . " " . $array_paging['upper'];
     print " (" . $array_paging['total'] . " " . $_lang["paging_total"] . ")<br />";
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
     $pagesfound = sizeof($array_row_paging);
     if ($pagesfound > 6) {
         $paging .= $array_row_paging[$current_row - 2];
         // ."&nbsp;";
         $paging .= $array_row_paging[$current_row - 1];
Esempio n. 27
0
    }
    $orderBy = " {$cursort} {$cursort_type}";
} else {
    $orderBy = " r2bd.dBidDate DESC ";
}
## ENDS HERE ###
$limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " ";
$jtbl = " INNER JOIN " . PRJ_DB_PREFIX . "_rfq2_master rfq2 on rfq2.iRFQ2Id=r2bd.iRFQ2Id\r\n\t\t\t\tLEFT JOIN " . PRJ_DB_PREFIX . "_inovice_order_heading ioh on rfq2.iInvoiceID=ioh.iInvoiceID\r\n                                LEFT JOIN " . PRJ_DB_PREFIX . "_purchase_order_heading poh on rfq2.iPurchaseOrderID=poh.iPurchaseOrderID\r\n\t\t\t\tLEFT JOIN " . PRJ_DB_PREFIX . "_status_master sm on rfq2.iStatusID=sm.iStatusID\r\n\t\t\t\tLEFT JOIN " . PRJ_DB_PREFIX . "_rfq2_product_buyer2 rpb2 on rpb2.iRFQ2Id=rfq2.iRFQ2Id ";
// echo $where; exit;
// $where .= " AND rfq2.iStatusID!=$csts ";
// $where .= " AND rfq2.dStartDate<NOW() ";
$where .= " AND r2bd.eDelete!='Verified' AND r2bd.iBuyer2Id={$curORGID} ";
$fields = " DISTINCT r2bd.*, rfq2.*, IF(rfq2.eFrom='Invoice',ioh.vInvoiceCode,poh.vPOCode) as vInvoiceCode, IF(rfq2.eFrom='Invoice',ioh.fAcceptedAmount,poh.fPOTotal) as fAcceptedAmount, IF(rfq2.eFrom='Invoice',ioh.vBuyerName,poh.vBuyerCompanyName) as vBuyerName, IF(rfq2.eFrom='Invoice',ioh.vSupplierName,poh.vSupplierName) as vSupplierName, sm.vStatus_" . LANG . " as status, r2bd.eStatus, r2bd.eSaved, r2bd.eDelete,\r\n\t\t\t\t\tIF(rfq2.eAuctionStatus='Completed' || rfq2.eAuctionStatus='Cancelled', rfq2.eAuctionStatus, IF(rfq2.dStartDate<NOW() AND rfq2.dEndDate>NOW(),'Live', IF(rfq2.dStartDate>NOW() AND rfq2.dEndDate>NOW(),'Not Started', rfq2.eAuctionStatus)) ) as rfq2Status,\r\n\t\t\t\t\tIF(rpb2.ePType='BProduct',(Select vProductName from " . PRJ_DB_PREFIX . "_bproduct_organization where iProductId=rpb2.ePType), (Select vProductName from " . PRJ_DB_PREFIX . "_sproduct_organization where iProductId=rpb2.ePType) ) as vProductName";
// IF(rfq2.dStartDate<NOW() AND rfq2.dEndDate>NOW(), 'Live', IF(rfq2.dStartDate>NOW() AND rfq2.dEndDate>NOW(), 'Not Started', IF(rfq2.eAuctionStatus!='Completed' AND rfq2.eAuctionStatus!='Cancelled', 'Completed', rfq2.eAuctionStatus) ) ) as eStatus,
// "IF(rfq2.dStartDate>NOW(), TIMESTAMPDIFF(DAY,NOW(),rfq2.dStartDate), 0) as rdays, IF(rfq2.dStartDate>NOW(), TIME_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,NOW(),rfq2.dStartDate) - (TIMESTAMPDIFF(DAY,NOW(),rfq2.dStartDate) * 24*60*60) ), '%H:%i'), 0) as rtime ";
$dtls = $r2bdObj->getJoinTableInfo($jtbl, $fields, $where, $orderBy, 'r2bd.iBidId' . $having, $limit, 'yes');
// pr($dtls); exit;
$count = $dtls['tot'];
unset($dtls['tot']);
if (!isset($pgajxobj)) {
    require_once SITE_CLASS_GEN . "class.paging-ajax.php";
    $pgajxobj = new Paging($count, $page, "listrfq2bid", $REC_LIMIT_FRONT);
}
$paging = $pgajxobj->getListPG($page);
$pgmsg = $pgajxobj->setMessage("Records");
//echo $paging; exit;
$smarty->assign('dtls', $dtls);
$smarty->assign('isusts', $isusts);
$smarty->assign('count', $count);
$smarty->assign('paging', $paging);
$smarty->assign('pgmsg', $pgmsg);
Esempio n. 28
0
<?php

$objCatalogue = new Catalogue();
$srch = Url::getParam('srch');
if (!empty($srch)) {
    $products = $objCatalogue->getAllProducts($srch);
    $empty = 'There are no results matching your searching criteria.';
} else {
    $products = $objCatalogue->getAllProducts();
    $empty = 'There are currently no records.';
}
$objPaging = new Paging($products, 5);
$rows = $objPaging->getRecords();
$objPaging->_url = '/admin' . $objPaging->_url;
require_once 'template/_header.php';
?>

<h1>Products</h1>

<form action="" method="get">
	<?php 
echo Url::getParams4Search(array('srch', Paging::$_key));
?>
	<table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
	
		<tr>
			<th><label for="srch">Product:</label></th>
			<td>
				<input type="text" name="srch" id="srch" 
					value="<?php 
echo stripslashes($srch);
Esempio n. 29
0
<?php

require_once '../common/config/config.inc.php';
require_once SOURCE_ROOT . 'classes/class.sort.php';
require_once SOURCE_ROOT . 'classes/class.paging.php';
require_once SOURCE_ROOT . 'classes/class.tax_discount.php';
//	CREATING THE CLASS OBJECTS FOR INCLUDING CLASS FILES
$objPaging = new Paging();
$objTaxDiscount = new TaxDiscount();
$_SESSION['sessTaxRedirectUrl'] = '';
$_SESSION['sessTaxDiscountAdd'] = '';
if ($_SERVER['QUERY_STRING'] != '') {
    $_SESSION['sessTaxRedirectUrl'] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
} else {
    $_SESSION['sessTaxRedirectUrl'] = $_SERVER['PHP_SELF'];
}
//	CREATING THE FIELDS ARRAYS TO SHOW & TABLE (IF JOIN OR OTHER CONDITION EXISTS) & A WHERE CONDITION
$arrTaxDiscountFlds = array('pkTaxDiscountID', 'TaxDiscountType', 'TaxDiscountName', 'TaxDiscountValue', 'TaxDiscountDateAdded', 'TaxDiscountDateModified', 'TaxDiscountStatus');
//	GET THE SEARCHING CONDITION ON THE SPECIFIC SEARCHING
$varSearchWhere = $objTaxDiscount->getSearchKeyWhere($_GET);
//applied the paging
$varPageStart = $objPaging->getPageStartLimit($_GET['page'], ADMIN_PAGE_RECORD_SIZE);
$varLimit = $varPageStart . ',' . ADMIN_PAGE_RECORD_SIZE;
$varTaxDiscountClm = 'pkTaxDiscountID';
$varSearchWhr = $varSearchWhere;
$NumberofRows = $objDatabase->getNumRows(TABLE_TAX_DISCOUNTS, $varTaxDiscountClm, $varSearchWhr);
$varNumberPages = $objPaging->calculateNumberofPages($NumberofRows, ADMIN_PAGE_RECORD_SIZE);
$arrTaxDiscountList = $objTaxDiscount->getTaxDiscountRecord(TABLE_TAX_DISCOUNTS, $arrTaxDiscountFlds, $varLimit, $varSearchWhr);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Esempio n. 30
0
function getPagingView(&$paging, &$template, &$itemTemplate, $useSkinCache = false)
{
    return Paging::getPagingView($paging, $template, $itemTemplate, $useSkinCache);
}