本文整理汇总了PHP中DateUtil::getUTC方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::getUTC方法的具体用法?PHP DateUtil::getUTC怎么用?PHP DateUtil::getUTC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::getUTC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* @see Form::save()
*/
public function save()
{
parent::save();
$this->userSuspension->update($this->userSuspension->userID, $this->userSuspension->suspensionID, $this->expiresDay && $this->expiresMonth && $this->expiresYear ? DateUtil::getUTC(gmmktime($this->expiresHour, $this->expiresMinute, 0, $this->expiresMonth, $this->expiresDay, $this->expiresYear)) : 0);
$this->saved();
// show success message
WCF::getTPL()->assign('success', true);
}
示例2: checkParams
/**
* Checks the given parameters.
*
* @return boolean
*/
public function checkParams()
{
if (!$this->question) {
return false;
}
if (count($this->pollOptionsArray) < 2) {
throw new UserInputException('pollOptions', 'notEnoughOptions');
}
if (count($this->pollOptionsArray) > POLL_MAX_OPTIONS) {
throw new UserInputException('pollOptions', 'tooMuch');
}
if ($this->choiceCount < 1) {
throw new UserInputException('choiceCount', 'notValid');
}
if ($this->choiceCount > count($this->pollOptionsArray)) {
throw new UserInputException('choiceCount', 'tooMuch');
}
if ($this->endTimeDay || $this->endTimeMonth || $this->endTimeYear || $this->endTimeHour || $this->endTimeMinutes) {
$time = @gmmktime($this->endTimeHour, $this->endTimeMinutes, 0, $this->endTimeMonth, $this->endTimeDay, $this->endTimeYear);
// since php5.1.0 mktime returns false on failure
if ($time === false || $time === -1) {
throw new UserInputException('endTime', 'invalid');
}
// get utc time
$time = DateUtil::getUTC($time);
if (!$this->pollID && $time <= TIME_NOW) {
throw new UserInputException('endTime', 'invalid');
}
$this->data['endTime'] = $time;
} else {
$this->data['endTime'] = 0;
}
$this->valid = true;
}
示例3: save
/**
* @see Form::save()
*/
public function save()
{
parent::save();
$this->userWarning->update($this->warningID, $this->title, $this->points, $this->expiresDay && $this->expiresMonth && $this->expiresYear ? DateUtil::getUTC(gmmktime($this->expiresHour, $this->expiresMinute, 0, $this->expiresMonth, $this->expiresDay, $this->expiresYear)) : 0, $this->reason);
$this->saved();
// show success message
WCF::getTPL()->assign('success', true);
}
示例4: getAppointmentList
public function getAppointmentList()
{
$ret = array();
$i = 0;
$limit = intval(WBBCore::getUser()->monthlyCalendarBox_maxAppointments);
$showPublic = intval(WBBCore::getUser()->monthlyCalendarBox_showPublicAppointments);
$showBirthdays = intval(WBBCore::getUser()->monthlyCalendarBox_showBirthdaysInAppointments);
$maxDays = intval(WBBCore::getUser()->monthlyCalendarBox_maxAppointmentDays);
$userID = intval(WCF::getUser()->userID);
if (!$limit > 0) {
$limit = 10;
}
if (empty($maxDays)) {
$maxDays = 30;
}
if (empty($userID)) {
$showPublic = 1;
$showBirthdays = 1;
}
$m = intval(date('n'));
$y = intval(date('Y'));
$d = intval(date('j'));
$sTimestamp = mktime(0, 0, 0, $m, $d, $y);
$eTimestamp = $sTimestamp + 86400;
// WoltLab Calendar...
if (WBBCore::getUser()->getPermission('user.calendar.canUseCalendar')) {
require_once WCF_DIR . 'lib/util/CalendarUtil.class.php';
require_once WCF_DIR . 'lib/data/calendar/event/EventList.class.php';
$cals = Calendar::getEnabledCalendars();
if (empty($showBirthdays)) {
foreach ($cals as $k => $v) {
if ($v->className == 'BirthdayEvent') {
unset($cals[$k]);
break;
}
}
}
if (!empty($userID) && empty($showPublic)) {
foreach ($cals as $k => $v) {
if ($v->ownerID != $userID && $v->className != 'BirthdayEvent') {
unset($cals[$k]);
}
}
}
$events = new EventList($sTimestamp, $sTimestamp + 86400 * $maxDays, $cals);
$events->readEvents();
$myEvents = $events->getEvents($limit);
// file_put_contents('/tmp/debug.txt', print_r($myEvents, true));
foreach ($myEvents as $event) {
if ($showBirthdays && $event->calendar->className == 'BirthdayEvent' && $event->user && !$event->eventID) {
$ret[$i]['birthday'] = true;
$ret[$i]['userID'] = $event->userID;
$ret[$i]['username'] = $event->user->username;
$ret[$i]['age'] = $event->user->age;
$ret[$i]['time'] = $event->startTime;
$ret[$i]['eventID'] = null;
} else {
$ret[$i]['birthday'] = false;
$ret[$i]['eventID'] = $event->eventID;
}
if ($event->isFullDay) {
$ret[$i]['startTime'] = DateUtil::getUTC($event->startTime);
$ret[$i]['endTime'] = DateUtil::getUTC($event->endTime);
} else {
$ret[$i]['startTime'] = $event->startTime;
$ret[$i]['endTime'] = $event->endTime;
}
$ret[$i]['fullDay'] = $event->isFullDay;
$ret[$i]['subject'] = $event->subject;
$ret[$i]['severalDays'] = false;
$ret[$i]['curYear'] = true;
$ret[$i]['sameDay'] = false;
$ret[$i]['color'] = $event->color;
$ret[$i]['today'] = false;
$ret[$i]['title'] = '';
if ($ret[$i]['startTime'] >= $sTimestamp && $ret[$i]['endTime'] < $eTimestamp) {
$ret[$i]['today'] = true;
} else {
$ret[$i]['today'] = false;
if (date('j', $ret[$i]['startTime']) != date('j', $ret[$i]['endTime'])) {
$ret[$i]['severalDays'] = true;
}
if (date('Y', $ret[$i]['startTime']) != date('Y')) {
$ret[$i]['curYear'] = false;
}
}
if ($ret[$i]['severalDays']) {
$ret[$i]['title'] = DateUtil::formatDate('%d.%m. %H:%M', $ret[$i]['startTime']) . ' - ' . DateUtil::formatDate('%d.%m. %H:%M', $ret[$i]['endTime']);
} else {
$ret[$i]['title'] = DateUtil::formatDate('%H:%M', $ret[$i]['startTime']) . '-' . DateUtil::formatDate('%H:%M', $ret[$i]['endTime']);
}
$ret[$i]['title'] .= ': ' . $ret[$i]['subject'];
$i++;
}
} else {
if (WBBCore::getUser()->getPermission('user.calendar.canEnter')) {
if (!empty($showBirthdays)) {
$birthdays = self::getBirthdayList($y, $m, $d);
$color = '';
$isEnabled = 1;
//.........这里部分代码省略.........