add paginator and edit click on ID

This commit is contained in:
arlemp@selectel.ru
2024-02-05 21:39:09 +03:00
parent ceaca3ca54
commit a56bcd7864
5 changed files with 128 additions and 41 deletions

View File

@@ -129,7 +129,11 @@ function unlock_id($table, $id, $user){
function fileimg($img, $id, $folder){
function fileimg($img, $id, $folder = ''){
if ($img == ''){
return '';
}
if (in_array($img, array('jpg', 'jpeg', 'gif', 'png', 'JPG'))) {
$fileimg = $folder . '/' . $id . '.' . $img;
@@ -1001,6 +1005,7 @@ $order = (isset($_GET['order'])) ? strip_tags(trim($_GET['order'])) : '';
$component[$maxi]['column'] = (string)$item[$it]->column;
if (isset($item[$it]->link)) $component[$maxi]['link'] = (string)$item[$it]->link;
if (isset($item[$it]->folder)) $component[$maxi]['folder'] = (string)$item[$it]->folder;
if (isset($item[$it]->preview)) $component[$maxi]['preview'] = (string)$item[$it]->preview;
if (isset($item[$it]->folder)) $component[$maxi]['width'] = (string)$item[$it]->width;
if (isset($item[$it]->fieldate))
$component[$maxi]['fieldate'] = (string)$item[$it]->fieldate;
@@ -1215,12 +1220,10 @@ $order = (isset($_GET['order'])) ? strip_tags(trim($_GET['order'])) : '';
break;
case 'increment':
if ($inc_show) {
echo('<TD>');
echo (AnonsText($selectrow[$a], 30, 0));
echo('</td>');
}
break;
if ($inc_show):?>
<td class="id-click"><div onClick="StartLink('<?=$admin?>', 'edit', 'forms', 'increment', '<?=$increment_value?>');"><?=AnonsText($selectrow[$a], 30, 0)?></div></td>
<?endif;
break;
case 'spin':
echo('<TD>');
if ($selectrow[$a] != 0)
@@ -1231,15 +1234,27 @@ $order = (isset($_GET['order'])) ? strip_tags(trim($_GET['order'])) : '';
echo '<TD>';
$wwwname = SITE.fileimg($selectrow[$a], $increment_value, $component[$a]['folder']);
$fileimg = fileimg($selectrow[$a], $increment_value);
$fwidth = 100;
if ($component[$a]['width'])
$fwidth = $component[$a]['width'];
else
$fwidth = 100;
$nocacheprefix = date('Y_m_d_h_i_s');
echo'<a href="'.$wwwname.'" target="_blank"><img src ="'.$wwwname.'" width="'.$fwidth.'"></a>';
if ($fileimg !== ''){
if (isset($component[$a]['preview'])){
$wwwname = (string)$component[$a]['preview'].$fileimg;
} else {
$wwwname = SITE.$component[$a]['folder'].$fileimg;
}
//$wwwname = SITE.$fileimg;
$fwidth = 100;
if ($component[$a]['width'])
$fwidth = $component[$a]['width'];
else
$fwidth = 100;
$nocacheprefix = date('Y_m_d_h_i_s');
echo'<a href="'.$wwwname.'" target="_blank"><img src ="'.$wwwname.'" width="'.$fwidth.'" loading="lazy"></a>';
}
echo '</TD>';
@@ -1316,15 +1331,27 @@ $order = (isset($_GET['order'])) ? strip_tags(trim($_GET['order'])) : '';
echo('</TBODY></TABLE></div>');
if ($action != 'select' && $action != 'selecttable') {
if ($total_rows > $per_page) { //рисуем странички
echo('</div><br /><div id = "page"><b>Странички: </b>
<SELECT NAME = "pages" id="pages" onChange="'.js_func('select_page_link', array('select_id'=>'pages', 'admin'=>$admin)).'">');
echo('</div><br /><div id = "page"><b>Странички: </b>');?>
<?if ($page > 1):?>
<span class="pagenav page1" onClick="StartLink( '<?=$admin?>', 'selectpage', 'main', 'page', 1);"><<</span>
<span style="margin-left: 4px; margin-right: 4px;" class="pagenav page-prev" onClick="StartLink( '<?=$admin?>', 'selectpage', 'main', 'page', <?=$page-1?>);"><</span>
<?endif?>
<?echo('<SELECT NAME = "pages" id="pages" onChange="'.js_func('select_page_link', array('select_id'=>'pages', 'admin'=>$admin)).'">');
for($i = 1; $i <= $num_pages; $i++) {
$selected = ($i == $page) ? 'selected' : '';
echo('<option value = "'.$i.'" '.$selected.' accesskey="'.$i.'"> '.$i.'</option>');
}
echo('</SELECT> из <b>'.$num_pages.'</b>');
$olimits = array('5', '10', '15', '20', '25', '30');
echo('</SELECT> из <b>'.$num_pages.'</b>');?>
<?if ($num_pages > $page):?>
<span class="pagenav page-next" onClick="StartLink( '<?=$admin?>', 'selectpage', 'main', 'page', <?=$page+1?>);">></span>
<span class="pagenav pageend" onClick="StartLink( '<?=$admin?>', 'selectpage', 'main', 'page', <?=$num_pages?>);">>></span>
<?endif?>
<?$olimits = array('5', '10', '15', '20', '25', '30');
/*echo('&nbsp;&nbsp;&nbsp;&nbsp;<b>Элементы:</b>&nbsp;<select id = "limit">');
for ($it = 0; $it < sizeof($olimits) ;$it++) {
$selected = ($olimits[$it] == $per_page) ? 'selected' : '';