public function actionArticle_edit($article_id) { $model = Blog::findOne($article_id); $categories = Category::getAllCategory(); $marks = AdminBlog::getArticlesMarks($article_id); $comments = AdminCommon::getComments('blog', $article_id, 0, 5); $content = ['content_type' => 'blog', 'content_id' => $article_id]; if (Yii::$app->request->post() && $model->validate()) { $model['id_level_1'] = $_POST['Blog']['id_level_1']; $model->save(); $this->redirect('/admin/blog?page=1'); } return $this->render('article_edit', ['model' => $model, 'categories' => $categories, 'marks' => $marks, 'comments' => $comments, 'content' => $content]); }
public static function deleteContent($content_id, $content_type, $ctrl) { if ($content_type == "user") { User::deleteUserAndAllInfo($content_id); } elseif ($content_type == "article") { AdminBlog::DeleteArticle($content_id, $ctrl); } elseif ($content_type == 'photo') { AdminPhoto::deletePhoto($content_id); } elseif ($content_type == 'club') { AdminClub::deleteClub($content_id); } elseif ($content_type == 'message') { AdminMessages::deleteMessage($content_id); } }