Ejemplo n.º 1
0
 public function delete($cod = null)
 {
     if (is_null($cod)) {
         Redirect::to('404.html');
     } else {
         $agencia = Tour::where('codAgencia', '=', $cod)->firstOrFail();
         if (is_object($agencia)) {
             $agencia->estado = '0';
             $agencia->save();
             return Redirect::to('agencias');
         }
     }
 }
Ejemplo n.º 2
0
 public function thankyou($payment_reference = null, $charge = null)
 {
     $charge = Session::get('charge');
     $payment_reference = Session::get('payment_reference');
     if ($payment_reference) {
         $booking = Booking::find($payment_reference);
         $booking->receipt = array('stripe_id' => $charge->id, 'payment_reference' => Session::get('payment_reference'), 'amount' => $charge->amount);
         $booking->save();
         Tour::where('dates.id', (int) $booking->tour_date)->decrement('dates.$.spaces');
         $tour = Tour::find($booking->id);
         Mail::send('emails.stripebooking', compact('booking', 'tour'), function ($message) {
             $message->to('*****@*****.**', 'Not Normal Tours')->subject('New Booking at Not Normal Tours');
         });
         return View::make('pages.thankyou');
     }
     return View::make('pages.thankyou');
 }
Ejemplo n.º 3
0
 /**
  * @param $compet
  * @return bool
  */
 private function saveTour($compet)
 {
     // Delete Tour qui sont supérieur au compet->nbtour
     Tour::where('compet_id', '=', $compet->id)->where('num', '>', $compet->nbtours)->delete();
     for ($t = 1; $t <= $compet->nbtours; $t++) {
         $tour = Tour::where('compet_id', '=', $compet->id)->where('num', '=', $t)->first();
         if ($tour) {
             $tour->datetour = $compet->date->addDays($t - 1);
             $tour->save();
         } else {
             $tour = new Tour();
             $tour->compet_id = $compet->id;
             $tour->num = $t;
             $tour->datetour = $compet->date->addDays($t - 1);
             $tour->save();
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function tourDetail($country = '', $tour = '', $tour_type = '')
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $filter_tours = Tour::where('val', 1)->get();
     $filter_cities = City::where('val', 1)->get();
     if (!empty($country)) {
         $country = str_replace('-', ' ', $country);
         $get_country_id = DB::table('countries')->where('country', 'LIKE', $country)->first();
         $country_id = $get_country_id->id;
     }
     if (!empty($tour)) {
         $tour = str_replace('-', ' ', $tour);
         $get_tour_id = DB::table('tours')->where('tour_title', 'LIKE', $tour)->first();
         $tour_id = $get_tour_id->id;
     }
     if (!empty($tour_type)) {
         $tour_type = str_replace('-', ' ', $tour_type);
         $get_tour_type_id = DB::table('tour_types')->where('tour_type_title', 'LIKE', $tour_type)->first();
         $tour_type_id = $get_tour_type_id->id;
     }
     $path = array();
     $tour = Tour::where('id', $tour_id)->where('val', 1)->get();
     $tour_type = TourType::where('id', $tour_type_id)->where('val', 1)->first();
     //        dd(DB::getQueryLog());
     if (!$tour_type->count()) {
         return Redirect::to('/403');
     }
     return View::make('tour.tour_details')->with(array('tour' => $tour, 'tour_id' => $tour_id, 'tour_type_id' => $tour_type_id, 'path' => $path, 'tour_type' => $tour_type, 'st_date' => $st_date, 'ed_date' => $ed_date, 'filter_tours' => $filter_tours, 'filter_cities' => $filter_cities));
 }
Ejemplo n.º 5
0
<?php

$param = $dsp->var['param'];
$tours = Tour::where('compet_id', '=', $param['compet_id'])->get();
?>

{{ openContent($param['titre']) }}

    <?php 
// Open Form
Xform::form('route', 'tour.formule');
// Hidden
Xform::startRow('hidden');
Xform::addText('_token', 'x', Session::getToken(), 2);
Xform::addText('backUrl', '', $param['backUrl']);
Xform::addText('compet_id', 'COMPET_ID', $param['compet_id'], 1);
Xform::endRow();
?>

    @foreach($tours as $tour)

        <?php 
$t = $tour->num;
// Hidden
Xform::startRow('hidden');
Xform::addText('id[' . $t . ']', 'ID', $tour->id, 2);
Xform::endRow();
// Get Fields
Xform::startRow();
Xform::addDate('datetour[' . $t . ']', 'Date', $tour->datetour, 2);
Xform::addSelect('formulecompet_id[' . $t . ']', $tour->compet->typecompet->listFormules(), 'Formule de jeu', $tour->formulecompet_id, 3);
Ejemplo n.º 6
0
 function viewTours($idAdvice)
 {
     $adviceDetails = AdviceDetail::where('id_advice', $idAdvice)->get();
     //=============
     $questionAnswerLoc = AdviceDetail::where('id_advice', $idAdvice)->where('id_question', 1)->first();
     $location = Location::join(Answer::getTableName(), Answer::getTableName() . '.name', '=', Location::getTableName() . '.code')->where(Answer::getTableName() . '.id', $questionAnswerLoc->id_answer)->select(Location::getTableName() . '.*')->first();
     $tours = Tour::where('start_loc', $location->id)->get();
     $listAnsOfNotFactor = $adviceDetails->filter(function ($row) {
         return !in_array($row->id_question, Question::$_rootQuestionID);
     });
     if ($listAnsOfNotFactor->count() > 0) {
         $arrAnsPoint = $this->scoreAnswer($listAnsOfNotFactor->lists('id_answer'));
         $arrAnsPoint = $this->interaction($arrAnsPoint);
         $lisIDAvailable = [];
         foreach ($arrAnsPoint as $idAns => $item) {
             if ($item['point']) {
                 $lisIDAvailable[] = TourScore::where('id_answer', $idAns)->where('score', '>=', $item['point'])->whereIn('id_tour', $tours->lists('id'))->select('id_tour')->lists('id_tour');
             }
         }
         $fileInput = public_path('z1.txt');
         $fileOutput = public_path('z2.txt');
         if (file_exists($fileInput)) {
             unlink($fileInput);
         }
         foreach ($lisIDAvailable as $list) {
             if ($list) {
                 file_put_contents($fileInput, implode(' ', $list) . "\n", FILE_APPEND);
             }
         }
         $cmd = 'java -jar spmf.jar run FPGrowth_itemsets ' . $fileInput . ' ' . $fileOutput . ' 50%';
         exec($cmd);
         $file = fopen($fileOutput, 'r');
         $arrID = [];
         while (!feof($file)) {
             $line = fgets($file);
             if ($line) {
                 preg_match('/(.*)#SUP(.*)/', $line, $matches);
                 $strID = trim($matches[1]);
                 $arrID = array_merge($arrID, explode(' ', $strID));
                 $arrID = array_unique($arrID);
             }
         }
         $tableLocation = Location::getTableName();
         $tours = Tour::whereIn(Tour::getTableName() . '.id', $arrID)->join($tableLocation, "{$tableLocation}.id", '=', 'start_loc')->get([Tour::getTableName() . '.*', $tableLocation . '.name as locationName']);
         return View::make('advice.tour', compact('tours'));
     }
 }