コード例 #1
0
 /**
  * [queryDataAction query data by use ajax get data follow flag]
  * @param  [integer] $dataid [data id]
  * @param  [integer] $cond_id [condtion id]
  * @param  [string] $flag   [to specific data is own agency or all agency]
  * @param  [integer] $agencyid [agenc id]
  * @return [array]         [collection of data]
  */
 public function queryDataAction($dataid, $cond_id, $flag, $agencyid = "")
 {
     $data_name = Data::find($dataid)->data_name;
     $qData = new QueryData();
     $rsData = $qData->queryDataNHC($this->policy_id, $dataid, $cond_id, $flag, $agencyid);
     if ($rsData) {
         if ($dataid == 11) {
             list($tb_name, $field, $datefield, $tele_id) = explode("-", $rsData['info_querydata']->table_name);
         } else {
             list($tb_name, $field, $datefield) = explode("-", $rsData['info_querydata']->table_name);
         }
         if ($dataid == 6) {
             $teleid = 'dam_id';
         } else {
             $teleid = 'tele_station_id';
         }
     } else {
         $rsData['data'] = null;
         $data_name = null;
         $datefield = null;
         $field = null;
         $teleid = null;
     }
     // var_dump($rsData);exit;
     // return View::make('querydata.ajax_test')
     // 			->with('paginator',$rsData['data']);
     return View::make('querydata.ajax_data')->with('paginator', $rsData['data'])->with('data_name', $data_name)->with('field_date', $datefield)->with('field_value', $field)->with('teleid', $teleid);
 }
コード例 #2
0
ファイル: DataController.php プロジェクト: nattaphat/cuse2
 /**
  * [editedDataAction description]
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function editedDataAction($id)
 {
     $data = Input::all();
     $rules = array('dataname' => array('required'));
     // Build the custom messages array.
     $messages = array('dataname.required' => 'กรุณาระบุชื่อข้อมูล');
     // Create a new validator instance.
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         $data_content = trim($data['dataname']);
         $data_tablename = trim($data['table_name']);
         $data_obj = Data::find($id);
         $rs_check = $data_obj->checkData($data_content, $data_tablename);
         if ($rs_check) {
             $data_obj->data_name = $data_content;
             $data_obj->table_name = $data_tablename;
             $data_obj->save();
             return Redirect::to('data')->with('success', 'แก้ไขสำเร็จ');
         } else {
             return Redirect::to('data-edit/' . $id)->with('warning', 'มีชื่อข้อมูลอยู่ในระบบแล้ว');
         }
     } else {
         // $errors = $validator->messages();
         return Redirect::to('data-edit/' . $id)->withErrors($validator);
     }
 }
コード例 #3
0
 public function dashboard()
 {
     if (Auth::is_valid()) {
         $data = new Data();
         $carpeta = new Carpeta();
         $this->data = $data->find();
         $this->carpetas = $carpeta->get_nombre_carpetas_by_user_id(Auth::get("id"));
         $this->obj_carpeta_data = new CarpetaData();
     }
 }
コード例 #4
0
 /**
  * disconnect
  * --------------------------------------------------
  * Disconnecting the user from braintree.
  * @throws BraintreeNotConnected
  * --------------------------------------------------
  */
 public function disconnect()
 {
     /* Check valid connection */
     if (!$this->user->isBraintreeConnected()) {
         throw new BraintreeNotConnected();
     }
     $this->user->connections()->where('service', 'braintree')->delete();
     /* Deleting all widgets, plans, subscribtions */
     foreach ($this->user->widgets() as $widget) {
         if ($widget->descriptor->category == 'braintree') {
             /* Saving data while it is accessible. */
             $dataID = 0;
             if (!is_null($widget->data)) {
                 $dataID = $widget->data->id;
             }
             $widget->delete();
             /* Deleting data if it was present. */
             if ($dataID > 0) {
                 Data::find($dataID)->delete();
             }
         }
     }
     /* Deleting all plans. */
     foreach ($this->user->braintreePlans as $braintreePlan) {
         BraintreeSubscription::where('plan_id', $braintreePlan->id)->delete();
         $braintreePlan->delete();
     }
 }