1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of cinecturlink2, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2009-2013 Jean-Christian Denis and contributors |
---|
7 | # contact@jcdenis.fr http://jcd.lv |
---|
8 | # |
---|
9 | # Licensed under the GPL version 2.0 license. |
---|
10 | # A copy of this license is available in LICENSE file or at |
---|
11 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
12 | # |
---|
13 | # -- END LICENSE BLOCK ------------------------------------ |
---|
14 | |
---|
15 | if (!defined('DC_CONTEXT_ADMIN')) { |
---|
16 | |
---|
17 | return null; |
---|
18 | } |
---|
19 | |
---|
20 | class adminlistCinecturlink2 extends adminGenericList |
---|
21 | { |
---|
22 | public function display($page, $nb_per_page, $url) |
---|
23 | { |
---|
24 | if ($this->rs->isEmpty()) { |
---|
25 | echo '<p><strong>'.__('There is no link').'</strong></p>'; |
---|
26 | } |
---|
27 | else { |
---|
28 | $pager = new pager($page, $this->rs_count, $nb_per_page,10); |
---|
29 | |
---|
30 | $pager->base_url = $url; |
---|
31 | |
---|
32 | $html_block = |
---|
33 | '<table class="clear">'. |
---|
34 | '<thead>'. |
---|
35 | '<tr>'. |
---|
36 | '<th class="nowrap" colspan="2">'.__('Title').'</th>'. |
---|
37 | '<th class="nowrap">'.__('Author').'</th>'. |
---|
38 | '<th class="maximal">'.__('Description').'</th>'. |
---|
39 | '<th class="maximal">'.__('Links').'</th>'. |
---|
40 | '<th class="nowrap">'.__('Category').'</th>'. |
---|
41 | '<th class="nowrap">'.__('My rating').'</th>'. |
---|
42 | '<th class="nowrap">'.__('Date').'</th>'. |
---|
43 | '</tr>'. |
---|
44 | '</thead>'. |
---|
45 | '<tbody>%s</tbody>'. |
---|
46 | '</table>'; |
---|
47 | |
---|
48 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
49 | $blocks = explode('%s',$html_block); |
---|
50 | echo $blocks[0]; |
---|
51 | |
---|
52 | $this->rs->index(((integer)$page - 1) * $nb_per_page); |
---|
53 | $iter = 0; |
---|
54 | while ($iter < $nb_per_page) { |
---|
55 | echo $this->linkLine($url,$iter); |
---|
56 | |
---|
57 | if ($this->rs->isEnd()) |
---|
58 | break; |
---|
59 | else |
---|
60 | $this->rs->moveNext(); |
---|
61 | |
---|
62 | $iter++; |
---|
63 | } |
---|
64 | echo $blocks[1]; |
---|
65 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | private function linkLine($url, $loop) |
---|
70 | { |
---|
71 | return |
---|
72 | '<tr class="line">'."\n". |
---|
73 | '<td class="nowrap">'. |
---|
74 | form::checkbox(array('links[]'), $this->rs->link_id, 0). |
---|
75 | '</td>'. |
---|
76 | '<td class="nowrap">'. |
---|
77 | '<a href="plugin.php?p=cinecturlink2&link_id='.$this->rs->link_id.'#newlink" title="'.__('Edit').'">'. |
---|
78 | html::escapeHTML($this->rs->link_title). |
---|
79 | '</a>'. |
---|
80 | "</td>\n". |
---|
81 | '<td class="nowrap">'. |
---|
82 | html::escapeHTML($this->rs->link_author). |
---|
83 | "</td>\n". |
---|
84 | '<td class="maximal">'. |
---|
85 | html::escapeHTML($this->rs->link_desc). |
---|
86 | "</td>\n". |
---|
87 | '<td class="nowrap">'. |
---|
88 | '<a href="'.$this->rs->link_url.'" title="'.html::escapeHTML($this->rs->link_url).'">'.__('URL').'</a> '. |
---|
89 | '<a href="'.$this->rs->link_img.'" title="'.html::escapeHTML($this->rs->link_img).'">'.__('image').'</a> '. |
---|
90 | "</td>\n". |
---|
91 | '<td class="nowrap">'. |
---|
92 | html::escapeHTML($this->rs->cat_title). |
---|
93 | "</td>\n". |
---|
94 | '<td class="nowrap">'. |
---|
95 | html::escapeHTML($this->rs->link_note).'/20'. |
---|
96 | "</td>\n". |
---|
97 | '<td class="nowrap">'. |
---|
98 | dt::dt2str($GLOBALS['core']->blog->settings->system->date_format.', '.$GLOBALS['core']->blog->settings->system->time_format,$this->rs->link_upddt,$GLOBALS['core']->auth->getInfo('user_tz')). |
---|
99 | "</td>\n". |
---|
100 | '</tr>'."\n"; |
---|
101 | } |
---|
102 | } |
---|