Code Duplication    Length = 25-25 lines in 9 locations

app/module/Albums/Category/One/Admin/AddController.php 1 location

@@ 9-33 (lines=25) @@
6
use Rudolf\Modules\Categories\One\Admin\AddForm;
7
use Rudolf\Modules\Categories\One\Admin\AddModel;
8
9
class AddController extends AdminController
10
{
11
    public function add()
12
    {
13
        $form = new AddForm();
14
        $form->setModel(new AddModel());
15
        $form->setType('albums');
16
17
        // if data was send
18
        if (isset($_POST['add'])) {
19
            $form->handle($_POST);
20
21
            if ($form->isValid()) {
22
                $id = $form->save();
23
                $this->redirect(DIR.'/admin/albums/categories/edit/'.$id);
24
            }
25
26
            $form->dispalyAlerts();
27
        }
28
29
        $view = new AddView();
30
        $view->add($form->getDataToDisplay());
31
        $view->render('admin');
32
    }
33
}
34

app/module/Albums/Category/One/Admin/DelController.php 1 location

@@ 10-34 (lines=25) @@
7
use Rudolf\Modules\Categories\One\Admin\DelModel;
8
use Rudolf\Modules\Categories\One\Model as OneModel;
9
10
class DelController extends AdminController
11
{
12
    public function del($id)
13
    {
14
        // if data was send
15
        if (isset($_POST['delete'])) {
16
            $form = new DelForm();
17
            $form->handle(['id' => $id]);
18
            $form->setModel(new DelModel());
19
20
            if ($form->isValid()) {
21
                $form->delete();
22
                $this->redirect(DIR.'/admin/albums/categories');
23
            }
24
25
            $form->dispalyAlerts();
26
        }
27
28
        $category = (new OneModel())->getCategoryInfoById($id);
29
30
        $view = new DelView();
31
        $view->delCategory($category);
32
        $view->render('admin');
33
    }
34
}
35

app/module/Albums/One/Admin/DelController.php 1 location

@@ 8-32 (lines=25) @@
5
use Rudolf\Framework\Controller\AdminController;
6
use Rudolf\Modules\Albums\One\Model as OneModel;
7
8
class DelController extends AdminController
9
{
10
    public function del($id)
11
    {
12
        // if data was send
13
        if (isset($_POST['delete'])) {
14
            $form = new DelForm();
15
            $form->handle(['id' => $id]);
16
            $form->setModel(new DelModel());
17
18
            if ($form->isValid()) {
19
                $form->delete();
20
                $this->redirect(DIR.'/admin/albums');
21
            }
22
23
            $form->dispalyAlerts();
24
        }
25
26
        $album = (new OneModel())->getOneById($id);
27
28
        $view = new DelView();
29
        $view->delAlbum($album);
30
        $view->render('admin');
31
    }
32
}
33

app/module/Articles/Category/One/Admin/AddController.php 1 location

@@ 9-33 (lines=25) @@
6
use Rudolf\Modules\Categories\One\Admin\AddForm;
7
use Rudolf\Modules\Categories\One\Admin\AddModel;
8
9
class AddController extends AdminController
10
{
11
    public function add()
12
    {
13
        $form = new AddForm();
14
        $form->setModel(new AddModel());
15
        $form->setType('articles');
16
17
        // if data was send
18
        if (isset($_POST['add'])) {
19
            $form->handle($_POST);
20
21
            if ($form->isValid()) {
22
                $id = $form->save();
23
                $this->redirect(DIR.'/admin/articles/categories/edit/'.$id);
24
            }
25
26
            $form->dispalyAlerts();
27
        }
28
29
        $view = new AddView();
30
        $view->add($form->getDataToDisplay());
31
        $view->render('admin');
32
    }
33
}
34

app/module/Articles/Category/One/Admin/DelController.php 1 location

@@ 10-34 (lines=25) @@
7
use Rudolf\Modules\Categories\One\Admin\DelModel;
8
use Rudolf\Modules\Categories\One\Model as OneModel;
9
10
class DelController extends AdminController
11
{
12
    public function del($id)
13
    {
14
        // if data was send
15
        if (isset($_POST['delete'])) {
16
            $form = new DelForm();
17
            $form->handle(['id' => $id]);
18
            $form->setModel(new DelModel());
19
20
            if ($form->isValid()) {
21
                $form->delete();
22
                $this->redirect(DIR.'/admin/articles/categories');
23
            }
24
25
            $form->dispalyAlerts();
26
        }
27
28
        $category = (new OneModel())->getCategoryInfoById($id);
29
30
        $view = new DelView();
31
        $view->delCategory($category);
32
        $view->render('admin');
33
    }
34
}
35

app/module/Articles/One/Admin/DelController.php 1 location

@@ 8-32 (lines=25) @@
5
use Rudolf\Framework\Controller\AdminController;
6
use Rudolf\Modules\Articles\One\Model as OneModel;
7
8
class DelController extends AdminController
9
{
10
    public function del($id)
11
    {
12
        // if data was send
13
        if (isset($_POST['delete'])) {
14
            $form = new DelForm();
15
            $form->handle(['id' => $id]);
16
            $form->setModel(new DelModel());
17
18
            if ($form->isValid()) {
19
                $form->delete();
20
                $this->redirect(DIR.'/admin/articles');
21
            }
22
23
            $form->dispalyAlerts();
24
        }
25
26
        $article = (new OneModel())->getOneById($id);
27
28
        $view = new DelView();
29
        $view->delArticle($article);
30
        $view->render('admin');
31
    }
32
}
33

app/module/Galleries/One/Admin/DelController.php 1 location

@@ 8-32 (lines=25) @@
5
use Rudolf\Framework\Controller\AdminController;
6
use Rudolf\Modules\Galleries\One;
7
8
class DelController extends AdminController
9
{
10
    public function del($id)
11
    {
12
        // if data was send
13
        if (isset($_POST['delete'])) {
14
            $form = new DelForm();
15
            $form->handle(['id' => $id]);
16
            $form->setModel(new DelModel());
17
18
            if ($form->isValid()) {
19
                $form->delete();
20
                $this->redirect(DIR.'/admin/galleries');
21
            }
22
23
            $form->dispalyAlerts();
24
        }
25
26
        $gallery = (new One\Model())->getGalleryInfoById($id);
27
28
        $view = new DelView();
29
        $view->delGallery($gallery);
30
        $view->render('admin');
31
    }
32
}
33

app/module/Pages/One/Admin/AddController.php 1 location

@@ 8-32 (lines=25) @@
5
use Rudolf\Framework\Controller\AdminController;
6
use Rudolf\Modules\Pages\Roll\Model as PagesList;
7
8
class AddController extends AdminController
9
{
10
    public function add()
11
    {
12
        $form = new AddForm();
13
        $form->setModel(new AddModel());
14
15
        // if data was send
16
        if (isset($_POST['add'])) {
17
            $form->handle($_POST);
18
19
            if ($form->isValid()) {
20
                $id = $form->save();
21
                $this->redirect(DIR.'/admin/pages/edit/'.$id);
22
            }
23
24
            $form->dispalyAlerts();
25
        }
26
27
        $view = new AddView();
28
        $view->addPage($form->getDataToDisplay());
29
        $view->setPages((new PagesList())->getPagesList());
30
        $view->render('admin');
31
    }
32
}
33

app/module/Pages/One/Admin/DelController.php 1 location

@@ 8-32 (lines=25) @@
5
use Rudolf\Framework\Controller\AdminController;
6
use Rudolf\Modules\Pages\One\Model as OneModel;
7
8
class DelController extends AdminController
9
{
10
    public function del($id)
11
    {
12
        // if data was send
13
        if (isset($_POST['delete'])) {
14
            $form = new DelForm();
15
            $form->handle(['id' => $id]);
16
            $form->setModel(new DelModel());
17
18
            if ($form->isValid()) {
19
                $form->delete();
20
                $this->redirect(DIR.'/admin/pages');
21
            }
22
23
            $form->dispalyAlerts();
24
        }
25
26
        $page = (new OneModel())->getOneById($id);
27
28
        $view = new DelView();
29
        $view->delPage($page);
30
        $view->render('admin');
31
    }
32
}
33