예제 #1
0
 /**
  * Returns the HTML to display pagination links.
  *
  * @param string $baseUrl The URL template for links with a page number.
  * @param int $total The total number of items across all pages.
  * @param int $currentPage The current page to be displayed.
  * @param int $perPage The total tweets per page.
  * @param bool $niceUrl
  * @return string The pagination links HTML.
  */
 public function paginate($baseUrl, $total, $currentPage = 1, $perPage = 100, $niceUrl = true)
 {
     if ($total == 0) {
         return '';
     }
     $data = ['totalItems' => $total, 'itemsPerPage' => $perPage, 'totalPages' => ceil($total / $perPage), 'currentPage' => $currentPage, 'pageMarker' => $niceUrl ? 'page/' : '&page=', 'baseUrl' => $baseUrl];
     return $this->view->render('components/pagination.php', $data, false);
 }
예제 #2
0
 public function notFound()
 {
     if (!headers_sent()) {
         header('HTTP/1.0 404 Not Found');
     }
     $this->data['pageType'] = 'not-found';
     $this->data['content'] = '<h1>' . $this->i18n->trans('page_not_found', ['ucf']) . '</h1>';
     $this->view->render('_layout.php', $this->data, true);
 }
예제 #3
0
 /**
  * @param \Darathor\Amt\View $view
  * @return string
  * @throws \Exception
  */
 public function renderHtmlFragment(\Darathor\Amt\View $view)
 {
     return $view->render('components/entity-link.php', ['entity' => $this], false);
 }
예제 #4
0
 /**
  * @param \Darathor\Amt\View $view
  * @param string $mode item|single|quote
  * @return string
  * @throws \Exception
  */
 public function renderHtmlFragment(\Darathor\Amt\View $view, $mode = 'item')
 {
     return $view->render('components/tweet.php', ['tweet' => $this, 'mode' => $mode], false);
 }
예제 #5
0
 /**
  * @param \Darathor\Amt\View $view
  * @return string
  * @throws \Exception
  */
 public function renderHtmlFragment(\Darathor\Amt\View $view)
 {
     return $view->render('components/avatar.php', ['avatar' => $this], false);
 }