本文整理匯總了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));