Exemplo n.º 1
0
 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);
         }
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 3
0
 public function userdelete()
 {
     $userid = $_GET['userid'];
     /// Comment delete //////////
     $cmtcnt = commentModel::select('id')->where('userid', $userid)->get();
     for ($i = 0; $i < count($cmtcnt); $i++) {
         $replycnt = replycommentModel::where('comment_id', $cmtcnt[$i]['id'])->get()->count();
         if ($replycnt) {
             replycommentModel::where('comment_id', $cmtcnt[$i]['id'])->delete();
         }
     }
     /// REply comt delete /////
     $replycmtcnt = replycommentModel::where('user_id', $userid)->get()->count();
     if ($replycmtcnt) {
         replycommentModel::where('user_id', $userid)->delete();
     }
     /// Contest delete/////
     $contestcnt = contestModel::select('ID')->where('createdby', $userid)->get();
     for ($k = 0; $k < count($contestcnt); $k++) {
         $conpartdet = contestparticipantModel::select('ID')->where('contest_id', $contestcnt[$k]['ID'])->get();
         for ($p = 0; $p < count($conpartdet); $p++) {
             $cmtcnt = commentModel::where('contest_participant_id', $conpartdet[$p]['ID'])->delete();
             votingModel::where('contest_participant_id', $conpartdet[$p]['ID'])->delete();
         }
         $contestintrdlet = contestinterestModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
         invitefollowerforcontestModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
         invitegroupforcontestModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
         leaderboardModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
         privateusercontestModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
         contestModel::where('createdby', $userid)->delete();
         contestparticipantModel::where('contest_id', $contestcnt[$k]['ID'])->delete();
     }
     ///Contestparticipant delete ///////////
     $contestparticipant = contestparticipantModel::where('user_id', $userid)->get();
     for ($p = 0; $p < count($contestparticipant); $p++) {
         $cmtcnt = commentModel::where('contest_participant_id', $contestparticipant[$p]['ID'])->delete();
         votingModel::where('contest_participant_id', $contestparticipant[$p]['ID'])->delete();
     }
     ///////////////Group //////////////////
     $group = groupModel::select('ID')->where('createdby', $userid)->get();
     if (count($group) > 0) {
         groupmemberModel::where('group_id', $group[0]['ID'])->delete();
         invitegroupforcontestModel::where('group_id', $group[0]['ID'])->delete();
         invitememberforgroupModel::where('group_id', $group[0]['ID'])->delete();
     }
     contestparticipantModel::where('user_id', $userid)->delete();
     followModel::where('userid', $userid)->delete();
     followModel::where('followerid', $userid)->delete();
     userinterestModel::where('user_id', $userid)->delete();
     votingModel::where('user_id', $userid)->delete();
     invitememberforgroupModel::where('user_id', $userid)->delete();
     groupmemberModel::where('user_id', $userid)->delete();
     ProfileModel::where('ID', $userid)->delete();
     $er_data['message'] = 'User details deleted successfully';
     return Redirect::to('user')->with('er_data', $er_data);
 }
Exemplo n.º 4
0
?>
<div class="main_head" style="width:180px;"><span id="txt_editmyprofile" class="txt_editmyprofile">Edit Profile</span></div>
<div class="main_wrap" style="background-colour:">    
    <form id="editprofile" name="edit_profile_update" enctype="multipart/form-data"  action="<?php 
echo url() . "/edit_profile_update/" . $user_id;
?>
" method="post" class="form_mid">
        @if(isset($er_data['Message']))
        <p class="alert" style="color:green;padding:5px;text-align:center;font-size:13px">{{ $er_data['Message'] }}</p>
        @endif
<?php 
//$user_id = Auth::user()->ID;
$user_id = $user_id;
$profileData = ProfileModel::where('ID', $user_id)->first();
$interestList = InterestCategoryModel::where('status', 1)->lists('Interest_name', 'Interest_id');
$userInterest = userinterestModel::where('user_id', $user_id)->lists('interest_id');
$timezoneList = timezoneDBModel::lists('timezonename', 'timezonevalue');
?>
        <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>
                <input type="text" id="pch_username" name="username" placeholder="User Name" title="User Name" value="{{ isset($old_data['username'])?$old_data['username']:$profileData['username'] }}" <?php 
if (Auth::user()->ID != $user_id) {
    echo "readonly";
}
?>
  class="radius pfix_mar" />
                </p>
                @if(isset($er_data['username']))
                <p class="alert" style="text-align:left;margin-left:55px;color:red;">{{ $er_data['username'] }}</p>
 public function editmyprofile()
 {
     $GeneralData = array_filter(Input::except(array('_token', 'passwordhidden', 'profilepicture', 'interest_id', 'userid', 'timezone', 'dateofbirth')));
     $timezone = Input::get('timezone');
     $GeneralData['dateofbirth'] = timezoneModel::convert(Input::get('dateofbirth'), $timezone, 'UTC', 'Y-m-d');
     $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);
     } else {
         //$GeneralData['profilepicture']=Input::get('profileimgedithidden');
     }
     $GeneralData['status'] = 1;
     $data = Input::get('userid');
     $newpassword = Input::get('password');
     $updaterules = array('username' => 'required|unique:user,username,' . $data, 'password' => 'confirmed:min:5', 'email' => 'required|email|unique:user,email,' . $data);
     $validation = Validator::make($GeneralData, $updaterules);
     if ($validation->passes()) {
         if ($newpassword != "") {
             $GeneralData['password'] = Hash::make(Input::get('password'));
         }
         unset($GeneralData["password_confirmation"]);
         $affectedRows = ProfileModel::where('ID', $data)->update($GeneralData);
         $interest_id = Input::get('interest_id');
         $interestid = explode(',', $interest_id);
         $interestidcount = count($interestid);
         $interest['user_id'] = Input::get('userid');
         $affectedRows = userinterestModel::where('user_id', $data)->delete();
         for ($i = 0; $i < $interestidcount; $i++) {
             $interest['interest_id'] = $interestid[$i];
             $validationinterest = Validator::make($interest, userinterestModel::$rules);
             if ($validationinterest->passes()) {
                 $userregister = userinterestModel::create($interest);
             }
         }
         $Response = array('success' => '1', 'message' => 'Record Updated successfully', 'msgcode' => "c109");
         $final = array("response" => $Response);
         return json_encode($final);
     } else {
         $Response = array('success' => '0', 'message' => $validation->messages()->first(), 'msgcode' => "c110");
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }
Exemplo n.º 6
0
 public function savecontest()
 {
     $conteststart = Input::get('conteststartdate');
     $contestenddate = Input::get('contestenddate');
     $votingstartdate = Input::get('votingstartdate');
     $votingenddate = Input::get('votingenddate');
     $a = 0;
     //if($conteststart<$contestenddate && $contestenddate<=$votingstartdate && $votingstartdate<$votingenddate){}else{  return "S"; }
     if ($conteststart > $contestenddate) {
         $a = 1;
         $er_data['contestenddate'] = 'Contest end date should be greater than contest start date';
     } elseif (strtotime($contestenddate) > strtotime($votingstartdate)) {
         $a = 1;
         $er_data['votingstartdate'] = 'Voting start date should be greater than or equal to contest end date';
     } elseif ($votingstartdate > $votingenddate) {
         $a = 1;
         $er_data['votingenddate'] = 'Voting end date should be greater than voting start date';
     }
     if ($a == 1) {
         return Redirect::to('/contest')->withInput()->with('er_data', $er_data);
     }
     $inputdetails = Input::except(array('_token', 'themephoto', 'sponsor', 'sponsorphoto', 'sponsorname'));
     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;
     }
     if (Auth::user()->ID == 1) {
         $inputdetails['sponsorname'] = Input::get('sponsorname');
         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;
         }
     }
     $lantyp = Session::get('language');
     if ($lantyp == "") {
         $lantyp = "value_en";
     }
     $validation = Validator::make($inputdetails, contestModel::$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'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s');
             $inputdetails['contestenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['contestenddate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s');
             $inputdetails['votingstartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingstartdate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s');
             $inputdetails['votingenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingenddate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s');
         }
         $inputdetails['createdby'] = Auth::user()->ID;
         if (Auth::user()->ID == 1) {
             $inputdetails['visibility'] = Input::get('visibility');
         } else {
             $inputdetails['visibility'] = "p";
         }
         $inputdetails['status'] = 1;
         $inputdetails['createddate'] = $inputdetails['updateddate'] = date('Y-m-d H:i:s');
         $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);
         }
         $product = contestModel::create($inputdetails);
         $contest_id = $product->ID;
         $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);
                     /// Vew enhanchment for interest send push notification to appropriate user ////
                     $pushnotificationdetail = userinterestModel::select('user.firstname', 'user.lastname', 'user.username', 'user.ID', 'user.email', 'user.gcm_id', 'user.device_type', 'user.timezone')->LeftJoin('user', 'user.ID', '=', 'user_interest.user_id')->where('interest_id', $interest[$i])->get();
                     for ($j = 0; $j < count($pushnotificationdetail); $j++) {
                         if (Auth::user()->ID == 1) {
                             if ($pushnotificationdetail[$j]['firstname'] != '') {
                                 $name = $pushnotificationdetail[$j]['firstname'] . ' ' . $pushnotificationdetail[$j]['lastname'];
                             } else {
                                 $name = $pushnotificationdetail[$j]['username'];
                             }
                             $email = $pushnotificationdetail[$j]['email'];
                             $gcm_id = $pushnotificationdetail[$j]['gcm_id'];
                             $device_type = $pushnotificationdetail[$j]['device_type'];
                             $uid = $pushnotificationdetail[$j]['ID'];
                             $contestname = Input::get('contest_name');
                             $contesttype = Input::get('contesttype');
                             $contestimage = $Image_them;
                             $conteststartdate = timezoneModel::convert($inputdetails['conteststartdate'], 'UTC', $pushnotificationdetail[$j]['timezone'], 'd-m-Y h:i:s');
                             $contestenddate = timezoneModel::convert($inputdetails['contestenddate'], 'UTC', $pushnotificationdetail[$j]['timezone'], 'd-m-Y h:i:s');
                             $this->Inviteforcontestintest($name, $email, $gcm_id, $device_type, $uid, $interest[$i], $contestname, $contest_id, $contesttype, $contestimage, $conteststartdate, $contestenddate);
                         }
                     }
                     //
                     //$interest[$i]
                 }
                 unset($interes);
             }
         }
         $private_cont['contest_id'] = $contest_id;
         $private_cont['user_id'] = Auth::user()->ID;
         $private_cont['requesteddate'] = date('Y-m-d H:i:s');
         $private_cont['status'] = 1;
         if (Auth::user()->ID == 1) {
             if (Input::get('visibility') == 'p') {
                 privateusercontestModel::create($private_cont);
             }
         } else {
             privateusercontestModel::create($private_cont);
         }
         return Redirect::to('contest_info/' . $product->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');
         }
         if ($validation->messages()->first('themephoto') == "The themephoto field is required.") {
             $er_msg_them = "The Contest Image field is required.";
         } else {
             $er_msg_them = $validation->messages()->first('themephoto');
         }
         $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, $er_msg_them])->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>";
             } elseif (in_array($val['ctrlCaptionId'], ['alert_themephoto'])) {
                 $er_data['themephoto'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>";
             }
         }
         return Redirect::to('/contest')->withInput()->with('er_data', $er_data);
     }
 }