private function getForm() { $request = $this->getRequest(); $id = $request->getQuery('id'); if ($id) { $info = Model_Bulletin::getBulletin($id); } $this->view->page_num = $this->getRequest()->getRequest('page', 1); if (isset($info)) { $this->view->info = $info; $this->view->info['text'] = html_entity_decode($info['text'], ENT_QUOTES, 'utf-8'); $date = new JO_Date($info['datetime'], 'H:i dd MM yy'); $this->view->info['datetime'] = $date->toString(); } if ($id) { if ($request->getPost('name')) { $this->view->name = $request->getPost('name'); } elseif (isset($info)) { $this->view->name = $info['name']; } else { $this->view->name = ''; } if ($request->getPost('text')) { $this->view->text = $request->getPost('text'); } elseif (isset($info)) { $this->view->text = $info['text']; } else { $this->view->text = ''; } } }
/** * 用户读取文章ajax */ private function _userRead() { if ($this->_isAjax()) { $this->_modelBulletin = $this->_getGlobalData('Model_Bulletin', 'object'); $this->_modelBulletin->userRead($_GET['Id']); //当前登录用户读取$_GET['Id']邮件 } }
public function add($data) { if (Model_Bulletin::checkMail($data['email'])) { return false; } $db = JO_Db::getDefaultAdapter(); $db->insert('bulletin_emails', array('firstname' => $data['fname'], 'lastname' => $data['lname'], 'email' => $data['email'], 'bulletin_subscribe' => 'true')); }
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'); }