@@ 10-39 (lines=30) @@ | ||
7 | use Rudolf\Modules\Categories\One\Admin\AddForm; |
|
8 | use Rudolf\Modules\Categories\One\Admin\AddModel; |
|
9 | ||
10 | class AddController extends AdminController |
|
11 | { |
|
12 | /** |
|
13 | * @throws Exception |
|
14 | */ |
|
15 | public function add() |
|
16 | { |
|
17 | $addModel = new AddModel(); |
|
18 | $form = new AddForm(); |
|
19 | $form->setModel($addModel); |
|
20 | $form->setType('albums'); |
|
21 | ||
22 | // if data was send |
|
23 | if (isset($_POST['add'])) { |
|
24 | $form->handle($_POST); |
|
25 | ||
26 | if ($form->isValid()) { |
|
27 | $id = $form->save(); |
|
28 | $addModel->flushCache('categories'); |
|
29 | $this->redirect(DIR . '/admin/albums/categories/edit/' . $id); |
|
30 | } |
|
31 | ||
32 | $form->displayAlerts(); |
|
33 | } |
|
34 | ||
35 | $view = new AddView(); |
|
36 | $view->add($form->getDataToDisplay()); |
|
37 | $view->render(); |
|
38 | } |
|
39 | } |
|
40 |
@@ 10-39 (lines=30) @@ | ||
7 | use Rudolf\Modules\Categories\One\Admin\AddForm; |
|
8 | use Rudolf\Modules\Categories\One\Admin\AddModel; |
|
9 | ||
10 | class AddController extends AdminController |
|
11 | { |
|
12 | /** |
|
13 | * @throws Exception |
|
14 | */ |
|
15 | public function add() |
|
16 | { |
|
17 | $addModel = new AddModel(); |
|
18 | $form = new AddForm(); |
|
19 | $form->setModel($addModel); |
|
20 | $form->setType('articles'); |
|
21 | ||
22 | // if data was send |
|
23 | if (isset($_POST['add'])) { |
|
24 | $form->handle($_POST); |
|
25 | ||
26 | if ($form->isValid()) { |
|
27 | $id = $form->save(); |
|
28 | $addModel->flushCache('categories'); |
|
29 | $this->redirect(DIR . '/admin/articles/categories/edit/' . $id); |
|
30 | } |
|
31 | ||
32 | $form->displayAlerts(); |
|
33 | } |
|
34 | ||
35 | $view = new AddView(); |
|
36 | $view->add($form->getDataToDisplay()); |
|
37 | $view->render(); |
|
38 | } |
|
39 | } |
|
40 |
@@ 9-40 (lines=32) @@ | ||
6 | use Rudolf\Framework\Controller\AdminController; |
|
7 | use Rudolf\Modules\Articles\One\Model as OneModel; |
|
8 | ||
9 | class DelController extends AdminController |
|
10 | { |
|
11 | /** |
|
12 | * @param $id |
|
13 | * |
|
14 | * @throws Exception |
|
15 | */ |
|
16 | public function del($id) |
|
17 | { |
|
18 | // if data was send |
|
19 | if (isset($_POST['delete'])) { |
|
20 | $delModel = new DelModel(); |
|
21 | $form = new DelForm(); |
|
22 | $form->handle(['id' => $id]); |
|
23 | $form->setModel($delModel); |
|
24 | ||
25 | if ($form->isValid()) { |
|
26 | $form->delete(); |
|
27 | $delModel->flushCache('articles'); |
|
28 | $this->redirect(DIR . '/admin/articles'); |
|
29 | } |
|
30 | ||
31 | $form->displayAlerts(); |
|
32 | } |
|
33 | ||
34 | $article = (new OneModel())->getOneById($id); |
|
35 | ||
36 | $view = new DelView(); |
|
37 | $view->delArticle($article); |
|
38 | $view->render(); |
|
39 | } |
|
40 | } |
|
41 |
@@ 9-40 (lines=32) @@ | ||
6 | use Rudolf\Framework\Controller\AdminController; |
|
7 | use Rudolf\Modules\Galleries\One; |
|
8 | ||
9 | class DelController extends AdminController |
|
10 | { |
|
11 | /** |
|
12 | * @param $id |
|
13 | * |
|
14 | * @throws Exception |
|
15 | */ |
|
16 | public function del($id) |
|
17 | { |
|
18 | // if data was send |
|
19 | if (isset($_POST['delete'])) { |
|
20 | $delModel = new DelModel(); |
|
21 | $form = new DelForm(); |
|
22 | $form->handle(['id' => $id]); |
|
23 | $form->setModel($delModel); |
|
24 | ||
25 | if ($form->isValid()) { |
|
26 | $form->delete(); |
|
27 | $delModel->flushCache('galleries'); |
|
28 | $this->redirect(DIR . '/admin/galleries'); |
|
29 | } |
|
30 | ||
31 | $form->displayAlerts(); |
|
32 | } |
|
33 | ||
34 | $gallery = (new One\Model())->getGalleryInfoById($id); |
|
35 | ||
36 | $view = new DelView(); |
|
37 | $view->delGallery($gallery); |
|
38 | $view->render(); |
|
39 | } |
|
40 | } |
|
41 |
@@ 9-38 (lines=30) @@ | ||
6 | use Rudolf\Framework\Controller\AdminController; |
|
7 | use Rudolf\Modules\Pages\Roll\Model as PagesList; |
|
8 | ||
9 | class AddController extends AdminController |
|
10 | { |
|
11 | /** |
|
12 | * @throws Exception |
|
13 | */ |
|
14 | public function add() |
|
15 | { |
|
16 | $addModel = new AddModel(); |
|
17 | $form = new AddForm(); |
|
18 | $form->setModel($addModel); |
|
19 | ||
20 | // if data was send |
|
21 | if (isset($_POST['add'])) { |
|
22 | $form->handle($_POST); |
|
23 | ||
24 | if ($form->isValid()) { |
|
25 | $id = $form->save(); |
|
26 | $addModel->flushCache('pages'); |
|
27 | $this->redirect(DIR . '/admin/pages/edit/' . $id); |
|
28 | } |
|
29 | ||
30 | $form->displayAlerts(); |
|
31 | } |
|
32 | ||
33 | $view = new AddView(); |
|
34 | $view->addPage($form->getDataToDisplay()); |
|
35 | $view->setPages((new PagesList())->getPagesList()); |
|
36 | $view->render(); |
|
37 | } |
|
38 | } |
|
39 |
@@ 9-40 (lines=32) @@ | ||
6 | use Rudolf\Framework\Controller\AdminController; |
|
7 | use Rudolf\Modules\Pages\One\Model as OneModel; |
|
8 | ||
9 | class DelController extends AdminController |
|
10 | { |
|
11 | /** |
|
12 | * @param $id |
|
13 | * |
|
14 | * @throws Exception |
|
15 | */ |
|
16 | public function del($id) |
|
17 | { |
|
18 | // if data was send |
|
19 | if (isset($_POST['delete'])) { |
|
20 | $delModel = new DelModel(); |
|
21 | $form = new DelForm(); |
|
22 | $form->handle(['id' => $id]); |
|
23 | $form->setModel($delModel); |
|
24 | ||
25 | if ($form->isValid()) { |
|
26 | $form->delete(); |
|
27 | $delModel->flushCache('pages'); |
|
28 | $this->redirect(DIR . '/admin/pages'); |
|
29 | } |
|
30 | ||
31 | $form->displayAlerts(); |
|
32 | } |
|
33 | ||
34 | $page = (new OneModel())->getOneById($id); |
|
35 | ||
36 | $view = new DelView(); |
|
37 | $view->delPage($page); |
|
38 | $view->render(); |
|
39 | } |
|
40 | } |
|
41 |