Example #1
0
function get_related_dates($projectname, $basedate)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    $dates = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    pdo_select_db("{$CDASH_DB_NAME}", $db);
    $dbQuery = pdo_query("SELECT nightlytime FROM project WHERE name='{$projectname}'");
    if (pdo_num_rows($dbQuery) > 0) {
        $project = pdo_fetch_array($dbQuery);
        $nightlytime = $project['nightlytime'];
        //echo "query result nightlytime: " . $nightlytime . "<br/>";
    } else {
        $nightlytime = "00:00:00";
        //echo "default nightlytime: " . $nightlytime . "<br/>";
    }
    if (!isset($basedate) || strlen($basedate) == 0) {
        $basedate = gmdate(FMT_DATE);
    }
    // Convert the nightly time into GMT
    $nightlytime = gmdate(FMT_TIME, strtotime($nightlytime));
    $nightlyhour = time2hour($nightlytime);
    $nightlyminute = time2minute($nightlytime);
    $nightlysecond = time2second($nightlytime);
    $basemonth = date2month($basedate);
    $baseday = date2day($basedate);
    $baseyear = date2year($basedate);
    $dates['nightly+2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 2, $baseyear);
    $dates['nightly+1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 1, $baseyear);
    $dates['nightly-0'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday, $baseyear);
    $dates['nightly-1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 1, $baseyear);
    $dates['nightly-2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 2, $baseyear);
    // Snapshot of "now"
    //
    $currentgmtime = time();
    $currentgmdate = gmdate(FMT_DATE, $currentgmtime);
    // Find the most recently past nightly time:
    //
    $todaymonth = date2month($currentgmdate);
    $todayday = date2day($currentgmdate);
    $todayyear = date2year($currentgmdate);
    $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    while ($currentnightly > $currentgmtime) {
        $todayday = $todayday - 1;
        $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    }
    $dates['now'] = $currentgmtime;
    $dates['most-recent-nightly'] = $currentnightly;
    $dates['today_utc'] = $currentgmdate;
    $dates['basedate'] = gmdate(FMT_DATE, $dates['nightly-0']);
    // CDash equivalent of DART1's "last rollup time"
    if ($dates['basedate'] === $dates['today_utc']) {
        // If it's today, it's now:
        $dates['last-rollup-time'] = $dates['now'];
    } else {
        // If it's not today, it's the nightly time on the basedate:
        $dates['last-rollup-time'] = $dates['nightly-0'];
    }
    return $dates;
}
Example #2
0
function get_related_dates($projectnightlytime, $basedate)
{
    $dates = array();
    $nightlytime = $projectnightlytime;
    if (!isset($basedate) || strlen($basedate) == 0) {
        $basedate = gmdate(FMT_DATE);
    }
    // Convert the nightly time into GMT
    $nightlytime = gmdate(FMT_TIME, strtotime($nightlytime));
    $nightlyhour = time2hour($nightlytime);
    $nightlyminute = time2minute($nightlytime);
    $nightlysecond = time2second($nightlytime);
    $basemonth = date2month($basedate);
    $baseday = date2day($basedate);
    $baseyear = date2year($basedate);
    $dates['nightly+2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 2, $baseyear);
    $dates['nightly+1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 1, $baseyear);
    $dates['nightly-0'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday, $baseyear);
    $dates['nightly-1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 1, $baseyear);
    $dates['nightly-2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 2, $baseyear);
    // Snapshot of "now"
    //
    $currentgmtime = time();
    $currentgmdate = gmdate(FMT_DATE, $currentgmtime);
    // Find the most recently past nightly time:
    //
    $todaymonth = date2month($currentgmdate);
    $todayday = date2day($currentgmdate);
    $todayyear = date2year($currentgmdate);
    $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    while ($currentnightly > $currentgmtime) {
        $todayday = $todayday - 1;
        $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    }
    $dates['now'] = $currentgmtime;
    $dates['most-recent-nightly'] = $currentnightly;
    $dates['today_utc'] = $currentgmdate;
    $dates['basedate'] = gmdate(FMT_DATE, $dates['nightly-0']);
    // CDash equivalent of DART1's "last rollup time"
    if ($dates['basedate'] === $dates['today_utc']) {
        // If it's today, it's now:
        $dates['last-rollup-time'] = $dates['now'];
    } else {
        // If it's not today, it's the nightly time on the basedate:
        $dates['last-rollup-time'] = $dates['nightly-0'];
    }
    return $dates;
}
                                    <input type="hidden" name='time' value='' />
                                    <?php 
function time2second($seconds)
{
    $seconds = (int) $seconds;
    if ($seconds < 86400) {
        //如果不到一天
        $format_time = gmstrftime('-1&%H&%M', $seconds);
    } else {
        $time = explode(' ', gmstrftime('%j %H %M %S', $seconds));
        //Array ( [0] => 04 [1] => 14 [2] => 14 [3] => 35 )
        $format_time = $time[0] - 1 . '&' . $time[1] . '&' . $time[2];
    }
    return $format_time;
}
$times = time2second($item['tel_time']);
$times = explode('&', $times);
$day = ltrim($times[0], '0');
$hours = ltrim($times[1], '0');
$minute = ltrim($times[2], '0');
?>
                                   
                                        <label style="width:20%;"><select name="day" style="width:70%;margin-right:5px;">
                                        	<script>
                                        	for(var i=0;i<=30;i++){
                                            	if(i=='<?php 
echo $day;
?>
'){var ch="selected='selected'";}else{var ch='';}
                                            	document.write("<option "+ch+" value='"+i+"'>"+i+"</option>");
                                            	}
Example #4
0
							<tr>
								<th style="text-align: center;">เวลา</th>
								<th style="text-align: center;">เส้นทาง</th>
								<th style="text-align: center;">รถ</th>
								<th></th>
							</tr>
							<?php 
    $starttime = $daystamp;
    $endtime = $daystamp + time2second(23, 59, 59);
    $sql = "SELECT DEPARTURE_TIME, NAME, CB_BUSES.BUSNUMBER AS \"BUSNO\", NUMPLATE, CB_ROUTES.COLOR\n\t\t\t\t\t\t\t\tFROM CB_BUSRUNS, CB_ROUTES, CB_BUSES\n\t\t\t\t\t\t\t\tWHERE CB_BUSRUNS.ROUTE_ID = CB_ROUTES.ID\n\t\t\t\t\t\t\t\t\tAND CB_BUSRUNS.BUSNUMBER = CB_BUSES.BUSNUMBER\n\t\t\t\t\t\t\t\t\tAND CB_BUSRUNS.DRIVER_ID = " . $_SESSION['user']['id'] . "\n\t\t\t\t\t\t\t\t\tAND CB_BUSRUNS.DEPARTURE_TIME BETWEEN {$starttime} AND {$endtime}\n\t\t\t\t\t\t\t\tORDER BY CB_BUSRUNS.DEPARTURE_TIME ASC";
    $parse = oci_parse($connection, $sql);
    oci_execute($parse);
    while ($rundata = oci_fetch_array($parse)) {
        $time = date("H:i", $rundata['DEPARTURE_TIME']);
        $pass = "******";
        if ($rundata['DEPARTURE_TIME'] < mktime() + time2second(6)) {
            $pass = "******";
        }
        echo "<tr>\n\t\t\t\t\t\t\t\t\t<td style='font-size:20px;'>{$time}</td>\n\t\t\t\t\t\t\t\t\t<td><span style='color: {$rundata['COLOR']}'>■</span> {$rundata['NAME']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$rundata['BUSNO']} ({$rundata['NUMPLATE']})</td>\n\t\t\t\t\t\t\t\t\t<td>{$pass}</td>\n\t\t\t\t\t\t\t\t</tr>";
    }
    ?>
						</table>
						</div>
					</p>
				</div>
			</div>
			<?php 
}
?>
	</body>
</html>
Example #5
0
    ?>
</td>
                                                            <td><?php 
    echo $row['sn_password'];
    ?>
</td>
                                                            <td><?php 
    echo substr($row['start_time'], 0, -3);
    ?>
</td>
                                                            <td><?php 
    echo substr($row['end_time'], 0, -3);
    ?>
</td>
                                                            <td><?php 
    echo time2second($row['tel_time']);
    ?>
</td>
                                                            <td><?php 
    echo $row['sale_price'] / 100;
    ?>
</td>
                                                            <td><?php 
    echo $row['status'] ? yii::t('vcos', '启用') : yii::t('vcos', '禁用');
    ?>
</td>
                                                            <td>
                                                                <?php 
    //操作挂件
    $this->widget('ManipulateWidget', array('ControllerName' => 'Systemsetting', 'MethodName' => 'telephone_service_edit', 'id' => $row['id'], 'canedit' => $canedit, 'candelete' => $candelete));
    ?>
Example #6
0
&orderby=bus&sort=<?php 
    echo $orderby == "bus" ? $sort : $xsort;
    ?>
'>รถ</a></th>
				<th><a href='administrator.php?page=trip&daystamp=<?php 
    echo $daystamp;
    ?>
&orderby=driver&sort=<?php 
    echo $orderby == "driver" ? $sort : $xsort;
    ?>
'>พนักงานขับ</a></th>
				<th>จัดการ</th>
			</tr>
			<?php 
    $startday = $daystamp;
    $endday = $daystamp + time2second(23, 59, 59);
    $sql = "SELECT RUNID,\n\t\t\t\t\tCB_BUSRUNS.BUSNUMBER AS \"BUSNO\",\n\t\t\t\t\tNUMPLATE,\n\t\t\t\t\tCB_BUSES.COLOR AS \"BUSCOLOR\",\n\t\t\t\t\tCB_ROUTES.NAME AS \"ROUTENAME\",\n\t\t\t\t\tCB_ROUTES.COLOR AS \"ROUTECOLOR\",\n\t\t\t\t\tCB_USERS.NAME AS \"DRIVERNAME\",\n\t\t\t\t\tCB_BUSRUNS.DEPARTURE_TIME AS \"DEP\"\n\t\t\t\tFROM CB_BUSRUNS, CB_BUSES, CB_ROUTES, CB_USERS\n\t\t\t\tWHERE CB_BUSRUNS.BUSNUMBER = CB_BUSES.BUSNUMBER\n\t\t\t\t\tAND CB_BUSRUNS.ROUTE_ID = CB_ROUTES.ID\n\t\t\t\t\tAND CB_BUSRUNS.DRIVER_ID = CB_USERS.ID\n\t\t\t\t\tAND CB_BUSRUNS.DEPARTURE_TIME BETWEEN {$startday} AND {$endday}\n\t\t\t\tORDER BY {$orderby} {$sort}, DEPARTURE_TIME ASC";
    $parse = oci_parse($connection, $sql);
    oci_execute($parse);
    while ($rundata = oci_fetch_array($parse)) {
        echo "<tr><td style='font-size: 20px; text-align: center;'>" . date("H:i", $rundata['DEP']) . "</td>";
        echo "<td><span style='color: {$rundata['ROUTECOLOR']}'>■</span> {$rundata['ROUTENAME']}</td>";
        echo "<td><span style='color: {$rundata['BUSCOLOR']}; text-shadow: 0px 0px 2px #000000;'>■</span> {$rundata['BUSNO']} ({$rundata['NUMPLATE']})</td>";
        echo "<td>{$rundata['DRIVERNAME']}</td>";
        echo "<td><a href='?page=administrator&page=trip&action=edit&id={$rundata['RUNID']}'>แก้ไข</a> <a href='?page=administrator&daystamp={$daystamp}&page=trip&action=remove&id={$rundata['RUNID']}' onclick='return confirm(\"แน่ใจหรือไม่ว่าจะลบ\");'>ลบ</a></td></tr>";
    }
    ?>
			</table></div></p>
			
		</div>
	  </div>
{
    $seconds = (int) $seconds;
    if ($seconds < 86400) {
        //如果不到一天
        $format_time = gmstrftime('0天%H时%M分', $seconds);
    } else {
        $time = explode(' ', gmstrftime('%j %H %M %S', $seconds));
        //Array ( [0] => 04 [1] => 14 [2] => 14 [3] => 35 )
        $format_time = $time[0] - 1 . '天' . $time[1] . '时' . $time[2] . '分';
    }
    return $format_time;
}
?>
                                                        <?php 
foreach ($type as $key => $row) {
    $times = time2second($row['tel_time']);
    ?>
                                                        <tr>
                                                        <td class="center">
                                                                <label>
                                                                    <input type="checkbox" name="ids[]" value="<?php 
    echo $row['tel_id'];
    ?>
" class="ace isclick" />
                                                                    <span class="lbl"></span>
                                                                </label>
                                                            </td>
                                                            <td><?php 
    echo ++$key;
    ?>
</td>
Example #8
0
{
    $seconds = (int) $seconds;
    if ($seconds < 86400) {
        //如果不到一天
        $format_time = gmstrftime('0天%H时%M分', $seconds);
    } else {
        $time = explode(' ', gmstrftime('%j %H %M %S', $seconds));
        //Array ( [0] => 04 [1] => 14 [2] => 14 [3] => 35 )
        $format_time = $time[0] - 1 . '天' . $time[1] . '时' . $time[2] . '分';
    }
    return $format_time;
}
?>
                                                        <?php 
foreach ($wifi_item as $key => $row) {
    $times = time2second($row['wifi_time']);
    ?>
                                                        <tr>
                                                            <td class="center">
                                                                <label>
                                                                    <input type="checkbox" name="ids[]" value="<?php 
    echo $row['wifi_id'];
    ?>
" class="ace isclick" />
                                                                    <span class="lbl"></span>
                                                                </label>
                                                            </td>
                                                            <td><?php 
    echo ++$key;
    ?>
</td>
Example #9
0
</div>
<?php 
    if (isset($_POST['submit'])) {
        $id = $_POST['id'];
        $name = $_POST['name'];
        $color = $_POST['color'];
        $firstrun = explode(":", $_POST['firstrun']);
        $lastrun = explode(":", $_POST['lastrun']);
        if (!is_numeric($firstrun[0]) || !is_numeric($firstrun[1]) || !is_numeric($lastrun[0]) || !is_numeric($lastrun[1])) {
            error("", "กรุณากรอกเวลาในรูปแบบ ชม:นท");
        }
        if ($firstrun[0] > 23 || $firstrun[0] < 0 || $lastrun[0] < 0 || $firstrun[1] > 59 || $lastrun[1] > 59 || $firstrun[1] < 0 || $lastrun[1] < 0) {
            error("", "กรุณากรอกเวลาให้ถูกต้อง");
        }
        $firstrun = time2second($firstrun[0], $firstrun[1], 0);
        $lastrun = time2second($lastrun[0], $lastrun[1], 0);
        if ($lastrun < $firstrun) {
            error("", "เวลาจบต้องมาทีหลังเวลาเริ่ม");
        }
        if (!is_numeric($id)) {
            error("", "กรุณากรอกรหัสเส้นทางเป็นตัวเลข");
        }
        if (trim($name) == "" || trim($color) == "") {
            error("", "กรุณากรอกข้อมูลให้ครบ");
        }
        $sql = "INSERT INTO CB_ROUTES (ID, NAME, COLOR, FIRST_RUN, LAST_RUN) VALUES ({$id}, '{$name}', '{$color}', {$firstrun}, {$lastrun})";
        $parse = oci_parse($connection, $sql);
        if (oci_execute($parse)) {
            header("location: administrator.php?page=routes");
        } else {
            $e = oci_error();
Example #10
0
                                    <input type="hidden" name='time' value='' />
                                    <?php 
function time2second($seconds)
{
    $seconds = (int) $seconds;
    if ($seconds < 86400) {
        //如果不到一天
        $format_time = gmstrftime('-1&%H&%M', $seconds);
    } else {
        $time = explode(' ', gmstrftime('%j %H %M %S', $seconds));
        //Array ( [0] => 04 [1] => 14 [2] => 14 [3] => 35 )
        $format_time = $time[0] - 1 . '&' . $time[1] . '&' . $time[2];
    }
    return $format_time;
}
$times = time2second($wifi_item['wifi_time']);
$times = explode('&', $times);
$day = ltrim($times[0], '0');
$hours = ltrim($times[1], '0');
$minute = ltrim($times[2], '0');
?>
                                   
                                        <label style="width:20%;"><select name="day" style="width:70%;margin-right:5px;">
                                        	<script>
                                        	for(var i=0;i<=30;i++){
                                            	if(i=='<?php 
echo $day;
?>
'){var ch="selected='selected'";}else{var ch='';}
                                            	document.write("<option "+ch+" value='"+i+"'>"+i+"</option>");
                                            	}