/** * ### .init() * * Initializes the pager by setting some default property values. */ public function init() { $this->registerScript(); $this->registerCss(); $classes = array(); $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); if (in_array($this->alignment, $validAlignments)) { $classes[] = 'pagination-' . $this->alignment; } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } if ($this->nextPageLabel === null) { $this->nextPageLabel = Yii::t('yii', '>'); } if ($this->prevPageLabel === null) { $this->prevPageLabel = Yii::t('yii', '<'); } if ($this->firstPageLabel === null) { $this->firstPageLabel = Yii::t('yii', '<<'); } if ($this->lastPageLabel === null) { $this->lastPageLabel = Yii::t('yii', '>>'); } if ($this->header === null) { $this->header = Yii::t('yii', 'Go to page: '); } parent::init(); }
/** * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = '→'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '←'; } $classes = array(); // $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); // // if (in_array($this->alignment, $validAlignments)) // $classes[] = 'pagination-'.$this->alignment; $classes[] = 'pagination'; $validSizes = array(self::SIZE_LARGE, self::SIZE_SMALL, self::SIZE_MINI); if (isset($this->size) && in_array($this->size, $validSizes)) { $classes[] = 'pagination-' . $this->size; } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } parent::init(); }
public function actionPickAtt() { $return_id = $_GET['return_id']; $rtype = $_GET['rtype']; $criteria = new CDbCriteria(); if (isset($_GET['keyword'])) { $screen_name = trim($_GET['keyword']); $criteria->condition = 'screen_name like :screen_name'; $criteria->params = array(':screen_name' => "%{$screen_name}%"); $partial_tpl = '_att'; //$atts = Attachment::model()->findAll($criteria); //$this->renderPartial('_att',array('return_id' => $return_id,'atts' => $atts,'rtype' => $rtype ),false,true); } else { $partial_tpl = 'pickatt'; //$atts = Attachment::model()->findAll(); //$this->renderPartial('pickatt',array('return_id' => $return_id,'atts' => $atts ,'rtype' => $rtype ),false,true); } $item_count = Attachment::model()->count($criteria); $page_size = 10; $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->cssFile = false; $pagination->setPages($pages); $pagination->init(); $criteria->limit = $page_size; $criteria->offset = $pages->offset; $select_pagination = new CListPager(); $select_pagination->htmlOptions['onchange'] = ""; $select_pagination->setPages($pages); $select_pagination->init(); $atts = Attachment::model()->findAll($criteria); $this->renderPartial($partial_tpl, array('return_id' => $return_id, 'atts' => $atts, 'rtype' => $rtype, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true); }
/** * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = Yii::t('bootstrap', 'Next') . ' →'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '← ' . Yii::t('bootstrap', 'Previous'); } if ($this->firstPageLabel === null) { $this->firstPageLabel = Yii::t('bootstrap', 'First'); } if ($this->lastPageLabel === null) { $this->lastPageLabel = Yii::t('bootstrap', 'Last'); } $classes = array(); $validAlignments = array(self::ALIGNMENT_LEFT, self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); if (in_array($this->alignment, $validAlignments)) { $classes[] = 'pagination-' . $this->alignment; } $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } parent::init(); }
/** * Initializes the pager by setting some default property values. */ public function init() { if ($this->header === null) { $this->header = ''; } // Bootstrap does not use a header if ($this->nextPageLabel === null) { $this->nextPageLabel = Yii::t('bootstrap', 'Next') . ' →'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '← ' . Yii::t('bootstrap', 'Previous'); } if ($this->firstPageLabel === null) { $this->firstPageLabel = Yii::t('bootstrap', 'First'); } if ($this->lastPageLabel === null) { $this->lastPageLabel = Yii::t('bootstrap', 'Last'); } if ($this->cssFile === null) { $this->cssFile = false; } // Bootstrap has its own css if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ''; } // would default to yiiPager parent::init(); }
public function actioncxIndex() { //print_r( ucfirst($this->getId() ) ); //$this->actionId = $this->getAction()->getId(); $controllerId = $this->controllerId; $criteria = new CDbCriteria(); if (isset($_GET['keyword']) || !empty($_GET['keyword']) || strlen($_GET['keyword']) > 0) { $keyword = trim($_GET['keyword']); $criteria->condition = 'title like :keyword '; $criteria->params = array(':keyword' => "%{$keyword}%"); $is_partial = true; } $imodel = new $controllerId(); $item_count = call_user_func(array($imodel, 'count'), $criteria); $page_size = 10; $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->cssFile = false; $pagination->setPages($pages); $pagination->init(); $criteria->limit = $page_size; $criteria->offset = $pages->offset; $select_pagination = new CListPager(); $select_pagination->header = '跳转到:'; $select_pagination->htmlOptions['onchange'] = ""; $select_pagination->setPages($pages); $select_pagination->init(); $list = call_user_func(array($imodel, 'findAll'), $criteria); if ($is_partial) { $this->renderPartial('_index', array('list' => $list, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true); } else { $this->render('index', array('list' => $list, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true); } }
public function init() { if ($this->cssFile === null) { $this->cssFile = CHtml::asset(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'pager.css'); } $this->header .= CHtml::openTag('div', array('class' => $this->pagerCssClass)); $this->footer = $this->ajaxProcessTemplate . CHtml::closeTag('div') . $this->footer; parent::init(); }
public function init() { parent::init(); $this->firstPageLabel = Yii::t('app', '<< First'); $this->footer = Yii::t('app', ''); $this->header = Yii::t('app', ''); $this->lastPageLabel = Yii::t('app', 'Last >>'); $this->nextPageLabel = Yii::t('app', 'Next >'); $this->prevPageLabel = Yii::t('app', '< Previous'); }
public function init() { if ($this->prevPageLabel === null) { $this->prevPageLabel = Yii::t('site_texts', 'Prev'); } if ($this->nextPageLabel === null) { $this->nextPageLabel = Yii::t('site_texts', 'Next'); } parent::init(); }
/** * Override from CBasePager in order to utilize * pagination class which allows for custom * routes during createUrl for pages * @return pagination the default pagination instance. */ public function init() { parent::init(); if (isset($this->paginationParams)) { assert('is_array($this->paginationParams)'); $this->getPages()->params = $this->paginationParams; } if (isset($this->route)) { $this->getPages()->route = $this->route; } }
/** * */ public function init() { parent::init(); $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $assets = dirname(__FILE__) . '/assets/js'; $this->baseUrl = Yii::app()->assetManager->publish($assets); $cs->registerScriptFile($this->baseUrl . '/jquery.iasUp.js', CClientScript::POS_END); $cs->registerScriptFile($this->baseUrl . '/callbacks.js', CClientScript::POS_END); return; }
public function init() { if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ''; } if (!isset($this->header)) { $this->header = ''; } parent::init(); if ($this->htmlOptions['class'] === '') { unset($this->htmlOptions['class']); } }
public function init() { if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = 'yiiPager myPager'; } if (!in_array($this->pageSize, $this->sizes)) { $this->sizes[$this->pageSize] = $this->pageSize; sort($this->sizes); //Ordena os tamanhos $this->sizes = array_combine($this->sizes, $this->sizes); } $this->header = ''; return parent::init(); }
public function init() { parent::init(); $assets = dirname(__FILE__) . '/assets'; $this->baseUrl = Yii::app()->assetManager->publish($assets); $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $cs->registerCSSFile($this->baseUrl . '/css/jquery.ias.css'); if (YII_DEBUG) { $cs->registerScriptFile($this->baseUrl . '/js/jquery.ias.js', CClientScript::POS_END); } else { $cs->registerScriptFile($this->baseUrl . '/js/jquery-ias.min.js', CClientScript::POS_END); } return; }
/** * Lists all models. */ public function actionIndex($opt = null) { $controllerId = strlen($opt['controllerId']) > 0 ? $opt['controllerId'] : $this->controllerId; if (!is_array($opt)) { $criteria = new CDbCriteria(); $keyword = trim($_GET['keyword']); } else { extract($opt); } $imodel = new $controllerId(); $item_count = call_user_func(array($imodel, 'count'), $criteria); $page_size = strlen($opt['page_size']) > 0 ? $opt['page_size'] : 10; $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->cssFile = false; $pagination->setPages($pages); $pagination->init(); $criteria->limit = $page_size; $criteria->offset = $pages->offset; $select_pagination = new CListPager(); $select_pagination->header = Yii::t('cp', 'Go to:'); $select_pagination->htmlOptions['onchange'] = ""; $select_pagination->setPages($pages); $select_pagination->init(); $list = call_user_func(array($imodel, 'findAll'), $criteria); if (!is_array($opt['tpl_params'])) { $opt['tpl_params'] = array(); } $opt['tpl_params']['list'] = $list; $opt['tpl_params']['pagination'] = $pagination; $opt['tpl_params']['select_pagination'] = $select_pagination; // echo Chtml::listBox('category_id',1,$leafs) //print_r($opt['tpl_params']); if ($is_partial) { $this->renderPartial('_index', $opt['tpl_params'], false, true); } else { $tpl = strlen($opt['tpl']) > 0 ? $opt['tpl'] : 'index'; if ($_GET['ajax'] == 'ajax') { $this->renderPartial($tpl, $opt['tpl_params'], false, true); } else { $this->render($tpl, $opt['tpl_params'], false, true); } } }
/** * @see CLinkPager::init() */ public function init() { $this->header = ''; if ($this->nextPageLabel === null) { $this->nextPageLabel = '»'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '«'; } if ($this->firstPageLabel === null) { $this->firstPageLabel = Yii::t('core', 'first'); } if ($this->lastPageLabel === null) { $this->lastPageLabel = Yii::t('core', 'last'); } $this->maxButtonCount = 5; parent::init(); }
/** * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = Yii::t('bootstrap', 'Next') . ' →'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '← ' . Yii::t('bootstrap', 'Previous'); } if ($this->firstPageLabel === null) { $this->firstPageLabel = Yii::t('bootstrap', 'First'); } if ($this->lastPageLabel === null) { $this->lastPageLabel = Yii::t('bootstrap', 'Last'); } if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ''; } // would default to yiiPager parent::init(); }
/** * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = '→'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '←'; } if ($this->firstPageCssClass === null) { $this->firstPageCssClass = 'first'; } if ($this->previousPageCssClass === null) { $this->previousPageCssClass = 'previous'; } if ($this->internalPageCssClass === null) { $this->internalPageCssClass = 'page'; } if ($this->nextPageCssClass === null) { $this->nextPageCssClass = 'next'; } if ($this->lastPageCssClass === null) { $this->lastPageCssClass = 'last'; } $classes = array(); $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); if (in_array($this->alignment, $validAlignments)) { $classes[] = 'pagination-' . $this->alignment; } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } parent::init(); }
/** *### .init() * * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = '<i class="fa fa-angle-right"></i>'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '<i class="fa fa-angle-left"></i>'; } $classes = array('pagination'); $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); if (in_array($this->alignment, $validAlignments)) { $classes[] = 'pagination-' . $this->alignment; } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } parent::init(); }
public function actionPhotos() { $criteria = new CDbCriteria(); $criteria->condition = 'user_id = :user_id'; $criteria->params = array(':user_id' => User()->id); $criteria->order = 'c_time DESC'; if (isset($_GET['keyword'])) { $partial_tpl = '_photos'; } else { $partial_tpl = 'photos'; } $item_count = Attachment::model()->count($criteria); $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->cssFile = false; $pagination->setPages($pages); $pagination->init(); $criteria->limit = 6; $criteria->offset = $pages->offset; $select_pagination = new CListPager(); $photos = Attachment::model()->findAll($criteria); $this->renderPartial($partial_tpl, array('photos' => $photos, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true); }
/** * Override from CBasePager in order to utilize * pagination class which allows for custom * routes during createUrl for pages * @return pagination the default pagination instance. */ public function init() { parent::init(); $this->getPages()->params = $this->paginationParams; $this->getPages()->route = $this->route; }
public function actionAPIx() { $item_count = 32; $page_size = 2; $pages = new CPagination($item_count); //$pages->pageVar = 'iook=8&ok'; //$pages->createPageUrl(CController::createUrl('blog/index',$pages) ); $pages->setPageSize($page_size); // simulate the effect of LIMIT in a sql query //$end =($pages->offset+$pages->limit <= $item_count ? $pages->offset+$pages->limit : $item_count); //$sample =range($pages->offset+1, $end); $pagination = new CLinkPager(); //print_r("<pre>"); //print_r($pagination); //print_r("</pre>"); //$pages->pageVar='stat='.$_GET[stat]."&page"; $pagination->setPages($pages); $pagination->init(); $pagination->run(); print_r("--"); print_r($pages->offset); print_r("--"); $pagination = new CListPager(); $pages->pageVar = 'ioof'; $pagination->setPages($pages); $pagination->init(); $pagination->run(); exit; echo 'find id=2 essay <br>'; echo '<pre>'; $a = API::essay(array('id' => '2')); $a->print; echo 'find id=2,3,4 essay <br>'; $a = API::essay(array('id' => ',1,2,3,4,5,6,7,,8,,9,0,0,-,-,,,,r,r,r,w,,3,2,3')); foreach ($a as $t) { print_r("<hr>"); $t->print; } echo '</pre>'; exit; }
public function init() { parent::init(); //$this->header = 'Total Pages:' . $this->pageCount; }
/** *### .init() * * Initializes the pager by setting some default property values. */ public function init() { if ($this->nextPageLabel === null) { $this->nextPageLabel = '»'; } if ($this->prevPageLabel === null) { $this->prevPageLabel = '«'; } $classes = array('pagination'); /* TODO: move these to styles files! */ $style = ''; $containerStyle = ''; $validAlignments = array(self::ALIGNMENT_CENTER, self::ALIGNMENT_RIGHT); if (in_array($this->alignment, $validAlignments)) { if ($this->alignment == self::ALIGNMENT_RIGHT) { $classes[] = 'pull-right'; } if ($this->alignment == self::ALIGNMENT_CENTER) { // $style = 'margin-left: auto; margin-right: auto;'; // not needed! $containerStyle = 'text-align: center;'; } } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } if (!empty($style)) { if (isset($this->htmlOptions['style']) && !empty($this->htmlOptions['style'])) { $this->htmlOptions['style'] .= ' ' . $style; } else { $this->htmlOptions['style'] = $style; } } if (!empty($containerStyle)) { if (isset($this->containerHtmlOptions['style']) && !empty($this->containerHtmlOptions['style'])) { $this->containerHtmlOptions['style'] .= ' ' . $containerStyle; } else { $this->containerHtmlOptions['style'] = $containerStyle; } } parent::init(); }
public function init() { parent::init(); }
/** * Lists all models. */ public function actionIndex($opt = null) { $controllerId = strlen($opt['controllerId']) > 0 ? $opt['controllerId'] : $this->controllerId; if (!is_array($opt)) { $criteria = new CDbCriteria(); $keyword = trim($_GET['keyword']); } else { extract($opt); } if (isset($_GET['id_start']) && !empty($_GET['id_start'])) { $criteria->condition .= " AND id >= :id_start "; $criteria->params[':id_start'] =& $_GET['id_start']; $tpl_params['id_start'] =& $_GET['id_start']; } if (isset($_GET['id_end']) && !empty($_GET['id_end'])) { $criteria->condition .= " AND id <= :id_end "; $criteria->params[':id_end'] =& $_GET['id_end']; $tpl_params['id_end'] =& $_GET['id_end']; } //if( isset($_GET['account_type']) && !empty($_GET['account_type']) ) { if (strlen($_GET['account_type']) > 0) { $criteria->condition .= " AND account_type = :account_type "; $criteria->params[':account_type'] =& str_replace('.html', '', $_GET['account_type']); $tpl_params['account_type'] =& str_replace('.html', '', $_GET['account_type']); } $tpl_params['is_hide_adv'] =& $_GET['is_hide_adv']; $imodel = new $controllerId(); $item_count = call_user_func(array($imodel, 'count'), $criteria); $page_size = strlen($opt['page_size']) > 0 ? $opt['page_size'] : 10; $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->header = ''; $pagination->cssFile = false; $pagination->setPages($pages); $pagination->init(); $criteria->limit = $page_size; $criteria->offset = $pages->offset; $select_pagination = new CListPager(); $select_pagination->header = '<span>跳到:</span>'; // $select_pagination->htmlOptions['onchange']=""; $select_pagination->setPages($pages); $select_pagination->init(); $list = call_user_func(array($imodel, 'findAll'), $criteria); if (!is_array($opt['tpl_params'])) { $opt['tpl_params'] = array(); } $opt['tpl_params']['item_count'] = '第 <span class="fwB">' . ($page_size * $pagination->currentPage + 1) . ' - ' . $page_size * ($pagination->currentPage + 1); $opt['tpl_params']['item_count'] .= '</span>,共 <span class="fwB" >' . $item_count . '</span> 条 '; $opt['tpl_params']['list'] = $list; $opt['tpl_params']['pagination'] = $pagination; $opt['tpl_params']['select_pagination'] = $select_pagination; // echo Chtml::listBox('category_id',1,$leafs) //print_r($opt['tpl_params']); $this->tpl_params =& $tpl_params; if ($is_partial) { $this->renderPartial('_index', $opt['tpl_params'], false, true); } else { $tpl = strlen($opt['tpl']) > 0 ? $opt['tpl'] : 'index'; if ($_GET['ajax'] == 'ajax') { $this->renderPartial($tpl, $opt['tpl_params'], false, true); } else { $this->render($tpl, $opt['tpl_params'], false, true); } } }
public function init() { $this->cssFile = Yii::app()->theme->baseUrl . '/css/pager.css'; parent::init(); }
public function init() { $this->htmlOptions['class'] = "pagination pagination-sm"; //$this->htmlOptions['style'] = "margin: 0;"; parent::init(); }
public function init() { $this->header = ''; $this->htmlOptions['class'] = 'pagination pagination-sm'; parent::init(); }
public function essays($opt = null) { $include = empty($opt['include']) ? false : true; $split = empty($opt['split']) ? false : true; $order = empty($opt['order']) ? ' id DESC ' : $opt['order']; if ($include) { $ids = $this->sub_nodes(); $criteria = new CDbCriteria(); $criteria->condition = 'find_in_set(category_id,:ids)'; $criteria->order = $order; $criteria->params = array(':ids' => $ids); if ($split) { $item_count = Article::model()->count($criteria); $page_size = 2; $pages = new CPagination($item_count); $pages->setPageSize($page_size); $pagination = new CLinkPager(); $pagination->setPages($pages); $pagination->init(); //$pagination->run(); // display the html pagination $criteria->limit = $page_size; $criteria->offset = $pages->offset; $articles = Article::model()->findall($criteria); } else { $articles = Article::model()->findall($criteria); } } else { $articles = $this->articles; } if ($split) { return array($articles, $pagination); } else { return $articles; } }