Exemplo n.º 1
0
 /**
  * @param PaginatorContract $paginator
  * @param UrlWindow $window
  */
 public function __construct(PaginatorContract $paginator, UrlWindow $window = null)
 {
     $this->paginator = $paginator;
     if ($this->hasPages()) {
         $this->window = is_null($window) ? UrlWindow::make($paginator) : $window->get();
     }
 }
Exemplo n.º 2
0
 public function index(request $req, $res)
 {
     $this->initRoute($req, $res);
     $model = ModelsFactory::getModelWithRequest($req);
     $this->data['items'] = $model->orderBy($this->pageOrderBy, $this->pageOrderType)->paginate($this->pagecount);
     $this->data['items']->setPath($this->router->pathFor($this->data['all_e_link']));
     $this->data['items']->pagenItems = UrlWindow::make($this->data['items']);
     $this->data['fields'] = $this->getFields($model->getColumnsNames(), array('id'));
     $userField = ModelsFactory::getModel('UserViewsSettings');
     $userField = $userField->where('user_id', Session::get('user')['id'])->where('group', $this->data['all_e_link'])->where('code', 'show_fields_in_table')->first();
     $this->data['showFields'] = array();
     if ($userField) {
         $this->data['showFields'] = (array) json_decode($userField->toArray()['value']);
         $this->data['fields'] = $this->data['showFields'];
     }
     $this->data['allFields'] = array_diff($model->getColumnsNames(), $this->data['showFields']);
     $this->render('admin\\dataTables.twig');
 }
Exemplo n.º 3
0
 /**
  * @param request $req
  * @param $res
  */
 public function index(request $req, $res)
 {
     $this->initRoute($req, $res);
     $model = ModelsFactory::getModelWithRequest($req);
     if (!$this->containerSlim->systemOptions->isHideFunctionality() || $this->containerSlim->systemOptions->isDevMode()) {
         $this->data['items'] = $model->paginate($this->pagecount);
     } elseif ($this->containerSlim->systemOptions->isHideFunctionality()) {
         $this->data['items'] = $model->where('frozen', '!=', 1)->orWhere('code', 'develop_mode')->paginate($this->pagecount);
     }
     $this->data['items']->setPath($this->router->pathFor($this->data['all_e_link']));
     $this->data['items']->pagenItems = UrlWindow::make($this->data['items']);
     $t = $model->getColumnsNames(['GroupName']);
     $this->data['fields'] = $this->getFields($t, ['id'], ['values', 'type', 'options_group_id', 'frozen']);
     $userField = ModelsFactory::getModel('UserViewsSettings');
     $userField = $userField->where('user_id', Session::get('user')['id'])->where('group', $this->data['all_e_link'])->where('code', 'show_fields_in_table')->first();
     $this->data['showFields'] = array();
     if ($userField) {
         $this->data['showFields'] = (array) json_decode($userField->toArray()['value']);
         $this->data['fields'] = $this->data['showFields'];
     }
     $this->data['allFields'] = array_diff($model->getColumnsNames(), $this->data['showFields']);
     $this->data['developMode'] = $this->containerSlim->systemOptions->isDevMode();
     $this->render('admin\\optionsTable.twig');
 }
 /**
  * Render the paginator using the given view.
  *
  * @param  string  $view
  * @return string
  */
 public function render($view = null)
 {
     $window = UrlWindow::make($this);
     $elements = [$window['first'], is_array($window['slider']) ? '...' : null, $window['slider'], is_array($window['last']) ? '...' : null, $window['last']];
     return new HtmlString(static::viewFactory()->make($view ?: static::$defaultView, ['paginator' => $this, 'elements' => array_filter($elements)])->render());
 }
 public function __construct(PaginatorContract $paginator, UrlWindow $window = null)
 {
     $this->paginator = $paginator;
     $side = config('view.paginator.side', 3);
     $this->window = is_null($window) ? UrlWindow::make($paginator, $side) : $window->get($side);
 }
 /**
  * Create a new Bootstrap presenter instance.
  *
  * @param PaginatorContract $paginator paginator
  * @param UrlWindow|null    $window    url window
  * @param int               $pageCount page link count
  */
 public function __construct(PaginatorContract $paginator, UrlWindow $window = null, $pageCount = 3)
 {
     $this->paginator = $paginator;
     $this->window = is_null($window) ? UrlWindow::make($paginator, $pageCount) : $window->get();
 }
Exemplo n.º 7
0
 /**
  * @param \Illuminate\Pagination\LengthAwarePaginator $data
  * @return array
  */
 public function getPaginationToArray($data)
 {
     $list = [];
     if ($data->lastPage() > 1) {
         $window = \Illuminate\Pagination\UrlWindow::make($data);
         $elements = [$window['first'], is_array($window['slider']) ? '...' : null, $window['slider'], is_array($window['last']) ? '...' : null, $window['last']];
         if ($url = $data->previousPageUrl() ?: '') {
             $list[] = $this->getItemForPagination('', '«', $url, 'prev', $data->currentPage() - 1);
         }
         foreach ($elements as $item) {
             if (is_string($item)) {
                 $list[] = $this->getItemForPagination('disabled', $item);
             }
             if (is_array($item)) {
                 foreach ($item as $page => $url) {
                     if ($page == $data->currentPage()) {
                         $list[] = $this->getItemForPagination('active', $page);
                     } else {
                         $list[] = $this->getItemForPagination('', '', $url, '', $page);
                     }
                 }
             }
         }
         if ($data->hasMorePages()) {
             $list[] = $this->getItemForPagination('', '»', $data->nextPageUrl(), 'next', $data->currentPage() + 1);
         }
     }
     return $list;
 }
 /**
  * @param int $onEachSide
  * @return array
  */
 protected function getFullSlider($onEachSide)
 {
     return $this->append(parent::getFullSlider($onEachSide));
 }