public function editAction() { $id = $_GET['id']; $model = Doctrine_Core::getTable("DBModel_GovPublic")->find($id); if ($this->isPost()) { $model->title = $_POST['title']; $model->author = $_POST['author']; $model->content = $_POST['editor_content']; $model->save(); $model->free(); $this->redirect("gov"); } $editor = new Das_CKEditor(); $this->view->editor = $editor->init($model->content); $this->view->data = $model->toArray(); $cats = Doctrine_Core::getTable('DBModel_GovPublicCat')->findAll(); $this->view->cats = $cats; $this->view->render("govpublicedit.html"); }
public function editAction() { $editor = new Das_CKEditor(); $id = $_GET['id']; $q = Doctrine_Query::create()->from('DBModel_Faq')->where('id = ? ', $id)->fetchOne(); $this->view->data = $q; $this->view->editor = $editor->init($this->view->data['content']); if ($this->isPost()) { $p = $_POST; $q->free(); $q = Doctrine_Query::create(); $q->update('DBModel_Faq'); $q->set('title', '?', $p['title']); $q->set('content', '?', $p['editor_content']); $q->where('id =?', $id); $q->execute(); $this->redirect("faq"); } $this->view->render("noteedit.html"); $q->free(); }
public function addAction() { if ($this->isPost()) { $post = $_POST; $cond = Zend_Validate::is($post['title'], 'StringLength', array(1, 999)); if (!$cond) { $this->error("标题错误", "标题长度不够"); } $cond = Zend_Validate::is($post['editor_content'], 'StringLength', array(1, 50000)); if (!$cond) { $this->error("内容错误", "内容长度不够"); } $sendto = $post['sendto']; $sendto = implode(",", $sendto); $model = new DBModel_XFile(); $model->title = $post['title']; $model->content = str_replace("'", "", $post['editor_content']); $model->author = $post['author']; $model->is_xfwj = $post['xfwj']; $model->sendto = $sendto; $model->Department = Doctrine_Core::getTable("DBModel_Department")->find($this->view->login->department_id); $model->user_id = $this->view->login->id; $model->post_time = new Doctrine_Expression("NOW()"); $model->save(); $model->free(); $this->redirect("XFile", "index"); } $editor = new Das_CKEditor(); $this->view->editor = $editor->init(); $query = Doctrine_Query::create()->from('DBModel_Department'); $department = $query->execute()->toArray(); $this->view->department = $department; $this->view->render("xfileedit.html"); }