コード例 #1
0
ファイル: PrivacyController.php プロジェクト: nattaphat/cuse2
 /**
  * [privacyFrm show privacy page]
  * @param  [integer] $id [user id]
  */
 public function privacyFrm($id)
 {
     //get user's privacy by user id
     $priv_user = new Privacy();
     $user = $priv_user->getUserPrivacy($id);
     //var_dump($user);exit;
     //get user's info by user id
     $usernhc_obj = new Usernhc();
     $usernhc = $usernhc_obj->getUsernhcById($id);
     //get data relate with agency
     $agency_data = new AgencyData();
     $rs_agency_data = $agency_data->getDataByAgency($usernhc[0]->agency_id);
     // var_dump($rs_agency_data);//exit;
     //get agency's data privacy by agency id
     $priv_data = new DataPrivacy();
     $data = $priv_data->getDataPrivacy($usernhc[0]->agency_id);
     // var_dump($data);exit;
     //get all data name
     $data_table = Data::all();
     foreach ($data_table as $key => $value) {
         $raws[$value['id']][] = $value;
     }
     // var_dump($raws);exit;
     //get all period for each data_id
     $period_data = RetainData::all();
     //var_dump($period_data);exit;
     $privacy_init = PrivacyInit::all()->toArray();
     $period = array(array('name' => 'ระยะเก็บรักษาข้อมูล 1 วัน', 'value' => '1:day'), array('name' => 'ระยะเก็บรักษาข้อมูล 1 เดือน', 'value' => '1:month'), array('name' => 'ระยะเก็บรักษาข้อมูล 3 เดือน', 'value' => '3:month'), array('name' => 'ระยะเก็บรักษาข้อมูล 6 เดือน', 'value' => '6:month'), array('name' => 'ระยะเก็บรักษาข้อมูล 1 ปี', 'value' => '1:year'), array('name' => 'ระยะเก็บรักษาข้อมูล 3 ปี', 'value' => '3:year'), array('name' => 'ระยะเก็บรักษาข้อมูล 5 ปี', 'value' => '5:year'), array('name' => 'ระยะเก็บรักษาข้อมูล 7 ปี', 'value' => '7:year'), array('name' => 'ระยะเก็บรักษาข้อมูล 10 ปี', 'value' => '10:year'));
     $rt = new RetainData();
     $rs = $rt->listRetain();
     //var_dump($period_data->toArray());exit;
     return View::make('privacy.privacy')->with('priv_user', $user[0])->with('priv_data', $data)->with('user_info', $usernhc[0])->with('src_table', $raws)->with('period', $period)->with('period_data', $period_data)->with('active_status', $this->active_status)->with('privacy_init', $privacy_init)->with('retain_data', $rs)->with('period_text', $this->period_text)->with('agency_data', $rs_agency_data);
 }
コード例 #2
0
ファイル: PeerController.php プロジェクト: nattaphat/cuse2
 /**
  * [userPeerPrivacy show informatioin of user by user's privacy in modal]
  * @param  [integer] $id [user id]
  * @return [type]     [description]
  */
 public function userPeerPrivacy($id)
 {
     $user_info = new Usernhc();
     $rs_userinfo = $user_info->getUsernhcPrivacyById($id);
     $arr_userinfo = json_decode(json_encode($rs_userinfo), true);
     // var_dump($arr_userinfo);
     //
     // $privacy = new Privacy;
     // $user_privacy = $privacy->getUserPrivacy($id);
     $privacyInit = PrivacyInit::orderBy('id', 'asc')->get();
     // var_dump($privacyInit);
     return View::make('peer.ajax_userprivacy')->with('user_info', $arr_userinfo[0])->with('user_privacy', $privacyInit);
 }
コード例 #3
0
ファイル: AgencyData.php プロジェクト: nattaphat/cuse2
    /**
     * [getAgenyByDataId description]
     * @param  [type] $data_id [description]
     * @return [type]          [description]
     */
    public function getAgenyByDataId($data_id)
    {
        $rs = DB::select(DB::raw('
				select ad.agency_id,a.tname 
				from agency_data ad inner join agency a on (ad.agency_id = a.id)
				where ad.data_id = :data_id '), array('data_id' => $data_id));
        foreach ($rs as $key => $value) {
            $arr_agency[] = $value->agency_id;
        }
        $user = new Usernhc();
        $rs_useragency = $user->getUserByAgencyId($arr_agency);
        // var_dump($rs_useragency);
        // var_dump($rs);exit;
        return $rs_useragency;
    }
コード例 #4
0
ファイル: Policy.php プロジェクト: nattaphat/cuse2
 /**
  * [getPolicyByUserId get policy by relete with user id]
  * @return [array]     [collect of policy]
  */
 public static function getPolicyByUserId()
 {
     $role_id = Usernhc::getRoleName()->role_id;
     $rs = DB::table('role_policy')->join('policy', 'role_policy.policy_id', '=', 'policy.id')->where('role_policy.role_id', '=', $role_id)->orderBy('policy.id', 'asc')->select('policy.id', 'policy.policy_content', 'policy.author', 'policy.status', 'policy.policy_duty')->distinct()->get();
     //var_dump($rs);exit;
     return $rs;
 }
コード例 #5
0
ファイル: DataPrivacy.php プロジェクト: nattaphat/cuse2
 /**
  * [getData get data at the status data is ture]
  * @return [array] [return set of data status is true]
  */
 public static function getData()
 {
     $user_role = new Usernhc();
     $role_id = $user_role->getRoleName()->role_id;
     //Get role id
     $rs_policy = RolePolicy::where('role_id', '=', $role_id)->select('policy_id')->get()->toArray();
     //Get relate policy
     $policy_id = $rs_policy[0]['policy_id'];
     //Policy id
     $data_id = DataPolicy::where('policy_id', '=', $policy_id)->select('data_id')->get()->toArray();
     $data_id = array_flatten($data_id);
     // Data id that relate with policy
     $rs_dataid = DataPrivacy::where('status', '=', true)->whereIn('data_id', $data_id)->distinct()->get(array('data_id'));
     foreach ($rs_dataid->toArray() as $key => $value) {
         $id[] = $value['data_id'];
     }
     //$dataid_set = implode("','", $id); //Displays 'A', 'B', 'C'
     return $id;
 }
コード例 #6
0
ファイル: PolicyController.php プロジェクト: nattaphat/cuse2
 public function getListRole($roleid)
 {
     $rolelist = Usernhc::getRoleById($roleid);
     return View::make('rbac.ajax_rolelist')->with('paginator', $rolelist);
 }
コード例 #7
0
ファイル: Usernhc.php プロジェクト: nattaphat/cuse2
 /**
  * [getUserIdByUserName description]
  * @param  [type] $username [description]
  * @return [type]           [description]
  */
 public function getUserIdByUserName($username)
 {
     $rs = Usernhc::where('username', '=', $username)->get(array('id'));
     return $rs[0]['id'];
 }
コード例 #8
0
ファイル: UsernhcController.php プロジェクト: nattaphat/cuse2
 /**
  * [userDeleteAction description]
  * @param  [type] $userid [description]
  * @return [type]         [description]
  */
 public function userDeleteAction($userid)
 {
     try {
         Usernhc::find($userid)->delete();
         return Redirect::to('userlist')->with('success', 'ผู้ใช้งานรหัส ' . $userid . ' ลบทิ้งสำเร็จ');
     } catch (Exception $e) {
         return Redirect::to('userlist')->withErrors(array('Caught exception: ' . $e->getMessage()));
     }
 }
コード例 #9
0
 /**
  * [userPeerPrivacy show informatioin of user by user's privacy in modal]
  * @param  [integer] $id [user id]
  * @return [type]     [description]
  */
 public function userPeerPrivacy($id)
 {
     $user_info = new Usernhc();
     $rs_userinfo = $user_info->getUsernhcById($id);
     //var_dump($rs_userinfo);
     $privacy = new Privacy();
     $user_privacy = $privacy->getUserPrivacy($id);
     return View::make('peer.ajax_userprivacy')->with('user_info', $rs_userinfo[0])->with('user_privacy', $user_privacy[0]);
 }
コード例 #10
0
 /**
  * [manReport description]
  * @param  string $flag ['yes' for export to pdf or os on ,'' for pagination]
  * @param  string $id [user id]
  * @param  string $type [type of report]
  * @return [type]       [description]
  */
 public function manReport($id = "", $flag = "", $type = "")
 {
     $training = new UserTraining();
     if ($id == '') {
         $usernhc = new Usernhc();
         $rs = $usernhc->getUsernhc('no');
         return View::make('train.reportman')->with('rs', $rs);
     } else {
         if ($id != '' and $flag == '') {
             $rs = $training->getUserTrainByUserId($id);
             return View::make('train.reportman_ajax')->with('rs', $rs)->with('userid', $id);
         } else {
             $rs = $training->getUserTrainByUserId($id);
             $this->userid = $id;
             $this->exportXls($rs, $type);
         }
     }
 }
コード例 #11
0
ファイル: AuthController.php プロジェクト: nattaphat/cuse2
 public function resetpwdAction()
 {
     $data = Input::all();
     //var_dump($data);exit();
     $rules = array('emailremind' => 'required | email', 'password' => 'required | min:6 | same:password_confirmation');
     $messages = array('emailremind.email' => 'รูปแบบอีเมล์ไม่ถูกต้อง', 'emailremind.required' => 'กรุณาระบุอีเมล์', 'password.required' => 'กรุณาระบุรหัสผ่าน', 'password.same' => 'รหัสผ่านที่กรอกไม่ตรงกัน', 'password.min' => 'ความยามรหัสผ่านอย่างน้อย :min ตัวอักษร');
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         $ck_email = new Usernhc();
         $rs_ckemail = $ck_email->checkUserByEmail($data['emailremind']);
         if ($rs_ckemail) {
             $credentials = array('email' => Input::get('emailremind'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation'), 'token' => Input::get('token'));
             Password::reset($credentials, function ($user, $password) {
                 $user->password = Hash::make($password);
                 $user->save();
             });
             return Redirect::to('/login')->with('success', 'เปลี่ยนรหัสผ่านสำเร็จ');
         } else {
             return Redirect::to('/password/reset/' . $data['token'])->withErrors(array('message' => 'ไม่มีอีเมล์นี้ในระบบ'));
         }
     } else {
         //return 'fail';
         return Redirect::to('/password/reset/' . $data['token'])->withErrors($validator);
     }
 }