Exemplo n.º 1
0
 /**
  * 添加公告
  */
 private function _add()
 {
     #------初始化------#
     $this->_modelBulletin = $this->_getGlobalData('Model_Bulletin', 'object');
     #------初始化------#
     if ($this->_isPost()) {
         $data = $this->_modelBulletin->add($_POST);
         if ($data['status'] == 1) {
             $this->_utilMsg->showMsg($data['msg'], 1, Tools::url(CONTROL, 'NoticeShow'));
         } else {
             $this->_utilMsg->showMsg($data['msg'], -2);
         }
     } else {
         $this->_view->assign('selectKind', $this->_modelBulletin->createBulletinKind());
         //分类
         #------显示分组用户------#
         $this->_modelOrg = $this->_getGlobalData('Model_Org', 'object');
         $orgList = $this->_modelOrg->findUsersToCache();
         //获取所有用户,按分组来显示
         $this->_view->assign('org', $orgList);
         #------显示分组用户------#
         $this->_view->set_tpl(array('body' => 'ServiceTools/Add.html'));
         $this->_utilMsg->createNavBar();
         $this->_view->display();
     }
 }
Exemplo n.º 2
0
 public function bulletinAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->isPost()) {
         $error = array();
         if (!Model_Users::ValidMail($request->getPost('bulletin_email'))) {
             JO_Session::set('msg_error_bulletin', $this->translate('You must fill valid email'));
             JO_Session::set('data_bulletin', $request->getParams());
         } elseif (!Model_Bulletin::checkMail($request->getPost('bulletin_email'))) {
             Model_Bulletin::add(array('fname' => $request->getPost('bulletin_fname'), 'lname' => $request->getPost('bulletin_lname'), 'email' => $request->getPost('bulletin_email')));
             JO_Session::set('msg_success_bulletin', $this->translate('You have been successfully added into our newsletter'));
         } else {
             JO_Session::set('msg_error_bulletin', $this->translate('The email is already in our newsletter'));
             JO_Session::set('data_bulletin', $request->getParams());
         }
     }
     $this->redirect($request->getServer('HTTP_REFERER') . '#bulletin');
 }