コード例 #1
0
 function update_category()
 {
     $data = $this->get_json_object();
     if (!isset($data)) {
         return false;
     }
     if (!isset($data->CategoryType) || !$this->is_valid_category_type($data->CategoryType)) {
         return false;
     }
     $this->load->model('Category_model', '', true);
     $category = new Category_model();
     Model_base::map_objects($category, $data);
     $result = $this->Category_model->udpate_category($category);
     if (!$result) {
         return false;
     }
     echo json_encode($result);
     return $result;
 }
コード例 #2
0
 function update_post()
 {
     $data = $this->get_json_object();
     if (!isset($data)) {
         echo false;
         return false;
     }
     if (!isset($data->PostType) || !$this->is_valid_post_type($data->PostType)) {
         return false;
     }
     $this->load->model('Post_model', '', true);
     $post = new Post_model();
     Model_base::map_objects($post, $data);
     $result = $this->Post_model->udpate_post($post);
     if (!$result) {
         return false;
     }
     echo json_encode($result);
 }
コード例 #3
0
 function update_account()
 {
     $data = $this->get_json_object();
     if (!isset($data)) {
         return false;
     }
     if (!$this->is_valid_account_type($data->AccountType)) {
         return false;
     }
     $this->load->model('Account_model', '', true);
     $account = new Account_model();
     Model_base::map_objects($account, $data);
     //update photo
     if (!$this->upload_user_image($account)) {
         return false;
     }
     $result = $this->Account_model->update_account($account);
     if (!$result) {
         return false;
     }
     echo json_encode($result);
 }