?? featured.php
字號:
<?php
/*
[SOOBIC!] admin/featured.php
Version: 1.5
Author: Soolan (soolan@qq.com)
Copyright: soolan (www.soobic.com)
Last Modified: 2005/4/2 10:00
*/
if(!defined('IN_SOOBIC')) {
exit('Access Denied');
}
cpheader();
include ("admin/languages/".$language."/featured.php");
if ($action) {
switch($action){
case 'setflag':
if ($flag == '1') {
$db->query("update $table_featured set status = '1', expires_date = NULL, date_status_change = NULL where featured_id = '" . $id . "'");
} elseif ($flag == '0') {
$db->query("update $table_featured set status = '0', date_status_change = now() where featured_id = '" . $id . "'");
}
cpmsg("Soobic! 操作成功。",tep_href_link('admincp.php', 'act=featured&page='.$page));
break;
case 'new':
$expires_date = '';
if (isset($day) && isset($month) && isset($year)) {
$expires_date = $year;
$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
}
$db->query("insert into $table_featured (products_id, featured_date_added, expires_date, status) values ('" . $products_id. "', now(), '" . $expires_date . "', '1')");
cpmsg("Soobic! 推薦商品添加成功。",tep_href_link('admincp.php', 'act=featured&page='.$page));
case 'edit':
if (isset($day) && isset($month) && isset($year)) {
$expires_date = $year;
$expires_date .= (strlen($month) == 1) ? '0' . $month : $month;
$expires_date .= (strlen($day) == 1) ? '0' . $day : $day;
}
$db->query("update $table_featured set featured_last_modified = now(), expires_date = '" . $expires_date . "' where featured_id = '$fID'");
cpmsg("Soobic! 推薦商品成功編輯成功",tep_href_link('admincp.php', 'act=featured&page=' . $page. '&fID=' . $fID));
break;
case 'delete':
$db->query("delete from $table_featured where featured_id = '".(int)$fID."'");
cpmsg("Lansen!推薦商品成功刪除。",tep_href_link('admincp.php', 'act=featured&page='.$page));
break;
default:
}
}elseif($type){
switch($type){
case 'delete':
cpmsg("本操作不可恢復,您確定要刪除該推薦商品?", tep_href_link('admincp.php', 'act=featured&page='.$page.'&fID='.$fID.'&action=delete', 'NONSSL'), "form");
break;
case 'new':
case 'edit':
?>
<script language="javascript" src="includes/general.js"></script>
<link rel="stylesheet" type="text/css" href="includes/javascript/calendar.css">
<script language="JavaScript" src="includes/javascript/calendarcode.js"></script>
<div id="popupcalendar" class="text"></div>
<?
$form_action = $type == 'edit' ? 'edit': 'new';
if ( ($type == 'edit') && isset($fID) ) {
$query = $db->query("select p.products_id, p.products_price,pd.products_name, f.expires_date from $table_products p, $table_products_description pd, $table_featured f where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = f.products_id and f.featured_id = '$fID' order by pd.products_name");
@extract($db->fetch_array($query));
}else {
$featured_array = array();
$featured_query = $db->query("select p.products_id from $table_products p, $table_featured f where f.products_id = p.products_id");
while ($featured = $db->fetch_array($featured_query)){
$featured_array[] = $featured['products_id'];
}
$query = $db->query("select p.products_id, pd.products_name, p.products_price from $table_products p, $table_products_description pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_name");
$select_string= '<select name="products_id">';
while ($products = $db->fetch_array($query)) {
if (!in_array($products['products_id'], $featured_array)) {
$select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . '(' . $currencies->format($products['products_price']) . ')</option>';
}
}
}
$select_string.= '</select>';
?>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
<tr class="header"><td><?=SPECIALS_NOTICE?></td></tr>
<tr bgcolor="<?=ALTBG1?>"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td><?=TEXT_FEATURED_DATE_TIP?></td>
<td align="right" class="smallText"><input type="button" value="返 回" onClick="history.go(-1);"> </td>
</tr></table></td></tr></table></td></tr></table>
<br>
<form name="new_special" <?php echo 'action="' . tep_href_link('admincp.php', 'act=featured&fID='.$fID.'&action='.$form_action, 'NONSSL') . '"'; ?> method="post">
<input type="hidden" name="specials_id" value="<?=$fID?>">
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
<tr class="header"><td colspan="7"><?=HEADING_TITLE;?></td></tr>
<tr align="center" bgcolor="<?=ALTBG2?>"><td align="right">商品</td>
<td bgcolor="<?=ALTBG2?>" align="left"><?php echo (isset($products_name)) ? $products_name . ' (' . $currencies->format($products_price) . ')' : $select_string ; echo tep_draw_hidden_field('products_price', (isset($products_price) ? $products_price : '')); ?></td>
</tr>
<tr align="center" bgcolor="<?=ALTBG2?>"><td align="right">截止日期:</td>
<td bgcolor="<?=ALTBG2?>" align="left"><?php echo tep_draw_input_field('day', (isset($expires_date) ? substr($expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($expires_date) ? substr($expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($expires_date) ? substr($expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="javascript:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_special','dteWhen','BTN_date');return false;"><img src="images/common/cal_date_up.gif" border="0" act="Calendar" align="absmiddle" name="BTN_date"></a></td>
</tr>
</table></td></tr></table>
<br><center><?=$warning?>
<input type="submit" name="submit" value="提 交"> <input type="button" value="返 回" onClick="history.go(-1);">
</center></form><br><br>
<?
break;
default:
}
}else{
if($page) {
$start_limit = ($page - 1) * MAX_DISPLAY_SEARCH_RESULTS ;
} else {
$start_limit = 0;
$page = 1;
}
$query = $db->query("SELECT COUNT(*) from $table_products p, $table_featured s, $table_products_description pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name");
$multipage = multi($db->result($query, 0), MAX_DISPLAY_SEARCH_RESULTS, $page, "admincp.php?act=specials&order=$order".($desc ? "&desc=$desc" : NULL));
?>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
<tr class="header"><td>特別提示</td></tr>
<tr bgcolor="<?=ALTBG1?>"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td><li>點擊右邊按鈕添加新特色商品</td>
<td align="right" class="smallText"><input type="button" value="我要添加" onClick="javascrt:location='<?=tep_href_link('admincp.php', 'act=featured&page=' . $page . '&type=new')?>'"> </td>
</tr></table></td></tr></table></td></tr></table>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center" style="word-break:break-all;">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%" style="word-break:break-all;">
</tr><td bgcolor="<?=ALTBG1?>" colspan="2">
<?=$multipage?></td></tr>
</table></td></tr></table>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center" style="word-break:break-all;">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%" style="word-break:break-all;">
<tr class="header" align="center">
<td><?=TABLE_HEADING_PRODUCTS; ?></td>
<td width="25%"><?=TABLE_HEADING_PRODUCTS_PRICE; ?></td>
<td width="25%"><?=TABLE_HEADING_STATUS; ?></td>
<td width="15%"><?=TABLE_HEADING_ACTION; ?></td></tr>
<?
$query = $db->query("select p.products_id,p.products_price, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from $table_products p, $table_featured s, $table_products_description pd where p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = s.products_id order by pd.products_name");
while ($featured = $db->fetch_array($query)) {
@extract($featured);
?>
<tr>
<td bgcolor="<?=ALTBG1?>"><?=$products_name; ?></td>
<td bgcolor="<?=ALTBG1?>" align="center"><?php echo $currencies->format($products_price); ?></td>
<td bgcolor="<?=ALTBG1?>" align="center">
<?php
if ($status == '1') {
echo IMAGE_ICON_STATUS_GREEN.' <a href="' . tep_href_link('admincp.php', 'act=featured&action=setflag&flag=0&id=' . $featured_id, 'NONSSL') . '">'.IMAGE_ICON_STATUS_RED_LIGHT.'</a>';
} else {
echo '<a href="' . tep_href_link('admincp.php', 'act=featured&action=setflag&flag=1&id=' . $featured_id, 'NONSSL').'">'.IMAGE_ICON_STATUS_GREEN_LIGHT.'</a> '.IMAGE_ICON_STATUS_RED;
}
?>
</td>
<td bgcolor="<?=ALTBG2?>" align="center" width="15%">
<a href="<?echo tep_href_link("admincp.php", 'act=featured&type=edit&page=' . $page. '&fID=' . $featured_id);?>">編輯</a>
<a href="<?echo tep_href_link("admincp.php", 'act=featured&type=delete&page=' . $page. '&fID=' . $featured_id);?>">刪除</a>
</td>
</tr>
<?php
}
?>
</table></td></tr></table>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="95%" align="center" style="word-break:break-all;">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%" style="word-break:break-all;">
</tr>
<td bgcolor="<?=ALTBG1?>" colspan="2">
<?=$multipage?></td></tr>
</table></td></tr></table>
<?
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -