Esempio n. 1
0
 /**
  * 关闭/重开图度(讨论)
  */
 public function closeAction()
 {
     $tuduId = $this->_request->getParam('tid');
     $isClose = (bool) $this->_request->getParam('isclose');
     // 参数:图度ID必须存在
     if (!$tuduId) {
         return $this->json(false, $this->lang['invalid_tuduid']);
     }
     $tudu = $this->manager->getTuduById($tuduId, $this->_user->uniqueId);
     // 图度必须存在
     if (null == $tudu) {
         return $this->json(false, $this->lang['tudu_not_exists']);
     }
     // 图度不能是已确定状态
     if ($tudu->isDone && $isClose) {
         return $this->json(false, $this->lang['discuss_is_closed']);
     }
     // 操作人必须为图度发起人
     if ($tudu->sender != $this->_user->userName) {
         return $this->json(false, $this->lang['perm_deny_close_tudu']);
     }
     // 执行关闭/重开图度操作
     $ret = $this->manager->closeTudu($tuduId, $isClose);
     if (!$ret) {
         return $this->json(false, $this->lang['']);
     }
     // 添加操作日志
     $this->_writeLog(Dao_Td_Log_Log::TYPE_TUDU, $tuduId, $isClose ? Dao_Td_Log_Log::ACTION_CLOSE : Dao_Td_Log_Log::ACTION_OPEN, array('isdone' => $isClose));
     return $this->json(true, $this->lang['state_success']);
 }