Ejemplo n.º 1
0
 /**
  * Returns the list as a string
  * @param array $data
  * @return string
  */
 public function get($sql, mysql_connection $db = null)
 {
     if (!isset($db)) {
         if (function_exists('db')) {
             $db = db();
         } else {
             throw new Exception('No Database given.');
         }
     }
     $pagination = new data_pagination($this->link, $this->pagesize, $this->prefix);
     $res = $pagination->query($sql);
     $pagination = $pagination->get();
     $content = $pagination . $this . $this->header() . '<tbody>';
     foreach ($res as $row) {
         $content .= $this->row($row);
     }
     return $content . '</tbody></table>' . $pagination;
 }
Ejemplo n.º 2
0
 /**
  * Returns the list as a string
  * @param array $data
  * @return string
  */
 public function get($data)
 {
     $this->total = count($data);
     $pagination = data_pagination::pagination($this->link, $this->total, $this->page, $this->pagesize, $this->prefix);
     $content = $pagination . $this . $this->header() . '<tbody>';
     $from = $this->page * $this->pagesize;
     $to = min($from + $this->pagesize, $this->total);
     for ($i = $from; $i < $to; $i++) {
         $content .= $this->row($data[$i]);
     }
     return $content . '</tbody></table>' . $pagination;
 }
Ejemplo n.º 3
0
 public function showThread(forum_thread $thread)
 {
     /** @var rights_container $rights */
     $rights = iv::get('rights');
     $user = iv::get('user');
     $board = $thread->loadBoard();
     $flags = $rights->flags('forum', $board->id);
     if (!$board->public_read && !$rights->has('forum', $board->id)) {
         throw new Exception('Sie haben keinen Zugriff auf dieses Forum!');
     }
     $thread->markRead();
     $pagination = new data_pagination(new html_link(PAGE_SELF . '&thread=' . $thread->id), 25, 'thread_');
     $this->context['postings'] = $pagination->query("SELECT p.*, u.name as user_name, u.id as user_id, u.email as user_email\n\t\t\tFROM forum_post p LEFT JOIN user_data u ON u.id = p.create_by\n\t\t\tWHERE p.thread = %d ORDER BY id", $thread->id)->assocs();
     $this->context['author'] = db()->user_data->row($thread->create_by)->assoc();
     $this->context['breadcrumb'] = $board->breadcrumb();
     $this->context['thread'] = $thread;
     $this->context['reply'] = $user && (!$thread->closed || $flags['moderate']) && ($board->public_reply || $flags['reply']);
     $this->context['moderate'] = $flags['moderate'];
     $this->context['user'] = $user;
     $this->context['pagination'] = $pagination->get();
     template('forum/thread')->display($this->context);
 }
Ejemplo n.º 4
0
<?php

echo data_pagination::pagination(new html_link(MODUL_SELF), 850, $_GET['page']);