/**
  * 增加资讯
  */
 public function cAdd()
 {
     if ($this->isPost()) {
         $this->_modelNews = $this->getGlobal('model/News', 'Model_News');
         $info = $this->_modelNews->add($_POST);
         if ($info['status'] == 1) {
             $this->success($info['info'], url('index/news/index'));
         } else {
             $this->error($info['info'], 2);
         }
     } else {
         $this->display(VIEW_PAGE);
     }
 }
예제 #2
0
파일: News.php 프로젝트: adrianpl20/oop
 public function action_add()
 {
     $model_News = new Model_News();
     // obsluga formularza
     if (isset($_POST['add'])) {
         $valid = $model_News->validation($_POST);
         if ($valid === TRUE) {
             $model_News->add($_POST);
         }
     }
     // wybieram widok
     $this->view = View::factory('template');
     // ustawiam dane w widoku
     $this->view->title = 'Dodaj artykuł';
     $this->view->content = View::factory('news/add');
     $this->view->content->valid = $valid;
 }