cinecturlink2/inc/lib.cinecturlink2.list.php

101 lines
3.3 KiB
PHP
Raw Normal View History

2021-09-07 12:33:18 +00:00
<?php
2021-09-07 13:21:38 +00:00
/**
* @brief cinecturlink2, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-09-07 12:33:18 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-09-07 13:21:38 +00:00
return null;
2021-09-07 12:33:18 +00:00
}
class adminlistCinecturlink2 extends adminGenericList
{
2021-09-07 13:21:38 +00:00
public function display($page, $nb_per_page, $url)
{
if ($this->rs->isEmpty()) {
echo '<p><strong>'.__('There is no link').'</strong></p>';
}
else {
$pager = new pager($page, $this->rs_count, $nb_per_page,10);
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
$pager->base_url = $url;
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
$html_block =
'<table class="clear">'.
'<thead>'.
'<tr>'.
'<th class="nowrap" colspan="2">'.__('Title').'</th>'.
'<th class="nowrap">'.__('Author').'</th>'.
'<th class="maximal">'.__('Description').'</th>'.
'<th class="maximal">'.__('Links').'</th>'.
'<th class="nowrap">'.__('Category').'</th>'.
'<th class="nowrap">'.__('My rating').'</th>'.
'<th class="nowrap">'.__('Date').'</th>'.
'</tr>'.
'</thead>'.
'<tbody>%s</tbody>'.
'</table>';
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>';
$blocks = explode('%s',$html_block);
echo $blocks[0];
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
$this->rs->index(((integer)$page - 1) * $nb_per_page);
$iter = 0;
while ($iter < $nb_per_page) {
echo $this->linkLine($url,$iter);
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
if ($this->rs->isEnd())
break;
else
$this->rs->moveNext();
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
$iter++;
}
echo $blocks[1];
echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>';
}
}
2021-09-07 12:33:18 +00:00
2021-09-07 13:21:38 +00:00
private function linkLine($url, $loop)
{
return
'<tr class="line">'."\n".
'<td class="nowrap">'.
form::checkbox(array('links[]'), $this->rs->link_id, 0).
'</td>'.
'<td class="nowrap">'.
'<a href="plugin.php?p=cinecturlink2&amp;link_id='.$this->rs->link_id.'#newlink" title="'.__('Edit').'">'.
html::escapeHTML($this->rs->link_title).
'</a>'.
"</td>\n".
'<td class="nowrap">'.
html::escapeHTML($this->rs->link_author).
"</td>\n".
'<td class="maximal">'.
html::escapeHTML($this->rs->link_desc).
"</td>\n".
'<td class="nowrap">'.
'<a href="'.$this->rs->link_url.'" title="'.html::escapeHTML($this->rs->link_url).'">'.__('URL').'</a> '.
'<a href="'.$this->rs->link_img.'" title="'.html::escapeHTML($this->rs->link_img).'">'.__('image').'</a> '.
"</td>\n".
'<td class="nowrap">'.
html::escapeHTML($this->rs->cat_title).
"</td>\n".
'<td class="nowrap">'.
html::escapeHTML($this->rs->link_note).'/20'.
"</td>\n".
'<td class="nowrap">'.
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')).
"</td>\n".
'</tr>'."\n";
}
}