/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $meetingid = null; if ($request->has('meeting_id') && $request->meeting_id > 0) { $meetingid = $request->meeting_id; } $this->repository->RegisterNew(['subject_id' => $request->subject_id, 'subject_type' => $request->subject_type, 'subject_name' => Breadcrumbs::getSubjectName($request->subject_type, $request->subject_id), 'status' => $request->status, 'title' => $request->title, 'description' => $request->description, 'owner' => $request->owner, 'raised' => $request->raised, 'DueDate' => Carbon::parse($request->DueDate)->toDateTimeString(), 'meeting_id' => $meetingid, 'created_by' => Auth::id()]); flash()->success('Success', "New Assumption created successfully"); return redirect(Session::GetRedirect()); }
public function ProcessTheParsedFile($projectid) { $array = session('msimportarray'); //delete all previously imported items for this project $affected = DB::table('tasks')->where('subject_type', '=', 'Project')->where('subject_id', '=', $projectid)->where('imported', '=', 1)->delete(); //loop through and add the records $donearray = array(); $seq = 1; $parentUID = 0; foreach ($array as $mainitem) { foreach ($mainitem as $item) { //check if already added if (isset($donearray[$item['UID']])) { $parentUID = $item['UID']; continue; } $task = new Task(); $task->imported = 1; $task->subject_id = $projectid; $task->subject_type = 'Project'; $task->subject_name = Breadcrumbs::getSubjectName($task->subject_type, $task->subject_id); $task->status = 'Open'; $task->flag1 = $item['flag1']; $task->created_by = auth()->user()->id; $task->action_owner = auth()->user()->id; $task->title = $item['Name']; $task->description = 'Imported from MS Project'; if ($item['Milestone'] == '1') { $task->milestone = 1; $task->StartDate = Carbon::parse($item['Finish'])->toDateTimeString(); $task->EndDate = null; } else { $task->milestone = 0; $task->StartDate = Carbon::parse($item['Start'])->toDateTimeString(); $task->EndDate = Carbon::parse($item['Finish'])->toDateTimeString(); } $task->sequence = $seq; $task->UID = $item['UID']; $task->outlinenumber = $item['OutlineNumber']; $task->PercentComplete = $item['PercentComplete']; if ($item['OutlineLevel'] > 1) { //is a child $task->parentUID = $parentUID; } $task->save(); $donearray[$item['UID']] = 1; $parentUID = $item['UID']; $seq++; } } //return $array; flash()->success('Success', "Tasks imported successfully from the MS Project File"); return redirect()->action('TaskController@indexTask', ['Project', $projectid]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id, Request $request) { $subject = rag::findOrFail($id); $subjectid = $subject->subject_id; $subjecttype = $subject->subject_type; $title = "Edit RAG {$subject->title} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['RAGs', URL::action('RagController@index', [$subjecttype, $subjectid]), false]; $breadcrumbs[] = [$subject->title, '', true]; $subjecttype = 'Rag'; return view('Rags.show', compact('subject', 'title', 'breadcrumbs', 'subjectid', 'subjecttype')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id, Request $request) { $subject = Member::findOrFail($id); $subjectid = $subject->subject_id; $subjecttype = $subject->subject_type; $username = $subject->User->name; $title = "{$username} as {$subject->role} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['Members', URL::action('MemberController@indexMember', [$subjecttype, $subjectid]), false]; $breadcrumbs[] = [$username, '', true]; $subjecttype = 'Member'; return view('Members.show', compact('subject', 'title', 'breadcrumbs', 'subjectid', 'subjecttype')); }
public function show($id) { try { $subject = $this->repository->getByID($id); } catch (ModelNotFoundException $e) { return $this->indexall(); } $subjectid = $subject->subject_id; $subjecttype = $subject->subject_type; $title = "Edit " . $this->getItemName() . " {$subject->title} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid); $breadcrumbs = $this->getBaseBreadcrumb($subjecttype, $subjectid); $breadcrumbs[] = [$subject->title, '', true]; return view("{$this->viewRoot}.show", compact('subject', 'title', 'breadcrumbs')); }
public static function getBreadCrumb($subjecttype, $subjectid) { $breadcrumbs[] = ['Home', URL::asset('/home'), false]; switch ($subjecttype) { case "Program": $program = Program::findOrFail($subjectid); $programid = $program->id; $breadcrumbs[] = ['Programs', URL::asset('programs'), false]; $breadcrumbs[] = [$program->name, URL::asset('/') . "/programs/{$programid}", false]; return $breadcrumbs; break; case "WorkStream": $workstream = WorkStream::findOrFail($subjectid); $program = Program::findOrFail($workstream->program_id); $programid = $program->id; $workstreamid = $workstream->id; $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]; return $breadcrumbs; break; case "Project": $project = Project::findOrFail($subjectid); $workstream = WorkStream::findOrFail($project->work_stream_id); $program = Program::findOrFail($workstream->program_id); $programid = $program->id; $workstreamid = $workstream->id; $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[] = ['Projects', '', false]; $breadcrumbs[] = [$project->name, URL::asset('/') . "/programs/{$programid}/workstreams/{$workstreamid}/projects/{$project->id}", false]; return $breadcrumbs; break; case "Risk": $risk = Risk::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($risk->subject_type, $risk->subject_id); $breadcrumbs[] = ['Risks', '', false]; $breadcrumbs[] = [$risk->title, URL::asset('risks/') . "/{$risk->id}", false]; return $breadcrumbs; break; case "Action": $action = Action::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($action->subject_type, $action->subject_id); $breadcrumbs[] = ['Actions', URL::action('ActionController@index', [$action->subject_type, $action->subject_id]), false]; $breadcrumbs[] = [$action->title, '', false]; return $breadcrumbs; break; case "Rag": $rag = rag::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($rag->subject_type, $rag->subject_id); $breadcrumbs[] = ['RAGs', URL::action('RagController@index', [$rag->subject_type, $rag->subject_id]), false]; $breadcrumbs[] = [$rag->title, '', false]; return $breadcrumbs; break; case "Task": $task = Task::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($task->subject_type, $task->subject_id); $breadcrumbs[] = ['Tasks', URL::action('TaskController@indexTask', [$task->subject_type, $task->subject_id]), false]; $breadcrumbs[] = [$task->title, URL::asset('tasks/') . "/{$task->id}", false]; return $breadcrumbs; break; case "Dependency": $dependency = Dependency::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($dependency->subject_type, $dependency->subject_id); $breadcrumbs[] = ['Dependencies', URL::action('DependencyController@index', [$dependency->subject_type, $dependency->subject_id]), false]; $breadcrumbs[] = [$dependency->title, URL::asset('dependencies/') . "/{$dependency->id}", false]; return $breadcrumbs; break; case "ChangeRequest": $changerequest = ChangeRequest::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($changerequest->subject_type, $changerequest->subject_id); $breadcrumbs[] = ['Change Requests', URL::action('ChangeRequestController@index', [$changerequest->subject_type, $changerequest->subject_id]), false]; $breadcrumbs[] = [$changerequest->title, URL::asset('changerequests/') . "/{$changerequest->id}", false]; return $breadcrumbs; break; case "Link": $link = Link::findOrFail($subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($link->subject_type, $link->subject_id); $breadcrumbs[] = ['Links', URL::action('LinkController@index', [$link->subject_type, $link->subject_id]), false]; $breadcrumbs[] = [$link->title, URL::asset('links/') . "/{$link->id}", false]; return $breadcrumbs; break; } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($taskid, Request $request) { $subject = Task::findOrFail($taskid); $subjectid = $subject->subject_id; $subjecttype = $subject->subject_type; $title = "Task {$subject->title} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['Tasks', action('TaskController@indexTask', [$subjecttype, $subjectid]), false]; $breadcrumbs[] = [$subject->title, '', true]; return view('Tasks.show', compact('subject', 'title', 'breadcrumbs', 'subjectid', 'subjecttype')); }
protected function getBaseBreadcrumb($subjecttype, $subjectid, $active = false) { $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['Actions', URL::action('ActionController@index', [$subjecttype, $subjectid]), $active]; return $breadcrumbs; }
/** * @param Meeting $meeting * @param Request $request * @param bool $new */ protected function Save(Meeting $meeting = null) { $new = false; if (!isset($meeting)) { $meeting = new Meeting(); $new = true; } $request = request(); $alldayevent = $request->has('all_day_event') ? $request->all_day_event : 0; if ($new) { $meeting->subject_id = $request->subject_id; $meeting->subject_type = $request->subject_type; $meeting->subject_name = Breadcrumbs::getSubjectName($request->subject_type, $request->subject_id); } $meeting->title = $request->title; $meeting->all_day_event = $alldayevent; if ($alldayevent == 1) { $meeting->start_date = Carbon::parse($request->start_date)->toDateTimeString(); $meeting->duration = 24; } else { $startdate = $request->start_date . ' ' . $request->start_time; $meeting->start_date = Carbon::parse($startdate)->toDateTimeString(); $meeting->duration = $request->duration; } $meeting->owner = $request->owner; $meeting->description = $request->description; $meeting->save(); return $meeting; }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id, Request $request) { try { $changerequest = ChangeRequest::findOrFail($id); } catch (ModelNotFoundException $e) { abort(404, "Change Request with id {$id} not found"); } $subjectid = $changerequest->subject_id; $subjecttype = $changerequest->subject_type; $subjectname = Breadcrumbs::getSubjectName($subjecttype, $subjectid); $title = "Edit Change Request {$changerequest->title} for {$changerequest->subject_type} {$subjectname}"; $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['Change Requests', URL::action('ChangeRequestController@index', [$subjecttype, $subjectid]), true]; $breadcrumbs[] = [$changerequest->title, URL::action('ChangeRequestController@show', [$id]), false]; $breadcrumbs[] = ['Edit', '', false]; return view('ChangeRequests.edit', compact('changerequest', 'title', 'breadcrumbs', 'subjectid', 'subjecttype', 'subjectname')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id, Request $request) { //$risk = Risk::findOrFail($id); $subject = Risk::where('id', $id)->with('AuditTrail')->first(); $risksubjectid = $subject->subject_id; $risksubjecttype = $subject->subject_type; $title = "Risk {$subject->title} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($risksubjecttype, $risksubjectid); $breadcrumbs = Breadcrumbs::getBreadCrumb($risksubjecttype, $risksubjectid); $breadcrumbs[] = ['Risks', '', false]; $breadcrumbs[] = [$subject->title, '', true]; $subjecttype = 'Risk'; //return $risk; return view('RisksAndIssues.show', compact('subject', 'title', 'breadcrumbs', 'risksubjectid', 'risksubjecttype', 'subjecttype')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($program_id, $work_stream_id, $subjectid, Request $request) { $subject = Project::findOrFail($subjectid); $workstreamname = $this->getWorkstream($work_stream_id)->name; $title = "Edit Task {$subject->name} for {$workstreamname} Workstream"; $breadcrumbs = Breadcrumbs::getBreadCrumb('WorkStream', $work_stream_id); $breadcrumbs[] = ['Projects', '', false]; $breadcrumbs[] = [$subject->name, '', false]; $breadcrumbs[] = ['edit', '', false]; return view('Project.edit', compact('program_id', 'work_stream_id', 'title', 'breadcrumbs', 'subject')); }
/** * @param $subjecttype * @param $subjectid * * @return array */ protected function GetBaseBreadcrumb($subjecttype, $subjectid) { $breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid); $breadcrumbs[] = ['Dependencies', URL::action('DependencyController@index', [$subjecttype, $subjectid]), true]; return $breadcrumbs; }