| @@ 134-150 (lines=17) @@ | ||
| 131 | return $response->withJson($shifts); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function createRoleForDepartment($request, $response, $args) |
|
| 135 | { |
|
| 136 | $deptId = $args['dept']; |
|
| 137 | if($this->canEditDept($request, $deptId) === false) |
|
| 138 | { |
|
| 139 | return $response->withStatus(401); |
|
| 140 | } |
|
| 141 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'roles'); |
|
| 142 | $obj = $request->getParsedBody(); |
|
| 143 | if($obj == NULL) |
|
| 144 | { |
|
| 145 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 146 | } |
|
| 147 | $obj['departmentID'] = $deptId; |
|
| 148 | $ret = $dataTable->create($obj); |
|
| 149 | return $response->withJson($ret); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function createShiftForDepartment($request, $response, $args) |
|
| 153 | { |
|
| @@ 152-168 (lines=17) @@ | ||
| 149 | return $response->withJson($ret); |
|
| 150 | } |
|
| 151 | ||
| 152 | public function createShiftForDepartment($request, $response, $args) |
|
| 153 | { |
|
| 154 | $deptId = $args['dept']; |
|
| 155 | if($this->canEditDept($request, $deptId) === false) |
|
| 156 | { |
|
| 157 | return $response->withStatus(401); |
|
| 158 | } |
|
| 159 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'shifts'); |
|
| 160 | $obj = $request->getParsedBody(); |
|
| 161 | if($obj == NULL) |
|
| 162 | { |
|
| 163 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 164 | } |
|
| 165 | $obj['departmentID'] = $deptId; |
|
| 166 | $ret = $dataTable->create($obj); |
|
| 167 | return $response->withJson($ret); |
|
| 168 | } |
|
| 169 | ||
| 170 | public function updateRoleForDepartment($request, $response, $args) |
|
| 171 | { |
|
| @@ 113-129 (lines=17) @@ | ||
| 110 | return $response->withJson($shifts); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function createShiftForEvent($request, $response, $args) |
|
| 114 | { |
|
| 115 | $eventId = $args['event']; |
|
| 116 | if($this->canUpdate($request, null) === false) |
|
| 117 | { |
|
| 118 | return $response->withStatus(401); |
|
| 119 | } |
|
| 120 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'shifts'); |
|
| 121 | $obj = $request->getParsedBody(); |
|
| 122 | if($obj == NULL) |
|
| 123 | { |
|
| 124 | $obj = json_decode($request->getBody()->getContents(), true); |
|
| 125 | } |
|
| 126 | $obj['eventID'] = $eventId; |
|
| 127 | $ret = $dataTable->create($obj); |
|
| 128 | return $response->withJson($ret); |
|
| 129 | } |
|
| 130 | } |
|
| 131 | ||