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{
|
|
|
|
/**
|
2012-07-17 05:04:04 +04:00
|
|
|
* @brief Creates default calendar for a user
|
|
|
|
* @param paramters parameters from postCreateUser-Hook
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function createUser($parameters) {
|
|
|
|
OC_Calendar_Calendar::addCalendar($parameters['uid'],'Default calendar');
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Deletes all calendars of a certain user
|
2011-08-11 13:22:07 +04:00
|
|
|
* @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
|
|
|
}
|
|
|
|
|
2012-05-13 22:03:27 +04:00
|
|
|
OC_Calendar_Share::post_userdelete($parameters['uid']);
|
|
|
|
|
2011-08-11 13:22:07 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|