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;"> <a href="' . URL() . '"><img src="' . URL::to('assets/images/logo.png') . '" style="margin-top:3px; line-height:20px;" /></a> </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); } }
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); } }
} ?> value="{{ isset($old_data['prize'])?$old_data['prize']:$contestdetails['prize'] }}" class="radius pfix_mar" /> </p>--> <p> <!--<div class="inp_pfix"><img src="img/gender_icons.png" width="25" height="25"></div>--> <textarea name="description" cols="" rows="" class="radius" placeholder="Contest Information" title="Contest Information">{{ isset($old_data['description'])?$old_data['description']:$contestdetails['description'] }}</textarea> </p> </legend> <legend class="radius"><div class="leg_head"><span id="txt_favorite">Favorite</span></div> <p> <div class="inp_pfix mbmtop"><img src="{{ URL::to($assets_path.'img/interest_icons.png')}}" width="25" height="25"></div> <?php $interestList = InterestCategoryModel::where('status', 1)->lists('Interest_name', 'Interest_id'); $contestInterest = contestinterestModel::where('contest_id', $contest_id)->lists('category_id'); ?> {{ Form::select('interest[]', $interestList,$contestInterest, array('class'=>'SlectBox testsel radius','multiple'=>'multiple',(($noofparticipants>0)?'disabled':''),'placeholder'=>'Select Interest','onchange'=>'console.log($(this).children(":selected").length)')) }} </p> </legend> </div> <div class="loginform loginbox mar2"> <legend class="radius"><div class="leg_head"><span id="txt_contestschedule">Contest Schedule</span></div> <p> <div class="inp_pfix "><img src="{{ URL::to($assets_path.'img/date_icons.png')}}" width="25" height="25"></div> <input type="text" value="{{ isset($old_data['conteststartdate'])?date('m/d/Y h:i a',strtotime($old_data['conteststartdate'])):(timezoneModel::convert($contestdetails['conteststartdate'],'UTC',Auth::user()->timezone, 'm/d/Y h:i a')) }}" <?php if (Auth::user()->ID != 1) { if ($noofparticipants > 0 || $contestdetails['conteststartdate'] <= date('Y-m-d H:i:s')) {
</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>
?> class="add-link backclr_<?php echo $categorydetails[$i]['Interest_id']; ?>"></a></td> <td><a href="<?php echo url() . '/gotoeditcategory?interestid=' . $categorydetails[$i]['Interest_id']; ?>" class="edit-link" ></a></td> <td><a href="#" onclick="deletecategory('<?php echo $categorydetails[$i]['Interest_id']; ?>')" class="del-link" ></a></td> </tr> <?php } ?> </tbody> </table> </div> </div> <div id="tab-body-2" class="tab-body"> <div id="p"> <div class="clrscr"></div> <?php if ($categoryid != '') { ?> <form id="editprofile" name="group" enctype="multipart/form-data" action="<?php echo url() . '/editcategory/' . $categoryid; ?>" method="post" class="form_mid"> <?php $categorydetails = InterestCategoryModel::where('Interest_id', $categoryid)->first(); } else { ?><form id="editprofile" name="group" enctype="multipart/form-data" action="addcategory" method="post" class="form_mid"><?php } ?> <div class="loginform loginbox grp_ctr"><!-- mar1--> <legend class="radius" style="min-height:100px;"><div class="leg_head">Category details</div> <div class="leg_head"> </div> @if(isset($er_data)) <p class="alert" style="color:green;padding:5px;text-align:center;font-size:13px">{{ $er_data }}</p> @endif <p> <div class="inp_pfix aft_fst_mar"><img src="{{ URL::to('/assets/inner/images/pass_icons.png') }}" width="25" height="25"></div> <input ="text" id="categoryname" name="categoryname" value="{{ isset($categorydetails->Interest_name)?$categorydetails->Interest_name:"" }}" placeholder="Category Name" class="radius pfix_mar" /> </p>
public function getinterest() { //$interestList=InterestCategoryModel::lists('Interest_name','Interest_id'); $interestList = InterestCategoryModel::select('Interest_name', 'Interest_id')->where('status', 1)->get()->toArray(); $Response = array('success' => '1', 'message' => 'Interest Details are fetched Successfully', 'msgcode' => "c176"); $final = array("response" => $Response, "interestdetails" => $interestList); return json_encode($final); }
public function deletecategory() { $categoryid = Input::get('categoryid'); $usercategory = userinterestModel::where('interest_id', $categoryid)->get()->count(); $contestcategory = contestinterestModel::where('category_id', $categoryid)->get()->count(); if ($usercategory > 0 || $contestcategory > 0) { $er_data = 'This category is used. So not able to delete '; return Redirect::to('category')->with('er_data', $er_data); } else { $deletecategory = InterestCategoryModel::where('Interest_id', $categoryid)->delete(); if ($deletecategory) { $er_data = 'Category deleted successfully'; return Redirect::to('category')->with('er_data', $er_data); } } }