Dotclear

source: plugins/cinecturlink2/inc/lib.cinecturlink2.list.php @ 2314

Revision 2314, 3.1 KB checked in by JcDenis, 13 years ago (diff)

cinecturlink2 0.6

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

Sites map