Пример #1
0
 /**
  * function report()
  * A function that is similar to search()
  * But this function will return in a new page for print and report purpose.
  * @return string		string of the contents
  */
 public function report()
 {
     $dataProcess = new DataProcess(trim($_POST['ticketNumber']), trim($_POST['passengerName']), trim($_POST['rloc']), trim($_POST['date-from-field']), trim($_POST['date-to-field']), trim($_POST['system-selector']));
     $ticketNumber = $dataProcess->getTicketNumber();
     $passengerName = $dataProcess->getPassengerName();
     $rloc = $dataProcess->getRloc();
     $fromDate = $dataProcess->getNewFromDate();
     $toDate = $dataProcess->getNewToDate();
     if (empty($ticketNumber . $passengerName . $rloc . $fromDate . $toDate)) {
         return View::make('date', array('long' => 'Please enter at least one search condition.', 'back' => true));
     }
     $query = Document::query();
     $dataProcess->getQuery($query);
     $model = $query->orderBy('dateString', 'asc')->orderBy('documents_id', 'asc')->get();
     if (sizeof($model) > 0) {
         $longString = null;
         foreach ($model as $key => $value) {
             $document = $value->getAttributes();
             $content = "<div>" . $document['fileContent'] . "</div><hr>";
             $longString .= $content;
         }
     } else {
         $longString = 'Sorry the document does not exist, or hasn not been update yet, please click update and try again.';
     }
     return View::make('date', array('long' => $longString, 'back' => false));
 }