Example #1
0
 protected function post()
 {
     global $routes;
     /* get list or nothing */
     parent::get();
     ListModel::delete($this->list['id']);
     header('Location: ' . $routes['lists']);
 }
Example #2
0
 public function post()
 {
     global $user, $routes;
     parent::get();
     $item_id = isset($_POST['item_id']) ? $_POST['item_id'] : null;
     $is_checked = isset($_POST['checked']) ? $_POST['checked'] : null;
     if (!empty($item_id) && !empty($is_checked)) {
         ItemModel::mark_completed($item_id, $is_checked == 1 ? true : false);
         $this->context['success'] = true;
     }
 }
Example #3
0
 public function post()
 {
     global $user, $routes;
     parent::get();
     $content = $_POST['content'];
     $this->is_json = isset($_GET['json']);
     if (isset($content) && !empty($content)) {
         ItemModel::add($this->list['id'], $content);
         if (!$this->is_json) {
             header('Location: ' . $routes['list_view'] . '?id=' . $this->list['id']);
         } else {
             $r = array('success' => true, 'item_name' => $content, 'list_id' => $this->list['id']);
             header('Content-Type: application/json');
             echo json_encode($r);
         }
     }
 }