public function action_update() { Controller_admin::check_user(); $items = News::get_one($_GET['id']); $viewer = new Views(); $viewer->items = $items; $viewer->display('edit_views'); if (!empty($_POST['delete'])) { $delete = new Controller_add(); $delete->deleteNews(); } if (!empty($_POST['title'])) { $article = new Add(); $article->title = $_POST['title']; $article->content = $_POST['content']; $article->id_article = $_GET['id']; $article->save(); } }
public function action_update() { $items = News::get_one($_GET['id']); $viewer = new Views; $viewer->items = $items; $viewer->display ('edit_views'); //Обрабатываем нажатие кнопки "удалить" if (!empty($_POST['delete'])) { $delete = new Controller_add; $delete->deleteNews(); } //Сохраняем изменения if (!empty($_POST['title'])) { $article = new Add; $article->title = $_POST['title']; $article->content = $_POST['content']; $article->id_article = $_GET['id']; $article->save(); } }