本文整理汇总了PHP中Kronolith::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::search方法的具体用法?PHP Kronolith::search怎么用?PHP Kronolith::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::search方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Purge old events.
*
* @throws Kronolith_Exception
* @throws Horde_Exception_NotFound
*/
public function execute()
{
/* Get the current time minus the number of days specified in
* 'purge_events_keep'. An event will be deleted if it has an end
* time prior to this time. */
$del_time = new Horde_Date($_SERVER['REQUEST_TIME']);
$del_time->mday -= $GLOBALS['prefs']->getValue('purge_events_keep');
/* Need to have Horde_Perms::DELETE on a calendar to delete events
* from it */
$calendars = Kronolith::listInternalCalendars(true, Horde_Perms::DELETE);
/* Start building the search */
$kronolith_driver = Kronolith::getDriver();
$query = new StdClass();
$query->start = null;
$query->end = $del_time;
$query->status = null;
$query->calendars = array(Horde_String::ucfirst($GLOBALS['conf']['calendar']['driver']) => array_keys($calendars));
$query->creator = $GLOBALS['registry']->getAuth();
/* Perform the search */
$days = Kronolith::search($query);
$count = 0;
foreach ($days as $events) {
foreach ($events as $event) {
/* Delete if no recurrence, or if we are past the last occurence */
if (!$event->recurs() || $event->recurrence->nextRecurrence($del_time) == false) {
if ($event->calendar != $kronolith_driver->calendar) {
$kronolith_driver->open($event->calendar);
}
try {
$kronolith_driver->deleteEvent($event->id, true);
++$count;
} catch (Exception $e) {
Horde::log($e, 'ERR');
throw $e;
}
}
}
}
$GLOBALS['notification']->push(sprintf(ngettext("Deleted %d event older than %d days.", "Deleted %d events older than %d days.", $count), $count, $GLOBALS['prefs']->getValue('purge_events_keep')));
}
示例2: Horde_Date
/* Make a new empty event object with default values. */
$event = Kronolith::getDriver($search_calendar[0], $search_calendar[1])->getEvent();
$event->title = $event->location = $event->status = $event->description = null;
/* Set start on today, stop on tomorrow. */
$event->start = new Horde_Date(mktime(0, 0, 0));
$event->end = new Horde_Date($event->start);
$event->end->mday++;
/* We need to set the event to initialized, otherwise we will end up with
* a default end date. */
$event->initialized = true;
if (Horde_Util::getFormData('actionID') == 'search_calendar') {
$event->readForm();
if (Horde_Util::getFormData('status') == Kronolith::STATUS_NONE) {
$event->status = null;
}
$events = Kronolith::search($event, $search_calendar[1] == '__any' ? null : $search_calendar[0] . '|' . $search_calendar[1]);
}
$optgroup = $GLOBALS['browser']->hasFeature('optgroup');
$current_user = $GLOBALS['registry']->getAuth();
$calendars = array();
foreach (Kronolith::listInternalCalendars(false, Horde_Perms::READ) as $id => $cal) {
if ($cal->get('owner') && $cal->get('owner') == $current_user) {
$calendars[_("My Calendars:")]['|' . $id] = $cal->get('name');
} else {
$calendars[_("Shared Calendars:")]['|' . $id] = Kronolith::getLabel($cal);
}
}
foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_EXTERNAL_CALENDARS) as $id => $cal) {
$app = $GLOBALS['registry']->get('name', $GLOBALS['registry']->hasInterface($cal->api()));
if (!$cal->display()) {
continue;