Пример #1
0
?>
</textarea>
<button id="click-to-copy" data-clipboard-target="clipboard-text" style="float:right">Copy To Clipboard</button>
</fieldset>

<br>

<fieldset id="deadline" style="border-color:#3BA4C7">
<legend><b>TA Input Deadline</b></legend>
<p>The current deadline for TAs to rank preferences and input course schedules for
<?php 
print $_SESSION['season_name'] . ' ' . $_SESSION['year'];
?>
 is 11:59 PM on:<b>
<?php 
$deadline = get_deadline($_SESSION['dept'], $_SESSION['year'], $_SESSION['season']);
if (!isset($deadline)) {
    print "No Deadline Set";
} else {
    print $deadline[1] . '/' . $deadline[2] . '/' . $deadline[0];
}
?>
</b></p>
	<input name="deaddate" type="date" style="width: 90%; margin-left: 5%; margin-right: 5%">
   <br>
   <input name="deadline" type="submit" value="Set Deadline" style="float:right; clear:right; margin-right:20px">
</fieldset>
</form>


Пример #2
0
 $smarty->assign('goods_attr', $attr);
 foreach ($goods_list as &$val) {
     $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('freepostalcard_type') . " WHERE free_goods_sn='{$val['goods_sn']}'";
     $postal = $GLOBALS['db']->getRow($sql);
     // 获取今天的日期
     date_default_timezone_set('Asia/Shanghai');
     $nowdate = date('Y-m-d');
     if (is_array($postal) && count($postal)) {
         //获取$admin_id所属平台
         $sql = 'SELECT r.role_describe role, i.user_id FROM ' . $GLOBALS['ecs']->table('order_info') . ' i, ' . $GLOBALS['ecs']->table('users') . ' u, ' . $GLOBALS['ecs']->table('admin_user') . ' a, ' . $GLOBALS['ecs']->table('role') . " r WHERE i.user_id=u.user_id AND u.admin_id=a.user_id AND a.role_id=r.role_id AND i.order_id={$val['order_id']}";
         $role = $GLOBALS['db']->getRow($sql);
         // 判断该顾客的包邮卡是否已经生成
         $sql = 'SELECT freecard_num, free_limit, buy_date, effective_date effective FROM ' . $GLOBALS['ecs']->table('free_postal_card') . " WHERE user_id={$role['user_id']} AND free_goods_sn='{$val['goods_sn']}' " . " AND free_platform IN ({$postal['free_platform']})";
         $isExist = $GLOBALS['db']->getRow($sql);
         // 计算包邮卡的有效期
         $effective = get_deadline($postal['effective_date'], $nowdate);
         // 如果该顾客没有包邮卡存在,
         // 或者包邮卡剩余使用次数为0
         // 或者包邮卡已过期
         // 则直接添加包邮卡到顾客列表
         if (empty($isExist)) {
             // 生成包邮卡卡号
             $freecard_num = generate_card_number($role);
             $val['goods_name'] .= "(卡号:{$freecard_num} )";
             $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('free_postal_card') . '(user_id, freecard_num, effective_date, free_limit, free_platform, free_goods_sn, buy_date, order_id)VALUES(' . "{$role['user_id']}, '" . strtr($freecard_num, array(' ' => '')) . "', '{$effective}', {$postal['free_limit']}, '{$postal['free_platform']}', '{$postal['free_goods_sn']}', '{$nowdate}', {$order['order_id']})";
             $GLOBALS['db']->query($sql);
             $smarty->assign('effective', $effective . '前有效 ');
         } else {
             $sql = 'UPDATE ' . $GLOBALS['ecs']->table('free_postal_card') . " SET effective_date='{$effective}', order_id={$order['order_id']} " . " WHERE user_id={$role['user_id']} AND free_goods_sn='{$postal['free_goods_sn']}'" . " AND order_id<>{$order['order_id']}";
             $GLOBALS['db']->query($sql);
             if ($GLOBALS['db']->affected_rows()) {
Пример #3
0
function check_deadline($dept, $year, $season)
{
    //returns 1 if the deadline has passed, 0 else.
    $d1 = get_deadline($dept, $year, $season);
    //check against current date
    if (!isset($d1)) {
        return 0;
    }
    $d2 = getdate();
    $d1[2] = str_pad($d1[2], 2, "0", STR_PAD_LEFT);
    $d2["mday"] = str_pad($d2["mday"], 2, "0", STR_PAD_LEFT);
    $dead = $d1[0] . $d1[1] . $d1[2];
    $current = $d2["year"] . $d2["mon"] . $d2["mday"];
    return $dead < $current;
}
Пример #4
0
<?php

require 'values.php';
require 'functions.php';
session_start();
$d1 = get_deadline($_SESSION['tadept'], $_SESSION['year'], $_SESSION['season']);
unset($_SESSION['section']);
unset($_SESSION['course']);
unset($_SESSION['dept']);
unset($_SESSION['ta_id']);
?>
<link rel="shortcut icon" href="icon.ico" >
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="test_files/css3menu13/style.css" type="text/css" /><style type="text/css">._css3m{display:none}</style>

<?php 
print '<h3> <center>The deadline to enter preferences has passed.</center></h3>';
print '<p><center>The deadline for ' . $_SESSION['season_name'] . ' ' . $_SESSION['year'] . ' was ' . $_SESSION['deadline'] . '.</center></p>';
//check against current date
$d2 = getdate();
//  $d1[2] = str_pad ( $d1[2] , 2 , "0", STR_PAD_LEFT );
//  $d["mday"] = str_pad ( $d2["mday"] , 2 , "0", STR_PAD_LEFT );
$current = $d2["year"] . $d2["mon"] . $d2["mday"];
print "<br><p>Today is {$current}.</p>";
$dead = $d1[0] . $d1[1] . $d1[2];
print "<br><p>Deadline is {$dead}.</p>";
?>