-
Notifications
You must be signed in to change notification settings - Fork 5
/
CalendarPlusModule.php
executable file
·56 lines (45 loc) · 1.45 KB
/
CalendarPlusModule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
class CalendarPlusModule extends HWebModule
{
public function behaviors()
{
return array(
'SpaceModuleBehavior' => array(
'class' => 'application.modules_core.space.behaviors.SpaceModuleBehavior',
),
'UserModuleBehavior' => array(
'class' => 'application.modules_core.user.behaviors.UserModuleBehavior',
),
);
}
public function disable()
{
if (parent::disable()) {
foreach (CalendarPlusEntry::model()->findAll() as $entry) {
$entry->delete();
}
return true;
}
return false;
}
public function getSpaceModuleDescription()
{
return Yii::t('CalendarPlusModule.base', 'Adds an event calendar to this space.');
}
public function getUserModuleDescription()
{
return Yii::t('CalendarPlusModule.base', 'Adds an calendar for private or public events to your profile and mainmenu.');
}
public function disableSpaceModule(Space $space)
{
foreach (CalendarPlusEntry::model()->contentContainer($space)->findAll() as $entry) {
$entry->delete();
}
}
public function disableUserModule(User $user)
{
foreach (CalendarPlusEntry::model()->contentContainer($user)->findAll() as $entry) {
$entry->delete();
}
}
}