Esempio n. 1
0
    public function getIncidents()
    {
        $incidents = ITP::select(['ID', 'Title', 'ReportingOrg', 'ImpactDescription', 'BriefDescription', 'IncidentLevel', 'Date', 'Section', 'IncidentOwner', 'Engineer', 'IncidentStatus']);
        $datatables = Datatables::of($incidents)->editColumn('BriefDescription', function ($incident) {
            return '
					<div class="text-semibold"><a href="./incident/' . $incident->ID . '/edit">' . str_limit($incident->Title, 40) . '</a></div>
                    <div class="text-muted">' . str_limit($incident->BriefDescription, 80) . '</div>
				';
        })->removeColumn('Title');
        if ($months = $datatables->request->get('months')) {
            $datatables->where(function ($query) use($months) {
                foreach ($months as $month) {
                    $query->orWhereRaw('MONTH(Date) = ' . $month);
                }
            });
        }
        if ($quarters = $datatables->request->get('quarters')) {
            $datatables->where(function ($query) use($quarters) {
                foreach ($quarters as $quarter) {
                    $query->orWhereRaw('MONTH(Date) = ' . $quarter);
                }
            });
        }
        if ($years = $datatables->request->get('years')) {
            $datatables->where(function ($query) use($years) {
                foreach ($years as $year) {
                    $query->orWhereRaw('YEAR(Date) = ' . $year);
                }
            });
        }
        return $datatables->make(true);
    }
Esempio n. 2
0
 public function time()
 {
     $timeString = ITP::select('ID', 'ImpactDuration')->get();
     foreach ($timeString as $time) {
         preg_match('([a-Z])', $time->ImpactDuration, $matches);
         echo $time->ID . " ";
         //            print_r($matches);
         echo filter_var($time->ImpactDuration, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
         echo " ";
         print_r($matches);
         echo "<br>";
     }
 }
Esempio n. 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id, Request $request)
 {
     $data['request'] = $request;
     $data['incident'] = ITP::findOrFail($id);
     $data['reportingOrgs'] = ITP::select('ReportingOrg')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('ReportingOrg')->get();
     $data['buildings'] = ITP::select('Building')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('Building')->get();
     $data['ImpactDescriptions'] = ITP::select('ImpactDescription')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('ImpactDescription')->get();
     $data['IncidentLevels'] = ITP::select('IncidentLevel')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('IncidentLevel')->get();
     $data['Sections'] = ITP::select('Section')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('Section')->get();
     $data['IncidentOwner'] = ITP::select('IncidentOwner')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('IncidentOwner')->get();
     $data['Engineers'] = ITP::select('Engineer')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('Engineer')->get();
     $data['RootCauses'] = ITP::select('RootCause')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('RootCause')->get();
     $data['IncidentStatus'] = ITP::select('IncidentStatus')->where('Date', '>=', '2015-01-01')->distinct()->orderBy('IncidentStatus')->get();
     return view('incident.edit.edit', $data);
 }