本文整理汇总了PHP中OC_Calendar_Object::setAlarmsSent方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Object::setAlarmsSent方法的具体用法?PHP OC_Calendar_Object::setAlarmsSent怎么用?PHP OC_Calendar_Object::setAlarmsSent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Object
的用法示例。
在下文中一共展示了OC_Calendar_Object::setAlarmsSent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$l = OC_L10N::get('calendar');
$alarms = OC_Calendar_Object::getAlarmsToDisplay();
$alarmsIdsSent = array();
$ouput = array();
$timeFormat = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'H:i' : 'h:i a';
$dateFormat = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'dateformat', 'dd-mm-yy') == 'dd-mm-yy' ? 'd-m-Y' : 'm-d-Y';
$tz = OC_Calendar_App::getTimezone();
$midnight = new DateTime('now', new DateTimeZone($tz));
$midnight->setTime(23, 59, 59);
while ($row = $alarms->fetchRow()) {
$startDate = new DateTime($row['startdate'], new DateTimeZone('UTC'));
$startDate->setTimezone(new DateTimeZone($tz));
$oneDay = 60 * 60 * 24;
if ($startDate->getTimestamp() <= $midnight->getTimestamp()) {
$ouput[] = $l->t('Reminder (%s): %s is starting at %s', array($row['displayname'], $row['summary'], $startDate->format($timeFormat)));
} else {
$ouput[] = $l->t('Reminder (%s): %s is starting at %s on %s', array($row['displayname'], $row['summary'], $startDate->format($timeFormat), $startDate->format($dateFormat)));
}
$alarmsIdsSent[] = $row['id'];
}
OC_Calendar_Object::setAlarmsSent($alarmsIdsSent);
OCP\JSON::success(array('events' => $ouput));