2011-08-11 13:22:07 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2011-09-24 00:59:24 +04:00
|
|
|
* Copyright (c) 2011 Jakob Sack <mail@jakobsack.de>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
2011-08-11 13:22:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class contains all hooks.
|
|
|
|
*/
|
|
|
|
class OC_Calendar_Hooks{
|
|
|
|
/**
|
|
|
|
* @brief Deletes all Addressbooks of a certain user
|
|
|
|
* @param paramters parameters from postDeleteUser-Hook
|
|
|
|
* @return array
|
|
|
|
*/
|
2011-09-18 18:34:41 +04:00
|
|
|
public static function deleteUser($parameters) {
|
2011-08-11 13:22:07 +04:00
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars($parameters['uid']);
|
2012-03-02 23:25:20 +04:00
|
|
|
|
2011-08-11 13:22:07 +04:00
|
|
|
foreach($calendars as $calendar) {
|
2011-08-22 18:59:16 +04:00
|
|
|
OC_Calendar_Calendar::deleteCalendar($calendar['id']);
|
2011-08-11 13:22:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2012-03-02 23:25:20 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds the CardDAV resource to the DAV server
|
|
|
|
* @param paramters parameters from initialize-Hook
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function initializeCalDAV($parameters){
|
|
|
|
// We need a backend, the root node and the caldav plugin
|
|
|
|
$parameters['backends']['caldav'] = new OC_Connector_Sabre_CalDAV();
|
|
|
|
$parameters['nodes'][] = new Sabre_CalDAV_CalendarRootNode($parameters['backends']['principal'], $parameters['backends']['caldav']);
|
|
|
|
$parameters['plugins'][] = new Sabre_CalDAV_Plugin();
|
|
|
|
return true;
|
|
|
|
}
|
2011-08-11 13:22:07 +04:00
|
|
|
}
|