/
Ladlen
/
library
Обзор
Документация
Войти
/
Ladlen
/
library
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
controllers/admin/publisher/Controller.php
56 строк
1 KB
Dolgov Dmitriy
users
14 фев 2017, 01:25
14 фев 2017, 01:25
7aac280
Код
Авторство
О чём код?
<?php namespace app\controllers\admin\publisher; use app\core\Web; use app\core\Container; use app\models\Publisher; class Controller extends \app\controllers\admin\Controller { public function actionModify() { $publisher = new Publisher; if (!empty($_GET['id'])) { if ($item = $publisher->getPublisher($_GET['id'])) { $values = new Container(); $values->id = $_GET['id']; $values->name = $item['name']; return $this->render('admin/publishers/edit', $values); } //TODO: рендер страницы ошибки } if (!empty($_POST['id'])) { $publisher->updatePublisher($_POST['id'], $_POST['name']); Web::redirect('admin', ['action' => 'publishers']); } return $this->render('404'); } public function actionCreate() { $publisher = new Publisher; $publisher->addPublisher($_POST['name']); Web::redirect('admin', ['action' => 'publishers']); } public function actionRemove() { $publisher = new Publisher; $publisher->removePublisher($_POST['id']); Web::redirect('admin', ['action' => 'publishers']); } public function actionRestore() { $publisher = new Publisher; $publisher->restorePublisher($_POST['id']); Web::redirect('admin', ['action' => 'publishers']); } }