本文整理匯總了PHP中vCal::setCacheUpdateEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::setCacheUpdateEnabled方法的具體用法?PHP vCal::setCacheUpdateEnabled怎麽用?PHP vCal::setCacheUpdateEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vCal
的用法示例。
在下文中一共展示了vCal::setCacheUpdateEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteRecordAndRecurrences
/**
* Deletes the parent and associated child events in a series.
* @param $api
* @param $args
* @return array
*/
public function deleteRecordAndRecurrences($api, $args)
{
$bean = $this->loadBean($api, $args, 'delete');
if (!empty($bean->repeat_parent_id)) {
$parentArgs = array_merge($args, array('record' => $bean->repeat_parent_id));
$bean = $this->loadBean($api, $parentArgs, 'delete');
}
// Turn off The Cache Updates while deleting the multiple recurrences.
// The current Cache Enabled status is returned so it can be appropriately
// restored when all the recurrences have been deleted.
$cacheEnabled = vCal::setCacheUpdateEnabled(false);
$this->deleteRecurrences($bean);
$bean->mark_deleted($bean->id);
// Restore the Cache Enabled status to its previous state
vCal::setCacheUpdateEnabled($cacheEnabled);
$this->getCalendarEvents()->rebuildFreeBusyCache($GLOBALS['current_user']);
return array('id' => $bean->id);
}
示例2: saveRecurringEvents
/**
* @param SugarBean $parentBean
* @return array events saved
* @throws SugarException
*/
public function saveRecurringEvents(SugarBean $parentBean)
{
global $timedate;
if (!$this->isEventRecurring($parentBean)) {
$logmsg = 'SaveRecurringEvents() : Event is not a Recurring Event';
$GLOBALS['log']->error($logmsg);
throw new SugarException('LBL_CALENDAR_EVENT_NOT_A_RECURRING_EVENT', array($parentBean->object_name));
}
if (!empty($parentBean->repeat_parent_id)) {
$logmsg = 'SaveRecurringEvents() : Event received is not the Parent Occcurrence';
$GLOBALS['log']->error($logmsg);
throw new SugarException('LBL_CALENDAR_EVENT_IS_NOT_A_PARENT_OCCURRENCE', array($parentBean->object_name));
}
$dateStart = $this->formatDateTime('datetime', $parentBean->date_start, 'user');
$params = array();
$params['type'] = $parentBean->repeat_type;
$params['interval'] = $parentBean->repeat_interval;
$params['count'] = $parentBean->repeat_count;
$params['until'] = $this->formatDateTime('date', $parentBean->repeat_until, 'user');
$params['dow'] = $parentBean->repeat_dow;
$repeatDateTimeArray = $this->buildRecurringSequence($dateStart, $params);
$limit = $this->getRecurringLimit();
if (count($repeatDateTimeArray) > $limit - 1) {
$logMessage = sprintf('Calendar Events (%d) exceed Event Limit: (%d)', count($repeatDateTimeArray), $limit);
$GLOBALS['log']->warning($logMessage);
}
// Turn off The Cache Updates while deleting the multiple recurrences.
// The current Cache Enabled status is returned so it can be appropriately
// restored when all the recurrences have been deleted.
$cacheEnabled = vCal::setCacheUpdateEnabled(false);
$this->markRepeatDeleted($parentBean);
// Restore the Cache Enabled status to its previous state
vCal::setCacheUpdateEnabled($cacheEnabled);
return $this->saveRecurring($parentBean, $repeatDateTimeArray);
}