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); } }
public function laravel_register() { $username = Input::get('username'); $email = Input::get('email'); $pass = Input::get('password'); $password = Hash::make(Input::get('password')); $dateofbirth = Input::get('dateofbirth'); $data = Input::except(array('_token', 'client_login')); // $validator = Validator::make($data,$rule); $validator = Validator::make($data, ProfileModel::$webrule); $lantyp = Session::get('language'); $data['password'] = $password; if ($validator->fails()) { //return $validator->messages(); if ($validator->messages()->first('terms') != "") { $terms = "Accept terms"; } else { $terms = ""; } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$validator->messages()->first('username'), $validator->messages()->first('email'), $validator->messages()->first('password'), $validator->messages()->first('dateofbirth'), $terms])->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_enteremail', 'alert_validemail', 'alertr_emailalready'])) { $er_data['email'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enterpassword', 'alert_minpass5'])) { $er_data['password'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enterdob'])) { $er_data['dateofbirth'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } else { if (in_array($val['ctrlCaptionId'], ['alert_enterterms'])) { $er_data['terms'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } } } //return $er_data; return View::make('user/register/userregister')->with('er_data', $er_data)->with('old_value', $data); } else { unset($data['terms']); $lantyp = Session::get('language'); $data['timezone'] = "EST"; $data['status'] = 1; $userregister = ProfileModel::create($data); Mail::send([], array('pass' => $pass, 'email' => $email, 'username' => $username), function ($message) use($pass, $email, $username) { //$user = MailTemplate::find(1); //$mail_body = $user->MailContent; //$mail_body = str_replace("{password}", Session::get('sess_string'), $mail_body); /* $mail_body = "Dear {username},<br><br>Your DingDatt Registration successfully completed.Your Login details are<br><br>Username: {username}<br>Password: {password} <br><br> Thank You, <br><br>Regards,<br>DingDatt"; $mail_body = str_replace("{password}", $pass, $mail_body); $mail_body = str_replace("{username}", $username, $mail_body); */ $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'); }); $labelname = ['txt_userdetaile_save_msg']; $languageDetails = languageModel::select($lantyp)->whereIn('ctrlCaptionId', $labelname)->get()->toArray(); return View::make('user/register/userregister')->with('Message', $languageDetails[0][$lantyp]); //return Redirect::to('userregister')->with('Message', ); // return Redirect::to('userregister')->with('Message', $languageDetails[0][$lantyp]); } }
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 adminLogin() { $user_name = Input::get('username'); $password = Input::get('password'); $LoginData_email = ['email' => $user_name, 'password' => $password]; $LoginData_user = ['username' => $user_name, 'password' => $password]; $LoginData = Input::except(array('_token', 'terms', 'client_login')); $validator = Validator::make($LoginData, User::$loginrule); $lantyp = Session::get('language'); if ($lantyp == "") { $lantyp = "value_en"; } if ($validator->fails()) { if ($validator->messages()->first('username') == "The username field is required when email is .") { $username = "******"; } else { $username = $validator->messages()->first('username'); } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$username, $validator->messages()->first('password')])->get()->toArray(); foreach ($languageDetails as $key => $val) { if (in_array($val['ctrlCaptionId'], ['alert_enterusername', 'alert_invaliduserpass', 'alert_enteruseroremail'])) { $er_data['username'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enterpassword'])) { $er_data['password'] = "******" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } } return Redirect::to('/admin')->withInput()->with('er_data', $er_data); } elseif (Auth::attempt(array('email' => $user_name, 'password' => $password), Input::has('terms') ? true : false) || Auth::attempt(array('username' => $user_name, 'password' => $password), Input::has('terms') ? true : false)) { $userid = Auth::user()->ID; if ($userid == 1) { $user_names = Auth::user()->firstname . " " . Auth::user()->lastname; if (Auth::user()->firstname != '') { Session::put('login_user', $user_names); } else { Session::put('login_user', Auth::user()->username); } return Redirect::intended('user'); } else { Session::flush(); return Redirect::to('/admin')->withInput()->with('Messageadmin', 'You are not a admin'); } } else { $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('ctrlCaptionId', ['alert_invaliduserpass'])->get()->toArray(); $er_data['username'] = "******" . $languageDetails[0]['ctrlCaptionId'] . "'>" . $languageDetails[0][$lantyp] . "</span>"; return Redirect::to('/admin')->withInput()->with('er_data', $er_data); } }
public function getmultilingualalert() { $ctrlCaptionId = $_GET['ctrlCaptionKey']; $lantyp = Session::get('language'); if ($lantyp == "") { $lantyp = "value_en"; } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('ctrlCaptionId', ['alert_delete_group_msg'])->get(); return $languageDetails[0][$lantyp]; }
function mobilemultilingual() { $languagekey = Input::get('languagekey'); $languagename = 'value_' . $languagekey; $languageDetails = languageModel::select('ctrlCaptionId', $languagename)->get()->toArray(); $Response = array('success' => '1', 'message' => 'Language Details Fetched Successfully', 'msgcode' => "c139"); $final = array("response" => $Response, 'languageDetails' => $languageDetails); return json_encode($final); }
public function update_contest() { $inputdetails = Input::except(array('_token', 'themephoto', 'sponsor', 'sponsorphoto', 'interest', 'contest_id', 'client_login', 'enable')); $contest_id = Input::get('contest_id'); if (Input::file('themephoto') != '') { $destinationPath_them = 'public/assets/upload/contest_theme_photo'; $filename_them = Input::file('themephoto')->getClientOriginalName(); $Image_them = str_random(8) . '_' . $filename_them; $inputdetails['themephoto'] = $Image_them; } $lantyp = Session::get('language'); if ($lantyp == "") { $lantyp = "value_en"; } $rules = array('contest_name' => 'required|unique:contest,contest_name,' . $contest_id, 'conteststartdate' => 'required', 'contestenddate' => 'required', 'votingstartdate' => 'required', 'votingenddate' => 'required', 'noofparticipant' => 'required', 'contesttype' => 'required'); if (Auth::user()->ID == 1) { $inputdetails['sponsorname'] = Input::get('sponsorname'); //return Input::file('sponsorphoto'); if (Input::file('sponsorphoto') != '') { $destinationPath_spons = 'public/assets/upload/sponsor_photo'; $filename_spons = Input::file('sponsorphoto')->getClientOriginalName(); $Image_spons = str_random(8) . '_' . $filename_spons; $inputdetails['sponsorphoto'] = $Image_spons; } } $usertimezone = contestModel::select('user.email', 'user.timezone', 'user.firstname', 'user.lastname', 'user.username', 'contest.contest_name', 'contest.themephoto')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $contest_id)->first(); $validation = Validator::make($inputdetails, $rules); if ($validation->passes()) { if (Auth::user()->ID == 1) { $admintimezone = User::where('ID', 1)->get()->first(); $inputdetails['conteststartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['conteststartdate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['contestenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['contestenddate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingstartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingstartdate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingenddate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); } else { $inputdetails['conteststartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['conteststartdate'])), $usertimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['contestenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['contestenddate'])), $usertimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingstartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingstartdate'])), $usertimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingenddate'])), $usertimezone->timezone, 'UTC', 'Y-m-d H:i:s'); } //$inputdetails['visibility']="p"; if (Auth::user()->ID == 1) { $inputdetails['visibility'] = Input::get('visibility'); } else { $inputdetails['visibility'] = "p"; } $interest = Input::get('interest'); $interest_length = sizeof(Input::get('interest')); if ($interest_length > 0) { contestinterestModel::whereNotIn('category_id', $interest)->where('contest_id', '=', $contest_id)->delete(); for ($i = 0; $i < $interest_length; $i++) { $interes['contest_id'] = $contest_id; $interes['category_id'] = $interest[$i]; $userInterest = contestinterestModel::where('contest_id', $contest_id)->where('category_id', $interest[$i])->lists('category_id'); if (count($userInterest) < 1) { contestinterestModel::create($interes); } unset($interes); } } else { contestinterestModel::where('contest_id', '=', $contest_id)->delete(); } $file_them = Input::file('themephoto'); $file_spons = Input::file('sponsorphoto'); if (isset($inputdetails['sponsorphoto'])) { $uploadSuccess_spons = $file_spons->move($destinationPath_spons, $Image_spons); } if (isset($inputdetails['themephoto'])) { $uploadSuccess_them = $file_them->move($destinationPath_them, $Image_them); } contestModel::where('ID', $contest_id)->update($inputdetails); if (Auth::user()->ID == 1) { if ($usertimezone->firstname != '') { $name = $usertimezone->firstname . ' ' . $usertimezone->lastname; } else { $name = $usertimezone->username; } $contestname = $usertimezone->contest_name; $themephoto = $usertimezone->themephoto; $email = $usertimezone->email; if ($usertimezone->createdby != 1) { $contestdetailsformail = contestModel::select('user.email', 'user.timezone', 'user.firstname', 'user.lastname', 'user.username', 'contest.contest_name', 'contest.themephoto', 'contest.description', 'contest.noofparticipant', 'contest.conteststartdate', 'contest.contestenddate', 'contest.votingstartdate', 'contest.votingenddate', 'contest.contesttype', 'contest.visibility', 'contest.status', 'contest.sponsorname')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $contest_id)->first(); if ($contestdetailsformail->status == 1) { $status = "Active"; } else { $status = "Inactive"; } if ($contestdetailsformail->visibility == "p") { $visibility = "Private"; } else { $visibility = "Public"; } $timezone = $contestdetailsformail->timezone; if ($contestdetailsformail->contesttype == "p") { $contesttype = "Photo"; } elseif ($contestdetailsformail->contesttype == "v") { $contesttype = "Video"; } else { $contesttype = "Topic"; } $details = '<div styel"float:left;"> <table width="500" height="95" border="1" style="margin-bottom:10px;float:left;font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Contest Name:</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $contestdetailsformail->contest_name . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Contest Image:</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;"><img src=' . URL::to('public/assets/upload/contest_theme_photo/' . $contestdetailsformail->themephoto) . ' width="150" height="150" /></td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Contest Type:</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $contesttype . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Status </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $status . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Contest Start date </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . timezoneModel::convert($contestdetailsformail->conteststartdate, 'UTC', $timezone, 'd-m-Y H:i:s') . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Contest end date </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . timezoneModel::convert($contestdetailsformail->contestenddate, 'UTC', $timezone, 'd-m-Y H:i:s') . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Voting start date </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . timezoneModel::convert($contestdetailsformail->votingstartdate, 'UTC', $timezone, 'd-m-Y H:i:s') . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Voting end date </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . timezoneModel::convert($contestdetailsformail->votingenddate, 'UTC', $timezone, 'd-m-Y H:i:s') . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Visibility </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $visibility . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Sponsor </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $contestdetailsformail->sponsorname . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">No of participant</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $contestdetailsformail->noofparticipant . '</td> </tr> </table> </div>'; $this->editcontestmail($email, $name, $contestname, $themephoto, $contest_id, $details); } $er_data['Message'] = 'Updated successfully'; return Redirect::to('edit_contest/' . $contest_id)->with('er_data', $er_data); } else { return Redirect::to('/contest_info/' . $contest_id); } } else { if ($validation->messages()->first('contest_name') == "The contest name field is required.") { $er_msg_con_name = "The Contest Name field is required."; } else { $er_msg_con_name = $validation->messages()->first('contest_name'); } if ($validation->messages()->first('conteststartdate') == "The conteststartdate field is required.") { $er_msg_con_start = "The Contest Start Date field is required."; } else { $er_msg_con_start = $validation->messages()->first('conteststartdate'); } if ($validation->messages()->first('contestenddate') == "The contestenddate field is required.") { $er_msg_con_end = "The Contest End Date field is required."; } else { $er_msg_con_end = $validation->messages()->first('contestenddate'); } if ($validation->messages()->first('votingstartdate') == "The votingstartdate field is required.") { $er_msg_vote_start = "The Voting Start Date field is required."; } else { $er_msg_vote_start = $validation->messages()->first('votingstartdate'); } if ($validation->messages()->first('votingenddate') == "The votingenddate field is required.") { $er_msg_vote_end = "The Voting End Date field is required."; } else { $er_msg_vote_end = $validation->messages()->first('votingenddate'); } if ($validation->messages()->first('noofparticipant') == "The noofparticipant field is required.") { $er_msg_noof_part = "The No of Participant field is required."; } else { $er_msg_noof_part = $validation->messages()->first('noofparticipant'); } if ($validation->messages()->first('contesttype') == "The contesttype field is required.") { $er_msg_con_type = "The Contest Type field is required."; } else { $er_msg_con_type = $validation->messages()->first('contesttype'); } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$er_msg_con_name, $er_msg_con_start, $er_msg_con_end, $er_msg_vote_start, $er_msg_vote_end, $er_msg_noof_part, $er_msg_con_type])->get()->toArray(); //return $validation->messages(); foreach ($languageDetails as $key => $val) { if (in_array($val['ctrlCaptionId'], ['alert_entercontestname', 'alert_alreadycontestname'])) { $er_data['contest_name'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enterconteststartdate'])) { $er_data['conteststartdate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_contestenddate'])) { $er_data['contestenddate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_votingstartdate'])) { $er_data['votingstartdate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_votingenddate'])) { $er_data['votingenddate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enternoofpartis'])) { $er_data['noofparticipant'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_entercontesttype'])) { $er_data['contesttype'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } } return Redirect::to('edit_contest/' . $contest_id)->with('er_data', $er_data)->with('old_data', $inputdetails); } }
public function updategroup($data = Null) { $inputdetails = Input::except(array('client_login', 'groupimage')); $updaterules = array('groupname' => 'required'); $validation = Validator::make($inputdetails, $updaterules); if ($validation->passes()) { if (Input::file('groupimage')) { $inputdetails['groupimage'] = Input::file('groupimage'); $destinationPath = 'public/assets/upload/group'; $filename = Input::file('groupimage')->getClientOriginalName(); $Image = str_random(8) . '_' . $filename; $inputdetails['groupimage'] = $Image; $file = Input::file('groupimage'); $uploadSuccess = $file->move($destinationPath, $Image); } $affectedRows = groupModel::where('ID', $data)->update($inputdetails); if ($affectedRows) { /// Admin process //// if (Auth::user()->ID == 1) { $savegroup = groupModel::select('grouptype', 'groupname', 'createdby', 'status', 'groupimage')->where('ID', $data)->get(); $groupowneruserid = $savegroup[0]['createdby']; $getcreateduserdetails = ProfileModel::select('email', 'firstname', 'lastname', 'username')->where('ID', $groupowneruserid)->get(); $email = $getcreateduserdetails[0]['email']; if ($getcreateduserdetails[0]['firstname'] != '') { $groupownername = $getcreateduserdetails[0]['firstname'] . ' ' . $getcreateduserdetails[0]['lastname']; } else { $groupownername = $getcreateduserdetails[0]['username']; } $groupname = $savegroup[0]['groupname']; ///// Group member details /////////// if ($savegroup[0]['status'] == 1) { $status = "Active"; } else { $status = "Inactive"; } $groupdetails = '<div style="font-size:12px; color: #000000; float:left;padding:10px 2px;width:100%;margin:15px;">Your group <b>"' . $groupname . '"</b> is edited by admin </div><div styel"float:left;"> <table width="180" height="95" border="0" style="margin-bottom:10px;float:left;font-family:Helvetica Neue, Helvetica, Arial, sans-serif;"> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Name:</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $groupname . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Type:</td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $savegroup[0]['grouptype'] . '</td> </tr> <tr> <td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group status </td> <td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $status . '</td> </tr> <tr style="border-radius:6px;-webkit-border-radius: 5px; -moz-border-radius: 5px;"> <td colspan="2" style="vertical-align: text-middle;" > <span><a href="' . URL::to('viewgroupmember/' . $groupowneruserid) . '" style="text-decoration:none;><img src="' . URL::to('assets/inner/images/vist_dingdatt.png') . '/assets/inner/images/vist_dingdatt.png" width="120" height="30" /></a></span> </td> </tr> </table> </div>'; $this->adminmailtogroupowner($email, $groupownername, $groupname, $groupownername, $data, $groupdetails); } } $lantyp = Session::get('language'); if ($lantyp == "") { $lantyp = "value_en"; } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', ['Group Details Updated Successfully'])->get()->toArray(); $er_data['message'] = $languageDetails[0][$lantyp]; return Redirect::to('group')->with('tab', 'grouplist')->with('er_data', $er_data); } else { return Redirect::to('editgroup/' . $data); } }