public function indexAction()
 {
     $user = User::findOrFail(Auth::user()->id);
     //die(var_dump($user));
     if ($user->name == $this->adminGroup) {
         $records = Data::all();
     } else {
         $records = $user->datas()->get();
     }
     $data = ["records" => $records, "HeaderTitle" => trans('data.index')];
     return View::make($this->routeIndex, $data);
 }
Esempio n. 2
0
 public function getReport()
 {
     // $purp = new Purpose();
     // $per_page = Config::get('nhc/site.perpage') ;
     // $purpose = $purp->getAllPurpose($per_page);
     $allDataName = Data::all(array('id', 'data_name'))->toArray();
     foreach ($allDataName as $key => $value) {
         $arr_data[$key]['id'] = 'data_' . $value['id'];
         $arr_data[$key]['name'] = $value['data_name'];
     }
     $allRoleName = Roles::all(array('id', 'role_name'))->toArray();
     foreach ($allRoleName as $key => $value) {
         $arr_role[$key]['id'] = 'role_' . $value['id'];
         $arr_role[$key]['name'] = $value['role_name'];
     }
     $supportData = array_merge($arr_role, $arr_data);
     return View::make('report.report')->with('listbox', $supportData);
     //->with('paginator',$purpose);
 }
Esempio n. 3
0
 /**
  * [listDataFrm show form data and select data run by ajax
  * @return [array] [collect of data]
  */
 public function listDataFrm()
 {
     return View::make('rbac.datalist')->with('all_data', Data::all());
 }
Esempio n. 4
0
 /**
  * [privacyDataSave save method for user privacy
  * @param  [integer] $agency_id [agency id]
  * @param  [integer] $user_id [user id]
  * @return [none]     [redirect to user privacy page]
  */
 public function privacyDataSave($agency_id, $user_id)
 {
     $data = Input::all();
     //var_dump($data);exit;
     //Get all data type
     $data_type = Data::all();
     foreach ($data as $key => $value) {
         if ($key != "_token") {
             list($data_id, $table_info) = explode(":", $key);
             $value == 'on' ? $status = true : ($status = false);
             // echo $status;
             // echo "<br />";
             $priv_data['data_id'] = $data_id;
             $priv_data['agency_id'] = $agency_id;
             $priv_data['status'] = $status;
             $privacy_data[] = $priv_data;
         }
     }
     // var_dump($privacy_data);
     // exit;
     DataPrivacy::where('agency_id', '=', $agency_id)->delete();
     DataPrivacy::insert($privacy_data);
     return Redirect::to('/privacy/' . $user_id)->with('success', 'Your data privacy saved.');
 }
Esempio n. 5
0
 /**
  * [peerDataFrm show form peer's data use ajax]
  * @return [type] [description]
  */
 public function peerDataFrm()
 {
     return View::make('peer.datalist')->with('all_data', Data::all());
 }
Esempio n. 6
0
 /**
  * [dataPeerPrivacy return information of agency's privacy]
  * @param  [integer] $agency_id [agency id]
  * @return [type]            [description]
  */
 public function dataPeerPrivacy($agency_id)
 {
     $dataprivacy = new DataPrivacy();
     //$rs index is agency_id
     $rs = $dataprivacy->getDataPrivacy($agency_id);
     // var_dump(Data::all()->toArray());
     // var_dump($rs);exit;
     return View::make('peer.ajax_dataprivacy')->with('agency_dataprivacy', $rs)->with('data_info', Data::all()->toArray());
 }
Esempio n. 7
0
 public function usageAction()
 {
     $roleObj = Roles::all();
     $dataObj = Data::all();
     return View::make('usage.usage');
 }