0000372 房間加上排序功能

This commit is contained in:
Wayne Hsu 2023-05-17 00:39:00 +08:00
parent 46982a26dc
commit 75a19e7638
4 changed files with 14 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
/images/
/temp/*
data/config.php
.vscode/

View File

@ -266,12 +266,12 @@ elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update')
@unlink('../' . $row['image1']);
}
}
$original_img = $image->upload_image($_FILES['image1']); // 原始图片
if ($original_img === false)
{
sys_msg($image->error_msg(), 1, array(), false);
}
$image1 = $original_img; // 商品图片
$original_img = $image->upload_image($_FILES['image1']); // 原始图片
if ($original_img === false)
{
sys_msg($image->error_msg(), 1, array(), false);
}
$image1 = $original_img; // 商品图片
}
@ -664,12 +664,11 @@ elseif ($_REQUEST['act'] == 'toggle_enable')
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'edit_sort_order')
{
check_authz_json('room_manage');
// check_authz_json('room_manage');
$room_id = intval($_POST['id']);
$sort_order = intval($_POST['val']);
if ($exc->edit("sort_order = '$sort_order', last_update=" .gmtime(), $room_id))
if ($exc->edit("sort_order = '$sort_order', ustamp=" .time(), $room_id))
{
clear_cache_files();
make_json_result($sort_order);
@ -1594,8 +1593,8 @@ function room_list($id)
{
$filter['keyword'] = json_str_iconv($filter['keyword']);
}
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'sort_order' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']);
/* 关键字 */
if (!empty($filter['keyword']))

View File

@ -18,7 +18,7 @@
</th>
<th><a href="javascript:listTable.sort('cname'); ">名稱</a>{$sort_cname}</th>
<th><a href="javascript:listTable.sort('is_on_sale'); ">是否上架</a>{$sort_is_on_sale}</th>
<!-- <th><a href="javascript:listTable.sort('sort_order'); ">{$lang.sort_order}</a>{$sort_sort_order}</th>-->
<th><a href="javascript:listTable.sort('sort_order'); ">{$lang.sort_order}</a>{$sort_sort_order}</th>
<th>{$lang.handler}</th>
<tr>
{foreach from=$room_list item=room}
@ -26,7 +26,7 @@
<td>&nbsp;{$room.id}</td>
<td class="first-cell">{$room.name|escape:html}</td>
<td align="center"><img src="images/{if $room.enable}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_enable', {$room.id})" /></td>
<!-- <td align="center"><span onclick="listTable.edit(this, 'edit_sort_order', {$room.id})">{$room.sort_order}</span></td>-->
<td align="center"><span onclick="listTable.edit(this, 'edit_sort_order', {$room.id})">{$room.sort_order}</span></td>
<td align="center">
<a href="room.php?act=edit&id={$room.id}" title="{$lang.edit}"><img src="images/icon_edit.gif" width="21" height="21" border="0" /></a>
<a href="javascript:;" onclick="listTable.remove({$room.id}, '確認刪除')" title="刪除"><img src="images/icon_trash.gif" width="21" height="21" border="0" /></a>

View File

@ -23,7 +23,7 @@ if ($_REQUEST['act'] == 'list')
// assign_dynamic('room');
$sql = 'SELECT * ' .
' FROM ' . $GLOBALS['ecs']->table('hs_room') .
' WHERE enable=1 and hs_id= '.$site_id;
' WHERE enable=1 and hs_id= '.$site_id.' order by sort_order asc';
$rooms = $GLOBALS['db']->getAll($sql);
$site_name=$GLOBALS['db']->getOne("SELECT cname FROM ".$GLOBALS['ecs']->table('hs_web')." WHERE hs_id=".$site_id);