public function execute() { $lastMonth = date('Y-m-d', strtotime('-1 month')) . ' 00:00:00'; $issues = $this->issueService->getIssues(array('status=' => Issue::STATUS_RESOLVED, 'issue.updated < ' => $lastMonth)); foreach ($issues as $issue) { $issue->status = Issue::STATUS_CLOSED; $this->issueService->saveIssue($issue, false); echo "Closed request " . $issue->id . ": " . $issue->title . "\r\n"; } }
public function execute() { $server = za()->getConfig('support_mail_server'); $user = za()->getConfig('support_email_user'); $pass = za()->getConfig('support_email_pass'); if (!$server || !$user || !$pass) { // exit! throw new Exception("Configuration incorrect for checking issue emails"); } $emails = $this->emailService->readEmailFrom($server, $user, $pass, true); $this->issueService->processIncomingEmails($emails); }
public function execute() { $issues = $this->issueService->getIssues(array('status=' => 'Open')); // Get the project for each issue $group = $this->groupService->getGroupByField('title', za()->getConfig('issue_group')); if ($group) { $users = $this->groupService->getUsersInGroup($group); $msg = new TemplatedMessage('open-issues.php', array('issues' => $issues)); $this->notificationService->notifyUser('Open Requests', $users, $msg); } else { za()->log()->warn("Could not find group for sending issues to"); } }
/** * Get a list of the new issues * */ public function issuelistAction() { $from = za()->getUser()->getLastLogin(); $type = $this->_getParam('type'); $date = $type == 'new' ? 'issue.created' : 'issue.updated'; $this->view->issues = $this->issueService->getIssues(array($date . ' > ' => $from), "{$date} desc", 1, 10); $this->view->type = $type; $this->renderRawView('issue/ajax-issue-list.php'); }
/** * View a project. * */ public function viewAction() { $__start = getmicrotime(); $project = $this->projectService->getProject((int) $this->_getParam('id')); if ($project == null) { $this->flash("Project not found"); $this->renderView('error.php'); return; } $this->view->hideHeader = false; $totalCount = $this->projectService->getTaskCount(array('projectid =' => $project->id, 'complete=' => 0)); $this->view->taskPagerName = 'ptasks'; $currentPage = ifset($this->_getAllParams(), $this->view->taskPagerName, 1); $this->view->totalTasks = $totalCount; $this->view->taskListSize = za()->getConfig('project_task_list_size'); $this->view->displayedTasks = $this->projectService->getTasks(array('projectid =' => $project->id, 'complete=' => 0), 'due asc', $currentPage, za()->getConfig('project_task_list_size')); $totalCompleted = $this->projectService->getTaskCount(array('projectid =' => $project->id, 'complete=' => 1)); $this->view->completedPagerName = 'ctasks'; $currentPage = ifset($this->_getAllParams(), $this->view->completedPagerName, 1); $this->view->totalCompleted = $totalCompleted; $this->view->completedTasks = $this->projectService->getTasks(array('projectid =' => $project->id, 'complete=' => 1), 'due asc', $currentPage, za()->getConfig('project_task_list_size')); $this->view->projectStatusReports = $this->projectService->getStatusReports($project); $this->view->project = $project; $this->view->title = $project->title; $group = $this->groupService->getGroup($project->ownerid); if ($group == null) { $this->log->warn("Invalid project owner {$project->ownerid}"); } else { } $this->view->groupusers = $project->getUsers(); $this->view->users = $this->userService->getUserList(); $this->view->group = $group; $this->view->existingWatch = $this->notificationService->getWatch(za()->getUser(), $project); $this->view->projectuser = za()->getUser(); if ($this->_getParam('projectuser')) { if ($this->_getParam('projectuser') == 'all') { $this->view->projectuser = null; } else { $this->view->projectuser = $this->userService->getUser($this->_getParam('projectuser')); } } if ($this->view->projectuser && !isset($this->view->groupusers[$this->view->projectuser->id])) { $this->view->projectuser = null; } $where = array('projectid =' => $project->id); $new = $this->issueService->getIssues(array('projectid =' => $project->id, 'status =' => Issue::STATUS_NEW)); if (count($new)) { $this->view->newIssues = true; } else { $this->view->newIssues = false; } $this->view->issues = $this->issueService->getIssues($where); za()->recordStat('projectcontroller::setupview', getmicrotime() - $__start); $__start = getmicrotime(); if ($this->_getParam('_ajax')) { $this->renderRawView('project/ajaxView.php'); } else { $this->renderView('project/view.php'); } za()->recordStat('projectcontroller::viewrendered', getmicrotime() - $__start); }
protected function getChildDataProject(Project $project, $options = null) { $data = array(); switch ($options) { case 'subprojects': $children = $project->getSubProjects(); foreach ($children as $child) { $item = new stdClass(); $item->id = get_class($child) . '-' . $child->id; $item->text = $child->title . ' <a href="' . build_url('project', 'view', array('id' => $child->id)) . '"><img src="' . resource('images/bullet_go.png') . '" /></a>'; $item->expanded = false; $item->classes = "project-item iconed"; $item->hasChildren = true; $data[] = $item; } break; case 'milestones': $children = $project->getMilestones(); foreach ($children as $child) { $item = new stdClass(); $item->id = get_class($child) . '-' . $child->id . '-tasks'; $item->text = $child->title . ' <a href="' . build_url('project', 'view', array('id' => $child->id)) . '"><img src="' . resource('images/bullet_go.png') . '" /></a>'; $item->expanded = false; $item->classes = "tree-milestone iconed"; $item->hasChildren = true; $data[] = $item; } break; case 'features': $items = $this->featureService->getFeatures(array('projectid=' => $project->id)); foreach ($items as $child) { $item = new stdClass(); $item->id = get_class($child) . '-' . $child->id . '-tasks'; $item->text = $child->title . ' <a href="' . build_url('feature', 'edit', array('id' => $child->id)) . '"><img src="' . resource('images/bullet_go.png') . '" /></a>'; $item->expanded = false; $item->classes = "tree-feature iconed"; $item->hasChildren = true; $data[] = $item; } break; case 'requests': $items = $this->issueService->getIssues(array('projectid=' => $project->id, 'status <> ' => Issue::STATUS_CLOSED)); foreach ($items as $child) { $item = new stdClass(); $item->id = get_class($child) . '-' . $child->id . '-tasks'; $item->text = $child->title . ' <a href="' . build_url('issue', 'edit', array('id' => $child->id)) . '"><img src="' . resource('images/bullet_go.png') . '" /></a>'; $item->expanded = false; $item->classes = "tree-request iconed"; $item->hasChildren = true; $data[] = $item; } break; case 'tasks': $items = $this->projectService->getTasks(array('projectid=' => $project->id, 'complete=' => 0)); foreach ($items as $child) { $item = new stdClass(); $item->id = get_class($child) . '-' . $child->id . ''; ob_start(); $this->view->percentageBar($child->getPercentage()); $bar = ob_get_clean(); $item->text = $bar . $child->title . ' <a href="' . build_url('task', 'edit', array('id' => $child->id)) . '"><img src="' . resource('images/bullet_go.png') . '" /></a>'; $item->expanded = false; $item->classes = "tree-task iconed"; $item->hasChildren = false; $data[] = $item; } break; default: $subProjects = $project->getSubProjects(); if (count($subProjects)) { $option = new stdClass(); $option->text = 'Sub Projects'; $option->id = get_class($project) . '-' . $project->id . '-subprojects'; $option->classes = "tree-folder iconed"; $option->hasChildren = true; $data[] = $option; } if ($project->hasMilestones()) { $option = new stdClass(); $option->text = 'Milestones'; $option->id = get_class($project) . '-' . $project->id . '-milestones'; $option->classes = "tree-folder iconed"; $option->hasChildren = true; $data[] = $option; } // see if there are features $items = $this->featureService->getFeatures(array('projectid=' => $project->id)); if (count($items)) { $option = new stdClass(); $option->text = 'Features'; $option->id = get_class($project) . '-' . $project->id . '-features'; $option->classes = "tree-folder iconed"; $option->hasChildren = true; $data[] = $option; } // see if there are requests $items = $this->issueService->getIssues(array('projectid=' => $project->id, 'status <> ' => Issue::STATUS_CLOSED)); if (count($items)) { $option = new stdClass(); $option->text = 'Requests'; $option->id = get_class($project) . '-' . $project->id . '-requests'; $option->classes = "tree-folder iconed"; $option->hasChildren = true; $data[] = $option; } break; } return $data; }