| @@ 112-128 (lines=17) @@ | ||
| 109 | return $response->withJson($shifts); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function createRoleForDepartment($request, $response, $args) |
|
| 113 | { |
|
| 114 | $deptId = $args['dept']; |
|
| 115 | if($this->canEditDept($request, $deptId) === false) |
|
| 116 | { |
|
| 117 | return $response->withStatus(401); |
|
| 118 | } |
|
| 119 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'roles'); |
|
| 120 | $obj = $request->getParsedBody(); |
|
| 121 | if($obj == NULL) |
|
| 122 | { |
|
| 123 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 124 | } |
|
| 125 | $obj['departmentID'] = $deptId; |
|
| 126 | $ret = $dataTable->create($obj); |
|
| 127 | return $response->withJson($ret); |
|
| 128 | } |
|
| 129 | ||
| 130 | public function createShiftForDepartment($request, $response, $args) |
|
| 131 | { |
|
| @@ 130-146 (lines=17) @@ | ||
| 127 | return $response->withJson($ret); |
|
| 128 | } |
|
| 129 | ||
| 130 | public function createShiftForDepartment($request, $response, $args) |
|
| 131 | { |
|
| 132 | $deptId = $args['dept']; |
|
| 133 | if($this->canEditDept($request, $deptId) === false) |
|
| 134 | { |
|
| 135 | return $response->withStatus(401); |
|
| 136 | } |
|
| 137 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'shifts'); |
|
| 138 | $obj = $request->getParsedBody(); |
|
| 139 | if($obj == NULL) |
|
| 140 | { |
|
| 141 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 142 | } |
|
| 143 | $obj['departmentID'] = $deptId; |
|
| 144 | $ret = $dataTable->create($obj); |
|
| 145 | return $response->withJson($ret); |
|
| 146 | } |
|
| 147 | ||
| 148 | public function updateRoleForDepartment($request, $response, $args) |
|
| 149 | { |
|
| @@ 93-109 (lines=17) @@ | ||
| 90 | return $response->withJson($shifts); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function createShiftForEvent($request, $response, $args) |
|
| 94 | { |
|
| 95 | $eventId = $args['event']; |
|
| 96 | if($this->canUpdate($request, null) === false) |
|
| 97 | { |
|
| 98 | return $response->withStatus(401); |
|
| 99 | } |
|
| 100 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'shifts'); |
|
| 101 | $obj = $request->getParsedBody(); |
|
| 102 | if($obj == NULL) |
|
| 103 | { |
|
| 104 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 105 | } |
|
| 106 | $obj['eventID'] = $eventId; |
|
| 107 | $ret = $dataTable->create($obj); |
|
| 108 | return $response->withJson($ret); |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||