public function componentArchivedProjects()
 {
     if (!isset($this->target)) {
         $this->projects = TBGProject::getAllRootProjects(true);
         $this->project_count = count($this->projects);
     } elseif ($this->target == 'team') {
         $this->team = TBGContext::factory()->TBGTeam($this->id);
         $projects = array();
         foreach (TBGProject::getAllByOwner($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (TBGProject::getAllByLeader($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (TBGProject::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 = TBGContext::factory()->TBGClient($this->id);
         $projects = TBGProject::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 = TBGContext::factory()->TBGProject($this->id);
         $this->projects = $this->parent->getChildren(true);
     }
     $this->project_count = count($this->projects);
 }
 public function runDeleteClient(TBGRequest $request)
 {
     try {
         try {
             $client = TBGContext::factory()->TBGClient($request->getParameter('client_id'));
         } catch (Exception $e) {
         }
         if (!$client instanceof TBGClient) {
             throw new Exception(TBGContext::getI18n()->__("You cannot delete this client"));
         }
         if (TBGProject::getAllByClientID($client->getID()) !== null) {
             foreach (TBGProject::getAllByClientID($client->getID()) as $project) {
                 $project->setClient(null);
                 $project->save();
             }
         }
         $client->delete();
         return $this->renderJSON(array('success' => true, 'message' => TBGContext::getI18n()->__('The client was deleted')));
     } catch (Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('failed' => true, 'error' => $e->getMessage()));
     }
 }
            include_component('project/overview', array('project' => $aProject));
            ?>
</li>
						<?php 
        }
        ?>
						</ul>
						<div class="header" style="margin: 5px 5px 5px 0;"><?php 
        echo __('Milestones / sprints');
        ?>
</div>
						<?php 
        $milestone_cc = 0;
        ?>
						<?php 
        foreach (TBGProject::getAllByClientID($client->getID()) as $project) {
            ?>
							<?php 
            foreach ($project->getUpcomingMilestonesAndSprints() as $milestone) {
                ?>
								<?php 
                if ($milestone->isScheduled()) {
                    ?>
									<?php 
                    include_template('main/milestonedashboardbox', array('milestone' => $milestone));
                    ?>
									<?php 
                    $milestone_cc++;
                    ?>
								<?php 
                }
示例#4
0
 /**
  * Client Dashboard
  *  
  * @param TBGRequest $request
  */
 public function runClientDashboard(TBGRequest $request)
 {
     $this->client = null;
     try {
         $this->client = TBGContext::factory()->TBGClient($request['client_id']);
         $projects = TBGProject::getAllByClientID($this->client->getID());
         $final_projects = array();
         foreach ($projects as $project) {
             if (!$project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
         $this->forward403Unless($this->client->hasAccess());
     } catch (Exception $e) {
         return $this->return404(TBGContext::getI18n()->__('This client does not exist'));
         TBGLogging::log($e->getMessage(), 'core', TBGLogging::LEVEL_WARNING);
     }
 }