Exemplo n.º 1
0
 protected function runTask(Project $project, Task $task)
 {
     // Add if the client has not already done so
     if (!$task->getProject()) {
         $task->setProject($project);
     }
     $task->main();
 }
Exemplo n.º 2
0
 public function addTask()
 {
     $projectId = $this->request_stack["arguments"][0];
     $task = new Task();
     $taskId = $task->setProject(ProjectQuery::create()->findOneById($projectId))->setEmployee(EmployeeQuery::create()->findOneById((new Cookie())->get("employee_id")))->save();
     $redirect = new Request();
     $redirect->redirect("task", "edit", array("id" => $task->getId()));
 }
Exemplo n.º 3
0
 /**
  * Executes initialization actions required to setup the data structures
  * related to the tag.
  * <p>
  * This includes:
  * <ul>
  * <li>creation of the task object</li>
  * <li>calling the setters for attributes</li>
  * <li>adding the task to the container object</li>
  * <li>adding a reference to the task (if id attribute is given)</li>
  * <li>executing the task if the container is the &lt;project&gt;
  * element</li>
  * </ul>
  *
  * @param string $tag The tag that comes in
  * @param array $attrs Attributes the tag carries
  * @throws ExpatParseException if attributes are incomplete or invalid
  */
 function init($tag, $attrs)
 {
     // shorthands
     try {
         $configurator = $this->configurator;
         $project = $this->configurator->project;
         $this->task = $project->createTask($tag);
     } catch (BuildException $be) {
         // swallow here, will be thrown again in
         // UnknownElement->maybeConfigure if the problem persists.
         print "Swallowing exception: " . $be->getMessage() . "\n";
     }
     // if the task is not known beforehand, wrap it
     // in an UnknownElement object to enable runtime configuration
     // NB: this is also done for ConditionBase objects to allow
     // dynamic conditions without breaking BC for all tasks
     if ($this->task === null) {
         $this->task = new UnknownElement($tag);
         $this->task->setProject($project);
         $this->task->setTaskType($tag);
         $this->task->setTaskName($tag);
     }
     // add file position information to the task (from parser)
     // should be used in task exceptions to provide details
     $this->task->setLocation($this->parser->getLocation());
     $configurator->configureId($this->task, $attrs);
     if ($this->container) {
         $this->container->addTask($this->task);
     }
     // Top level tasks don't have associated targets
     // FIXME: if we do like Ant 1.6 and create an implicitTarget in the projectconfigurator object
     // then we don't need to check for null here ... but there's a lot of stuff that will break if we
     // do that at this point.
     if ($this->target !== null) {
         $this->task->setOwningTarget($this->target);
         $this->task->init();
         $this->wrapper = $this->task->getRuntimeConfigurableWrapper();
         $this->wrapper->setAttributes($attrs);
         /*
         Commenting this out as per thread on Premature configurate of ReuntimeConfigurables 
         with Matthias Pigulla: http://phing.tigris.org/servlets/ReadMsg?list=dev&msgNo=251
         
         if ($this->parentWrapper !== null) { // this may not make sense only within this if-block, but it
                                             // seems to address current use cases adequately
             $this->parentWrapper->addChild($this->wrapper);
         }
         */
     } else {
         $this->task->init();
         $configurator->configure($this->task, $attrs, $project);
     }
 }
Exemplo n.º 4
0
 /**
  * @param $taskName
  * @param $taskDesc
  * @param $taskDueDate
  * @param $taskStatus
  * @param null $userId
  * @param null $projectId
  * @return bool
  * @throws \Exception
  */
 public function createTask($taskName, $taskDesc, $taskDueDate, $taskStatus, $userId = null, $projectId = null)
 {
     $task = new Task();
     $task->setTitle($taskName);
     $task->setDescription($taskDesc);
     $task->setDueDate(new \DateTime($taskDueDate));
     $task->setStatus($taskStatus);
     if ($projectId) {
         $project = $this->em->getRepository('AppBundle:Project');
         $task->setProject($project->find($project_id));
     }
     if ($userId) {
         $user = $this->em->getRepository('AppBundle:User');
         $task->setUser($user->find($useId));
     }
     try {
         $this->em->persist($task);
         $this->em->flush();
         return true;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Exemplo n.º 5
0
 /**
  * @see ProjectComponent::setProject()
  */
 public function setProject(Project $project)
 {
     parent::setProject($project);
     $this->fileset->setProject($project);
 }
Exemplo n.º 6
0
 public function addTask(Task $l)
 {
     $this->collTasks[] = $l;
     $l->setProject($this);
 }