コード例 #1
0
ファイル: IdeasPresenter.php プロジェクト: rawac/agenda
 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');
     }
 }
コード例 #2
0
ファイル: IdeasPresenter.php プロジェクト: hajek-raven/agenda
 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');
     }
 }