예제 #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $this->assertTrue($this->object->install());
     $this->assertTrue($this->object->update('0.1.0'));
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     $this->assertTrue($this->object->uninstall());
     StaticEventManager::resetInstance();
 }
예제 #2
0
 public function edit($blog, $id)
 {
     if (!empty($blog)) {
         $Blog = new Blog($this->plural_resorce, $this->option, $this->db);
         $sql = $Blog->update($blog, $id);
         mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
         header('Location:../index');
         exit;
     }
 }
예제 #3
0
 public function update()
 {
     $blog = new Blog(_post('blog'));
     $blog->trim();
     if (!$blog->validate_update()) {
         $this->flash->add('message_error', $blog->errors->get_messages());
         $this->back();
     }
     $blog->update();
     $this->redirect_to('/blog/index');
 }
 public function edit($id, $blog)
 {
     if (empty($blog)) {
         // ページに初めて訪れた際
         $blog_record = $this->show($id);
         $blog = mysqli_fetch_assoc($blog_record);
         return $blog;
     } elseif (!empty($blog)) {
         // 情報を編集し送信した際
         $id = array('id' => $id);
         $blog = array_merge($id, $blog);
         $Blog = new Blog($this->plural_resource);
         $sql = $Blog->update($blog);
         mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
         header("Location: ../index");
     }
 }
예제 #5
0
 public function edit($id)
 {
     if (empty($_POST)) {
         $blog_record = $this->show($id);
         $blog = mysqli_fetch_assoc($blog_record);
         return $blog;
     } else {
         if (!empty($_POST)) {
             $blog = $_POST;
             $id = array('id' => $id);
             $blog = array_merge($id, $blog);
             $Blog = new Blog($this->table_name, $this->action);
             $sql = $Blog->update($blog);
             mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
             header("Location: ../index");
         }
     }
 }
예제 #6
0
 function update_photo()
 {
     include_once '/kunden/homepages/0/d643120834/htdocs/config/index.php';
     $config = new Blog();
     $res = $config->update('user_profiles', 'photo', $_POST['photo'], $_POST['user_name']);
     // print_r($res);
     if ($res == true) {
         echo "Profile Successfully Updated!";
     } else {
         echo "Something Went Wrong!";
     }
 }
예제 #7
0
 public function update($id, $title, $body)
 {
     //モデル呼び出し
     $blog = new Blog();
     $this->editOption = $blog->update($id, $title, $body);
     header('Location: /seed_blog/blogs/index');
 }
예제 #8
0
 public function updateAction()
 {
     if (empty($_GET['id'])) {
         return false;
     }
     $Blog = new Blog($this->_db, new User($this->_db, $_SESSION['user']['id']));
     $Blog->debug();
     // make sure they own the blog post
     $post = $Blog->find(array('id' => abs($_GET['id'])));
     if (empty($post[0]) || $post[0]['users_id'] != $_SESSION['user']['id']) {
         $this->_template->hud = array('class' => 'error', 'message' => 'You do not own this post!');
         return false;
     }
     if (!empty($_POST['submit'])) {
         $bind = array();
         foreach ($Blog->columns() as $key => $val) {
             if (isset($_POST[$val])) {
                 $bind[$val] = $_POST[$val];
             }
         }
         $bind['unixtime'] = time();
         if ($Blog->update($bind, abs($_GET['id']))) {
             $this->_template->hud = array('class' => 'success', 'message' => 'Post updated!');
         } else {
             $this->_template->hud = array('class' => 'error', 'message' => 'There was an error updating the post!');
         }
     }
     $post = $Blog->find(array('id' => abs($_GET['id'])));
     if (!empty($post[0])) {
         $this->_template->post = $post[0];
     }
 }
예제 #9
0
 public function update($id, $post)
 {
     $blog = new Blog();
     $blog->update($id, $post);
     // indexへ遷移
     header('Location: /seed_blog/blogs/index/');
 }
예제 #10
0
 public function update($id, $post)
 {
     $blog = new Blog();
     $blog->update($id, $post);
     // var_dump($this->viewOptions);
     // アクション名を設定する
     // $this->action ='edit';
     // indexへ遷移
     header('Location: /seed_blog/blogs/index/');
 }