-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathEvents.php
More file actions
42 lines (35 loc) · 1.08 KB
/
Events.php
File metadata and controls
42 lines (35 loc) · 1.08 KB
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
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\notes;
use humhub\helpers\ControllerHelper;
use humhub\modules\notes\models\NoteUserColors;
use humhub\modules\space\widgets\Menu as SpaceMenu;
use humhub\modules\ui\menu\MenuLink;
use humhub\modules\user\models\User;
use Yii;
class Events
{
public static function onSpaceMenuInit($event)
{
/* @var SpaceMenu $menu */
$menu = $event->sender;
if ($menu->space->moduleManager->isEnabled('notes')) {
$menu->addEntry(new MenuLink([
'label' => Yii::t('NotesModule.base', 'Notes'),
'url' => $menu->space->createUrl('/notes/note/show'),
'icon' => 'file-text',
'isActive' => ControllerHelper::isActivePath('notes'),
]));
}
}
public static function onUserDelete($event)
{
/* @var User $user */
$user = $event->sender;
NoteUserColors::deleteAll(['user_id' => $user->id]);
}
}