/** * Get a bunch of data prepared for the view */ protected function prepareForEdit() { if ($this->view->model == null) { throw new Exception("Task not found!"); } // check the existence of the client to add this contact to $pid = (int) $this->_getParam('projectid') ? (int) $this->_getParam('projectid') : $this->view->model->projectid; $project = new Project(); if ($pid) { $project = $this->projectService->getProject($pid); } $this->view->project = $project; $this->view->projectUsers = $this->projectService->getProjectUsers($project); $this->view->activeTasks = array(); if ($project->id) { $this->view->projects = $this->projectService->getProjectsForClient($project->clientid); $this->view->activeTasks = $this->projectService->getActiveProjectTasks($project); } else { $this->view->projects = new ArrayObject(); } $this->view->categories = $this->view->model->constraints['category']->getValues(); $this->view->clients = $this->clientService->getClients(); $this->view->model->tags = ""; if ($this->view->model->id) { $this->view->notes = $this->notificationService->getNotesFor($this->view->model); $this->view->existingWatch = $this->notificationService->getWatch(za()->getUser(), $this->view->model->id, 'Task'); $this->view->allUsers = $this->userService->getUserList(); $this->view->subscribers = $this->notificationService->getSubscribers($this->view->model->id, 'Task'); $tags = $this->tagService->getItemTags($this->view->model); $tagStr = ""; $sep = ""; foreach ($tags as $tag) { $tagStr .= $sep . $tag->tag; $sep = ','; } $this->view->model->tags = $tagStr; // get all the issues that triggered this task $this->view->issues = $this->itemLinkService->getLinkedItemsOfType($this->view->model, 'to', 'Issue'); $this->view->features = $this->itemLinkService->getLinkedItemsOfType($this->view->model, 'to', 'Feature'); // get selectable features based on the milestont this project is in. $this->view->selectableFeatures = $project->getFeatures(); $client = $this->clientService->getClient($project->clientid); // get all the requests for the given client $this->view->selectableRequests = $client->getIssues(); } }