コード例 #1
0
ファイル: carsnodes.php プロジェクト: SerdarSanri/LextJS
 public function put_index()
 {
     $data = file_get_contents('php://input');
     $temp = json_decode($data);
     $new = Cars::find($temp->id);
     $new->text = $temp->text;
     $new->parent_id = $temp->parentId;
     $new->save();
     $array = array('success' => 'true');
     $json = json_encode($array);
     return $json;
 }
コード例 #2
0
ファイル: carsgrid.php プロジェクト: SerdarSanri/LextJS
 public function put_index()
 {
     $data = file_get_contents('php://input');
     $temp = json_decode($data);
     $new = Cars::find($temp->id);
     $new->id = $temp->id;
     $new->manufacturer = $temp->manufacturer;
     $new->model = $temp->model;
     $new->year = $temp->year;
     $new->save();
     $array = array('success' => 'true');
     $json = json_encode($array);
     return $json;
 }
コード例 #3
0
 public function indexAction()
 {
     $this->view->cars = Cars::find(array("order" => "ID DESC"));
 }
コード例 #4
0
 public function saveCar()
 {
     $carId = Input::get('car_id');
     $name = Input::get('name');
     $brand = Input::get('brand');
     $model = Input::get('model');
     $registration = Input::get('registration');
     $policeNumber = Input::get('police_number');
     $uberNumber = Input::get('uber_number');
     try {
         $car = Cars::find($carId);
         $car->name = $name;
         $car->brand = $brand;
         $car->model = $model;
         $car->registration = $registration;
         $car->police_number = $policeNumber;
         $car->uber_number = $uberNumber;
         $car->save();
         $result = array('success' => true);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
         $result = array('success' => false);
     }
     return $result;
 }
コード例 #5
0
ファイル: phql-186.php プロジェクト: aodkrisda/phalcon-code
<?php

$cars = Cars::find(array("order" => "name"));
foreach ($cars as $car) {
    echo "Name: ", $car->name, "\n";
}
コード例 #6
0
ファイル: phql-544.php プロジェクト: aodkrisda/phalcon-code
<?php

$messages = null;
$process = function () use(&$messages) {
    foreach (Cars::find("id > 101") as $car) {
        $car->price = 15000;
        if ($car->save() == false) {
            $messages = $car->getMessages();
            return false;
        }
    }
    return true;
};
$success = $process();
コード例 #7
0
ファイル: HomeController.php プロジェクト: neutt22/gibx-rfc
 public function getCompare()
 {
     $brand = e(Input::get('car'));
     $year = e(Input::get('year'));
     $model = e(Input::get('model'));
     $location = e(Input::get('location'));
     $usage = e(Input::get('usage'));
     $coverage = e(Input::get('coverage'));
     $car_id = Cars::where('brand', '=', $brand)->where('year', '=', $year)->where('model', '=', $model)->get()->first()->id;
     $insurers = Cars::find($car_id)->insurers;
     $message = "Sending an email with the following:<br/><br/>";
     $message .= "Your Car: {$brand}<br/>";
     $message .= "Year: {$year}<br/>";
     $message .= "Model: {$model}<br/>";
     $message .= "Location: {$location}<br/>";
     $message .= "Usage: {$usage}<br/>";
     $message .= "coverage: {$coverage}<br/><br/>";
     $message .= "<table border=1>";
     $message .= "<tr>";
     $message .= "<th>";
     $message .= "Original FMV";
     $message .= "</th>";
     $message .= "<th>";
     $message .= "Computed Qoutes";
     $message .= "</th>";
     $message .= "<th>";
     $message .= "Insurer";
     $message .= "</th>";
     $message .= "<th>";
     $message .= "";
     $message .= "</th>";
     $message .= "</tr>";
     $additional = 0;
     if ($location === "luzon") {
         $additional += 0.01;
     }
     if ($usage === "private") {
         $additional += 0.02;
     }
     if ($coverage === "yes") {
         $additional += 0.024;
     }
     foreach ($insurers as $insurer) {
         $message .= "<tr>";
         $message .= "<td>";
         $message .= number_format($insurer->fmv * 1000000, 2);
         $message .= "</td>";
         $message .= "<td>";
         $fmv_computed = $insurer->fmv + $additional;
         $message .= number_format($fmv_computed * 1000000, 2);
         $message .= "</td>";
         $message .= "<td>";
         $message .= $insurer->insurer;
         $message .= "</td>";
         $message .= "<td>";
         $message .= "<button>buy now</button>";
         $message .= "</td>";
         $message .= "</tr>";
     }
     $message .= "</table>";
     return $message;
 }
コード例 #8
0
 public function showMyTrips()
 {
     $userId = Session::get('user_id');
     $to = Input::get('to');
     $from = Input::get('from');
     if ($from == null || $to == null) {
         $today = LocationController::getTime();
         $todayFrom = $today['date'] . ' 00:00:00';
         $todayTo = $today['date'] . ' 23:59:59';
     } else {
         $todayFrom = $from . ' 00:00:00';
         $todayTo = $to . ' 23:59:59';
     }
     try {
         $myTrips = DailyTrips::where('user_id', '=', $userId)->where('departure_date_time', '>', $todayFrom)->where('departure_date_time', '<', $todayTo)->orderBy('departure_date_time', 'desc')->get()->toArray();
         $carId = Session::get('car_id');
         $car = Cars::find($carId);
         if ($myTrips == null) {
             $myTrips = array('my_trips' => 'no trips have been recorded for you.');
         }
         $results = array('success' => true, 'my_trips' => $myTrips, 'car' => $car);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
         $results = array('success' => false, 'message' => 'an error occurred');
     }
     return $results;
 }