PluginProbe
ShiftController Employee Shift Scheduling / trunk
ShiftController Employee Shift Scheduling vtrunk
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / calendars / html / admin / controller / managers.php

managers.php in ShiftController Employee Shift Scheduling trunk, at sh4/calendars/html/admin/controller/managers.php

60 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 #[AllowDynamicProperties]
3 class SH4_Calendars_Html_Admin_Controller_Managers
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7 HC3_Users_Query $usersQuery,
8 SH4_Calendars_Query $calendarsQuery,
9 SH4_App_Command $appCommand
10 )
11 {
12 $this->calendarsQuery = $hooks->wrap($calendarsQuery);
13 $this->usersQuery = $hooks->wrap($usersQuery);
14 $this->appCommand = $hooks->wrap($appCommand);
15 }
16
17 public function add( $calendarId, $userId )
18 {
19 $calendar = $this->calendarsQuery->findById( $calendarId );
20 $user = $this->usersQuery->findById( $userId );
21
22 $this->appCommand->addManagerToCalendar( $user, $calendar );
23
24 $return = array( 'admin/calendars/' . $calendarId . '/managers', '__Manager Added To Calendar__' );
25 return $return;
26 }
27
28 public function remove( $calendarId, $userId )
29 {
30 $calendar = $this->calendarsQuery->findById( $calendarId );
31 $user = $this->usersQuery->findById( $userId );
32
33 $this->appCommand->removeManagerFromCalendar( $user, $calendar );
34
35 $return = array( '-referrer-', '__Manager Removed From Calendar__' );
36 return $return;
37 }
38
39 public function addViewer( $calendarId, $userId )
40 {
41 $calendar = $this->calendarsQuery->findById( $calendarId );
42 $user = $this->usersQuery->findById( $userId );
43
44 $this->appCommand->addViewerToCalendar( $user, $calendar );
45
46 $return = array( 'admin/calendars/' . $calendarId . '/managers', '__Viewer Added To Calendar__' );
47 return $return;
48 }
49
50 public function removeViewer( $calendarId, $userId )
51 {
52 $calendar = $this->calendarsQuery->findById( $calendarId );
53 $user = $this->usersQuery->findById( $userId );
54
55 $this->appCommand->removeViewerFromCalendar( $user, $calendar );
56
57 $return = array( '-referrer-', '__Viewer Removed From Calendar__' );
58 return $return;
59 }
60 }