Exemplo n.º 1
0
 /**
  * Shows the issues view.
  *
  * @return \Illuminate\View\View
  */
 public function indexAction()
 {
     $state = Request::get('state');
     // Issue & Issue Project list.
     $usedIssueProjects = Issue::where('project_id', '>', 0)->where('state', '=', $state)->groupBy('project_id')->lists('project_id');
     $issueProjects = Project::whereIn('id', $usedIssueProjects)->get();
     return View::make('dashboard.issues.index')->withIssueProjects($issueProjects)->withPageTitle(trans('dashboard.issues.issues') . ' - ' . trans('dashboard.dashboard'));
 }
Exemplo n.º 2
0
 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // Default data
     $withData = ['systemStatus' => 'info', 'systemMessage' => trans('gitamin.service.bad'), 'favicon' => 'favicon-high-alert'];
     if (Project::notVisibilityLevel(1)->count() === 0) {
         // If all our projects are ok, do we have any non-fixed issues?
         $issues = Issue::orderBy('created_at', 'desc')->get();
         $issueCount = $issues->count();
         if ($issueCount === 0 || $issueCount >= 1 && (int) $issues->first()->visibility_level === 4) {
             $withData = ['systemStatus' => 'success', 'systemMessage' => trans('gitamin.service.good'), 'favicon' => 'favicon'];
         }
     } else {
         if (Project::whereIn('visibility_level', [2, 3])->count() > 0) {
             $withData['favicon'] = 'favicon-medium-alert';
         }
     }
     // Project & Project Team lists.
     $usedProjectTeams = Project::where('namespace_id', '>', 0)->groupBy('namespace_id')->lists('namespace_id');
     $projectTeams = ProjectNamespace::whereIn('id', $usedProjectTeams)->get();
     $unteamedProjects = Project::where('namespace_id', 0)->orderBy('created_at')->get();
     $view->with($withData)->withProjectTeams($projectTeams)->withUnteamedProjects($unteamedProjects);
 }
Exemplo n.º 3
0
 /**
  * Returns the projects a user is authorized to access.
  *
  * @return \Illuminate\Database\Eloquent\Relations\HasMany
  */
 public function authorized_projects()
 {
     $projectIds = ProjectMember::where('user_id', '=', $this->id)->where('target_type', '=', 'Project')->lists('target_id')->toArray();
     return Project::whereIn('id', $projectIds)->get();
 }