PluginProbe
ShiftController Employee Shift Scheduling / 4.9.85
ShiftController Employee Shift Scheduling v4.9.85
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 / employees / html / admin / view / user.php

user.php in ShiftController Employee Shift Scheduling 4.9.85, at sh4/employees/html/admin/view/user.php

90 lines 2.2 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_Employees_Html_Admin_View_User
4 {
5 public function __construct(
6 HC3_Hooks $hooks,
7 HC3_Ui $ui,
8 HC3_Ui_Layout1 $layout,
9
10 SH4_App_Query $appQuery,
11
12 SH4_Employees_Query $query,
13 HC3_Users_Presenter $usersPresenter,
14 HC3_Users_Query $users
15 )
16 {
17 $this->self = $hooks->wrap($this);
18 $this->ui = $ui;
19 $this->layout = $layout;
20
21 $this->appQuery = $hooks->wrap($appQuery);
22 $this->query = $hooks->wrap($query);
23
24 $this->usersPresenter = $hooks->wrap($usersPresenter);
25 $this->users = $hooks->wrap($users);
26 }
27
28 public function render( $id )
29 {
30 $model = $this->query->findById($id);
31
32 $users = $this->users->findAll();
33
34 $takenUsers = $this->appQuery->findAllUsersWithEmployee();
35 $takenUsersIds = array_keys($takenUsers);
36
37 $header = array( 'title' => '__User__', 'action' => NULL );
38 $rows = array();
39
40 foreach( $users as $e ){
41 $userId = $e->getId();
42 $row = array();
43
44 $userView = $this->usersPresenter->presentTitle( $e );
45 $row['title'] = $userView;
46
47 if( in_array($userId, $takenUsersIds) ){
48 $row['action'] = '__Already Linked To Another Employee__';
49 }
50 else {
51 $form = $this->ui->makeForm(
52 'admin/employees/' . $id . '/user/' . $userId,
53 $this->ui->makeInputSubmit( '__Link To This User Account__' )
54 ->tag('primary')
55 // ->tag('block')
56 );
57 $row['action'] = $form;
58 }
59
60 $rows[] = $row;
61 }
62
63 $out = $this->ui->makeTable( $header, $rows );
64
65 $this->layout
66 ->setContent( $out )
67 ->setBreadcrumb( $this->self->breadcrumb($model) )
68 ->setHeader( $this->self->header($model) )
69 ;
70
71 $out = $this->layout->render();
72 return $out;
73 }
74
75 public function header( $model )
76 {
77 $out = '__Link Employee To User Account__';
78 return $out;
79 }
80
81 public function breadcrumb( $model )
82 {
83 $return = array();
84 $return['admin'] = array( 'admin', '__Administration__' );
85 $return['employees'] = array( 'admin/employees', '__Employees__' );
86 $return['employees/edit'] = array( 'admin/employees/' . $model->getId(), $model->getTitle() );
87 return $return;
88 }
89 }
90