本文整理汇总了PHP中DateUtil::getDatetime_NextWeek方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::getDatetime_NextWeek方法的具体用法?PHP DateUtil::getDatetime_NextWeek怎么用?PHP DateUtil::getDatetime_NextWeek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::getDatetime_NextWeek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reserva
//.........这里部分代码省略.........
$finish_date = strtotime($finish_date);
if ($finish_date < strtotime('today')) {
LogUtil::registerError($this->__('Finish date is minnor than actual date'));
System::redirect(ModUtil::url('IWbookings', 'user', 'assigna', array('sid' => $sid)));
return true;
}
}
}
// get nsessions from finish_date
if ($book_end == 'date') {
$nsessions = 0;
$tmp_date = strtotime(date('Y-m-d', $eb));
while ($tmp_date <= $finish_date) {
$nsessions++;
$tmp_date = strtotime(date('Y-m-d', $tmp_date) . ' + 1 week');
}
}
$admin = true;
if (!SecurityUtil::checkPermission('IWbookings::', '::', ACCESS_ADMIN)) {
$admin = false;
// Check if num sessions exceeds num weeks limit from actual date
$maxWeeks = ModUtil::getVar('IWbookings', 'weeks');
if ($maxWeeks != 0) {
$factor = $nsessions - 1;
$last = strtotime(date('Y-m-d', $eb) . ' + ' . $factor . ' weeks');
$limit = strtotime('today + ' . $maxWeeks . ' weeks');
$alert = false;
while ($last > $limit) {
$last = strtotime(date('Y-m-d', $last) . ' -1 week');
$nsessions--;
$alert = true;
}
if ($alert)
$msg = $this->__('Bookings can only be made for the following ') . $maxWeeks . $this->__(' week(s). Haven\'t made all the requested bookings.');
}
}
$bookingDates = array();
// Generate all booking dates
for ($i = 0; $i < $nsessions; ++$i) {
foreach ($horaris as $h) {
// Calculate next week
$next = DateUtil::getDatetime_NextWeek($i, "%Y-%m-%d", $d[2], $d[1], $d[0], 12, 0, 0);
// Per evitar canvis d'hora produits per l'horari d'estiu
$bookingDates[] = array('s' => $next . " " . $h[t_inici][0] . ":" . $h[t_inici][1] . ":00",
'e' => $next . " " . $h[t_final][0] . ":" . $h[t_final][1] . ":00");
}
}
// Check if the requested bookings is possible
$reserved = array();
foreach ($bookingDates as $bd) {
$bookings = ModUtil::apiFunc('IWbookings', 'user', 'reservat', array('sid' => $sid,
'start' => $bd[s],
'end' => $bd[e]));
if (count($bookings) != 0)
$reserved[] = $bookings;
}
if (!count($reserved)) {
// If all bookings are possible do it
foreach ($bookingDates as $bd) {
$success = ModUtil::apiFunc('IWbookings', 'user', 'reserva', array('sid' => $sid,
'start' => $bd[s],
'end' => $bd[e],
'user' => $user,
'usrgroup' => $group,
'reason' => $reason,
'nsessions' => $nsessions,
'nbooking' => $success,
'admin' => $admin));
if (!$success) {
LogUtil::registerError($this->__('An error has occurred when loading the table or the form'));
return System::redirect(ModUtil::url('IWbookings', 'user', 'assigna', array('sid' => $sid,
'date' => $cdate)));
}
}
// Book receipt
LogUtil::registerStatus("<b>[ " . $this->__('Booking receipt') . " ]</b><br />" . $this->__('Booking day: ') . ": <b> " . $bookingDate . "</b><br/>" . $this->__('Time: ') . ": <b>" . $horari
. "</b><br />" . $this->__('Group: ') . ": <b>" . $group . "</b><br />" . $this->__('Reason for booking') . ": <b>" . $reason . "</b><br />"
. $this->__('Repeat next weeks') . ": <b>" . $nsessions . "<br /><br /><b>" . $msg);
} else {
// Launch error message with reserved frames
$message = $this->__('Booking failed! The following times are reserved:') . '<ul>';
foreach ($reserved as $r) {
$message .= '<li><b>' . date('d-m-Y', strtotime($r['0']['start'])) . $this->__('</b> from ') . date('H:i', strtotime($r['0']['start'])) . $this->__(' to ') . date('H:i', strtotime($r['0']['end'])) . '</li>';
}
$message .= '</ul>';
LogUtil::registerError($message);
}
return System::redirect(ModUtil::url('IWbookings', 'user', 'assigna', array('sid' => $sid,
'date' => $cdate)));
}
示例2: getJumpDates
/**
* Calculate dates for date navigation purposes
* @author Josep Ferr�ndiz Farr� (jferran6@xtec.cat)
* @args The date (a MySQL timestamp or a string)
* @return array. Fields: nextweek, preweek, nextmonth, prevmonth
*/
public function getJumpDates($args) {
$TheDate = FormUtil::getPassedValue('date', isset($args['date']) ? $args['date'] : null, 'GET');
$result = array();
if (!SecurityUtil::checkPermission('IWbookings::', '::', ACCESS_READ)) {
return false;
}
$fields = explode('-', $TheDate);
$result['nextweek'] = DateUtil::getDatetime_NextWeek(1, '%d-%m-%y', $fields[0], $fields[1], $fields[2]);
$result['prevweek'] = DateUtil::getDatetime_NextWeek(-1, '%d-%m-%y', $fields[0], $fields[1], $fields[2]);
$result['nextmonth'] = DateUtil::getDatetime_NextMonth(1, '%d-%m-%y', $fields[0], $fields[1], $fields[2]);
$result['prevmonth'] = DateUtil::getDatetime_NextMonth(-1, '%d-%m-%y', $fields[0], $fields[1], $fields[2]);
return $result;
}