作者:xw71682
项目:x
public function paging($data)
{
$currentPage = (int) $_GET['page'];
$paginator = new PaginatorModel(array("data" => $data, "limit" => 10, "page" => $currentPage));
$page = $paginator->getPaginate();
return $page;
}
作者:JosTruc
项目:phalcon-new
public function indexAction()
{
$this->tag->setTitle('Quản lý bài viết');
$news = News::find(array('order' => 'id DESC'));
$currentPage = $this->request->getQuery("page", "int") > 0 ? $this->request->getQuery("page", "int") : 1;
// Create a Model paginator, show 10 rows by page starting from $currentPage
$paginator = new PaginatorModel(array("data" => $news, "limit" => 10, "page" => $currentPage));
// Get the paginated results
$page = $paginator->getPaginate();
$this->view->setVar('page', $page);
// Change active
$params = $this->request->getPost();
$id = isset($params['id']) ? $params['id'] : '';
$active = isset($params['active']) ? $params['active'] : '';
if ($active == 1) {
$active = 2;
} else {
if ($active == 2) {
$active = 1;
}
}
if ($id != null) {
$news = News::findFirst($id);
$news->active = $active;
$news->save();
}
}
作者:zhangk
项目:phalcon_manag
public function indexAction($page = 1)
{
$parameters["order"] = "gid desc";
$users = Groups::find($parameters);
$paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page));
$this->view->page = $paginator->getPaginate();
}
作者:JosTruc
项目:phalcon-new
public function listAction()
{
$params = $this->request->getQuery();
if ($params['_url'] != null) {
$string = ltrim($params['_url'], '/danh-muc');
}
$array = explode('-', $string);
$id = $array[0];
// Get name category
$category = Category::findFirstById($id);
$this->tag->setTitle($category->name);
// Get list category of id
if ($id != '' && $id > 0) {
// The data set to paginate
$news = News::find(array('active = 1 AND category =' . $id, 'order' => 'id DESC'));
$currentPage = (int) $_GET["page"];
// Create a Model paginator, show 10 rows by page starting from $currentPage
$paginator = new PaginatorModel(array("data" => $news, "limit" => 13, "page" => $currentPage));
// Get the paginated results
$page = $paginator->getPaginate();
$this->view->setVar('page', $page);
$this->view->setVar('category', $category);
} else {
$this->response->redirect('error');
}
}
作者:Robert-Xi
项目:phalcon-webmi
public function getPage($config = array())
{
if (isset($config['data'])) {
$cname = isset($config['cname']) ? $config['where'] : $this->dispatcher->getControllerName();
$limit = isset($config['limit']) ? $config['limit'] : 15;
$getUrl = isset($config['getUrl']) ? $config['getUrl'] : '';
// Page
$page = $this->request->getQuery('page', 'int');
$paginator = new PaginatorModel(array('data' => $config['data'], 'limit' => $limit, 'page' => $page));
$Page = $paginator->getPaginate();
// Page Html
$Lang = $this->inc->getLang('inc');
$html = '';
if (empty($page) || $page == 1) {
$html .= '<span>' . $Lang->_('inc_page_first') . '</span>';
$html .= '<span>' . $Lang->_('inc_page_before') . '</span>';
} else {
$html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=1' . $getUrl . '">' . $Lang->_('inc_page_first') . '</a>';
$html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->before . $getUrl . '">' . $Lang->_('inc_page_before') . '</a>';
}
if ($page == $Page->last) {
$html .= '<span>' . $Lang->_('inc_page_next') . '</span>';
$html .= '<span>' . $Lang->_('inc_page_last') . '</span>';
} else {
$html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->next . $getUrl . '">' . $Lang->_('inc_page_next') . '</a>';
$html .= '<a href="' . $this->inc->BaseUrl($cname) . '?page=' . $Page->last . $getUrl . '">' . $Lang->_('inc_page_last') . '</a>';
}
$html .= ' Page : ' . $Page->current . '/' . $Page->total_pages;
$Page->PageHtml = $html;
return $Page;
} else {
return FALSE;
}
}
作者:devsnippe
项目:city_sit
/**
* Default action, shows the search form
*/
public function indexAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = \Phalcon\Mvc\Model\Criteria::fromInput($this->di, "\\Models\\Roles", $_POST);
$query->order("id ASC, name ASC");
$this->persistent->searchParams = $query->getParams();
if (!\Helpers\Arr::is_array_empty($this->persistent->searchParams)) {
$models = \Models\Roles::find($this->persistent->searchParams);
}
} else {
$numberPage = $this->request->getQuery("page", "int");
if (!$numberPage or $numberPage <= 0) {
$numberPage = 1;
}
if ($numberPage > 1 and !\Helpers\Arr::is_array_empty($this->persistent->searchParams)) {
$models = \Models\Roles::find($this->persistent->searchParams);
} else {
//$models = \Models\Roles::query()->order("id ASC, name ASC")->execute();
$models = \Models\Roles::find();
$this->persistent->searchParams = null;
}
}
if (count($models) == 0) {
$this->flashSession->notice("Не найдено");
$this->persistent->searchParams = null;
}
$paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $models, "limit" => 10, "page" => $numberPage));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
//$this->view->setVar('searchparams', $this->persistent->searchParams);
//$this->view->setVar('numpage', $numberPage);
}
作者:liushua
项目:phalcon_manag
/**
* user list
*/
public function indexAction()
{
$page = $this->request->getQuery('page', 'int', 1);
$users = Users::find();
$paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page));
$this->view->page = $paginator->getPaginate();
}
作者:ametsurame
项目:eazy-dashboar
public function articleAction()
{
$posts = Post::find(['type = "post" AND id_web = "' . $this->auth->id_web . '" order by id desc']);
$paginator = new PaginatorModel(array("data" => $posts, "limit" => $this->params->limit, "page" => $this->params->page));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
}
作者:lookingatsk
项目:zhonghewanban
public function indexAction()
{
$indexProducts = Products::find(array("limit" => 5, "order" => "id asc"));
$products = Products::find(array("order" => "id asc"));
$paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $products, "limit" => 8, "page" => $dynamicPageBegin));
$this->view->page = $paginator->getPaginate();
$this->view->indexProducts = $indexProducts;
}
作者:chenshuha
项目:BeginShak
public function getList()
{
if (self::count() == 0) {
return false;
}
$paginator = new PaginatorModel(array("data" => self::findBymerchantId(1), "limit" => 10, "page" => @(int) $_GET["page"]));
return $paginator->getPaginate();
}
作者:zhangk
项目:phalcon_manag
/**
* user list
*/
public function indexAction($page = 1)
{
$parameters["order"] = "id desc";
// $parameters['conditions'] = 'username = :username:';
// $parameters['bind'] = array('username'=>'seiven');
$users = Users::find($parameters);
$paginator = new Model(array('data' => $users, 'limit' => 20, 'page' => $page));
$this->view->page = $paginator->getPaginate();
}
作者:soutone
项目:api-desconect
/**
* Paginates given Resource. By default paginates ::find of caller Model.
*
* @param null $resource : Resource to be paginated
* @return Response
*/
public function paginate($resource = null)
{
if (empty($resource)) {
$full_path = explode('\\', get_called_class());
$className = 'App\\Models\\' . str_replace('sController', '', end($full_path));
$resource = $className::find();
}
$paginator = new PaginatorModel(array('data' => $resource, 'limit' => 10, 'page' => (int) $this->request->getQuery('page', 'int', '1')));
return new Response(json_encode($paginator->getPaginate()));
}
作者:RobBicke
项目:la
/**
* Index action - display all tariffs
*
* @package las
* @version 1.0
*/
public function indexAction()
{
$this->tag->setTitle(__('Tariffs'));
// Available sort to choose
$this->filter->add('in_array', function ($value) {
return in_array($value, ['amount', 'amount DESC', 'downloadCeil', 'downloadCeil DESC', 'name', 'name DESC', 'priority', 'priority DESC', 'uploadCeil', 'uploadCeil DESC']) ? $value : null;
});
// Get tariffs and prepare pagination
$paginator = new Paginator(["data" => Tariffs::find(['order' => $this->request->getQuery('order', 'in_array', 'id', true)]), "limit" => $this->request->getQuery('limit', 'int', 20, true), "page" => $this->request->getQuery('page', 'int', 1, true)]);
$this->view->setVars(['pagination' => $paginator->getPaginate(), 'bitRate' => \Las\Models\Settings::options('bitRate', $this->las['general']['bitRate'])]);
}
作者:munozdanie
项目:sy
/**
* Searches for operadora
*/
public function searchAction($yacimientoId = null)
{
parent::importarJsTable();
$numberPage = 1;
if ($yacimientoId != null) {
$operadora = Operadora::find(array('operadora_yacimientoId=:yacimiento_id:', 'bind' => array('yacimiento_id' => $yacimientoId)));
} else {
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, "Operadora", $_POST);
$this->persistent->parameters = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$parameters = $this->persistent->parameters;
if (!is_array($parameters)) {
$parameters = array();
}
$parameters["order"] = "operadora_id";
$operadora = Operadora::find($parameters);
}
if (count($operadora) == 0) {
$this->flash->notice("No se han encontrado resultados");
return $this->dispatcher->forward(array("controller" => "operadora", "action" => "index"));
}
$paginator = new Paginator(array("data" => $operadora, "limit" => 25, "page" => $numberPage));
$this->view->page = $paginator->getPaginate();
}
作者:gn0st1k4
项目:phalconBlo
/**
* Index action
*/
public function indexAction()
{
$numberPage = $this->request->getQuery("page", "int", 1);
$comments = Comments::query()->order("submitted DESC")->execute();
$paginator = new Paginator(array("data" => $comments, "limit" => 10, "page" => $numberPage));
$this->view->page = $paginator->getPaginate();
}
作者:Jonhathan-Roda
项目:ranchogrand
/**
* Searches for usuario
*/
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, "Usuario", $_POST);
$this->persistent->parameters = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$parameters = $this->persistent->parameters;
if (!is_array($parameters)) {
$parameters = array();
}
$parameters["order"] = "idusuario";
$usuario = Usuario::find($parameters);
if (count($usuario) == 0) {
$this->flash->notice("The search did not find any usuario");
return $this->dispatcher->forward(array("controller" => "usuario", "action" => "index"));
}
$barcode = new Barcode();
echo "<style>";
echo $barcode->getCssStyle();
echo "</style>";
//echo $barcode->code39("AB20150wewesdsd");
$this->view->setVar("barcode", $barcode);
$paginator = new Paginator(array("data" => $usuario, "limit" => 10, "page" => $numberPage));
$this->view->page = $paginator->getPaginate();
}
作者:Kefir9
项目:home-bookkeepin
public function indexAction($categoryID = 0)
{
$this->setTitle("Список элементов");
$this->setCategoryTitleSmall($categoryID);
$this->view->addUrl = $this->di->get('url')->get(array(
'for' => 'new_element',
'categoryID' => $categoryID
));
$elements = Elements::find([
"categoryID = :categoryID:",
"bind" => ["categoryID" => $categoryID],
"bindTypes" => ["categoryID" => Column::BIND_PARAM_INT],
"order" => "created desc"
]);
// ПАГИНАЦИЯ ???
$paginator = new Paginator(array(
"data" => $elements,
"limit" => 10,
"page" => $this->request->getQuery("page", "int") ?: 1
));
$this->view->page = $paginator->getPaginate();
$this->view->elements = $elements;
}
作者:muramoy
项目:kotor
/**
* ページングを実行する
* 指定がなければ最初(=1)のページ @param $page
* @param $count
* @param $list
* @return $this
*/
public function paging($list, $count, $page = 1)
{
$pagenator = new Paginator(['data' => $list, 'limit' => $count, 'page' => $page]);
$this->pagenate = $pagenator;
$this->page = $pagenator->getPaginate();
return $this;
}
作者:munozdanie
项目:sy
/**
* Searches for equipopozo
*/
public function searchAction($yacimientoId = null)
{
parent::importarJsTable();
$numberPage = 1;
if ($yacimientoId != null) {
$equipopozo = Equipopozo::find(array('equipoPozo_yacimientoId=:yacimiento_id:', 'bind' => array('yacimiento_id' => $yacimientoId)));
} else {
if ($this->request->isPost()) {
//$query = parent::fromInput($this->di, 'Equipopozo', $this->request->getPost());
$query = Criteria::fromInput($this->di, "Equipopozo", $_POST);
$this->persistent->parameters = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$parameters = $this->persistent->parameters;
if (!is_array($parameters)) {
$parameters = array();
}
$parameters["order"] = "equipoPozo_id";
$equipopozo = Equipopozo::find($parameters);
}
if (count($equipopozo) == 0) {
$this->flash->notice("No se encontraron resultados en la busqueda");
return $this->dispatcher->forward(array("controller" => "equipopozo", "action" => "index"));
}
$paginator = new Paginator(array("data" => $equipopozo, "limit" => 25, "page" => $numberPage));
$this->view->page = $paginator->getPaginate();
}
作者:alexz20
项目:goldenligh
public function indexAction()
{
$nowurl = $this->request->getURI();
$type_list = $this->_getBusTypeList();
$this->view->type_list = $type_list;
$this->view->url = $nowurl;
$project_type = '';
$project_grow_up = '';
$is_type_belongs = false;
$numberPage = 1;
if ($this->request->isGet()) {
$query = Criteria::fromInput($this->di, "DtbProduct", $_GET);
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$this->persistent->parameters = $query->getParams();
$parameters = $this->persistent->parameters;
if (!is_array($parameters)) {
$parameters = array();
}
$parameters["order"] = "product_id";
$dtb_product = DtbProduct::find($parameters);
if (count($dtb_product) == 0) {
$this->flash->notice("The search did not find any dtb_product");
}
$paginator = new Paginator(array("data" => $dtb_product, "limit" => $this->config->application->page_size, "page" => $numberPage));
$page = $paginator->getPaginate();
$page_split = $this->_split_page($page->current, $page->total_pages);
$this->view->page_split = $page_split;
//$this->view->disable();
$this->view->page = $page;
}