コード例 #1
0
ファイル: FeatureController.php プロジェクト: nyeholt/relapse
 public function removetaskAction()
 {
     $thisFeature = $this->byId();
     $task = $this->byId($this->_getParam('otherid'), 'Task');
     $linkType = $this->_getParam('linktype');
     if ($thisFeature == null) {
         $this->flash('Invalid Feature specified');
         $this->redirect('feature', 'edit', array('id' => $this->_getParam('id'), '#features'));
         return;
     }
     if ($task == null) {
         $this->flash('Invalid task specified');
         $this->redirect('feature', 'edit', array('id' => $this->_getParam('id'), '#features'));
         return;
     }
     try {
         if ($linkType == 'to') {
             // okay, delete the link from the feature TO the task
             $this->itemLinkService->deleteLinkBetween($thisFeature, $task);
             $this->flash("Removed link between feature {$thisFeature->title} and task {$task->title}");
         }
     } catch (Exception $e) {
         $this->flash("Failed removing link between items: " . $e->getMessage());
     }
     $params = array('id' => $this->_getParam('id'), '#features');
     if ($this->_getParam('_ajax')) {
         $params['_ajax'] = 1;
     }
     $this->redirect('feature', 'edit', $params);
 }
コード例 #2
0
ファイル: IssueController.php プロジェクト: nyeholt/relapse
 /**
  * Delete a link between an issue and a feature
  */
 public function removefeatureAction()
 {
     $issue = $this->byId();
     $feature = $this->byId($this->_getParam('featureid'), 'Feature');
     $linkType = $this->_getParam('linktype');
     if ($issue == null) {
         $this->flash('Invalid Issue specified');
         $this->redirect('issue', 'edit', array('id' => $this->_getParam('id'), '#features'));
         return;
     }
     if ($issue == null || $feature == null) {
         $this->flash('Invalid Feature specified');
         $this->redirect('issue', 'edit', array('id' => $this->_getParam('id'), '#features'));
         return;
     }
     try {
         if ($linkType == 'to') {
             // okay, delete the link from the feature TO the issue
             $this->itemLinkService->deleteLinkBetween($feature, $issue);
             $this->flash("Removed link between feature {$feature->title} and issue {$issue->title}");
         } else {
             $this->itemLinkService->deleteLinkBetween($issue, $feature);
             $this->flash("Removed link between issue {$issue->title} and feature {$feature->title}");
         }
     } catch (Exception $e) {
         $this->flash("Failed removing link between items: " . $e->getMessage());
     }
     $this->redirect('issue', 'edit', array('id' => $this->_getParam('id'), '#features'));
 }
コード例 #3
0
ファイル: TaskController.php プロジェクト: nyeholt/relapse
 public function removelinkfromAction()
 {
     $to = $this->byId();
     $from = $this->byId($this->_getParam('fromid'), $this->_getParam('fromtype'));
     if ($to && $from) {
         try {
             $this->itemLinkService->deleteLinkBetween($from, $to);
             $this->flash("Successfully removed link from " . $from->title . " to " . $to->title);
         } catch (Exception $e) {
             $this->flash($e->getMessage());
         }
         if ($this->_getParam('_ajax')) {
             $this->redirect('task', 'edit', array('_ajax' => 1, 'id' => $to->id));
         } else {
             $this->_redirect($this->getCallingUrl());
         }
     }
 }