本文整理汇总了PHP中DateUtil::formatShortTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::formatShortTime方法的具体用法?PHP DateUtil::formatShortTime怎么用?PHP DateUtil::formatShortTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::formatShortTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see TemplatePluginModifier::execute()
*/
public function execute($tagArgs, Template $tplObj)
{
if (isset($tagArgs[2])) {
$useStrftime = $tagArgs[2] ? true : false;
} else {
$useStrftime = isset($tagArgs[1]) ? true : false;
}
return DateUtil::formatShortTime(isset($tagArgs[1]) ? $tagArgs[1] : null, $tagArgs[0], isset($tagArgs[1]) ? false : true, $useStrftime);
}
示例2: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
// check permission
WCF::getUser()->checkPermission('admin.user.canPMToUserGroups');
$sql = "SELECT COUNT(DISTINCT u.userID) AS cnt" . "\n FROM wcf" . WCF_N . "_user u" . "\n LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n AND v.optionValue = '1'" . "\n AND u.userID != " . $this->userID . "\n AND g.groupID IN (" . $this->pmData['groupIDs'] . ")";
$row = WCF::getDB()->getFirstRow($sql);
$count = $row['cnt'];
if (!$count > 0) {
// clear session
if (isset($this->pmData)) {
$pmData = WCF::getSession()->getVar('pmData');
unset($pmData[$this->pmSessionID]);
WCF::getSession()->register('pmData', $pmData);
}
$this->finish('wcf.pmToUgrps.error.noRecipients', 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
if ($count <= $this->limit * $this->loop) {
$endTime = TIME_NOW;
$lf = "\n";
// remove from outbox
$sql = "UPDATE wcf" . WCF_N . "_pm" . "\n SET saveInOutbox = 0" . "\n WHERE pmID = " . $this->pmID;
WCF::getDB()->sendQuery($sql);
// groups...
$groups = '';
$sql = "SELECT groupName" . "\n FROM wcf" . WCF_N . "_group" . "\n WHERE groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY groupName";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (!empty($groups)) {
$groups .= ', ';
}
$groups .= StringUtil::decodeHTML($row['groupName']);
}
// log...
$log = '';
$subject = WCF::getLanguage()->get('wcf.pmToUgrps.log.subject', array('$pmID' => $this->pmID)) . ' ' . $this->pmData['subject'];
if ($this->pmData['enableHtml']) {
$log .= '<pre>';
}
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.started', array('$startTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $this->pmData['startTime']))) . $lf;
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.finished', array('$endTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $endTime))) . $lf;
$log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.recipients', array('$groups' => $groups, '$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)))) . $lf;
$log .= str_repeat('-', 60) . $lf;
if ($this->pmData['enableHtml']) {
$log .= '</pre>' . $lf;
}
$log .= $this->pmData['text'];
$this->recipientArray = $this->blindCopyArray = array();
$this->recipientArray[0]['userID'] = $this->userID;
$this->recipientArray[0]['username'] = $this->username;
PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $subject, $log, $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => false));
// clear session
$pmData = WCF::getSession()->getVar('pmData');
unset($pmData[$this->pmSessionID]);
WCF::getSession()->register('pmData', $pmData);
$this->calcProgress();
$msg = WCF::getLanguage()->get('wcf.pmToUgrps.finish', array('$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)), '$startTime' => DateUtil::formatShortTime('%H:%M:%S', $this->pmData['startTime']), '$endTime' => DateUtil::formatShortTime('%H:%M:%S', $endTime)));
$this->finish($msg, 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
// get users
$sql = "SELECT DISTINCT u.userID, u.username" . "\n FROM wcf" . WCF_N . "_user u" . "\n LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n AND v.optionValue = '1'" . "\n AND u.userID != " . $this->userID . "\n AND g.groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY u.userID";
$this->blindCopyArray = array();
$i = 0;
$result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->blindCopyArray[$i]['userID'] = $row['userID'];
$this->blindCopyArray[$i]['username'] = $row['username'];
$i++;
}
if (count($this->blindCopyArray)) {
if (empty($this->pmID)) {
$tmp = PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $this->pmData['subject'], $this->pmData['text'], $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => $this->pmData['showSignature']));
if ($tmp->pmID) {
$this->pmID = intval($tmp->pmID);
$pmData = WCF::getSession()->getVar('pmData');
$pmData[$this->pmSessionID]['pmID'] = $this->pmID;
WCF::getSession()->register('pmData', $pmData);
$mlt = intval($this->pmData['maxLifeTime']);
if ($mlt > 0) {
$mlt = $this->pmData['startTime'] + 86400 * $mlt;
} else {
$mlt = 0;
}
$sql = "INSERT IGNORE INTO wcf" . WCF_N . "_pm_bulk_mailing" . "\n (pmID, elapsedTime, time, userID)" . "\nVALUES (" . $this->pmID . ", " . $mlt . ", " . $this->pmData['startTime'] . ", " . $this->userID . ")";
WCF::getDB()->sendQuery($sql);
}
} else {
$recipientIDs = $inserts = '';
foreach ($this->blindCopyArray as $k => $v) {
$username = WCF::getDB()->escapeString($this->blindCopyArray[$k]['username']);
if (!empty($recipientIDs)) {
$recipientIDs .= ',';
}
$recipientIDs .= $this->blindCopyArray[$k]['userID'];
if (!empty($inserts)) {
$inserts .= ',';
}
//.........这里部分代码省略.........
示例3: getAppointmentList
//.........这里部分代码省略.........
$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;
foreach ($birthdays as $k => $v) {
$ret[$i]['birthday'] = true;
$ret[$i]['color'] = $color;
$ret[$i]['userID'] = $v['userID'];
$ret[$i]['username'] = $v['username'];
$ret[$i]['age'] = $v['age'];
$ret[$i]['time'] = $v['time'];
$i++;
}
}
$sql = "SELECT ce.eventID, cem.subject AS subject, ce.eventTime AS startTime, ce.eventEndTime AS endTime, ce.isFullDay AS fullDay" . "\n FROM wcf" . WCF_N . "_calendar_event ce" . "\n LEFT JOIN wcf" . WCF_N . "_calendar_event_message cem ON (cem.eventID = ce.eventID)" . "\n WHERE (ce.eventTime >= " . TIME_NOW . "\n OR (ce.isFullDay = 1 AND ce.eventTime >= " . $sTimestamp . ")" . "\n OR (ce.eventEndTime > ce.eventTime AND ce.eventEndTime > " . $sTimestamp . "))" . "\n AND cem.isDeleted != 1";
if (!empty($userID) && empty($showPublic)) {
$sql .= "\n AND cem.userID = " . $userID;
}
$sql .= "\n ORDER BY ce.eventTime" . "\n LIMIT " . $limit;
$result = WBBCore::getDB()->sendQuery($sql);
while ($row = WBBCore::getDB()->fetchArray($result)) {
if (!empty($row['fullDay'])) {
$tM = intval(date('n', $row['startTime']));
$tY = intval(date('Y', $row['startTime']));
$tD = intval(date('j', $row['startTime']));
$row['startTime'] = mktime(0, 0, 0, $tM, $tD, $tY);
if (empty($row['endTime'])) {
$row['endTime'] = mktime(0, 0, 0, $tM, $tD, $tY);
} else {
$tM = intval(date('n', $row['endTime']));
$tY = intval(date('Y', $row['endTime']));
$tD = intval(date('j', $row['endTime']));
$row['endTime'] = mktime(0, 0, 0, $tM, $tD, $tY);
}
}
if (empty($row['endTime'])) {
$row['endTime'] = $row['startTime'];
}
$ret[$i]['fullDay'] = $row['fullDay'];
$ret[$i]['birthday'] = false;
$ret[$i]['color'] = '';
$ret[$i]['eventID'] = $row['eventID'];
$ret[$i]['subject'] = $row['subject'];
$ret[$i]['startTime'] = $row['startTime'];
$ret[$i]['endTime'] = $row['endTime'];
$ret[$i]['severalDays'] = false;
$ret[$i]['curYear'] = true;
$ret[$i]['sameDay'] = false;
if ($row['startTime'] >= $sTimestamp && $row['endTime'] <= $eTimestamp) {
$ret[$i]['today'] = true;
} else {
$ret[$i]['today'] = false;
if (date('j', $row['startTime']) != date('j', $row['endTime'])) {
$ret[$i]['severalDays'] = true;
}
if (date('Y', $row['startTime']) != date('Y')) {
$ret[$i]['curYear'] = false;
}
}
if ($ret[$i]['severalDays']) {
$ret[$i]['title'] = DateUtil::formatShortTime('%d.%m. %H:%M', $row['startTime']) . ' - ' . DateUtil::formatShortTime('%d.%m. %H:%M', $row['endTime']);
} else {
$ret[$i]['title'] = DateUtil::formatShortTime('%H:%M', $row['startTime']) . '-' . DateUtil::formatShortTime('%H:%M', $row['endTime']);
}
$ret[$i]['title'] .= ': ' . $row['subject'];
$i++;
}
}
}
return $ret;
}