function testClearIfVoid()
 {
     $this->assertTrue(strlen($this->pager->links) > 0);
     $options = array('itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), 'perPage' => 20, 'mode' => 'Sliding');
     $this->pager = Pager::factory($options);
     $this->assertEqual('', $this->pager->links);
 }
Пример #2
0
 function testXSS()
 {
     $options = array('itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 'perPage' => 5, 'nextImg' => '»');
     $this->pager = Pager::factory($options);
     $expected = '&nbsp;<a href="./&quot;&gt;test?pageID=2" title="next page">&raquo;</a>&nbsp;';
     $this->assertEqual($expected, $this->pager->_getNextLink());
 }
Пример #3
0
 /**
  * Initializes the pager. Must be called before using the component.
  *
  * Takes user configuration and creates pager object ($this->Pager)
  *
  * @access public
  * @param array $config Configuration options for Pager::factory() method
  * @see http://pear.php.net/manual/en/package.html.pager.factory.php
  * @return void
  */
 function init($config)
 {
     // Get the correct URL, even with admin routes
     $here = array();
     if (defined('CAKE_ADMIN') && !empty($this->Controller->params[CAKE_ADMIN])) {
         $here[0] = $this->Controller->params[CAKE_ADMIN];
         $here[2] = substr($this->Controller->params['action'], strlen($this->Controller->params[CAKE_ADMIN]) + 1);
     } else {
         $here[2] = $this->Controller->params['action'];
     }
     $here[1] = Inflector::underscore($this->Controller->params['controller']);
     ksort($here);
     $url = implode('/', $here);
     // Set up the default configuration vars
     $this->params = array('mode' => 'Sliding', 'perPage' => 10, 'delta' => 5, 'totalItems' => '', 'httpMethod' => 'GET', 'currentPage' => 1, 'linkClass' => 'pager', 'altFirst' => 'First page', 'altPrev ' => 'Previous page', 'altNext' => 'Next page', 'altLast' => 'Last page', 'separator' => '', 'spacesBeforeSeparator' => 1, 'spacesAfterSeparator' => 1, 'useSessions' => false, 'firstPagePre' => '', 'firstPagePost' => '', 'firstPageText' => '<img src="' . $this->Controller->base . '/img/first.gif" alt="">', 'lastPagePre' => '', 'lastPagePost' => '', 'lastPageText' => '<img src="' . $this->Controller->base . '/img/last.gif" alt="">', 'prevImg' => '<img src="' . $this->Controller->base . '/img/prev.gif" alt="">', 'nextImg' => '<img src="' . $this->Controller->base . '/img/next.gif" alt="">', 'altPage' => 'Page', 'clearIfVoid' => true, 'append' => false, 'path' => '', 'fileName' => $this->Controller->base . DS . $url . DS . '%d', 'urlVar' => '');
     vendor('Pear/Pager/Pager');
     // Merge with user config
     $this->params = array_merge($this->params, $config);
     // sanitize requested page number
     if (!in_array($this->params['currentPage'], range(1, ceil($this->params['totalItems'] / $this->params['perPage'])))) {
         $this->params['currentPage'] = 1;
     }
     $this->Pager =& Pager::factory($this->params);
     // Set the template vars
     $this->Controller->set('pageLinks', $this->Pager->getLinks());
     $this->Controller->set('currentPage', $this->params['currentPage']);
     $this->Controller->set('isFirstPage', $this->Pager->isFirstPage());
     $this->Controller->set('isLastPage', $this->Pager->isLastPage());
 }
Пример #4
0
 function testGetAndPost()
 {
     $this->pager =& Pager::factory($this->options);
     $this->assertNoPattern('/id=/', $this->pager->links);
     $_GET['id'] = 123;
     $this->pager =& Pager::factory($this->options);
     $this->assertPattern('/id=123/', $this->pager->links);
 }
Пример #5
0
 /**
  * Create a new pager
  *
  * @param integer $itemCount   Number of items in total
  * @param integer $perPage     Number of items on one page
  * @param integer $currentPage Current page, beginning with 1
  * @param string  $filename    URL the page number shall be appended
  */
 public function __construct($itemCount, $perPage, $currentPage, $filename)
 {
     $append = true;
     if (strpos($filename, '%d') !== false) {
         $append = false;
     }
     //fix non-static factory method error
     error_reporting(error_reporting() & ~E_STRICT);
     $this->pager = \Pager::factory(array('mode' => 'Sliding', 'perPage' => $perPage, 'delta' => 2, 'totalItems' => $itemCount, 'currentPage' => $currentPage, 'urlVar' => 'page', 'append' => $append, 'path' => '', 'fileName' => $filename, 'separator' => '###', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'curPageSpanPre' => '', 'curPageSpanPost' => '', 'firstPagePre' => '', 'firstPageText' => 'first', 'firstPagePost' => '', 'lastPagePre' => '', 'lastPageText' => 'last', 'lastPagePost' => '', 'prevImg' => '« prev', 'nextImg' => 'next »'));
 }
Пример #6
0
 /**
  * Constructor
  *
  * Initialize the PEAR pager object.
  *
  * @param   array $options        The Pager options to override.
  * @access  public
  */
 public function __construct($options = array())
 {
     // Set default Pager options:
     $finalOptions = array('mode' => 'sliding', 'path' => "", 'delta' => 2, 'perPage' => 20, 'nextImg' => translate('Next') . ' &raquo;', 'prevImg' => '&laquo; ' . translate('Prev'), 'separator' => '', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'append' => false, 'clearIfVoid' => true, 'urlVar' => 'page', 'curPageSpanPre' => '<li><span>', 'curPageSpanPost' => '</span></li>', 'curPageClaas' => 'active');
     // Override defaults with user-provided values:
     foreach ($options as $optionName => $optionValue) {
         $finalOptions[$optionName] = $optionValue;
     }
     // Create the pager object:
     $this->pager =& Pager::factory($finalOptions);
 }
Пример #7
0
 function pager(&$paramobject)
 {
     $year = $paramobject->_param['year'];
     $site = $paramobject->_param['site'];
     $period = $paramobject->_param['period'];
     $focus = $paramobject->_param['focus'];
     $rowsum = $paramobject->_rowsum;
     require_once dirname(__FILE__) . '/../userlib/Pager/Pager.php';
     $options = array("totalItems" => $rowsum, "delta" => 10, "perPage" => 30, "mode" => "Jumping", "altFirst" => "最初", "altPrev" => "前へ", "altNext" => "次へ", "altLast" => "最後", "altPage" => "ページ", "prevImg" => "(前へ)", "nextImg" => "(次へ)", "separator" => " ", "urlVar" => "page", "append" => 0, "fileName" => "index.php?action=list&view=list&year=" . $year . "&site=" . $site . "&period=" . $period . "&focus=" . $focus . "&page=%d");
     $pager = Pager::factory($options);
     $this->_html .= '<div class="pager">' . $pager->links . "</div>";
 }
Пример #8
0
 /**
  * Constructor
  *
  * Initialize the PEAR pager object.
  *
  * @param array $options The Pager options to override.
  *
  * @access public
  */
 public function __construct($options = array())
 {
     // Set default Pager options:
     $perPage = isset($options['perPage']) ? $options['perPage'] : 20;
     $finalOptions = array('mode' => 'sliding', 'path' => "", 'delta' => 2, 'perPage' => 20, 'nextImg' => sprintf(translate('page_link_next'), $perPage), 'prevImg' => sprintf(translate('page_link_prev'), $perPage), 'separator' => '', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'append' => false, 'clearIfVoid' => true, 'urlVar' => 'page', 'curPageSpanPre' => '<span>', 'curPageSpanPost' => '</span>');
     // Override defaults with user-provided values:
     foreach ($options as $optionName => $optionValue) {
         $finalOptions[$optionName] = $optionValue;
     }
     // Create the pager object:
     $this->_pager =& Pager::factory($finalOptions);
     $this->options = $finalOptions;
 }
Пример #9
0
function pager_search ($sql,$cate) {
    //インストールしたPEARのPagerライブラリを読み込む
    require_once("Pager/Pager.php");
 
    //1ページあたりに表示するデータ数
    $pagelength = "10";
 
    //データを格納する配列
    $data_array=array();
 
    //SQLを実行する
    $sql->bindValue(':CATE', $cate, PDO::PARAM_STR);
    $sql->execute();
    $list = $sql->fetchAll(PDO::FETCH_ASSOC);

    //データ数を取得する
    $total = count($list);
 
    //ページャーライブラリに渡す設定(パラメーター
    $page=array(
    "itemData"=>$list,  //アイテムの配列です。
    "totalItems"=>$total, //合計アイテム数
    "perPage"=>$pagelength, //1ページあたりの表示数
    "mode"=>"Jumping",
    "linkClass" => "list",
    "curPageLinkClassName" => "list",
    "altFirst"=>"First", //以下、文字表示設定 1ページ目のalt表示
    "altPrev"=>"", //前のalt
    'prevImg'=>"&lt;&lt; 前へ", //前へ の文字表示
    "altNext"=>"", //次へ のalt
    "nextImg"=>"次へ &gt;&gt;", //次へ の文字表示
    "altLast"=>"Last", //ラストのalt表示
    "altPage"=>"",
    "separator"=>" ", //数字と数字の間の文字
    "append"=>1,
    "urlVar"=>"page",//get属性
    );
 
    //Pagerに設定した項目を読み込ませます
    $pager= Pager::factory($page);
 
    //現在のページ配列(戻り値)を取得
    $data_array['data'] = $pager->getPageData();
    //ページ遷移のリンクリストを取得
    $data_array['links'] = $pager->links;
    $data_array['total'] = $pager->numItems();
    //データ配列を返す

    return $data_array;
}
 function makeCategory($config, $subcategory)
 {
     print "Make subcategory {$subcategory['id']} page...\n";
     if (!is_dir($outputdir = "{$config->outputdir}/{$subcategory['folder']}")) {
         mkdir($outputdir);
     }
     $item = DB_DataObject::factory("item");
     $categDays = $item->getDays();
     $pager =& Pager::factory(array("mode" => "Jumping", "perPage" => $config->daynum, "delta" => 10, "itemData" => $categDays, "append" => false, "path" => "../", "fileName" => "{$subcategory['folder']}/index%d.html"));
     for ($i = 1; $i <= $pager->numPages(); $i++) {
         $tpl = new template();
         $tpl->load("templates/category.html", true, true);
         $tpl->setv("category_name", $subcategory["name"]);
         PagesGenerator::getCategories($tpl, "../");
         $data = $pager->getPageData($i);
         $links = $pager->getLinks($i);
         $tpl->setBlock("pages");
         $tpl->setv("pages", $links["all"]);
         foreach ($data as $day) {
             $res = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum);
             $res1 = $item->getItemsForDayCateg($subcategory["id"], $day[0], $config->itemnum, true);
             if (sizeof($res) == 0 && sizeof($res1) == 0) {
                 continue;
             }
             $tpl->setBlock("forday");
             $tpl->setv("date", date("Y-m-d", strtotime($day[0])));
             if (sizeof($res) > 0) {
                 foreach ($res as $row) {
                     $tpl->setBlock("rows");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                 }
             }
             if (sizeof($res1) > 0) {
                 $numthumbs = 0;
                 foreach ($res1 as $row) {
                     $tpl->setBlock("thumb");
                     $tpl->setv($row);
                     $tpl->parseBlock();
                     if (++$numthumbs >= $config->numthumbs) {
                         $tpl->parse("rowthumbs");
                         $numthumbs = 0;
                     }
                 }
             }
             $tpl->parse("forday");
         }
         file::save("{$config->outputdir}/{$subcategory['folder']}/index{$i}.html", $tpl->get());
     }
 }
Пример #11
0
 function pager($itemData, $perPage = 10, $delta = 5, $mode = 'Jumping', $urlVar = 'page', $prevImg = '&lt;', $nextImg = '&gt;', $separator = ' |')
 {
     list($path, $query) = split("\\?", $_SERVER['REQUEST_URI']);
     $options = array('itemData' => $itemData, 'mode' => $mode, 'path' => $path, 'append' => false, 'fileName' => '?' . $urlVar . '=%d', 'perPage' => $perPage, 'delta' => $delta, 'urlVar' => $urlVar, 'prevImg' => $prevImg, 'nextImg' => $nextImg, 'firstPageText' => '&lt;&lt;', 'lastPageText' => '&gt;&gt;', 'firstPagePre' => '', 'firstPagePost' => '', 'lastPagePre' => '', 'lastPagePost' => '', 'separator' => $separator);
     $pager =& Pager::factory($options);
     $links = $pager->getLinks();
     $link_pager = $links['all'];
     if (!$pager->isFirstPage()) {
         $link_pager = $links['first'] . ' ' . $link_pager;
     }
     if (!$pager->isLastPage()) {
         $link_pager = $link_pager . ' ' . $links['last'];
     }
     $pager->slider = $link_pager;
     return $pager;
 }
function getPagesHtml(&$rubrics, &$data, $procNum)
{
    $params = array("mode" => "Sliding", "perPage" => 50, "delta" => 3, "nextImg" => "Следующая", "prevImg" => "Предыдущая", "firstPageText" => "В начало", "lastPageText" => "В конец", "append" => false, "path" => "./", "fileName" => "tasks%d.html");
    if ($procNum >= 0) {
        $expr = " WHERE processes.rprocess_num = {$procNum} ";
    } else {
        $expr = "";
    }
    $sql = "\n\t\tSELECT processes.id\n\t\t\tFROM processes\n\t\t\tLEFT JOIN rubrics ON rubrics.id = processes.rubric_id\n\t\t\t{$expr}\n\t\t\tORDER BY adddate DESC, name DESC\n\t";
    $res =& $rubrics->db->getAll($sql);
    if (!PEAR::isError($res)) {
        $params["itemData"] = $res;
    }
    $pageId = isset($_REQUEST["pageID"]) ? $_REQUEST["pageID"] : 0;
    $pager =& Pager::factory($params);
    $data = $pager->getPageData($pageId);
    $links = $pager->getLinks();
    return $links["all"];
}
Пример #13
0
 function get_xsl_pager_params($xml_string)
 {
     $myedbsess = new MyEDB_SESSION();
     //$xml = new SimpleXMLElement($xml_string);
     /* Search for <a><b><c> */
     //$rows = count($xml->xpath('/records/record'));
     //	echo "<br>MyEDB_Pager, setting rows results from Session searcres_rowcnt: ".$_SESSION['search_res_row_cnt']." time is ".microtime();
     //	$rows = $_SESSION['search_res_row_cnt'];
     $rows = $myedbsess->search_res_row_cnt;
     require_once 'Pager/Pager.php';
     $data = range(1, $rows);
     //an array of data to paginate
     $pager_params = array('mode' => 'Jumping', 'append' => false, 'path' => '', 'fileName' => 'javascript:revealDiv(%d)', 'perPage' => myedbPager::get_num_per_page(), 'delta' => 5, 'itemData' => $data);
     $pager =& Pager::factory($pager_params);
     $n_pages = $pager->numPages();
     //print_r($data); echo $n_pages;
     $links = $pager->getLinks();
     list($from_row, $to_row) = $pager->getOffsetByPageId();
     return array("n_pages" => $n_pages, "page_links" => $links['all'], "numrows" => $rows, "from_row" => $from_row, "to_row" => $to_row, "total_rows" => $rows);
 }
Пример #14
0
Файл: db.php Проект: demental/m
 function preparePager($obj)
 {
     $c = clone $obj;
     $this->pagerOpts['totalItems'] = $this->totalItems = $c->count('distinct');
     if ($this->hasPager) {
         $obj->_pager = Pager::factory($this->pagerOpts);
         $lim = $obj->_pager->getOffsetByPageId();
         $obj->limit($lim[0] - 1, $lim[1] + 1 - $lim[0]);
     }
     if ($this->pointer['sort']) {
         if (strpos($this->pointer['sort'], '.') !== false) {
             $obj->orderBy($this->pointer['sort'] . ' ' . $this->pointer['direction']);
         } else {
             $obj->orderBy($obj->tableName() . '.' . $this->pointer['sort'] . ' ' . $this->pointer['direction']);
         }
     } elseif ($this->defaultSort) {
         $ord = $obj->tableName() . '.' . implode(',', $this->defaultSort);
         $obj->orderBy($ord);
     }
 }
Пример #15
0
 function search($term)
 {
     if (empty($term)) {
         $term = '%';
     }
     $this->_where = $this->getWhere($term);
     $pageID = isset($_GET['p']) ? (int) $_GET['p'] : 1;
     if ($pageID == 0) {
         $pageID = 1;
     }
     // Select all results
     $query = 'SELECT SQL_CALC_FOUND_ROWS name, summary FROM packages WHERE ' . $this->_where . ' ORDER BY name';
     $query .= ' LIMIT ' . ($pageID - 1) * $this->_perPage . ', ' . $this->_perPage;
     $this->_results = $this->_dbh->getAll($query, null, DB_FETCHMODE_ASSOC);
     // Get number of overall results
     $query = 'SELECT FOUND_ROWS()';
     $this->_total = $this->_dbh->getOne($query);
     $params = array('mode' => 'Jumping', 'perPage' => $this->_perPage, 'urlVar' => 'p', 'itemData' => range(1, $this->_total), 'extraVars' => array('q' => $term));
     $this->_pager =& Pager::factory($params);
 }
Пример #16
0
function Pager_Wrapper_DB(&$db, $query, $pager_options = array(), $disabled = false, $fetchMode = DB_FETCHMODE_ASSOC, $dbparams = null)
{
    if (!array_key_exists('totalItems', $pager_options)) {
        //  be smart and try to guess the total number of records
        if ($countQuery = rewriteCountQuery($query)) {
            $totalItems = $db->getOne($countQuery, $dbparams);
            if (PEAR::isError($totalItems)) {
                return $totalItems;
            }
        } else {
            $res =& $db->query($query, $dbparams);
            if (PEAR::isError($res)) {
                return $res;
            }
            $totalItems = (int) $res->numRows();
            $res->free();
        }
        $pager_options['totalItems'] = $totalItems;
    }
    $pager_options['delta'] = 3;
    require_once 'Pager/Pager.php';
    $pager =& Pager::factory($pager_options);
    $page = array();
    $page['totalItems'] = $pager_options['totalItems'];
    $page['links'] = $pager->links;
    $page['page_numbers'] = array('current' => $pager->getCurrentPageID(), 'total' => $pager->numPages());
    list($page['from'], $page['to']) = $pager->getOffsetByPageId();
    $res = $disabled ? $db->limitQuery($query, 0, $totalItems, $dbparams) : $db->limitQuery($query, $page['from'] - 1, $pager_options['perPage'], $dbparams);
    if (PEAR::isError($res)) {
        return $res;
    }
    $page['data'] = array();
    while ($res->fetchInto($row, $fetchMode)) {
        $page['data'][] = $row;
    }
    if ($disabled) {
        $page['links'] = '';
        $page['page_numbers'] = array('current' => 1, 'total' => 1);
    }
    return $page;
}
Пример #17
0
 /**
  * View list
  *
  * @author	John.meng
  * @since    version - Dec 23, 2005
  * @param	datatype paramname description
  * @return   datatype description
  */
 function viewList()
 {
     global $__Lang__, $UrlParameter, $FlushPHPObj, $table, $page_data, $all_data, $links, $form, $smarty;
     include_once PEAR_DIR . 'HTML/QuickForm.php';
     include_once PEAR_DIR . "HTML/Table.php";
     require_once PEAR_DIR . 'Pager/Pager.php';
     $form = new HTML_QuickForm('viewList');
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n{content}\n</table>\n</form>");
     $tableAttrs = array("class" => "grid_table");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     //		$table->setAutoFill("n/a");
     $hrAttrs = array("class" => "grid_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $params = array('itemData' => $all_data, 'perPage' => 10, 'delta' => 3, 'append' => true, 'separator' => ' . ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'prevImg' => $__Lang__['langPaginationPrev'], 'nextImg' => $__Lang__['langPaginationNext']);
     $pager =& Pager::factory($params);
     $page_data = $pager->getPageData();
     $links = $pager->getLinks();
     $selectBox = $pager->getPerPageSelectBox();
 }
Пример #18
0
 function getLinks()
 {
     $this->params["prevImg"] = $this->prev;
     $this->params["nextImg"] = $this->next;
     $this->params["currentPage"] = $this->currentPage;
     $this->params["mode"] = "Sliding";
     $this->pager =& Pager::factory($this->params);
     $this->range = $this->pager->getPageData();
     if ($this->pager->numPages() < 2) {
         return "";
     }
     $links = $this->pager->getLinks();
     if ($this->pager->isFirstPage()) {
         $links["back"] = $this->prevDis;
     }
     if ($this->pager->isLastPage()) {
         $links["next"] = $this->nextDis;
     }
     $pagesLinks = $this->getPrevNextPages();
     $result = $pagesLinks[0] . $links["back"] . "&nbsp;&nbsp;&nbsp;" . $links["pages"] . $links["next"] . $pagesLinks[1];
     return $result;
 }
 function getSQL()
 {
     $sql = $this->_sql;
     $NumPorts = $this->getRowCount();
     if (isset($this->_pager)) {
         unset($this->_pager);
     }
     $params = array('mode' => 'Sliding', 'perPage' => $this->_pageSize, 'delta' => 5, 'totalItems' => $NumPorts, 'urlVar' => 'page', 'currentPage' => $this->_pageNumber, 'spacesBeforeSeparator' => 1, 'spacesAfterSeparator' => 1);
     $this->_pager =& Pager::factory($params);
     unset($params);
     if ($this->_pageNumber > 1) {
         $offset = $this->_pager->getOffsetByPageId();
         $sql .= "\nOFFSET " . ($offset[0] - 1);
         unset($offset);
     }
     if ($this->_pageSize) {
         $sql .= "\nLIMIT " . $this->_pageSize;
     }
     #		echo '<pre>From line ' . __LINE__ . ' of ' . __FILE__ . ': ' . $sql . '</pre>';exit;
     #echo 'in GetSQL now';
     return $sql;
 }
Пример #20
0
 function executeList()
 {
     global $template, $WebBaseDir, $i18n, $WebTemplateDir, $ClassDir, $userid, $ActiveOption, $ReviewwayOption;
     include_once $ClassDir . "URLHelper.class.php";
     require_once 'Pager/Pager.php';
     $template->setFile(array("MAIN" => "apf_review_list.html"));
     $template->setBlock("MAIN", "main_list", "list_block");
     $apf_review = DB_DataObject::factory('ApfReview');
     $apf_review->orderBy('id desc');
     $max_row = 10;
     $start_num = !isset($_GET['entrant']) ? 0 : ($_GET['entrant'] - 1) * $max_row;
     $apf_review->limit($start_num, $max_row);
     $apf_review->whereAdd(" userid = '{$userid}' OR access = 'public' ");
     $ToltalNum = $apf_review->count();
     $apf_review->find();
     $myData = array();
     while ($apf_review->fetch()) {
         $myData[] = $apf_review->toArray();
     }
     $params = array('totalItems' => $ToltalNum, 'perPage' => $max_row, 'delta' => 8, 'append' => true, 'separator' => ' | ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'prevImg' => $i18n->_("PrevPage"), 'nextImg' => $i18n->_("NextPage"), 'mode' => 'Jumping', 'extraVars' => array());
     $pager =& Pager::factory($params);
     $links = $pager->getLinks();
     $current_page = $pager->getCurrentPageID();
     $selectBox = $pager->getPageSelectBox(array('autoSubmit' => true));
     $i = 0;
     foreach ($myData as $data) {
         $i % 2 == 0 ? $list_td_class = "admin_row_0" : ($list_td_class = "admin_row_1");
         $template->setVar(array("LIST_TD_CLASS" => $list_td_class));
         $template->setVar(array("ID" => $data['id'], "COMPANY" => $data['company'], "LINKMAN" => $data['linkman'], "REVIEWDATE" => $data['reviewdate'], "CATEGORY" => $ReviewwayOption[$data['category']], "CONTENT" => $data['content'], "GROUPID" => $data['groupid'], "USERID" => $data['userid'], "ACCESS" => $data['access'], "ACTIVE" => $ActiveOption[$data['active']], "ADD_IP" => $data['add_ip'], "CREATED_AT" => $data['created_at'], "UPDATE_AT" => $data['update_at']));
         $template->parse("list_block", "main_list", TRUE);
         $i++;
     }
     $template->setVar(array("WEBDIR" => $WebBaseDir, "WEBTEMPLATEDIR" => URLHelper::getWebBaseURL() . $WebTemplateDir, "TOLTAL_NUM" => $ToltalNum, "PAGINATION" => $links['all']));
 }
Пример #21
0
 /**
  * Handles generating the paging object
  *
  * @param   array        $options        Array of HTML::Pager options
  * @access  private
  * @return  void
  */
 function _buildPaging($options)
 {
     if ($this->_dg->_dataSource != null) {
         $count = $this->_dg->_dataSource->count();
     } else {
         $count = count($this->_dg->recordSet);
     }
     $defaults = array('totalItems' => $count, 'perPage' => $this->_dg->rowLimit, 'urlVar' => $this->_dg->requestPrefix . 'page');
     $options = array_merge($defaults, $options);
     $this->pager =& Pager::factory($options);
 }
Пример #22
0
 function testEmptyPagerWithImgEmpty()
 {
     $options = array('itemData' => range(1, 2), 'perPage' => 5, 'prevImgEmpty' => 'YYY', 'nextImgEmpty' => 'XXX');
     $this->pager = Pager::factory($options);
     $expected = '';
     $this->assertEqual($expected, $this->pager->links);
 }
include "./include/common.php";
include "Pager/Pager.php";
if (!User::is_logged_in() || User::get_id() != 1) {
    header('Location: index.php');
    exit;
}
if (isset($_GET['d'])) {
    $d = (int) $_GET['d'];
    AdReview::delete($d);
}
$tct = AdReview::count();
//total count
$rpp = 10;
//row per page
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct, 'excludeVars' => array('o', 'r', 'd', 't', 'e'));
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$reviews = AdReview::get_all(array(), '', $from - 1 . ", {$rpp}");
include "page-header.php";
?>

<div id="wrapper">
	
	<?php 
include "page-left.php";
?>

	<div id="content">

		<?php 
if ($tct > $rpp) {
Пример #24
0
/**
 * @param object PHP Eclipse instance
 * @param string db query
 * @param array  PEAR::Pager options
 * @param boolean Disable pagination (get all results)
 * @return array with links and paged data
 * @author Matte Edens <*****@*****.**>
 * @see http://sourceforge.net/projects/eclipselib/
 */
function Pager_Wrapper_Eclipse(&$db, $query, $pager_options = array(), $disabled = false)
{
    if (!$disabled) {
        require_once ECLIPSE_ROOT . 'PagedQuery.php';
        $query =& new PagedQuery($db->query($query), $pager_options['perPage']);
        $totalrows = $query->getRowCount();
        $numpages = $query->getPageCount();
        $whichpage = isset($_GET[$pager_options['urlVar']]) ? (int) $_GET[$pager_options['urlVar']] - 1 : 0;
        if ($whichpage >= $numpages) {
            $whichpage = $numpages - 1;
        }
        $result = $query->getPage($whichpage);
    } else {
        $result = $db->query($query);
        $totalrows = $result->getRowCount();
        $numpages = 1;
    }
    if (!$result->isSuccess()) {
        return PEAR::raiseError($result->getErrorMessage());
    }
    if (!array_key_exists('totalItems', $pager_options)) {
        $pager_options['totalItems'] = $totalrows;
    }
    $page = array();
    require_once ECLIPSE_ROOT . 'QueryIterator.php';
    for ($it =& new QueryIterator($result); $it->isValid(); $it->next()) {
        $page['data'][] =& $it->getCurrent();
    }
    require_once 'Pager/Pager.php';
    $pager = Pager::factory($pager_options);
    $page['links'] = $pager->links;
    $page['totalItems'] = $pager_options['totalItems'];
    $page['page_numbers'] = array('current' => $pager->getCurrentPageID(), 'total' => $numpages);
    $page['perPageSelectBox'] = $pager->getperpageselectbox();
    list($page['from'], $page['to']) = $pager->getOffsetByPageId();
    $page['limit'] = $page['to'] - $page['from'] + 1;
    if ($disabled) {
        $page['links'] = '';
        $page['page_numbers'] = array('current' => 1, 'total' => 1);
    }
    return $page;
}
Пример #25
0
 /**
  * Get the Pager object to split the showed data in several pages
  */
 public function get_pager()
 {
     if (is_null($this->pager)) {
         $total_number_of_items = $this->get_total_number_of_items();
         $params['mode'] = 'Sliding';
         $params['perPage'] = $this->per_page;
         $params['totalItems'] = $total_number_of_items;
         $params['urlVar'] = $this->param_prefix . 'page_nr';
         $params['currentPage'] = $this->page_nr;
         $icon_attributes = array('style' => 'vertical-align: middle;');
         $params['prevImg'] = Display::return_icon('action_prev.png', get_lang('PreviousPage'), $icon_attributes);
         $params['nextImg'] = Display::return_icon('action_next.png', get_lang('NextPage'), $icon_attributes);
         $params['firstPageText'] = Display::return_icon('action_first.png', get_lang('FirstPage'), $icon_attributes);
         $params['lastPageText'] = Display::return_icon('action_last.png', get_lang('LastPage'), $icon_attributes);
         $params['firstPagePre'] = '';
         $params['lastPagePre'] = '';
         $params['firstPagePost'] = '';
         $params['lastPagePost'] = '';
         $params['spacesBeforeSeparator'] = '';
         $params['spacesAfterSeparator'] = '';
         $query_vars = array_keys($_GET);
         $query_vars_needed = array($this->param_prefix . 'column', $this->param_prefix . 'direction', $this->param_prefix . 'per_page');
         if (count($this->additional_parameters) > 0) {
             $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters));
         }
         $query_vars_exclude = array_diff($query_vars, $query_vars_needed);
         $params['excludeVars'] = $query_vars_exclude;
         $this->pager =& Pager::factory($params);
     }
     return $this->pager;
 }
}
$oUserlog = new OA_Dll_Audit();
$aAuditData = $oUserlog->getAuditLog($aParams);
$aParams['totalItems'] = count($aAuditData);
if (!isset($pageID) || $pageID == 1) {
    $aParams['startRecord'] = 0;
} else {
    $aParams['startRecord'] = $pageID * $setPerPage - $setPerPage;
}
if ($aParams['startRecord'] > $aParams['totalItems']) {
    $aParams['startRecord'] = 0;
}
$aParams['perPage'] = MAX_getStoredValue('setPerPage', 10);
// Retrieve audit details
$aAuditData = $oUserlog->getAuditLog($aParams);
$pager =& Pager::factory($aParams);
$per_page = $pager->_perPage;
$pager->history = $pager->getPageData();
$pager->pagerLinks = $pager->getLinks();
$pager->pagerLinks = $pager->pagerLinks['all'];
$pager->pagerSelect = preg_replace('/(<select.*?)(>)/i', '$1 onchange="submitForm()" id="setPerPage"$2', $pager->getPerPageSelectBox(10, 100, 10));
// Build column header link params
$aAllowdParams = array('advertiserId', 'campaignId', 'publisherId', 'zoneId');
foreach ($aAllowdParams as $key) {
    if (!empty(${$key})) {
        $aUrlParam[$key] = "{$key}=" . ${$key};
    }
}
$aUrlParam['listorder'] = "listorder={$listorder}";
$aUrlParam['$orderdirection'] = $orderdirection == 'down' ? "orderdirection=up" : "orderdirection=down";
$urlParam = implode('&', $aUrlParam);
Пример #27
0
		<td>Nome</td>
		<td>Cidade</td>
		<td>UF</td>
		<td>Bairro</td>
		<td>CEP</td>
		<td>Tel</td>
		<td>Cell</td>
		<td>Endereço</td>
		<td>Login</td>
		<td>Senha</td>
		<td>Alterar</td>
	</tr>

	<?php 
$params = array('mode' => 'Jumping', 'perPage' => 10, 'delta' => 5, 'itemData' => $dadosClient);
$pager = @Pager::factory($params);
$data = $pager->getPageData();
//var_dump($data);
foreach ($data as $d) {
    ?>

	<form action="" method="post">
		<tr>
			<input type="hidden" name="id" value="<?php 
    echo $d['client_id'];
    ?>
">
			<td><input type="text" name="cliName" value="<?php 
    echo $d['client_name'];
    ?>
"  class="txt_field"/></td>
Пример #28
0
         /*
         $data[] = '
         <tr class="trOff" onMouseOver="trOver(this)" onMouseOut="trOut(this)">
         <td width="10"><label><input type="checkbox" name="dea_id[]" id="check_deal_'.$row["dea_id"].'" value="'.$row["dea_id"].'"></label></td>
         <td class="bold" onmousedown="document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked = (document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked ? false : true);">'.$row["pro_addr"].'</td>
         <td width="100" onmousedown="document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked = (document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked ? false : true);">'.format_price($row["dea_marketprice"]).'</td>
         <td width="75" onmousedown="document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked = (document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked ? false : true);">'.$row["dea_status"].'</td>
         <td width="125" onmousedown="document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked = (document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked ? false : true);">'.$row["cli_name"].'</td>
         <td width="100" onmousedown="document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked = (document.getElementById(\'check_deal_'.$row["dea_id"].'\').checked ? false : true);">'.$row["bra_title"].'</td>
         </tr>';
         */
     }
 }
 require_once 'Pager/Pager.php';
 $pager_params = array('mode' => 'Sliding', 'append' => false, 'path' => '', 'fileName' => 'javascript:showResultPage(%d)', 'perPage' => 20, 'delta' => 100, 'itemData' => $data);
 $pager =& Pager::factory($pager_params);
 $n_pages = $pager->numPages();
 $links = $pager->getLinks();
 if (!$links['back']) {
     $back = "&laquo;";
 } else {
     $back = $links['back'];
 }
 if (!$links['next']) {
     $next = "&raquo;";
 } else {
     $next = $links['next'];
 }
 if (!$links['last']) {
     $last = "&raquo;";
 } else {
 /**
  * create
  *
  */
 public function create($params)
 {
     Charcoal_ParamTrait::validateHashMap(1, $params);
     $this->pager = @Pager::factory($params);
 }
Пример #30
0
 /**
  * ページデータ(全てのページ)をセットする
  * ・ページデータ(全てのページ)を受け取り、smartyにpagerとページデータをセットする。
  *  なお、ページングの際の画面遷移先は、引数で指定されたアクションである。
  * ・アクションが指定されていない場合は、画面IDに紐付くアクションがデフォルトとなる。
  * ・Pagerに保持させる項目がある場合は、$extraVarsにカラム名をセットする。
  * ・Pagerに保持させたくない項目がある場合は、$excludeVarsにカラム名をセットする。
  * @access public
  * @param array $itemData ページングのアイテム配列データ
  * @param int $perPage ページあたりのアイテム数
  * @param string $pageName ページ名
  * @param string $moduleName モジュール名
  * @param string $actionName アクション名
  * @param array $extraVars Pagerに保持させる項目(カラム名)
  * @param array $excludeVars Pagerに保持させない項目(カラム名)
  */
 public function setPageItemData($itemData = null, $perPage = 30, $pageName = null, $moduleName = null, $actionName = null, $extraVars = array(), $excludeVars = array())
 {
     /* 初期値をセットする */
     if (empty($pageName)) {
         $pageName = $this->getPageName();
     }
     if (empty($moduleName)) {
         $moduleName = $this->moduleName;
     }
     if (empty($actionName)) {
         $actionName = $this->actionName;
     }
     if (empty($perPage)) {
         $perPage = 30;
     }
     /* 画面遷移先を設定する */
     $parameters['module'] = $moduleName;
     $parameters['action'] = $actionName;
     $url = $this->controller->genURL(null, $parameters);
     /* ページを生成する */
     $params = array("itemData" => $itemData, "perPage" => $perPage, "mode" => "Jumping", "httpMethod" => "POST", "urlVar" => $pageName, "fixFileName" => false, "path" => "", "fileName" => $url, "prevImg" => '&lt;&lt;', "nextImg" => '&gt;&gt;', "altFirst" => "最初ページ", "altPrev" => "前ページ", "altNext" => "次ページ", "altLast" => "最終ページ", "firstPagePre" => "{", "firstPageText" => "最初", "firstPagePost" => "}", "lastPagePre" => "{", "lastPageText" => "最終", "lastPagePost" => "}", "extraVars" => $extraVars, "excludeVars" => $excludeVars);
     $pager = Pager::factory($params);
     /* ページをsmartyにセットする */
     $pageData = array();
     foreach ($pager->getPageData() as $lineData) {
         $pageData[] = $lineData;
     }
     $this->setAttribute($pageName, $pager);
     if (count($pageData) > 0) {
         $this->setAttribute($pageName . '_data', $pageData);
     } else {
         $this->setAttribute($pageName . '_data', $this->getMessage("MC-006"));
     }
 }