Ejemplo n.º 1
0
 /**
  ** Function to plot graphs
  ***/
 public function index()
 {
     if (isset($_POST) && !empty($_POST['datepickerfrom']) && !empty($_POST['datepickerto'])) {
         $datefrom = $_POST['datepickerfrom'];
         $dateto = $_POST['datepickerto'];
     }
     $projectsArray = Project::all();
     /**Get all projects from databa se */
     $result_array = Report::all();
     if (!empty($result_array)) {
         foreach ($result_array as $key => $res) {
             $project[$key]['name'] = $res['name'];
             $projects[$key]['id'] = $res['id'];
         }
     } else {
         echo '<p class="error_msg">No data available in this range</p> <p>Please click <a href="?controller=pages&action=reportdata">Report</a> to select another range</p>';
         exit;
     }
     $date_range = $this->getDatesFromRange($datefrom, $dateto);
     $xaxis_data = json_encode($date_range);
     for ($rs = 0; $rs < count($project); $rs++) {
         foreach ($date_range as $dt) {
             $bugs[$rs] = Report::find($projects[$rs]['id'], $dt);
             $project[$rs]['data'][] = intval($bugs[$rs][$projects[$rs]['id']]['bugs']);
         }
     }
     $result_array = json_encode($project);
     require_once 'views/reports/index.php';
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     /*$reports = [];
     		$trafficjams = TrafficJam::where('clear_by', '>=', date('Y-m-d H:i:s', time()))->get();
     		foreach ($trafficjams as $value) {
     			array_push($reports, $value->report);
     		}*/
     $reports = [];
     $report = Report::all();
     foreach ($report as $key) {
         if ($key->clear_by >= date('Y-m-d H:i:s', time()) || $key->type == 'Accident' || $key->type == 'Road Block') {
             array_push($reports, $key);
         }
     }
     return Response::json(array('report' => $reports), 200);
 }
Ejemplo n.º 3
0
<?php

require_once 'lib/init.php';
$reports = Report::all("updated_at DESC");
view("index", array("reports" => $reports));
Ejemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $reports = $this->report->all();
     return View::make('reports.index', compact('reports'));
 }