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 inviteall_follower()
 {
     $follower_ids = Input::get("follower_list");
     $contest_id = Input::get("contest_id");
     $follower_ids = explode(',', $follower_ids);
     $followercount = count($follower_ids);
     $curdate = date('Y-m-d H:i:s');
     $contest_det = contestModel::where("ID", $contest_id)->first();
     if (Auth::user()->firstname != '') {
         $inviter = Auth::user()->firstname . " " . Auth::user()->lastname;
     } else {
         $inviter = Auth::user()->username;
     }
     if ($contest_det['contesttype'] == "p") {
         $contesttype = "Photo";
     } else {
         if ($contest_det['contesttype'] == "v") {
             $contesttype = "Video";
         } else {
             if ($contest_det['contesttype'] == "t") {
                 $contesttype = "Topic";
             }
         }
     }
     $contestname = $contest_det['contest_name'];
     if ($followercount > 0) {
         for ($i = 0; $i < $followercount; $i++) {
             $invited = invitefollowerforcontestModel::where('follower_id', $follower_ids[$i])->where('contest_id', $contest_id)->count();
             if ($invited == 0) {
                 $input_details['follower_id'] = $follower_ids[$i];
                 $input_details['contest_id'] = $contest_id;
                 $input_details['invitedate'] = $curdate;
                 invitefollowerforcontestModel::create($input_details);
                 $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $follower_ids[$i])->count();
                 if ($contest_det['visibility'] == "p" && $invited_member == 0) {
                     $privat_user['user_id'] = $follower_ids[$i];
                     $privat_user['contest_id'] = $contest_id;
                     $privat_user['requesteddate'] = date('Y-m-d H:i:s');
                     $privat_user['status'] = 1;
                     privateusercontestModel::create($privat_user);
                 }
                 if ($invited_member == 0) {
                     $user = ProfileModel::where('ID', $followerid)->first();
                     if ($user['firstname'] != '') {
                         $name = $user['firstname'] . ' ' . $user['lastname'];
                     } else {
                         $name = $user['username'];
                     }
                     $email = $user['email'];
                     $this->invitefollowerforcontestmail($name, $email, $inviter, $contesttype, $contestname, $contest_id);
                 }
             }
         }
         return 1;
     } else {
         return 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);
 }
Exemple #4
0
}
?>

                                    </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>
 public function invitefollowesforcontest()
 {
     //invitefollowerforcontestModel
     $invite_type = Input::get('invite_type');
     $contest_id = Input::get('contest_id');
     $curdate = date('Y-m-d h:i:s');
     $inpudetails['contest_id'] = $contest_id;
     $inpudetails['invitedate'] = $curdate;
     $contestdetails = contestModel::select('contest.createdby', 'contest.visibility', 'contest.contest_name', 'contest.contesttype', 'user.firstname', 'user.lastname', 'user.username', 'contest.conteststartdate', 'contest.contestenddate', 'contest.themephoto')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $contest_id)->get();
     $userid = $contestdetails[0]['createdby'];
     if ($contestdetails[0]['firstname'] != '') {
         $contestcreatedby = $contestdetails[0]['firstname'] . ' ' . $contestdetails[0]['lastname'];
     } else {
         $contestcreatedby = $contestdetails[0]['username'];
     }
     $conteststartdate = $contestdetails[0]['conteststartdate'];
     $contestenddate = $contestdetails[0]['contestenddate'];
     $contesttype = $contestdetails[0]['contesttype'];
     if ($contesttype == 'p') {
         $contesttype = "Photo";
     } else {
         if ($contesttype == 'v') {
             $contesttype = "Video";
         } else {
             if ($contesttype == 't') {
                 $contesttype = "Topic";
             }
         }
     }
     $contestname = $contestdetails[0]['contest_name'];
     $contestimage = $contestdetails[0]['themephoto'];
     //$userid = Input::get('user_id');
     if ($invite_type == 'All') {
         $invitedlis = invitefollowerforcontestModel::where('contest_id', $contest_id)->lists('follower_id');
         $invitedcnt = count($invitedlis);
         if ($invitedcnt) {
             $uninvitedfollower = followModel::where('userid', Input::get('user_id'))->whereNotIn('id', $invitedlis)->lists('id');
         } else {
             $uninvitedfollower = followModel::where('userid', Input::get('user_id'))->lists('id');
         }
         if (count($uninvitedfollower)) {
             for ($i = 0; $i < count($uninvitedfollower); $i++) {
                 $inpudetails['follower_id'] = $uninvitedfollower[$i];
                 invitefollowerforcontestModel::create($inpudetails);
                 /******** Here want to set the Notification for Group Members *********/
                 //return $uninvitedfollower[$i];
                 //$folloerdetails = followModel::select('user.firstname','user.lastname','user.username','user.ID as follower_user_id','user.gcm_id','user.email','user.device_type')->LeftJoin('user','user.ID','=','followers.followerid')->where('followers.id',$uninvitedfollower[$i])->get();
                 $folloerdetails = ProfileModel::where('ID', $followerid)->get();
                 $gcmid = $folloerdetails[0]['gcm_id'];
                 $device_type = $folloerdetails[0]['device_type'];
                 $email = $folloerdetails[0]['email'];
                 if ($folloerdetails[0]['firstname'] != '') {
                     $name = $folloerdetails[0]['firstname'] . ' ' . $folloerdetails[0]['lastname'];
                 } else {
                     $name = $folloerdetails[0]['username'];
                 }
                 if ($contestdetails[0]['visibility'] == 'p') {
                     $privat_user['user_id'] = $folloerdetails[0]['follower_user_id'];
                     $privat_user['contest_id'] = $contest_id;
                     $privat_user['requesteddate'] = date('Y-m-d H:i:s');
                     $privat_user['status'] = 1;
                     $privatecontestcnt = privateusercontestModel::where('user_id', $folloerdetails[0]['follower_user_id'])->where('contest_id', $contest_id)->get()->count();
                     if ($privatecontestcnt == 0) {
                         privateusercontestModel::create($privat_user);
                     }
                 }
                 if ($gcmid != '' && $device_type == 'A') {
                     $Message['user_id'] = $folloerdetails[0]['follower_user_id'];
                     $Message['title'] = 'Ding Datt';
                     $Message['message'] = 'You are invited for the Contest :' . $contestdetails[0]['contest_name'];
                     $Message['contest_id'] = $contest_id;
                     $Message = array("notification" => $Message);
                     $DeviceId = array($gcmid);
                     $Message = array("notification" => $Message);
                     $this->PushNotification($DeviceId, $Message);
                 } else {
                     if ($gcmid != '' && $device_type == 'I') {
                         $DeviceId = $gcmid;
                         $Message = $folloerdetails[0]['follower_user_id'] . '*You are invited for the Contest :' . $contestname;
                         $Message = str_replace(" ", "_", $Message);
                         $this->PushNotificationIos($DeviceId, $Message);
                     } else {
                         //$contestcreatedby= User::find($contestdetails[0]['createdby']);
                         $this->invitefollowerforcontestmail($name, $email, $contestcreatedby, $contesttype, $contestname, $contest_id, $conteststartdate, $contestenddate, $contestimage);
                     }
                 }
             }
             $Response = array('success' => '1', 'message' => 'Invited Successfully', 'msgcode' => "c166");
             $final = array("response" => $Response);
             return json_encode($final);
         } else {
             $Response = array('success' => '0', 'message' => 'Already Invited All Followers', 'msgcode' => "171");
             $final = array("response" => $Response);
             return json_encode($final);
         }
     } else {
         $ok = 0;
         $user_id = Input::get('user_id');
         $follower_id = Input::get('follower_id');
         $inpudetails['follower_id'] = $follower_id;
         /*$invitefollowcnt = invitefollowerforcontestModel::where('follower_id',$follower_id)->where('contest_id',$contest_id)->get()->count();
         	 if($invitefollowcnt==0)
         	 {*/
         invitefollowerforcontestModel::create($inpudetails);
         $ok = 1;
         /******** Here want to set the Notification for Group Members *********/
         $groupmemberlist = followModel::select('id')->where('userid', $follower_id)->where('followerid', $user_id)->get();
         //return $groupmemberlist[0]['id'];
         ///
         /*$folloerdetails = followModel::select('user.firstname','user.lastname','user.username','user.ID as follower_user_id','user.gcm_id','user.email')->LeftJoin('user','user.ID','=','followers.followerid')->where('followers.id',$groupmemberlist[0]['id'])->get();
         		
         		if($folloerdetails[0]['firstname']!=''){ $name =$folloerdetails[0]['firstname'].' '.$folloerdetails[0]['lastname']; }else{ $name =$folloerdetails[0]['username'];} 
         		
         		  $gcmid = $folloerdetails[0]['gcm_id'];
         		  $email = $folloerdetails[0]['email']; */
         $user = ProfileModel::where('ID', $follower_id)->first();
         if ($user['firstname'] != '') {
             $name = $user['firstname'] . ' ' . $user['lastname'];
         } else {
             $name = $user['username'];
         }
         $email = $user['email'];
         $gcmid = $user['gcm_id'];
         $device_type = $user['device_type'];
         if ($contestdetails[0]['visibility'] == 'p') {
             $privat_user['user_id'] = $follower_id;
             $privat_user['contest_id'] = $contest_id;
             $privat_user['requesteddate'] = date('Y-m-d H:i:s');
             $privat_user['status'] = 1;
             $privatecontestcnt = privateusercontestModel::where('user_id', $follower_id)->where('contest_id', $contest_id)->get()->count();
             if ($privatecontestcnt == 0) {
                 privateusercontestModel::create($privat_user);
             }
         }
         if ($gcmid != '' && $device_type == 'A') {
             $Message['user_id'] = $follower_id;
             $Message['title'] = 'Ding Datt';
             $Message['message'] = 'You are invited for the Contest :' . $contestdetails[0]['contest_name'];
             $Message['contest_id'] = $contest_id;
             $Message = array("notification" => $Message);
             $DeviceId = array($gcmid);
             $Message = array("notification" => $Message);
             $this->PushNotification($DeviceId, $Message);
         } else {
             if ($gcmid != '' && $device_type == 'I') {
                 $DeviceId = $gcmid;
                 $Message = $follower_id . '*You are invited for the Contest :' . $contestname;
                 $Message = str_replace(" ", "_", $Message);
                 $this->PushNotificationIos($DeviceId, $Message);
             } else {
                 //$contestcreatedby= User::find($contestdetails[0]['createdby']);
                 $this->invitefollowerforcontestmail($name, $email, $contestcreatedby, $contesttype, $contestname, $contest_id, $conteststartdate, $contestenddate, $contestimage);
             }
         }
         //}else{$ok=2;}
         ////
         if ($ok == 1) {
             $Response = array('success' => '1', 'message' => 'Invited Successfully', 'msgcode' => "c166");
             $final = array("response" => $Response);
             return json_encode($final);
         } else {
             if ($ok == 2) {
                 $Response = array('success' => '0', 'message' => 'Already Invited this Followers', 'msgcode' => "171");
                 $final = array("response" => $Response);
                 return json_encode($final);
             }
         }
     }
 }
if (Session::has('gallerytype')) {
    $gallerytype = Session::get('gallerytype');
} else {
    $gallerytype = 1;
}
if (Session::has('contest_partipant_id')) {
    $contest_partipant_id = Session::get('contest_partipant_id');
} else {
    $contest_partipant_id = '';
}
if (Session::has('viewcommentforparticipant')) {
    $viewcommentforparticipant = Session::get('viewcommentforparticipant');
}
if (isset($contest_id)) {
    $contestdetails = contestModel::where('ID', $contest_id)->first();
    $owner_contest = ProfileModel::where('ID', $contestdetails['createdby'])->first();
}
////// New User save the private contest for Share the Contest //////
if ($contestdetails->visibility == 'p') {
    $privatecontestmodel = privateusercontestModel::where('user_id', Auth::user()->ID)->where('contest_id', $contest_id)->get()->count();
    if ($privatecontestmodel == 0) {
        $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;
        privateusercontestModel::create($private_cont);
    }
}
$user_id = Auth::user()->ID;
$old_cont_value = contestparticipantModel::where('contest_id', $contest_id)->where('user_id', $user_id)->first();
$old_cont_count = count($old_cont_value);
 public function mobilegooglelogin()
 {
     $inpudetails = Input::except(array('link'));
     $inpudetails['google_id'] = Input::get('id');
     $emailid = Input::get('email');
     $curdate = date('Y-m-d h:i:s');
     $inpudetails['createddate'] = $curdate;
     //return $inpudetails;
     $validator = Validator::make($inpudetails, ProfileModel::$socialrules);
     if ($validator->passes()) {
         $verifyuser = ProfileModel::where('email', $emailid)->get()->count();
         $userid = ProfileModel::select('ID')->where('email', $emailid)->get();
         if ($verifyuser) {
             $userid1 = $userid[0]['ID'];
             $updatedata['google_id'] = Input::get('id');
             $updatedata['gcm_id'] = Input::get('gcm_id');
             $updatedata['device_id'] = Input::get('device_id');
             $updatedata['device_type'] = Input::get('device_type');
             $userregister = ProfileModel::where('ID', $userid1)->update($updatedata);
             $Response = array('success' => '1', 'message' => 'successfully Login', 'userid' => $userid1);
             $final = array("response" => $Response);
             return json_encode($final);
         } else {
             $inpudetails['google_id'] = Input::get('id');
             $inpudetails['status'] = 'A';
             $inpudetails['gcm_id'] = Input::get('gcm_id');
             $inpudetails['device_id'] = Input::get('device_id');
             $inpudetails['device_type'] = Input::get('device_type');
             $inpudetails['timezone'] = Input::get('timezone');
             $saved = ProfileModel::create($inpudetails);
             if ($saved) {
                 $userid = ProfileModel::max('ID');
                 $Response = array('success' => '1', 'message' => 'successfully created Login', 'userid' => $userid);
                 $final = array("response" => $Response);
                 return json_encode($final);
             }
         }
     } else {
         $Response = array('success' => '0', 'message' => 'Some Fields are Missing');
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }
}
if (Session::has('Massage')) {
    $inv_suc_message = Session::get('Massage');
}
?>
<div id="inv_success" style="color:green;text-align:center;font-size:14px"><?php 
if (Session::has('Massage')) {
    echo $inv_suc_message;
}
?>
 </div>	
                <div class="clrscr"></div>
                <form id="editprofile" action="" method="post" class="form_mid">
                    <div class="loginform loginbox mar1">
<?php 
$profiledetail = ProfileModel::where('ID', $profileid)->get();
$timezoneList = timezoneDBModel::lists('timezonename', 'timezonevalue');
?>
                        <legend class="radius"><div class="leg_head"><span id="txt_personalinfo">Personal Info</span></div>

                            <div class="personal_info">

                                @if($profiledetail[0]['profilepicture']!='')
                                <div><img src="{{ ($profiledetail[0]['profilepicture']!='')?(URL::to('public/assets/upload/profile/'.$profiledetail[0]['profilepicture'])):(URL::to('assets/inner/images/avator.png')) }}" width="100" height="100" class="roundedimg brd_grn"></div>
                                @endif
                                @if($profiledetail[0]['profilepicture']=='')
                                <div><img src="{{ URL::to('assets/inner/images/avator.png') }}" width="100" height="100" class="roundedimg brd_grn"></div>
                                @endif

                                <div class="per_det">
                                    <div><strong><span id="pch_firstname">First Name:</span></strong> {{ $profiledetail[0]['firstname'] }}</div>