/** * Lists all Board models. * * @return mixed */ public function actionIndex() { $boardId = YiiForum::getGetValue('boardid'); $locals = []; $locals['currentBoard'] = $this->getBoard($boardId); $locals['boards'] = $this->buildSubBoards($boardId, null); return $this->render('index', $locals); }
/** * Deletes an existing AuthItem model. * If deletion is successful, the browser will be redirected to the 'index' page. * * @param string $id * @return mixed */ public function actionDelete($id) { $categoryName = YiiForum::getGetValue('category'); $item = new Permission(); $item->name = $id; $this->auth->remove($item); AuthItem::createCachedPermissions(); return $this->redirect(['index', 'category' => $categoryName]); }
use yii\helpers\Html; use base\YiiForum; /** * @var yii\web\View $this * @var common\models\Board $model */ $this->title = 'Update Board: ' . $model->name; $this->params['breadcrumbs'][] = ['label' => 'Boards', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update'; $messageArray[1] = '<font color="red">父结点不能为当前结点的子结点</font>'; ?> <div class="board-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php $message = YiiForum::getGetValue('message', 0); if ($message == 1) { echo $messageArray[$message] . '<br>'; } ?> <?php echo $this->render('_form', ['model' => $model, 'boardArrayTree' => $boardArrayTree]); ?> </div>
/** * Deletes an existing AuthItem model. * If deletion is successful, the browser will be redirected to the 'index' page. * * @param string $id * @return mixed */ public function actionDelete($id) { $groupName = YiiForum::getGetValue('group'); $item = new Role(); $item->name = $id; $this->auth->remove($item); AuthItem::createCachedRoles(); return $this->redirect(['index', 'group' => $groupName]); }
public function actionEditPost($id) { if (!YiiForum::checkAuth('post_edit')) { return $this->noPermission(); } YiiForum::checkIsGuest(); $boardId = YiiForum::getGetValue('boardid'); $model = Post::findOne(['id' => $id]); $data = YiiForum::getPostValue('Post'); if ($data == null) { $thread = Thread::findOne(['id' => $model['thread_id']]); $locals = []; $locals['thread'] = $thread; $locals['currentBoard'] = $this->getBoard($boardId); $locals['model'] = $model; return $this->render('edit-post', $locals); } else { $model->load(Yii::$app->request->post()); $model->modify_time = TTimeHelper::getCurrentTime(); $model->save(); return $this->redirect(['view', 'id' => $model->thread_id]); } }