| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function update() |
||
| 18 | { |
||
| 19 | //security checks |
||
| 20 | $this->onlyAdmin(); |
||
| 21 | $this->onlyPost(); |
||
| 22 | |||
| 23 | //preparing our return results |
||
| 24 | $result = array(); |
||
| 25 | $tagUpdateJson = ($this->request->getData('tag-update')); |
||
| 26 | $tagUpdate = json_decode($tagUpdateJson); |
||
| 27 | |||
| 28 | //Converting our array of objects to simple array |
||
| 29 | $send = array(); |
||
| 30 | foreach ($tagUpdate as $item) { |
||
| 31 | $send[$item->name] = $item->value; |
||
| 32 | } |
||
| 33 | |||
| 34 | $tagModel = new TagModel($this->container); |
||
| 35 | $result['success'] = $tagModel->update($send["idtags"], $send["tag_name"]); |
||
| 36 | echo json_encode($result); |
||
| 37 | } |
||
| 64 | } |