本文整理汇总了PHP中DateUtil::incrementDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::incrementDate方法的具体用法?PHP DateUtil::incrementDate怎么用?PHP DateUtil::incrementDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::incrementDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleForm
public function handleForm(Context $context, $action)
{
if ($action == "createReservation") {
if (isset($_POST['equip_id']) && $_POST['equip_id'] != "" && (isset($_POST['start_date']) && $_POST['start_date'] != "") && (isset($_POST['length']) && $_POST['length'] != "")) {
$equipId = $_POST['equip_id'];
$equip = EquipmentDao::getEquipmentByID($equipId);
if ($equip != null) {
if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
$startDate = $_POST['start_date'];
$endDate = DateUtil::incrementDate($startDate, $_POST['length']);
$reservations = ReservationDao::getReservationsForEquipmentByDate($equipId, $startDate, $endDate);
if (count($reservations) == 0) {
$user = UserDao::getUserByUsername(SessionUtil::getUsername());
$reservation = ReservationDao::createReservation($user->id, $equipId, $_POST['length'], $startDate, $endDate, $_POST['user_comment']);
EmailUtil::sendNewReservationNotices($user, $reservation);
} else {
$context->addError("Reservations already exist during selected dates ({$startDate} and {$endDate}).");
}
} else {
$context->addError("Cannot reserve equipment (User Level).");
}
} else {
$context->addError("No such equipment.");
}
} else {
$context->addError("Required Field Left Blank.");
}
} else {
$context->addError("Incorrect Action.");
}
}