| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
#[AllowDynamicProperties] |
| 3 |
class SH4_New_Controller_Employee |
| 4 |
{ |
| 5 |
public function __construct( |
| 6 |
HC3_Hooks $hooks, |
| 7 |
HC3_Post $post, |
| 8 |
HC3_Request $request, |
| 9 |
|
| 10 |
SH4_Calendars_Query $calendars, |
| 11 |
SH4_ShiftTypes_Query $shiftTypes, |
| 12 |
|
| 13 |
HC3_Time $t |
| 14 |
) |
| 15 |
{ |
| 16 |
$this->t = $t; |
| 17 |
$this->request = $request; |
| 18 |
$this->post = $hooks->wrap( $post ); |
| 19 |
|
| 20 |
$this->calendars = $hooks->wrap($calendars); |
| 21 |
$this->shiftTypes = $hooks->wrap($shiftTypes); |
| 22 |
|
| 23 |
$this->self = $hooks->wrap($this); |
| 24 |
} |
| 25 |
|
| 26 |
public function execute() |
| 27 |
{ |
| 28 |
$thisId = array(); |
| 29 |
|
| 30 |
$params = $this->request->getParams(); |
| 31 |
$employees = $this->post->get('employee'); |
| 32 |
if( ! $employees ){ |
| 33 |
$employees = array(); |
| 34 |
} |
| 35 |
|
| 36 |
if( in_array('0', $employees) ){ |
| 37 |
$employees = HC3_Functions::removeFromArray( $employees, '0' ); |
| 38 |
} |
| 39 |
|
| 40 |
if( ! $employees ){ |
| 41 |
$errors = array(); |
| 42 |
$errors['employee'] = '__Select Employee__'; |
| 43 |
$return = array( '-referrer-', $errors, TRUE ); |
| 44 |
return $return; |
| 45 |
} |
| 46 |
|
| 47 |
$employeeString = HC3_Functions::glueArray( $employees ); |
| 48 |
|
| 49 |
$to = 'new'; |
| 50 |
$toParams = $params; |
| 51 |
$toParams['employee'] = $employeeString; |
| 52 |
$to = array( $to, $toParams ); |
| 53 |
|
| 54 |
$return = array( $to, NULL ); |
| 55 |
return $return; |
| 56 |
} |
| 57 |
} |