Exemplo n.º 1
0
 public function contestdelete()
 {
     $data = Input::get('contestid');
     $searchkey = Input::get('searchkey');
     /// Contest details /////
     $contestdetailsformail = contestModel::select('user.firstname', 'user.lastname', 'user.username', 'contest.contest_name', 'contest.contesttype', 'user.email', 'contest.themephoto')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $data)->first();
     $contestname = $contestdetailsformail->contest_name;
     $contesttype = $contestdetailsformail->contesttype;
     if ($contestdetailsformail->firstname != '') {
         $name = $contestdetailsformail->firstname . ' ' . $contestdetailsformail->lastname;
     } else {
         $name = $contestdetailsformail->username;
     }
     $contest_id = $data;
     $email = $contestdetailsformail->email;
     $details = "Your contest " . $contestname . " is deleted by admin.";
     $contestimage = $contestdetailsformail->themephoto;
     $contestdetails = contestparticipantModel::where('contest_id', $data)->get();
     for ($i = 0; $i < count($contestdetails); $i++) {
         $contestparticipantid = $contestdetails[$i]['ID'];
         $comment = commentModel::select('id')->where('contest_participant_id', $contestparticipantid)->get();
         for ($i = 0; $i < count($comment); $i++) {
             $replycmt = replycommentModel::where('comment_id', $comment[$i]['id'])->get()->count();
             if ($replycmt) {
                 replycommentModel::where('comment_id', $comment[$i]['id'])->delete();
             }
         }
         if (count($comment)) {
             commentModel::select('id')->where('contest_participant_id', $contestparticipantid)->delete();
         }
         $votingcnt = votingModel::where('contest_participant_id', $contestparticipantid)->get()->count();
         if ($votingcnt) {
             votingModel::where('contest_participant_id', $contestparticipantid)->delete();
         }
         $participantid = contestparticipantModel::where('ID', $contestparticipantid)->get()->count();
         if ($participantid) {
             $delete = contestparticipantModel::where('ID', $contestparticipantid)->delete();
         }
     }
     $contestcatgory = contestinterestModel::where('contest_id', $data)->count();
     if ($contestcatgory) {
         contestinterestModel::where('contest_id', $data)->delete();
     }
     $deleteinvitecontest = invitegroupforcontestModel::where('contest_id', $data)->count();
     if ($deleteinvitecontest) {
         invitegroupforcontestModel::where('contest_id', $data)->delete();
     }
     $deletefollowercontest = invitefollowerforcontestModel::where('contest_id', $data)->count();
     if ($deletefollowercontest) {
         invitefollowerforcontestModel::where('contest_id', $data)->delete();
     }
     $privatecontestdelete = privateusercontestModel::where('contest_id', $data)->count();
     if ($privatecontestdelete) {
         privateusercontestModel::where('contest_id', $data)->delete();
     }
     $deletecontest = contestModel::where('ID', $data)->delete();
     if ($deletecontest) {
         $this->contestchangesmaildelete($email, $name, $contestname, $contest_id, $contestimage, $details);
     }
     $er_data['message'] = 'Contest removed successfully';
     return Redirect::to('managecontest')->with('er_data', $er_data)->with('usercontestlist', '')->with('searchkey', $searchkey);
 }
Exemplo n.º 2
0
 public function uninvite_allfollower()
 {
     $contest_id = $_GET['contest_id'];
     $follower_ids = Input::get("follower_list");
     $follower_ids = explode(',', $follower_ids);
     $followercount = count($follower_ids);
     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 == 1) {
                 invitefollowerforcontestModel::where('follower_id', $follower_ids[$i])->where('contest_id', $contest_id)->delete();
                 $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $follower_ids[$i])->count();
                 if ($invited_member) {
                     privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $follower_ids[$i])->delete();
                 }
             }
         }
         return 1;
     } else {
         return 0;
     }
 }
Exemplo n.º 3
0
}
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);
?>
<div class="tabs-wrapper"> <input type="hidden" class="contest_id" value="{{ $contest_id }}" />
    <input type="radio" name="tab" id="tab1" class="tab-head" onclick="showhide_subtab('{{$contest_id}}');" <?php 
if ($tab == "contest_info") {
 public function uninvitefollowerforcontest()
 {
     $contest_id = Input::get('contest_id');
     $followerid = Input::get('follower_id');
     $invited = invitefollowerforcontestModel::where('follower_id', $followerid)->where('contest_id', $contest_id)->count();
     if ($invited == 1) {
         invitefollowerforcontestModel::where('follower_id', $followerid)->where('contest_id', $contest_id)->delete();
         $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $followerid)->count();
         if ($invited_member) {
             privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $followerid)->delete();
         }
         $Response = array('success' => '1', 'message' => 'Uninvited successfully', 'msgcode' => "c198");
         $final = array("response" => $Response);
         return json_encode($final);
     } else {
         $Response = array('success' => '0', 'message' => 'No data', 'msgcode' => "c199");
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }
    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')->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'];
        }
        $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'];
        //$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')->LeftJoin('user', 'user.ID', '=', 'followers.followerid')->where('followers.id', $uninvitedfollower[$i])->get();
                    $gcmid = $folloerdetails[0]['gcm_id'];
                    $email = $folloerdetails[0]['email'];
                    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 != '') {
                        $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 {
                        //$contestcreatedby= User::find($contestdetails[0]['createdby']);
                        Mail::send([], array('email' => $email, 'contestcreatedby' => $contestcreatedby, 'contesttype' => $contesttype, 'contestname' => $contestname, 'contest_id' => $contest_id), function ($message) use($email, $contestcreatedby, $contesttype, $contestname, $contest_id) {
                            $mail_body = '<body style="padding:0px;margin:-20px 0 0 0px; font-family: Arial, Helvetica, sans-serif; color: #222222; font-size:12px;">
						<div style="width:550px;height:auto; border:1px solid #d5d5d5;padding:0px;margin:0px;overflow:hidden;">
						
						<div style="display:block; margin:25px; overflow:hidden;">
						<div style="display:block; padding: 10px; border: 1px solid #e5e5e5; margin:10px 0px;">
							<span style="padding:0px;margin:0px;font-weight:bold;">Invitation for join the contest.</span>
						</div>
						<div style="display: block; margin: 15px;">
							 <h4 style="padding:0px;margin:0; font-size:14px;color:#d33030;">Contest Details:</h4>
						</div>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;"> Contest Name:</span>' . $contestname . '</p>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Contest Type:</span>' . $contesttype . '</p>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Created by:</span>' . $contestcreatedby . '</p>
						<p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;">This is auto generate email so please do not reply to this email.</p>
						<p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;"><a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">' . URL::to('contest_info/' . $contest_id) . '</a> </p>
						<div style="padding:0; margin:15px;">
						<p style="padding:0px; font-weight: bold;">Thanks,</p>
						DingDatt</div>
						<a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">
						<img src="' . URL::to('assets/inner/img/DingDatt_logo_web1.png') . '" width="110" height="86" style="width:110px; padding:0px; margin:0px;" alt="DingDatt"/>
						</a>
						</div>
						<div style="height:25px; width:100%;">&nbsp;</div>
						</div>
						</body>';
                            $message->setBody($mail_body, 'text/html');
                            $message->to($email);
                            $message->subject('Dingdatt-Invitation for join the contest');
                        });
                    }
                }
                $Response = array('success' => '1', 'message' => 'Invited Successfully');
                $final = array("response" => $Response);
                return json_encode($final);
            } else {
                $Response = array('success' => '0', 'message' => 'Already Invited All Followers');
                $final = array("response" => $Response);
                return json_encode($final);
            }
        } else {
            $user_id = Input::get('user_id');
            $follower_id = Input::get('follower_id');
            $inpudetails['follower_id'] = $follower_id;
            invitefollowerforcontestModel::create($inpudetails);
            /******** Here want to set the Notification for Group Members *********/
            $groupmemberlist = followModel::select('id')->where('userid', $user_id)->where('followerid', $follower_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();
            $gcmid = $folloerdetails[0]['gcm_id'];
            $email = $folloerdetails[0]['email'];
            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 != '') {
                $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 {
                //$contestcreatedby= User::find($contestdetails[0]['createdby']);
                Mail::send([], array('email' => $email, 'contestcreatedby' => $contestcreatedby, 'contesttype' => $contesttype, 'contestname' => $contestname, 'contest_id' => $contest_id), function ($message) use($email, $contestcreatedby, $contesttype, $contestname, $contest_id) {
                    $mail_body = '<body style="padding:0px;margin:-20px 0 0 0px; font-family: Arial, Helvetica, sans-serif; color: #222222; font-size:12px;">
						<div style="width:550px;height:auto; border:1px solid #d5d5d5;padding:0px;margin:0px;overflow:hidden;">
						
						<div style="display:block; margin:25px; overflow:hidden;">
						<div style="display:block; padding: 10px; border: 1px solid #e5e5e5; margin:10px 0px;">
							<span style="padding:0px;margin:0px;font-weight:bold;">Invitation for join the contest.</span>
						</div>
						<div style="display: block; margin: 15px;">
							 <h4 style="padding:0px;margin:0; font-size:14px;color:#d33030;">Contest Details:</h4>
						</div>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;"> Contest Name:</span>' . $contestname . '</p>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Contest Type:</span>' . $contesttype . '</p>
						<p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Created by:</span>' . $contestcreatedby . '</p>
						<p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;">This is auto generate email so please do not reply to this email.</p>
						<p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;"><a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">' . URL::to('contest_info/' . $contest_id) . '</a> </p>
						<div style="padding:0; margin:15px;">
						<p style="padding:0px; font-weight: bold;">Thanks,</p>
						DingDatt</div>
						<a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">
						<img src="' . URL::to('assets/inner/img/DingDatt_logo_web1.png') . '" width="110" height="86" style="width:110px; padding:0px; margin:0px;" alt="DingDatt"/>
						</a>
						</div>
						<div style="height:25px; width:100%;">&nbsp;</div>
						</div>
						</body>';
                    $message->setBody($mail_body, 'text/html');
                    $message->to($email);
                    $message->subject('Dingdatt-Invitation for join the contest');
                });
            }
            ////
            $Response = array('success' => '1', 'message' => 'Invited Successfully');
            $final = array("response" => $Response);
            return json_encode($final);
        }
    }