|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @license MIT |
|
7
|
|
|
* @copyright 2013 - 2016 Cross Solution <http://cross-solution.de> |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** */ |
|
11
|
|
|
namespace Organizations\Form; |
|
12
|
|
|
|
|
13
|
|
|
use Core\Form\ViewPartialProviderInterface; |
|
14
|
|
|
use Organizations\Entity\EmployeeInterface; |
|
15
|
|
|
use Zend\Form\Fieldset; |
|
16
|
|
|
use Organizations\Entity\EmployeePermissionsInterface as Perms; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* An employee fieldset. |
|
20
|
|
|
* |
|
21
|
|
|
* This fieldset contains two elements: |
|
22
|
|
|
* A user reference (field of type Employee) |
|
23
|
|
|
* and the permissions multi checkboxes. |
|
24
|
|
|
* |
|
25
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
26
|
|
|
* @since 0.18 |
|
27
|
|
|
*/ |
|
28
|
|
|
class EmployeeFieldset extends Fieldset implements ViewPartialProviderInterface |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
protected $partial = 'organizations/form/employee-fieldset'; |
|
32
|
|
|
|
|
33
|
|
|
public function setViewPartial($partial) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->partial = (string) $partial; |
|
36
|
|
|
|
|
37
|
|
|
return $this; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function getViewPartial() |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->partial; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function init() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->add( |
|
48
|
|
|
array( |
|
49
|
|
|
'type' => 'Organizations/Employee', |
|
50
|
|
|
'name' => 'user', |
|
51
|
|
|
) |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
$this->add( |
|
56
|
|
|
array( |
|
57
|
|
|
'type' => 'MultiCheckbox', |
|
58
|
|
|
'name' => 'permissions', |
|
59
|
|
|
'options' => array( |
|
60
|
|
|
'value_options' => array( |
|
61
|
|
|
Perms::JOBS_VIEW => /*@translate*/ 'View Jobs', |
|
62
|
|
|
Perms::JOBS_CHANGE => /*@translate*/ 'Edit Jobs', |
|
63
|
|
|
Perms::JOBS_CREATE => /*@translate*/ 'Create Jobs', |
|
64
|
|
|
Perms::APPLICATIONS_VIEW => /*@translate*/ 'View Applications', |
|
65
|
|
|
Perms::APPLICATIONS_CHANGE => /*@translate*/ 'Edit Applications', |
|
66
|
|
|
), |
|
67
|
|
|
), |
|
68
|
|
|
) |
|
69
|
|
|
); |
|
70
|
|
|
|
|
71
|
|
|
$this->add( |
|
72
|
|
|
array( |
|
73
|
|
|
'type' => 'select', |
|
74
|
|
|
'name' => 'role', |
|
75
|
|
|
'options' => array( |
|
76
|
|
|
'value_options' => array( |
|
77
|
|
|
EmployeeInterface::ROLE_RECRUITER => /*@translate*/ 'Recruiter', |
|
78
|
|
|
EmployeeInterface::ROLE_DEPARTMENT_MANAGER => /*@translate*/ 'Department Manager', |
|
79
|
|
|
EmployeeInterface::ROLE_MANAGEMENT => /*@translate*/ 'Managing Directors', |
|
80
|
|
|
), |
|
81
|
|
|
), |
|
82
|
|
|
) |
|
83
|
|
|
); |
|
84
|
|
|
|
|
85
|
|
|
$this->add( |
|
86
|
|
|
array( |
|
87
|
|
|
'type' => 'hidden', |
|
88
|
|
|
'name' => 'status', |
|
89
|
|
|
'attributes' => array( |
|
90
|
|
|
'value' => EmployeeInterface::STATUS_PENDING, |
|
91
|
|
|
), |
|
92
|
|
|
) |
|
93
|
|
|
); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|