本文整理汇总了PHP中DBUtils::dbDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::dbDate方法的具体用法?PHP DBUtils::dbDate怎么用?PHP DBUtils::dbDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtils
的用法示例。
在下文中一共展示了DBUtils::dbDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
require_once "classes/MealPlan.class.php";
require_once "classes/DBUtils.class.php";
// Initalize the Vars
$date = isset($_GET['date']) ? $_GET['date'] : date('m-d-Y');
$view = isset($_GET['view']) ? $_GET['view'] : "daily";
$dbDate = DBUtils::dbDate($date);
// get the date in ISO format so that we have the key
if ($SMObj->getUserLoginID() == NULL) {
die($LangUI->_('You must be logged in to use the Meal Planner!'));
}
// Create a new meal plan object
$MPObj = new MealPlan($date);
$MPObj->load($dbDate, $dbDate);
//just want this one day
$minshow = 4;
// Min number of empty fields to show
$defaultServings = 2;
// The default number of servings
// Read in a list of Meals and recipes
$rc = DBUtils::fetchColumn($db_table_meals, 'meal_name', 'meal_id', 'meal_id');
$mealList = DBUtils::createList($rc, 'meal_id', 'meal_name');
?>
<script type="text/javascript">
$(document).ready(function() {
$(".ui-widget").find("input[id^='recipeAuto_']").each(function()
{
$(this).autocomplete({
source: "index.php?m=recipes&a=get&format=no",
minLength: 1,
示例2: die
die($LangUI->_('You must be logged in to use the Meal Planner!'));
}
// Create a new meal plan object
$MPObj = new MealPlan($date);
// Depending on the view type, load the need amount of meals.
if ($view == "daily") {
// Just need to load the current date
$dbDate = DBUtils::dbDate($date);
// get the date in ISO format so that we have the key
$MPObj->load($dbDate, $dbDate);
} else {
if ($view == "weekly") {
// Most likely to happen
$weekList = $MPObj->getWeekDaysList($MPObj->currentDay, $MPObj->currentMonth, $MPObj->currentYear);
$startDate = DBUtils::dbDate($weekList[0][1] . '-' . $weekList[0][0] . '-' . $weekList[0][2]);
$endDate = DBUtils::dbDate($weekList[6][1] . '-' . $weekList[6][0] . '-' . $weekList[6][2]);
$MPObj->load($startDate, $endDate);
}
}
// we are not going to create a list for an entire month, that is just crazy...
?>
<table cellspacing="0" cellpadding="1" border="0" width="100%">
<tr>
<td align="left" class="title">
<?php
echo $LangUI->_('Create Shopping List');
?>
</td>
</tr>
<tr>
<td class="nav" align="left">
示例3: while
$delete = "delete_";
$iterator = 0;
// Remove all of the meals currently set for this day
$MPObj->clearDay($dbDate);
// Set the first value
$currentMeal = $meal . $iterator;
while (isset($_REQUEST[$currentMeal]) && $_REQUEST[$currentMeal] != 0) {
$currentServ = $servings . $iterator;
$currentRecipe = $recipe . $iterator;
$currentRepeat = $_REQUEST[$repeat . $iterator];
$currentDelete = isset($_REQUEST[$delete . $iterator]) ? $_REQUEST[$delete . $iterator] : "";
if ($currentDelete != "yes") {
// Now repeat this item for the given number of days
$thisDate = $date;
//save the current date
$dbDate = DBUtils::dbDate($thisDate);
//and the database formated date
for ($currentRepeat; $currentRepeat > 0; $currentRepeat--) {
$MPObj->insert($dbDate, htmlentities($_REQUEST[$currentMeal], ENT_QUOTES), htmlentities($_REQUEST[$currentRecipe], ENT_QUOTES), htmlentities($_REQUEST[$currentServ], ENT_QUOTES), $SMObj->getUserID());
list($month, $day, $year) = split("-", $thisDate);
list($day, $month, $year) = $MPObj->getNextDay($day, $month, $year);
//get the next day in case we need it.
$thisDate = $month . "-" . $day . "-" . $year;
$dbDate = $dbDate = DBUtils::dbDate($thisDate);
}
}
// Setup for next loop
$iterator++;
$currentMeal = $meal . $iterator;
}
echo $LangUI->_('Meal Plan Updated') . "<br />\n";
示例4: printWeekDays
}
echo "</table>";
} else {
if ($view == "weekly") {
//-------------------------------------------------------------------------------
// Weekly View
//-------------------------------------------------------------------------------
printWeekDays();
$weekdays = $MPObj->getWeekDaysList($MPObj->currentDay, $MPObj->currentMonth, $MPObj->currentYear);
// Load the meals into memory
$startDate = DBUtils::dbDate($weekdays[0][1] . '-' . $weekdays[0][0] . '-' . $weekdays[0][2]);
$endDate = DBUtils::dbDate($weekdays[6][1] . '-' . $weekdays[6][0] . '-' . $weekdays[6][2]);
$MPObj->load($startDate, $endDate);
// Print out the week
foreach ($weekdays as $d) {
$dbDate = DBUtils::dbDate($d[1] . '-' . $d[0] . '-' . $d[2]);
// get the date in ISO format so that we have the key
echo "<td width=80 height=140 valign=top";
if ($d[1] != $MPObj->currentMonth) {
echo " bgcolor=#DBDBDB";
} else {
if ($d[0] == $MPObj->realDay && $d[1] == $MPObj->realMonth && $d[2] == $MPObj->realYear) {
echo " bgcolor=#d6e6f5";
}
}
echo '><a href="index.php?m=meals&view=daily&date=' . $d[1] . '-' . $d[0] . '-' . $d[2] . '">' . $d[0] . '</a>';
echo ' ' . createEditLink($d[1] . '-' . $d[0] . '-' . $d[2], "weekly");
echo "<br/>";
echo $MPObj->getMeals($dbDate, 2);
echo "</td>\n";
}