コード例 #1
0
ファイル: Edit.php プロジェクト: veelko/money
 public function blog()
 {
     $blog_id = $this->input->get(0);
     $servarname = $_SERVER['SERVER_NAME'];
     $select = new \Models\Select();
     $this->view->blodData = $select->getBlogData($blog_id);
     if ($select->getAffectedRows() != 1) {
         header("Location: http://{$servarname}");
         /* Redirect browser */
         exit;
     }
     if ($this->input->post('edit')) {
         $name = $this->input->post('name');
         $description = $this->input->post('description');
         $link = $this->input->post('link');
         $create = new \Models\Manageblogs();
         $blogData = array('name' => $name, 'description' => $description, 'link' => $link);
         $check = $create->checkData($blogData);
         if ($check === true) {
             $create->updateBlog();
             header("Refresh:0");
             exit;
         } else {
             //returns an array with errors
             $this->view->errors = $create->getErrors();
         }
     }
     $this->view->appendToLayout('userbar', 'index.userbar');
     $this->view->appendToLayout('editblog', 'index.editblog');
     $this->view->display('index_in');
 }