protected function renderContent() { //登录 $params = $this->params; $model = new PeopleBoard(); $data = $model->findAllData($params); $data['more_link'] = $params['more_link']; $data['htmlOptions'] = $this->getClientOptions(); if ($params['object_type'] == 'mentor') { $lecturer_id = $params['object_id']; $data['isUserReply'] = PeopleBoard::model()->isUserReply($lecturer_id); $data['action'] = $this->controller->createUrl('ajax/boardReply'); } $this->render('WPeopleBoard', $data); }
public function actionBoardDelete() { $params = array('board_reply' => $_POST['board_reply'], 'object_type' => $_POST['object_type'], 'object_id' => $_POST['object_id']); $pk = $_POST['people_pk']; $PeopleBoard = new PeopleBoard(); $model = $PeopleBoard->findByPk($pk); if (!empty($model)) { //当导师未回复前,发表者允许删除. 导师可以自己删除回复 if ($model->isDeleteAccess()) { $model->deleteMark(); YiicmsHelper::ok('删除成功。'); } } YiicmsHelper::error('回复失败,可能留言不存在。'); }
public function actionDelete() { /* $params = array( 'board_reply' => $_POST['board_reply'], 'object_type' => $_POST['object_type'], 'object_id' => $_POST['object_id'], ); */ $pk = $_GET['people_pk']; $PeopleBoard = new PeopleBoard(); $model = $PeopleBoard->findByPk($pk); if (!empty($model)) { //当导师未回复前,发表者允许删除. 导师可以自己删除回复 if ($model->isDeleteAccess()) { $model->deleteMark(); } } $refer = Yii::app()->request->urlReferrer; $this->redirect($refer); }
/** * 查找某个对象留言信息(书籍、视频、导师) */ public function findPeopleBoard($params) { if (empty($params)) { return null; } $criteria = new CDbCriteria(); $criteria->condition = 'object_type = :object_type AND object_id = :object_id'; $criteria->params = array(':object_type' => $params['object_type'], ':object_id' => $params['object_id']); $model = PeopleBoard::model()->find($criteria); return $model; }