Example #1
0
 public function componentArchivedProjects()
 {
     if (!isset($this->target)) {
         $this->projects = entities\Project::getAllRootProjects(true);
         $this->project_count = count($this->projects);
     } elseif ($this->target == 'team') {
         $this->team = entities\Team::getB2DBTable()->selectById($this->id);
         $projects = array();
         foreach (entities\Project::getAllByOwner($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByLeader($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByQaResponsible($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach ($this->team->getAssociatedProjects() as $project_id => $project) {
             $projects[$project_id] = $project;
         }
         $final_projects = array();
         foreach ($projects as $project) {
             if ($project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
     } elseif ($this->target == 'client') {
         $this->client = entities\Client::getB2DBTable()->selectById($this->id);
         $projects = entities\Project::getAllByClientID($this->client->getID());
         $final_projects = array();
         foreach ($projects as $project) {
             if (!$project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
     } elseif ($this->target == 'project') {
         $this->parent = entities\Project::getB2DBTable()->selectById($this->id);
         $this->projects = $this->parent->getChildren(true);
     }
     $this->project_count = count($this->projects);
 }
Example #2
0
 /**
  * Team Dashboard
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runTeamDashboard(framework\Request $request)
 {
     try {
         $this->team = entities\Team::getB2DBTable()->selectById($request['team_id']);
         $this->forward403Unless($this->team->hasAccess());
         $projects = array();
         foreach (entities\Project::getAllByOwner($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByLeader($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByQaResponsible($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach ($this->team->getAssociatedProjects() as $project_id => $project) {
             $projects[$project_id] = $project;
         }
         $final_projects = array();
         foreach ($projects as $project) {
             if (!$project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
         $this->users = $this->team->getMembers();
     } catch (\Exception $e) {
         framework\Logging::log($e->getMessage(), 'core', framework\Logging::LEVEL_WARNING);
         return $this->return404(framework\Context::getI18n()->__('This team does not exist'));
     }
 }