@@ 122-139 (lines=18) @@ | ||
119 | * @param int $id Vocabulary's ID |
|
120 | * @return void Redirects to previous page |
|
121 | */ |
|
122 | public function delete($id) |
|
123 | { |
|
124 | $this->loadModel('Taxonomy.Vocabularies'); |
|
125 | $vocabulary = $this->Vocabularies->get($id, [ |
|
126 | 'conditions' => [ |
|
127 | 'locked' => 0 |
|
128 | ] |
|
129 | ]); |
|
130 | ||
131 | if ($this->Vocabularies->delete($vocabulary)) { |
|
132 | $this->Flash->success(__d('taxonomy', 'Vocabulary has been successfully deleted!')); |
|
133 | } else { |
|
134 | $this->Flash->danger(__d('taxonomy', 'Vocabulary could not be deleted, please try again')); |
|
135 | } |
|
136 | ||
137 | $this->title(__d('taxonomy', 'Delete Vocabulary')); |
|
138 | $this->redirect($this->referer()); |
|
139 | } |
|
140 | } |
|
141 |
@@ 359-374 (lines=16) @@ | ||
356 | * @param int $revisionId Revision's ID |
|
357 | * @return void Redirects to previous page |
|
358 | */ |
|
359 | public function deleteRevision($contentId, $revisionId) |
|
360 | { |
|
361 | $this->loadModel('Content.ContentRevisions'); |
|
362 | $revision = $this->ContentRevisions->find() |
|
363 | ->where(['id' => $revisionId, 'content_id' => $contentId]) |
|
364 | ->first(); |
|
365 | ||
366 | if ($this->ContentRevisions->delete($revision, ['atomic' => true])) { |
|
367 | $this->Flash->success(__d('content', 'Revision was successfully removed!')); |
|
368 | } else { |
|
369 | $this->Flash->danger(__d('content', 'Unable to remove this revision, please try again.')); |
|
370 | } |
|
371 | ||
372 | $this->title(__d('content', 'Editing Content Revision')); |
|
373 | $this->redirect($this->referer()); |
|
374 | } |
|
375 | } |
|
376 |