Exemplo n.º 1
0
 public function Programs()
 {
     $userid = $this->id;
     return Program::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($programid, $workstreamid, $subjectid)
 {
     $program = Program::findOrFail($programid);
     $workstream = WorkStream::where('id', $workstreamid)->with('RAGs', 'Risks', 'Projects.RAGs', 'Members.User', 'Tasks.ActionOwner')->first();
     $subject = Project::where('id', $subjectid)->with('RAGs', 'Risks', 'Members.User', 'Tasks.ActionOwner', 'Comments')->first();
     $subjecttype = 'Project';
     $subjectid = $subject->id;
     return view('Project.show', compact('program', 'workstream', 'subject', 'subjecttype', 'subjectid'));
 }
Exemplo n.º 3
0
 public function OpenLoadForm($projectID)
 {
     //get the project
     try {
         $project = Project::findOrFail($projectID);
     } catch (ModelNotFoundException $e) {
         abort(404, "Project with the id {$projectID} not found");
     }
     $program = Program::findOrFail($project->program_id);
     $workstream = WorkStream::findOrFail($project->work_stream_id);
     return view('Project.UploadMicrosoftProjectPlan', compact('project', 'workstream', 'program'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $subject = Program::where('id', $id)->with('RAGs', 'Risks', 'Members.User', 'Tasks.ActionOwner')->first();
     if (!$subject) {
         abort(404, 'Program not found');
     }
     //get worksteams for this program
     //todo : Move this to a seperate model to ensure single responsibility.  Should add number of active projects to the workstream list.  Maybe a nice small char
     $workstreams = WorkStream::where('program_id', $id)->orderBy('phase')->orderBy('status')->orderBy('name')->with('RAGs', 'Risks', 'Members.User')->get();
     //return $program->Tasks;
     $subjecttype = 'Program';
     $subjectid = $subject->id;
     return view('Program.show', compact('subject', 'workstreams', 'subjecttype', 'subjectid'));
 }
 public function show($programid, $workstreamid)
 {
     try {
         $program = Program::findOrFail($programid);
     } catch (ModelNotFoundException $e) {
         App::abort(404, 'Program not found');
     }
     $subject = WorkStream::where('id', $workstreamid)->with('RAGs', 'Risks', 'Projects.RAGs', 'Members.User', 'Tasks.ActionOwner')->first();
     if (!$subject) {
         App::abort(404, 'WorkStream not found');
     }
     $subjecttype = 'WorkStream';
     $subjectid = $subject->id;
     return view('workstream.show', compact('program', 'subject', 'subjecttype', 'subjectid'));
 }
Exemplo n.º 6
0
 public static function GetObject($subject_type, $subject_id)
 {
     switch ($subject_type) {
         case 'Program':
             return Program::findorFail($subject_id);
             break;
         case 'WorkStream':
             return WorkStream::findorFail($subject_id);
             break;
         case 'Project':
             return Project::findorFail($subject_id);
             break;
         case 'Risk':
             return Risk::findorFail($subject_id);
             break;
         case 'Task':
             return Task::findorFail($subject_id);
             break;
         case 'Action':
             return Action::findorFail($subject_id);
             break;
         case 'Rag':
             return rag::findorFail($subject_id);
             break;
         case 'Dependency':
             return Dependency::findorFail($subject_id);
             break;
         case 'ChangeRequest':
             return ChangeRequest::findorFail($subject_id);
             break;
         case 'Meeting':
             return Meeting::findorFail($subject_id);
             break;
         case 'Link':
             return Link::findorFail($subject_id);
             break;
         case 'Assumption':
             return Assumption::findorFail($subject_id);
             break;
         case 'Decision':
             return Decision::findorFail($subject_id);
             break;
         default:
             return null;
     }
 }
 public function editWorkstreamRiskOrIssue($programid, $workstreamid, $riskid)
 {
     $program = Program::findOrFail($programid);
     $workstream = WorkStream::findOrFail($workstreamid);
     $risk = Risk::findorFail($riskid);
     //return "Owner id: $risk->owner , Owner Name: $risk->OwnerName";
     $title = "Edit {$risk->title} for the {$workstream->name} Workstream";
     $breadcrumbs[] = ['Home', URL::asset('/home'), false];
     $breadcrumbs[] = ['Programs', URL::asset('programs'), false];
     $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false];
     $breadcrumbs[] = ['Workstreams', '', false];
     $breadcrumbs[] = [$workstream->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}", false];
     $breadcrumbs[] = ['Risks & Issues', '', false];
     $breadcrumbs[] = [$risk->title, '', false];
     $breadcrumbs[] = ['Edit', URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}/risksandissues/{$riskid}/edit", true];
     $redirect = "/programs/{$programid}/workstreams/{$workstreamid}";
     //return $risk->NextReviewDate;
     return $this->edit($risk, $title, $breadcrumbs, $redirect);
 }
Exemplo n.º 8
0
 public function dashboard($userid)
 {
     $user = User::findOrFail($userid);
     //get programs, workstreams and projects that the user is a member of
     $programs = Program::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     $workstreams = WorkStream::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     $projects = Project::whereHas('Members', function ($q) use($userid) {
         $q->where('user_id', $userid);
     })->get();
     //get tasks for the user
     $tasks = Task::where('action_owner', $userid)->get();
     //Get the users actions
     $actions = Action::where('actionee', $userid)->get();
     //Get risks and issues assigned to the user
     $risks = Risk::where('owner', $userid)->orWhere('action_owner', $userid)->get();
     //return $risks;
     return view('Users.dashboard', compact('user', 'programs', 'workstreams', 'projects', 'tasks', 'risks', 'actions'));
 }
Exemplo n.º 9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('programs')->delete();
     Program::create(array('name' => 'One Biology', 'Status' => 0, 'RAG' => 'G', 'StartDate' => date_create('01/05/2010'), 'EndDate' => date_create('01/01/2018'), 'description' => 'One Biology R&D change program to deliver the future trialing processes, ways of working and tools'));
     Program::create(array('name' => 'MINT', 'Status' => 0, 'RAG' => 'A', 'StartDate' => date_create('01/02/2009'), 'EndDate' => date_create('01/01/2017'), 'description' => 'Material Identity aNd Tracking R&D change program'));
 }
Exemplo n.º 10
0
 public static function getSubjectName($subjecttype, $subjectid)
 {
     switch ($subjecttype) {
         case "Program":
             $program = Program::findOrFail($subjectid);
             return $program->name;
             break;
         case "WorkStream":
             $workstream = WorkStream::findOrFail($subjectid);
             return $workstream->name;
             break;
         case "Project":
             $project = Project::findOrFail($subjectid);
             return $project->name;
             break;
         case "Risk":
             $risk = Risk::findOrFail($subjectid);
             return $risk->title;
             break;
         case "Rag":
             $rag = rag::findOrFail($subjectid);
             return $rag->title;
             break;
         case "Task":
             $task = Task::findOrFail($subjectid);
             return $task->title;
             break;
         case "Dependency":
             $dependency = Dependency::findOrFail($subjectid);
             return $dependency->title;
             break;
         case "ChangeRequest":
             $changerequest = ChangeRequest::findOrFail($subjectid);
             return $changerequest->title;
             break;
         case "Meeting":
             $meeting = Meeting::findOrFail($subjectid);
             return $meeting->title;
             break;
         case "Action":
             $action = Action::findOrFail($subjectid);
             return $action->title;
             break;
         case "Link":
             $link = Link::findOrFail($subjectid);
             return $link->title;
             break;
         case "Assumption":
             $assumption = Assumption::findOrFail($subjectid);
             return $assumption->title;
             break;
     }
 }