Example #1
0
 function index()
 {
     $this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
     $customer_id = \Yoda\Request::getInt('customer_id');
     $did_number = \Yoda\Request::getString('did_number');
     $from_date = \Yoda\Request::getString('from_date');
     $to_date = \Yoda\Request::getString('to_date');
     $order = \Yoda\Request::getString('order', 'duration');
     $direction = \Yoda\Request::getString('direction', 'ASC');
     $pagination = new Pagination();
     $pagination->setLimit(10);
     $pagination->setPage(\Yoda\Request::getInt('page', 1));
     $pagination->setLink('index.php?controller=call_history&did_number=' . $did_number . '&customer_id=' . $customer_id . '&from_date=' . $from_date . '&to_date=' . $to_date);
     $cdr = new Didww\API2\CDRCollection();
     $cdr->setCustomerId($customer_id);
     $cdr->setDidNumber($did_number);
     $cdr->setFromDate($from_date);
     $cdr->setToDate($to_date);
     $cdr->setOrderBy($order);
     $cdr->setOrderDir(strtoupper($direction));
     $cdr->setLimit($pagination->getLimit());
     $cdr->setOffset($pagination->getOffset());
     $cdrs = $cdr->getList();
     $total = $cdr->getTotal();
     $pagination->setTotal($total);
     $this->getView()->setProperties(['view' => $this->getView(), 'cdrs' => $cdrs, 'customer_id' => $customer_id, 'did_number' => $did_number, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
 }
Example #2
0
 private function listPublicGroups($offset)
 {
     $sql = "SELECT * FROM groups WHERE active=1 AND type <> 'private' ";
     require_once FRAMEWORK_PATH . 'lib/pagination/pagination.class.php';
     $pagination = new Pagination($this->registry);
     $pagination->setQuery($sql);
     $pagination->setOffset($offset);
     $pagination->setLimit(20);
     $pagination->setMethod('cache');
     $pagination->generatePagination();
     if ($pagination->getNumRowsPage() == 0) {
         $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/no-public.tpl.php', 'footer.tpl.php');
     } else {
         $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/public.tpl.php', 'footer.tpl.php');
         $this->registry->getObject('template')->getPage()->addTag('groups', array('SQL', $pagination->getCache()));
         $this->registry->getObject('template')->getPage()->addTag('page_number', $pagination->getCurrentPage());
         $this->registry->getObject('template')->getPage()->addTag('num_pages', $pagination->getNumPages());
         if ($pagination->isFirst()) {
             $this->registry->getObject('template')->getPage()->addTag('first', '');
             $this->registry->getObject('template')->getPage()->addTag('previous', '');
         } else {
             $this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/'>First page</a>");
             $this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getCurrentPage() - 2) . "'>Previous page</a>");
         }
         if ($pagination->isLast()) {
             $this->registry->getObject('template')->getPage()->addTag('next', '');
             $this->registry->getObject('template')->getPage()->addTag('last', '');
         } else {
             $this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/" . $pagination->getCurrentPage() . "'>Next page</a>");
             $this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getNumPages() - 1) . "'>Last page</a>");
         }
     }
 }
Example #3
0
 public function getMany()
 {
     $req = $this->bcms->request();
     $items = \ORM::for_table($this->tableName);
     if ($req->get('group')) {
         $group = $req->get('group');
         $items = $items->where_in('group', $group);
         $this->bcms->view()->appendData(array('currentGroup' => $group));
     }
     // Search
     $query = $req->get('query');
     if ($query) {
         $items = $items->where_like('email', "%{$query}%");
         $this->bcms->view()->appendData(array('query' => $query));
     }
     // Ordering
     if ($req->get('order_by')) {
         $orderBy = $req->get('order_by');
         $items = $items->order_by_asc($orderBy);
         $this->bcms->view()->appendData(array('order_by' => $orderBy));
     } else {
         $items = $items->order_by_desc('date_created');
     }
     $items = $items->left_outer_join('b_users_profiles', array($this->tableName . '.id', '=', 'b_users_profiles.user_id'));
     //Pagination
     $pagination = new Pagination($this->bcms);
     $pagination->setLimit($this->perPage);
     $pagination->setCount($items->count());
     $items = $items->limit($this->perPage)->offset($pagination->start);
     $items = $items->find_array();
     if (!$items) {
         return false;
     }
     return $items;
 }
Example #4
0
File: sms.php Project: didww/demo
 function index()
 {
     $this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
     $customer_id = \Yoda\Request::getInt('customer_id');
     $destination = \Yoda\Request::getString('destination');
     $source = \Yoda\Request::getString('source');
     $success = \Yoda\Request::getString('success', '');
     $from_date = \Yoda\Request::getString('from_date');
     $to_date = \Yoda\Request::getString('to_date');
     $order = \Yoda\Request::getString('order', 'destination');
     $direction = \Yoda\Request::getString('direction', 'ASC');
     $pagination = new Pagination();
     $pagination->setLimit(10);
     $pagination->setPage(\Yoda\Request::getInt('page', 1));
     $pagination->setLink('index.php?controller=sms&customer_id=' . $customer_id . '&destination=' . $destination . '&source=' . $source . '&success=' . $success . '&from_date=' . $from_date . '&to_date=' . $to_date);
     $sms = new Didww\API2\SMSCollection();
     $sms->setCustomerId($customer_id);
     $sms->setDestination($destination);
     $sms->setSource($source);
     if ($success !== '') {
         $sms->setSuccess($success);
     }
     $sms->setFromDate($from_date);
     $sms->setToDate($to_date);
     $sms->setOrderBy($order);
     $sms->setOrderDir(strtoupper($direction));
     $sms->setLimit($pagination->getLimit());
     $sms->setOffset($pagination->getOffset());
     $sms_log = $sms->getList();
     $total = $sms->getTotal();
     $pagination->setTotal($total);
     $this->getView()->setProperties(['view' => $this->getView(), 'sms_log' => $sms_log, 'customer_id' => $customer_id, 'destination' => $destination, 'source' => $source, 'success' => $success, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
 }
Example #5
0
 /**
  * Search for members based on their name
  * @param String $filter name
  * @param int $offset the offset
  * @return Object pagination object
  */
 public function filterMembersByName($filter = '', $offset = 0)
 {
     $filter = $this->registry->getObject('db')->sanitizeData(urldecode($filter));
     require_once FRAMEWORK_PATH . 'lib/pagination/pagination.class.php';
     $paginatedMembers = new Pagination($this->registry);
     $paginatedMembers->setLimit(25);
     $paginatedMembers->setOffset($offset);
     $query = "SELECT u.ID, u.username, p.name, p.dino_name, p.dino_gender, p.dino_breed FROM users u, profile p WHERE p.user_id=u.ID AND u.active=1 AND u.banned=0 AND u.deleted=0 AND p.name LIKE'%" . $filter . "%' ORDER BY p.name ASC";
     $paginatedMembers->setQuery($query);
     $paginatedMembers->setMethod('cache');
     $paginatedMembers->generatePagination();
     return $paginatedMembers;
 }
Example #6
0
<?php

include 'admin_header.php';
$view = new View();
$user = new User();
$pagination = new Pagination();
// get the actual pagenumber (for pagination)
if (isset($_GET['page'])) {
    $page = intval($_GET['page']);
} else {
    $page = 1;
}
// config pagination class
$pagination->setTable('users');
$pagination->setPageLink('users.php');
$pagination->setLimit(10);
$pagination->setPage($page);
$pagination->setTotal();
$pagination->setPages();
$pagination->setOffset();
// get the users data as array (for view)
$users = $pagination->getData();
?>

<!-- content wrapper -->
<div class="container-full">

	<!-- page row -->
	<div class="row"> 

		<!-- sidebar -->
Example #7
0
			
			<!-- content wrapper -->
			<div class="row-fluid">
				<?php 
//$view->showProducts($category);
if (isset($_GET['page'])) {
    $page = intval($_GET['page']);
} else {
    $page = 1;
}
$pagination = new Pagination();
$pagination->setTable('products');
if ($category != null) {
    $pagination->setCategory($category);
}
$pagination->setLimit($config->shop_articlepp);
$pagination->setPage($page);
//$pagination->setCategory('books');
$pagination->setTotal();
$pagination->setPages();
$pagination->setOffset();
$products = $pagination->getData();
$view->showProducts($products);
?>
			</div> <!-- /.content wrapper -->


			<!-- pagination -->
			<div class="row text-center">

				<div class="col-lg-12">
Example #8
0
<?php

include "./pagination.php";
$iLimit = 10;
$iPage = isset($_GET['page']) ? $_GET['page'] : 1;
$iStart = $iLimit * $iPage - $iLimit;
$oPaginate = new Pagination();
$aNames = $oPaginate->getNames($iStart, $iLimit);
$oPaginate->setCount($aNames['count']);
$oPaginate->setRange(3);
$oPaginate->setLimit($iLimit);
$oPaginate->setCurrentPage($iPage);
if ($aNames['count'] > 0) {
    foreach ($aNames['names'] as $r) {
        echo $r['name'] . '<br>';
    }
}
echo $oPaginate->create();