示例#1
1
 function getRate($location_id, $position_id)
 {
     App::uses('Rate', 'Model');
     /**
      * Get position and location classes
      */
     $location = $this->Location->find('all', array('conditions' => array('Location.id' => $location_id)));
     $position = $this->User->Position->find('all', array('conditions' => array('Position.id' => $position_id)));
     /**
      * Create a rate class to call the find() method
      */
     $Rate = new Rate();
     $result = $Rate->find('all', array('conditions' => array('Rate.location_class' => $location[0]['Location']['class'], 'Rate.position_class' => $position[0]['Position']['class']), 'order' => 'Rate.expense'));
     /**
      * Store values into an array and return
      */
     $rates = array();
     $rates['breakfast'] = $result[0]['Rate']['rate'];
     $rates['dinner'] = $result[1]['Rate']['rate'];
     $rates['lodging'] = $result[2]['Rate']['rate'];
     $rates['lunch'] = $result[3]['Rate']['rate'];
     return $rates;
 }
示例#2
0
<?php

$cates = Cate::where('type', "工程進度")->whereNotIn('name', array('圖面下載'))->get();
$cates_array = array();
$cates_not = array();
foreach ($cates as $cate) {
    $cates_array[$cate->id] = $cate->name;
    $cates_not[$cate->id] = $cate->id;
}
$id = Input::get("id");
$rate = Rate::find($id);
$dd1 = explode(" ", $rate->created_at);
$dd = explode("-", $dd1[0]);
$category_id = Input::get("category_id");
if (!empty($id)) {
    // print_r($cates_not);
    $pics = DB::table("rate_pics")->where('rate_id', $id)->whereIn('category_id', $cates_not)->get();
} else {
    $pics = DB::table("rate_pics")->first();
}
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>工程進度</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/css.css">
<link rel="stylesheet" type="text/css" href="css/process.css">
示例#3
0
 public function details_list($id)
 {
     $data["_title"] = array("top" => "工程進度-詳細資料-列表", "main" => "Home", "sub" => "rate");
     $data["active"] = "rates";
     $data["rate_id"] = $id;
     $data["result"] = Rate::find($id);
     $data["title"] = "編輯最新消息";
     return View::make('admin.rates.details_list', $data);
 }
 public function downloadImage()
 {
     $data = Input::all();
     $val = $data["val"];
     $id = $data["id"];
     $dd = explode("di", $id);
     // print_r($dd[1]);
     // print_r($data);
     $obj = DB::table('rate_pics')->where("id", (int) $dd[1])->first();
     $rate = Rate::find($obj->rate_id);
     // var_dump($rate);
     // echo $pathToFile = public_path().$obj->image;
     // echo $val."==".$rate->secret;
     // echo strcmp($val,$rate->sercret);
     if ($val == $rate->secret) {
         echo true;
         // return Response::download($pathToFile);
         // return Redirect::to('/downloadFile/'.$dd[1]);
         // return Redirect::route('downloadFile'.$dd[1]);
     } else {
         echo 'error';
     }
 }