Example #1
0
 public function addchildAction()
 {
     $project = $this->projectService->getProject((int) $this->_getParam('projectid'));
     if ($project == null) {
         $this->flash("Project not found");
         $this->renderView('error.php');
         return;
     }
     $isMilestone = $this->_getParam('milestone', 0);
     $newChild = null;
     if ($isMilestone) {
         $dateDue = $this->_getParam('due');
         $newChild = $this->projectService->createMilestone($project, $this->_getParam('newTitle'), $dateDue);
         $this->redirect('project', 'view', array('id' => $project->id));
     } else {
         // now create a sub-project and redirect to it
         $newChild = $this->projectService->createSubProject($project, $this->_getParam('newTitle'));
         $this->redirect('project', 'view', array('id' => $newChild->id));
     }
 }