function perform()
 {
     // set display requirements
     $result = array('renderer' => 'template_renderer.inc', 'pageTitle' => SITE_NAME . ' : Add Date Criteria', 'content' => 'content/reportFormDate.php');
     // don't lose the db!
     $db = $_REQUEST['db'];
     // where are we?
     $userFinder = new UserFinder($db);
     $user = $userFinder->findById($_SESSION['userId']);
     $library = $user['library_short_name'];
     $libraryID = $user['library_id'];
     $result['library_id'] = $libraryID;
     $result['library'] = $library;
     $result['user'] = $user;
     $report_id = grwd('report_id');
     $result['report_id'] = $report_id;
     // get all the info on the reports
     $reportFinder = new ReportFinder($db);
     $reportCount = $reportFinder->getReportCount();
     $result['reportCount'] = $reportCount;
     // get the information for the chosen report by requiring Reports.php and all the reports
     $report_class_handle = new Report();
     $report_class_get = $report_class_handle->get();
     // declare the report class by using it's ID
     $report_info = new $report_id();
     $result['reportList'] = $report_info->info();
     $libraryFinder = new LibraryFinder($db);
     $result['libraryList'] = $libraryFinder->getAllLibraries();
     $locationFinder = new LocationFinder($db);
     $result['locationList'] = $locationFinder->getAllLocations();
     return $result;
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $reports = Report::get();
     foreach ($reports as $report) {
         $report->query = self::migrateQuery((array) $report->query);
         $report->save();
     }
     $this->info('Migrated ' . count($reports) . ' reports.');
 }
 function perform()
 {
     // set display requirements
     $result = array('renderer' => 'template_renderer.inc', 'pageTitle' => SITE_NAME . ' : Finished Report', 'content' => 'content/reportReturn.php');
     // don't lose the db!
     $db = $_REQUEST['db'];
     // where are we?
     $userFinder = new UserFinder($db);
     $user = $userFinder->findById($_SESSION['userId']);
     $result['user'] = $user;
     // gather posted data
     $date1 = trim(grwd('date1'));
     $date2 = trim(grwd('date2'));
     if ($date1 == '') {
         $date1 = '1/1/1990';
     }
     if ($date2 == '') {
         $date2 = 'now';
     }
     $report_id = grwd('report_id');
     $library_id_post = grwd('library_id') + 0;
     $location_id_post = grwd('location_id') + 0;
     // function to sanity check dates
     $date1 = makeDateSane($date1);
     $date1 = date('Y-m-d G:i:s', strtotime($date1));
     $date2 = makeDateSane($date2);
     $date2 = date('Y-m-d G:i:s', strtotime($date2));
     $startDate = array('database_field' => 'questions.question_date', 'relation' => '>=', 'value' => $date1, 'type' => 'DATE');
     $endDate = array('database_field' => 'questions.question_date', 'relation' => '<=', 'value' => $date2, 'type' => 'DATE');
     $library_id = array('database_field' => 'questions.library_id', 'relation' => '=', 'value' => $library_id_post, 'type' => 'INT');
     $location_id = array('database_field' => 'questions.location_id', 'relation' => '=', 'value' => $location_id_post, 'type' => 'INT');
     // pull together all of the search criteria
     $criteria = array('start_date' => $startDate, 'end_date' => $endDate, 'library_id' => $library_id, 'location_id' => $location_id);
     $sql = " WHERE questions.delete_hide = 0 ";
     $i = 0;
     $param = array();
     foreach ($criteria as $value) {
         if (!$value["value"]) {
             continue;
         }
         $sql .= 'AND' . ' ' . $value["database_field"] . ' ' . $value["relation"] . ' ? ';
         $param[$i] = $value["value"];
         $i++;
     }
     // get the relevant data from the Report class
     $reportFinder = new ReportFinder($db);
     $reportCount = $reportFinder->getReportCount();
     $reportQuestionCount = $reportFinder->getReportQuestionCount($sql, $param);
     // call the specific class of the report
     $report_class_handle = new Report();
     $report_class_get = $report_class_handle->get();
     $report_info = new $report_id();
     // declare the report class by using it's ID
     $result['reportList'] = $report_info->info();
     // start preparing the report for processing
     $reportPerform = new $_REQUEST["report_id"]($db);
     $reportResults = $reportPerform->perform($sql, $param);
     $libraryFinder = new LibraryFinder($db);
     $reportLibName = $libraryFinder->getLibraryName($library_id_post);
     if (isset($location_id_post)) {
         $locationFinder = new LocationFinder($db);
         $reportLocName = $locationFinder->getLocation($location_id_post);
     }
     // prepare $results
     // since a CSV report is handled differently with the headers, configure the report here
     if ($report_id == "DataCSVReport" || isset($_REQUEST["csv_export"])) {
         $result['renderer'] = 'template_csv.inc';
         $result['content'] = 'content/outputCSV.php';
     }
     $result['report_id'] = $report_id;
     $result['date1'] = $date1;
     $result['date2'] = $date2;
     $result['library_id'] = $library_id;
     $result['library_id_post'] = $library_id_post;
     $result['library_name'] = $reportLibName;
     $result['location_id'] = $location_id;
     $result['location_id_post'] = $location_id_post;
     $result['location_name'] = $reportLocName;
     $result['reportCount'] = $reportCount;
     $result['reportQuestionCount'] = $reportQuestionCount;
     $result['reportResults'] = $reportResults;
     $result['criteria'] = $criteria;
     $result['sql'] = $sql;
     return $result;
 }
 /**
  * Display a listing of the resource.
  * GET /reports
  *
  * @return Response
  */
 public function index()
 {
     return Report::get();
 }
Пример #5
0
<?php

require_once 'lib/init.php';
Report::get()->destroy();
redirect("index.php");
Пример #6
0
 public function singlePost($id)
 {
     $post = Post::find($id);
     $data['date'] = $this->getBaseDateTime();
     if ($post == null) {
         return null;
     }
     if (Auth::check()) {
         if ($post->type == '0') {
             $post = Post::join('users', 'users.id', '=', 'posts.user_id')->select('posts.*')->where('posts.id', $id)->where('users.disable', '0')->whereType('0')->whereIn('posts.user_id', function ($query) {
                 $query->select('friend_id')->from('friend_list')->whereUserId(Auth::user()->id);
             })->orWhere('posts.user_id', Auth::user()->id)->where('users.disable', '0')->whereType('0')->where('posts.id', $id)->first();
             if ($post == null) {
                 return null;
             }
         }
         //
         $now = Carbon::parse($post->created_at);
         $feeling = DB::table('feelings')->find($post->feeling)->name;
         $following = Following::whereFollowerId(Auth::user()->id)->whereFollowingId($post->user_id)->get()->count();
         $confession = Confession::whereUserId($post->user_id)->first();
         if ($confession) {
             $confess_time = Carbon::parse($confession->created_at);
             $confess_time = $confess_time->diffInHours();
             //$confess_time = $confess_time->diffInSeconds();
             if ($confess_time < 24) {
                 if ($confession->updated_at < $post->created_at) {
                     $confession = $confession->confess;
                 } else {
                     $confession = null;
                 }
             } else {
                 $confession = null;
             }
         }
         $user = User::find($post->user_id);
         $url = Picture::find($user->picture);
         $url = $url->url;
         $text = htmlentities($post->post);
         // 9-2-Start
         $pos = strpos($text, 'watch?v=');
         if ($pos != 0) {
             $pos = $pos + 8;
             $str = substr($text, $pos, 11);
             # code...
         } else {
             $str = null;
         }
         // 9-2-End
         $data['post'] = array('id' => $post->id, 'post' => $text, 'user_id' => $post->user_id, 'img' => asset($url), 'confess' => $confession, 'following' => $following, 'type' => $post->type, 'like' => Like::wherePostId($post->id)->get()->count(), 'dislike' => Dislike::wherePostId($post->id)->get()->count(), 'liked' => Like::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'disliked' => Dislike::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'comment' => Comment::wherePostId($post->id)->get()->count(), 'feeling' => $feeling, 'vidsrc' => $str, 'ago' => $now->diffForHumans());
         $data['notifications'] = $this->getNotification();
         //
     } else {
         if ($post->type == '0') {
             return null;
         }
         //
         $now = Carbon::parse($post->created_at);
         $feeling = DB::table('feelings')->find($post->feeling)->name;
         $following = null;
         $confession = Confession::whereUserId($post->user_id)->first();
         if ($confession) {
             $confess_time = Carbon::parse($confession->created_at);
             $confess_time = $confess_time->diffInHours();
             //$confess_time = $confess_time->diffInSeconds();
             if ($confess_time < 24) {
                 if ($confession->updated_at < $post->created_at) {
                     $confession = $confession->confess;
                 } else {
                     $confession = null;
                 }
             } else {
                 $confession = null;
             }
         }
         $user = User::find($post->user_id);
         $url = Picture::find($user->picture);
         $url = $url->url;
         $text = htmlentities($post->post);
         // 9-2-Start
         $pos = strpos($text, 'watch?v=');
         if ($pos != 0) {
             $pos = $pos + 8;
             $str = substr($text, $pos, 11);
             # code...
         } else {
             $str = null;
         }
         //9-2-End
         $data['post'] = array('id' => $post->id, 'post' => $text, 'user_id' => $post->user_id, 'img' => asset($url), 'confess' => $confession, 'following' => $following, 'type' => $post->type, 'like' => Like::wherePostId($post->id)->get()->count(), 'dislike' => Dislike::wherePostId($post->id)->get()->count(), 'liked' => 0, 'disliked' => 0, 'comment' => Comment::wherePostId($post->id)->get()->count(), 'feeling' => $feeling, 'vidsrc' => $str, 'ago' => $now->diffForHumans());
         //
         $data['notifications'] = ['length' => 0, 'notifications' => null];
     }
     $data['single'] = 1;
     $data['reports'] = Report::get();
     // return json_encode($data['']);
     return View::make('single')->withData($data);
 }
Пример #7
0
<?php

require_once "lib/init.php";
$report = Report::get();
expects(array("section" => "int?"));
class ReportPDF extends TCPDF
{
    public function _setup()
    {
        $this->setPrintHeader(false);
        $this->setPrintFooter(true);
        $this->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $this->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $this->SetMargins(PDF_MARGIN_LEFT, 0, PDF_MARGIN_RIGHT);
        $this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $this->setImageScale(1.4);
        $this->setFontSubsetting(true);
        $this->SetFont('helvetica', '', 14, '', true);
    }
    public function Footer()
    {
        global $report;
        // Position at 15 mm from bottom
        $this->SetY(-15);
        $content3 = $report->find_contents(3);
        if ($content3 !== NULL) {
            $client_ref = $content3->data['client_ref'];
        }
        // Page number
        $this->writeHTMLCell(0, 0, '', '', "\n\t\t\t<hr /><br /><table width=100% style='font-size:16pt'><tr><td align=left>REPORT REFERENCE: " . htmlspecialchars($client_ref) . "</td><td width='50%' align='right'><p align=right>PAGE " . $this->getAliasNumPage() . " OF " . $this->getAliasNbPages() . "</p></td></tr></table>\n\t\t", 0, 1, 0, true, '', true);
Пример #8
0
<?php

require_once 'includes/session.php';
//Imports
require_once 'includes/db.php';
require_once 'includes/Checklist.php';
require_once 'includes/ChecklistItem.php';
require_once 'includes/Employee.php';
require_once 'includes/Report.php';
$con = connect_db();
$report = new Report();
$report->date = date('Y-m-d');
$report->get($con);
$con->close();
?>

<!DOCTYPE html>
<html>
<head>
	<title>Vehicle Checklist</title>
	
	<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
	
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
	<link href="css/style.css" rel="stylesheet" />	

	<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
	<script src="js/script.js" defer="defer"></script>
 public function get_by_id($id)
 {
     $order = new Report($this, array("Id" => $id));
     $order->get();
     return $order;
 }
Пример #10
0
<?php

include 'mainHeader.php';
// get all the infomation about the various reports to display in a list
$report_handle = new Report();
$report_list = $report_handle->get();
sort($report_list);
?>

<h3>Please choose from these <?php 
echo count($report_list);
?>
 reports.</h3>
<?php 
// loop through list and display all reports
for ($i = 0; $i < count($report_list); $i++) {
    $temp_report = new $report_list[$i]();
    $temp_info = $temp_report->info();
    ?>
<div class="report">
  <h3><?php 
    echo $i + 1;
    ?>
) <a href="reportAddDate.do?&amp;report_id=<?php 
    echo $report_list[$i];
    ?>
"/><?php 
    echo $temp_info["name"];
    ?>
</a></h3>
  <div><?php