當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBAccess::getEventRange方法代碼示例

本文整理匯總了PHP中DBAccess::getEventRange方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBAccess::getEventRange方法的具體用法?PHP DBAccess::getEventRange怎麽用?PHP DBAccess::getEventRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBAccess的用法示例。


在下文中一共展示了DBAccess::getEventRange方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: date

<?php

include_once '../scripts/DBAccess.php';
$month = date('m');
$year = date('Y');
$endmonth = $month + 1;
$endyear = $year;
$endmonth2 = $month + 2;
$endyear2 = $year;
if ($endmonth > 12) {
    $endmonth = 1;
    $endyear = $endyear + 1;
}
if ($endmonth2 > 12) {
    $endmonth2 = 2;
    $endyear2 = $endyear2 + 1;
}
$eventResult = DBAccess::getEventRange(1, $year . "-" . $month . "-01", $endyear . "-" . $endmonth . '-01');
$rows = count($eventResult, 0);
echo "<table class=\"eventsTable\" style=\"text-align:left;\">";
for ($i = 0; $i < $rows; $i++) {
    echo "<tr style=\"color:#" . $eventResult[$i]['EventColour'] . ";\">\n\t<td>" . $eventResult[$i]['EventName'] . ", ";
    if (ord($eventResult[$i]['Active']) == 1) {
        echo date('D j', strtotime($eventResult[$i]['EventDate'])) . ",\n\t\t\t     " . date('g:iA', strtotime($eventResult[$i]['EventTime'])) . "";
    } else {
        echo ", TBC";
    }
    echo "</tr>";
}
echo "</table>";
開發者ID:astrix37,項目名稱:seqas,代碼行數:30,代碼來源:clubEvents.php

示例2: count

<?php

include_once '../scripts/DBAccess.php';
$year = $_GET['year'];
$eventType = $_GET['type'];
$content = "";
if (is_numeric($year) && is_numeric($eventType)) {
    $eventResult = DBAccess::getEventRange($eventType, $year . "-01-01", $year . "-12-31");
    $rows = count($eventResult, 0);
    if ($rows == 0) {
        $content = "<h3>No events have been found</h3>";
    } else {
        $content = "\n\t\t\n\t\t\n\t\t<div class='container2'>\n\t\t<table class=\"eventsTable\" cellspacing=\"0\">\n\t\t<tr>\n\t\t<th style=\"width:11%\">Date</th>\n\t\t<th style=\"width:12%\">Time</th>\n\t\t<th style=\"width:30%\">Event Name</th>\n\t\t<th style=\"width:47%\">Description</th>\n\t\t</tr>\n\t\t";
        for ($i = 0; $i < $rows; $i++) {
            $thing = "";
            if (date('n', strtotime($eventResult[$i]['EventDate'])) % 2 == 0) {
                //echo (date('M', strtotime($eventResult[$i]['EventDate'])));
                $thing = "background:rgba(120, 120, 120, 0.5);";
            }
            $content = $content . "<tr style=\"" . $thing . "; color:#" . $eventResult[$i]['EventColour'] . ";\">";
            echo $eventResult[$i]['Active'];
            if (ord($eventResult[$i]['Active']) == 1) {
                $content .= "<td style=\"text-align:left;padding:10px;\">" . date('M, D j', strtotime($eventResult[$i]['EventDate'])) . "</td>\n\t\t\t\t\t     <td>" . date('g:iA', strtotime($eventResult[$i]['EventTime'])) . "</td>";
            } else {
                $content .= "<td style=\"text-align:left;padding:10px;\">TBC</td><td>TBC</td>";
            }
            $content .= "<td style=\"text-align:left;padding:10px;\">" . $eventResult[$i]['EventName'] . "</td>\n\t\t\t\t    <td>" . $eventResult[$i]['EventDescription'] . "</td> </tr>";
        }
        $content = $content . "</table></div>";
    }
} else {
開發者ID:astrix37,項目名稱:seqas,代碼行數:31,代碼來源:allEvents.php


注:本文中的DBAccess::getEventRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。