コード例 #1
0
    public function adduser()
    {
        $data = Auth::user()->ID;
        $GeneralData = Input::except(array('_token', 'status', 'pagename', 'profilepicture', 'profileimgedithidden', 'interest', 'update_profile', 'timezone'));
        $newimg = Input::file('profilepicture');
        if ($newimg != '') {
            $destinationPath = 'public/assets/upload/profile';
            $filename = Input::file('profilepicture')->getClientOriginalName();
            $Image = str_random(8) . '_' . $filename;
            $GeneralData['profilepicture'] = $Image;
            $uploadSuccess = Input::file('profilepicture')->move($destinationPath, $Image);
        }
        $interest = Input::get('interest');
        $interest_length = sizeof(Input::get('interest'));
        $GeneralData['status'] = 1;
        $cur_date = date('Y-m-d');
        $GeneralData['timezone'] = Input::get('timezone');
        $updaterules = array('username' => 'required|unique:user', 'password' => 'required|confirmed|min:5', 'email' => 'required|email|unique:user', 'dateofbirth' => 'required', 'timezone' => 'required|min:2');
        $validation = Validator::make($GeneralData, $updaterules);
        $newpassword = Input::get('password');
        if ($newpassword != "") {
            $GeneralData['password'] = Hash::make(Input::get('password'));
        } else {
            unset($GeneralData["password"]);
        }
        unset($GeneralData["password_confirmation"]);
        $updatedata = $GeneralData;
        $lantyp = Session::get('language');
        if ($lantyp == "") {
            $lantyp = "value_en";
        }
        if (!isset($updatedata['maritalstatus'])) {
            $updatedata['maritalstatus'] = 0;
        }
        if ($validation->passes()) {
            $affectedRows = ProfileModel::create($updatedata);
            $pass = $newpassword;
            $email = Input::get('email');
            $username = Input::get('username');
            Mail::send([], array('pass' => $pass, 'email' => $email, 'username' => $username), function ($message) use($pass, $email, $username) {
                $mail_body = '<style>.thank{text-align:center; width:100%;}
					.but_color{color:#ffffff;}
					.cont_name{width:100px;}
					.cont_value{width:500px;}
					
					</style>
				<body style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif; margin:0px auto; padding:0px;">

				<div style="margin:0px auto;background:#e5e5e5;float:left;	width:98%;	height:30px;margin:0px 1%;  border-bottom:#005377 1px solid;vertical-align: text-middle;">
					&nbsp;&nbsp;<a href="' . URL() . '"><img src="' . URL::to('assets/images/logo.png') . '" style="margin-top:3px; line-height:20px;" /></a>&nbsp;&nbsp;
				</div>
				<div style="background:#ffffff;float:left;padding:10px 20px;margin:1px 1%;" >
					<div class="thank" style="font-size:16px;color: #078AC2;font-weight:bold;float:left;width:100%;margin-top:10px;text-align:left;">Dear ' . $username . '</div>
					
					<div style="font-size:12px;	color: #000000;	float:left;padding:10px 2px;width:100%;margin:15px;">Your DingDatt Registration successfully completed.Your Login details are<br><br>Username: '******'<br>Password: '******'
				</div>
					
					<div style="margin:10px;"><a href="' . URL() . '"><img src="' . URL::to('assets/inner/images/vist_dingdatt.png') . '" width="120" height="30" /></a>
					</div>
				</div>
											
				<div style="font-size:12px; margin-top:10px;color: #5b5b5b;/*	background:#e5e5e5;*/width:95%;vertical-align: text-middle;height:30px;margin:0% 1%;padding:0px 15px; border-top:#005377 1px solid; border-bottom:5px solid background:#e5e5e5;line-height:25px; ">
				</body>';
                $message->setBody($mail_body, 'text/html');
                $message->to($email);
                $message->subject('DingDatt Registration');
            });
            $lantyp = Session::get('language');
            $labelname = ['txt_user_update_msg'];
            $languageDetails = languageModel::select($lantyp)->whereIn('ctrlCaptionId', $labelname)->get()->toArray();
            $user_id = Auth::user()->ID;
            $profileData = ProfileModel::where('ID', $user_id)->first();
            $interestList = InterestCategoryModel::lists('Interest_name', 'Interest_id');
            $userInterest = userinterestModel::where('user_id', $user_id)->lists('interest_id');
            $er_data['message'] = 'User details added successfully.';
            return Redirect::to('/user')->with('tab', 'userlist')->with('er_data', $er_data);
        } else {
            $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$validation->messages()->first('username'), $validation->messages()->first('password'), $validation->messages()->first('email'), $validation->messages()->first('dateofbirth'), $validation->messages()->first('timezone')])->get()->toArray();
            foreach ($languageDetails as $key => $val) {
                if (in_array($val['ctrlCaptionId'], ['alert_enterusername', 'alert_alreadyuser'])) {
                    $er_data['username'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
                } elseif (in_array($val['ctrlCaptionId'], ['alert_enterpassword', 'alert_minpass5', 'alert_passconfnotmatch'])) {
                    $er_data['password'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
                } elseif (in_array($val['ctrlCaptionId'], ['alert_enteremail', 'alert_validemail', 'alertr_emailalready'])) {
                    $er_data['email'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
                } elseif (in_array($val['ctrlCaptionId'], ['alert_enterdob'])) {
                    $er_data['dateofbirth'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
                } elseif (in_array($val['ctrlCaptionId'], ['txt_timezone_required'])) {
                    $er_data['timezone'] = "<span id='" . $val['ctrlCaptionId'] . "'>Timezone is required</span>";
                }
            }
            return Redirect::to('/user')->with('tab', 'createuser')->with('er_data', $er_data)->with('old_data', $updatedata);
        }
    }
コード例 #2
0
 public function profileupdate($data = Null)
 {
     //$data = Auth::user()->ID;
     $editid = $data;
     $GeneralData = Input::except(array('_token', 'status', 'pagename', 'profilepicture', 'profileimgedithidden', 'interest', 'update_profile'));
     $newimg = Input::file('profilepicture');
     if ($newimg != '') {
         $destinationPath = 'public/assets/upload/profile';
         $filename = Input::file('profilepicture')->getClientOriginalName();
         $Image = str_random(8) . '_' . $filename;
         $GeneralData['profilepicture'] = $Image;
         $uploadSuccess = Input::file('profilepicture')->move($destinationPath, $Image);
     }
     $interest = Input::get('interest');
     $interest_length = sizeof(Input::get('interest'));
     if ($interest_length > 0) {
         userinterestModel::whereNotIn('interest_id', $interest)->where('user_id', '=', $data)->delete();
         for ($i = 0; $i < $interest_length; $i++) {
             $interes['user_id'] = $data;
             $interes['interest_id'] = $interest[$i];
             $userInterest = userinterestModel::where('user_id', $data)->where('interest_id', $interest[$i])->lists('interest_id');
             if (count($userInterest) < 1) {
                 userinterestModel::create($interes);
             }
             unset($interes);
         }
     } else {
         userinterestModel::where('user_id', '=', $data)->delete();
     }
     $cur_date = date('Y-m-d');
     $updaterules = array('username' => 'required|unique:user,username,' . $data, 'password' => 'confirmed|min:5', 'email' => 'required|email|unique:user,email,' . $data, 'dateofbirth' => 'required', 'timezone' => 'required|min:2');
     $validation = Validator::make($GeneralData, $updaterules);
     $newpassword = Input::get('password');
     if ($newpassword != "") {
         $GeneralData['password'] = Hash::make(Input::get('password'));
     } else {
         unset($GeneralData["password"]);
     }
     unset($GeneralData["password_confirmation"]);
     $updatedata = $GeneralData;
     $lantyp = Session::get('language');
     if ($lantyp == "") {
         $lantyp = "value_en";
     }
     if (!isset($updatedata['maritalstatus'])) {
         $updatedata['maritalstatus'] = 0;
     }
     if ($validation->passes()) {
         $affectedRows = ProfileModel::where('ID', $data)->update($updatedata);
         $lantyp = Session::get('language');
         $labelname = ['txt_user_update_msg'];
         $languageDetails = languageModel::select($lantyp)->whereIn('ctrlCaptionId', $labelname)->get()->toArray();
         $user_id = $data;
         $profileData = ProfileModel::where('ID', $user_id)->first();
         $interestList = InterestCategoryModel::lists('Interest_name', 'Interest_id');
         $userInterest = userinterestModel::where('user_id', $user_id)->lists('interest_id');
         $er_data['Message'] = "<span id='txt_user_update_msg'>" . $languageDetails[0][$lantyp] . "</span>";
         return Redirect::to('/edit_profile/' . $data)->with('er_data', $er_data)->with('user_id', $user_id);
     } else {
         $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$validation->messages()->first('username'), $validation->messages()->first('password'), $validation->messages()->first('email'), $validation->messages()->first('dateofbirth'), $validation->messages()->first('timezone')])->get()->toArray();
         foreach ($languageDetails as $key => $val) {
             if (in_array($val['ctrlCaptionId'], ['alert_enterusername', 'alert_alreadyuser'])) {
                 $er_data['username'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
             } elseif (in_array($val['ctrlCaptionId'], ['alert_enterpassword', 'alert_minpass5', 'alert_passconfnotmatch'])) {
                 $er_data['password'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
             } elseif (in_array($val['ctrlCaptionId'], ['alert_enteremail', 'alert_validemail', 'alertr_emailalready'])) {
                 $er_data['email'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
             } elseif (in_array($val['ctrlCaptionId'], ['alert_enterdob'])) {
                 $er_data['dateofbirth'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
             } elseif (in_array($val['ctrlCaptionId'], ['txt_timezone_required'])) {
                 $er_data['timezone'] = "<span id='" . $val['ctrlCaptionId'] . "'>Timezone is required</span>";
             }
         }
         return Redirect::to('/edit_profile/' . $data)->with('er_data', $er_data)->with('old_data', $updatedata);
     }
 }
コード例 #3
0
ファイル: user.blade.php プロジェクト: karthiksky/Ding-datt
                                    </tbody>
                                    </table>   
                                    </div>
                                    <div id="tab-body-2" class="tab-body">


                                        <form id="editprofile" name="edit_profile_update" enctype="multipart/form-data"  action="{{ URL::to('/adduser') }}" method="post" class="form_mid">
                                            @if(isset($Message))
                                            <p class="alert" style="color:green;padding:5px;text-align:center;font-size:13px">{{ $Message }}</p>
                                            @endif
                                            <?php 
$user_id = Auth::user()->ID;
$profileData = ProfileModel::where('ID', $user_id)->first();
$interestList = InterestCategoryModel::lists('Interest_name', 'Interest_id');
$userInterest = InterestCategoryModel::lists('Interest_name', 'Interest_id');
//$userInterest=userinterestModel::where('user_id',$user_id)->lists('interest_id');
$timezoneList = timezoneDBModel::lists('timezonename', 'timezonevalue');
if (Session::has('er_data')) {
    $er_data = Session::get('er_data');
}
if (Session::has('old_data')) {
    $old_data = Session::get('old_data');
}
?>
                                            <div class="loginform loginbox mar1">

                                                <legend class="radius"><div class="leg_head"><span id="txt_logininfo">Login Info</span></div>

                                                    <p>
                                                    <div class="inp_pfix"><img src="{{ URL::to($assets_path.'img/user_icons.png') }}" width="25" height="25"></div>