Exemplo n.º 1
0
 public function handleDeleteGoal($id, $order)
 {
     $data = $this->model->get($id);
     if (!$this->checkAvailability($data)) {
         $this->flashMessage("Cíl nelze smazat.", "danger");
     }
     try {
         $this->model->deleteGoal($id, $order);
         $this->flashMessage("Cíl {$order} byl odstraněn.", "success");
     } catch (Exception $e) {
         $this->flashMessage("Odstranění cíle {$order} se nepodařilo.", "success");
     }
     $this->template->goals = $this->model->getGoals($id);
     if ($this->isAjax()) {
         $this->redrawControl('goalList');
         $this->redrawControl('flashMessages');
     }
 }
Exemplo n.º 2
0
 public function handleDeleteGoal($id, $order)
 {
     $data = $this->model->get($id);
     if ($data && $data->works == 0 && ($this->user->isInRole("administrator") || $this->user->id == $data->user_id)) {
         try {
             $this->model->deleteGoal($id, $order);
             $this->flashMessage("Cíl {$order} byl odstraněn.", "success");
         } catch (Exception $e) {
             $this->flashMessage("Odstranění cíle {$order} se nepodařilo.", "success");
         }
     } else {
         $this->flashMessage("Cíl nelze smazat.", "danger");
     }
     $this->template->goals = $this->model->getGoals($id);
     if ($this->isAjax()) {
         $this->redrawControl('goalList');
         $this->redrawControl('flashMessages');
     }
 }