/** * 回复留言对话 */ public function actionReplyDialog() { if ($this->_isPost()) { $this->_modelVerify = $this->_getGlobalData('Model_Verify', 'object'); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $userClass = $this->_utilRbac->getUserClass(); $dataList = $this->_modelVerify->findById($_POST['Id']); $contentArr = $dataList['log']; if ($contentArr) { $contentArr = unserialize($contentArr); if (!is_array($contentArr)) { $contentArr = array(); } } else { $contentArr = array(); } if ($dataList['status'] != $_POST['status']) { //如果更改过状态 $newLog = $this->_addLog(array('status' => $_POST['status'], 'action' => 'modify')); array_push($contentArr, $newLog); } if ($dataList['department_id'] != $_POST['department_id']) { $department = $this->_getGlobalData('department'); $content = "to Dep <font color='#FF0000'><b>{$department[$_POST['department_id']]['name']}</b></font> "; if (empty($_POST['content'])) { $content = $this->_addLog(array('msg' => $content)); } } if (!empty($_POST['content'])) { //如果content不为空的话,就继续加留言 $content .= ':' . $_POST['content']; $content = $this->_addLog(array('msg' => $content)); } if (!empty($content)) { array_push($contentArr, $content); } $updateArr = array('log' => serialize($contentArr), 'department_id' => $_POST['department_id'], 'status' => $_POST['status']); if ($_POST['status'] == Model_Verify::FINISH_STATUS) { $updateArr['finish_user_id'] = $userClass['_id']; } if ($this->_modelVerify->update($updateArr, "Id={$_POST['Id']}")) { #------发送邮件------# $this->_utilUserMailManage = $this->_getGlobalData('Util_UserMailManage', 'object'); $this->_utilUserMailManage->addUser($dataList['user_id']); $mail = array('title' => "Buglist change status:{$dataList['title']}", 'href' => Tools::url(CONTROL, 'Detail', array('Id' => $dataList['Id'], 'work_order_id' => $dataList['work_order_id'])), 'type' => 3); $this->_utilUserMailManage->addMail($mail); $this->_utilUserMailManage->send(); #------发送邮件------# $this->_utilMsg->showMsg(false); } else { $this->_utilMsg->showMsg(Tools::getLang('ADD_MSG_ERROR', __CLASS__), -2); } } }
public function edit($postArr) { if (!$postArr) { return array('status' => 0, 'msg' => '请填定完成的资料'); } if (!$postArr['Id']) { return array('status' => 0, 'msg' => '您需要编辑的公告不存在'); } if (!$postArr['title']) { return array('status' => 0, 'msg' => '请填定完成的资料'); } if (!$postArr['content']) { return array('status' => 0, 'msg' => '请填定完成的资料'); } if ($postArr['kind'] == '') { return array('status' => 0, 'msg' => '请选择分类'); } if (!count($postArr['users'])) { return array('status' => 0, 'msg' => '请选择用户'); } $users = serialize($postArr['users']); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $userClass = $this->_utilRbac->getUserClass(); $updateArr = array(); $updateArr['user_id'] = $userClass['_id']; $updateArr['title'] = $postArr['title']; $updateArr['content'] = $postArr['content']; $updateArr['create_time'] = CURRENT_TIME; $updateArr['kind'] = $postArr['kind']; $updateArr['not_read'] = $users; if (parent::add($updateArr)) { $id = $this->returnLastInsertId(); #------向用户发送消息------# $sendMsg = array(); $sendMsg['type'] = $updateArr['kind'] ? '2' : '1'; $sendMsg['title'] = $postArr['title']; $sendMsg['href'] = Tools::url('ServiceTools', 'NoticeShow', array('Id' => $id, 'doaction' => 'show')); $this->_utilUserMailManage = $this->_getGlobalData('Util_UserMailManage', 'object'); $this->_utilUserMailManage->addUser($postArr['users']); $this->_utilUserMailManage->addMail($sendMsg); $this->_utilUserMailManage->send(); $error = $this->_utilUserMailManage->getFailureUser(); #------向用户发送消息------# $this->delById($postArr['Id']); $this->_modelBulletinDate = $this->_getGlobalData('Model_BulletinDate', 'object'); $this->_modelBulletinDate->addBulletin($id); return array('status' => 1, 'msg' => $error); } else { return array('status' => 0, 'msg' => '添加失败'); } }