| @@ 143-152 (lines=10) @@ | ||
| 140 | public function actionDelete($type, $id = 0) |
|
| 141 | { |
|
| 142 | // sounds like a multiply delete definition |
|
| 143 | if ($id === 0 || (int)$id < 1) { |
|
| 144 | $ids = $this->request->query->get('selected'); |
|
| 145 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
|
| 146 | $id = $ids; |
|
| 147 | } else { |
|
| 148 | throw new NotFoundException('Bad conditions'); |
|
| 149 | } |
|
| 150 | } else { |
|
| 151 | $id = [$id]; |
|
| 152 | } |
|
| 153 | ||
| 154 | // prepare query to db |
|
| 155 | $query = null; |
|
| @@ 198-207 (lines=10) @@ | ||
| 195 | public function actionPublish($type, $id = 0) |
|
| 196 | { |
|
| 197 | // check if it multiple accept ids |
|
| 198 | if ($id === 0 || (int)$id < 1) { |
|
| 199 | $ids = $this->request->query->get('selected'); |
|
| 200 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
|
| 201 | $id = $ids; |
|
| 202 | } else { |
|
| 203 | throw new NotFoundException('Bad conditions'); |
|
| 204 | } |
|
| 205 | } else { |
|
| 206 | $id = [$id]; |
|
| 207 | } |
|
| 208 | ||
| 209 | // build query |
|
| 210 | $query = null; |
|
| @@ 104-113 (lines=10) @@ | ||
| 101 | public function actionDelete($id = null) |
|
| 102 | { |
|
| 103 | // check if id is passed or get data from GET as array ids |
|
| 104 | if ($id === 0 || (int)$id < 1) { |
|
| 105 | $ids = $this->request->query->get('selected'); |
|
| 106 | if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) { |
|
| 107 | $id = $ids; |
|
| 108 | } else { |
|
| 109 | throw new NotFoundException('Bad conditions'); |
|
| 110 | } |
|
| 111 | } else { |
|
| 112 | $id = [$id]; |
|
| 113 | } |
|
| 114 | ||
| 115 | // initialize delete model |
|
| 116 | $model = new FormUserDelete($id); |
|