/** * Returns an associative array of two links for any agenda-like view of the * calendar: * previous page (if previous events exist), * next page (if next events exist). * Each element is an associative array containing the link's enabled status * ['enabled'], CSS class ['class'], text ['text'] and value to assign to * link's href ['href']. * * @param array $args Current request arguments * * @param bool $prev Whether there are more events before * the current page * @param bool $next Whether there are more events after * the current page * @param Ai1ec_Date_Time|null $date_first * @param Ai1ec_Date_Time|null $date_last * @param string $title Title to display in datepicker button * @param string $title_short Short month names. * @param int|null $default_time_limit The default time limit in the case of pagination ends. * @return array Array of links */ protected function _get_agenda_like_pagination_links($args, $prev = false, $next = false, $date_first = null, $date_last = null, $title = '', $title_short = '', $default_time_limit = 0) { $links = array(); if ($this->_registry->get('model.settings')->get('ai1ec_use_frontend_rendering')) { $args['request_format'] = 'json'; } $args['page_offset'] = -1; if (null === $date_first || $date_first->is_empty()) { $args['time_limit'] = $default_time_limit; } else { $args['time_limit'] = $this->_registry->get('date.time', $date_first)->set_time($date_first->format('H'), $date_first->format('i'), $date_first->format('s') - 1)->format_to_gmt(); } $href = $this->_registry->get('html.element.href', $args); $links[] = array('class' => 'ai1ec-prev-page', 'text' => '<i class="ai1ec-fa ai1ec-fa-chevron-left"></i>', 'href' => $href->generate_href(), 'enabled' => $prev); // Minical datepicker. $factory = $this->_registry->get('factory.html'); $links[] = $factory->create_datepicker_link($args, $date_first->format_to_gmt(), $title, $title_short); $args['page_offset'] = 1; if (null === $date_last || $date_last->is_empty()) { $args['time_limit'] = $default_time_limit; } else { $args['time_limit'] = $this->_registry->get('date.time', $date_last)->set_time($date_last->format('H'), $date_last->format('i'), $date_last->format('s') + 1)->format_to_gmt(); } $href = $this->_registry->get('html.element.href', $args); $links[] = array('class' => 'ai1ec-next-page', 'text' => '<i class="ai1ec-fa ai1ec-fa-chevron-right"></i>', 'href' => $href->generate_href(), 'enabled' => $next); return $links; }