</p> <p> <div class="inp_pfix"><img src="{{ URL::to($assets_path.'img/date_icons.png')}}" width="25" height="25"></div> <input type="text" id="votingend" name="votingenddate" placeholder="Voting End Date" title="Voting End Date" value="{{ isset($old_data['votingenddate'])?date('m/d/Y h:i a',strtotime($old_data['votingenddate'])):(timezoneModel::convert($contestdetails['votingenddate'],'UTC',Auth::user()->timezone, 'm/d/Y h:i a')) }}" <?php if (Auth::user()->ID != 1) { if ($contestdetails['votingenddate'] < date('Y-m-d H:i:s') || $contestdetails['votingenddate'] <= date('Y-m-d H:i:s')) { echo "disabled"; } } ?> class="radius pfix_mar" readonly /> <?php if (Auth::user()->ID != 1) { if ($contestdetails['votingenddate'] <= date('Y-m-d H:i:s') || $contestdetails['votingenddate'] <= date('Y-m-d H:i:s')) { echo "<input type='hidden' name='votingenddate' value='" . timezoneModel::convert($contestdetails['votingenddate'], 'UTC', Auth::user()->timezone, 'm/d/Y h:i a') . "'>"; } } ?> </p> </legend> <?php if (Auth::User()->ID == 1) { ?> <legend class="radius" style="height:230px"><div class="leg_head"><span id="txt_sponsorinfo">Sponsor Info</span></div> <p> <div class="inp_pfix"><img src="{{ URL::to($assets_path.'img/sponsor_icons.png')}}" width="25" height="25"></div> <input type="text" id="sponsorname" name="sponsorname" placeholder="Sponsor Name" title="Sponsor Name" value="{{ $contestdetails['sponsorname'] }}" class="radius pfix_mar" /> </p> <div class="img_pfix mb_upimg"><img src="{{ (isset($contestdetails['sponsorphoto']))?(URL::to($sponsorpath.$contestdetails['sponsorphoto'])):(URL::to($assets_path.'img/thumb02.jpg')) }}" width="45" height="45" class="roundedimg roundedimgsopn"></div>
public function createdcontest() { $userid = Input::get('userid'); $timezone = Input::get('timezone'); $createdcontest = contestModel::select('ID', 'contest_name', 'themephoto', 'contestenddate', 'conteststartdate', 'votingstartdate', 'votingenddate', 'prize', 'createdby', 'description', 'noofparticipant')->where('createdby', $userid)->where('status', 1)->orderby('ID', 'DESC')->get(); if (count($createdcontest) != 0) { for ($i = 0; $i < count($createdcontest); $i++) { $createdcontest[$i]['contestenddate'] = timezoneModel::convert($createdcontest[$i]['contestenddate'], 'UTC', $timezone, 'd-m-Y h:i a'); $createdcontest[$i]['conteststartdate'] = timezoneModel::convert($createdcontest[$i]['conteststartdate'], 'UTC', $timezone, 'd-m-Y h:i a'); $createdcontest[$i]['votingstartdate'] = timezoneModel::convert($createdcontest[$i]['votingstartdate'], 'UTC', $timezone, 'd-m-Y h:i a'); $createdcontest[$i]['votingenddate'] = timezoneModel::convert($createdcontest[$i]['votingenddate'], 'UTC', $timezone, 'd-m-Y h:i a'); $participants = contestparticipantModel::where('user_id', $userid)->where('contest_id', $createdcontest[$i]['ID'])->get()->count(); if ($participants) { $createdcontest[$i]['contestparticipantid'] = 1; } else { $createdcontest[$i]['contestparticipantid'] = 0; } $createdcontest[$i]['themephoto'] = url() . '/public/assets/upload/contest_theme_photo/' . $createdcontest[$i]['themephoto']; } $Response = array('success' => '1', 'message' => 'Created Contest details are fetched Successfully', 'msgcode' => "c179"); $final = array("response" => $Response, "createdcontest" => $createdcontest); return json_encode($final); } else { $Response = array('success' => '0', 'message' => 'No Data Available', 'msgcode' => "c117"); $final = array("response" => $Response); return json_encode($final); } }
public function getcontestList() { $maintab = $_POST['main_tab']; $subtab = $_POST['sub_tab']; //return $subtab; $tsearch = $_POST['tsearch']; $interest = $_POST['interest']; if ($interest == 0) { $interest = ''; } $currentdate = date('Y-m-d H:i:s'); if ($maintab == "tab1") { $contest_type = "p"; } elseif ($maintab == "tab2") { $contest_type = "v"; } elseif ($maintab == "tab3") { $contest_type = "t"; } if ($subtab == "tab4") { if (isset($tsearch) && $tsearch != '' && $interest == '') { ///// current with search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where(function ($query) { $query->where(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('conteststartdate', '<=', $currentdate); $query->where('contestenddate', '>=', $currentdate); }); $query->orWhere(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('votingstartdate', '<=', $currentdate); $query->where('votingenddate', '>=', $currentdate); }); })->where('contest.contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($tsearch) && $tsearch != '' && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where(function ($query) { $query->where(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('conteststartdate', '<=', $currentdate); $query->where('contestenddate', '>=', $currentdate); }); $query->orWhere(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('votingstartdate', '<=', $currentdate); $query->where('votingenddate', '>=', $currentdate); }); })->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('contest.contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($interest) && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where(function ($query) { $query->where(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('conteststartdate', '<=', $currentdate); $query->where('contestenddate', '>=', $currentdate); }); $query->orWhere(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('votingstartdate', '<=', $currentdate); $query->where('votingenddate', '>=', $currentdate); }); })->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('contest.contesttype', $contest_type)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { ///// current without search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where(function ($query) { $query->where(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('conteststartdate', '<=', $currentdate); $query->where('contestenddate', '>=', $currentdate); }); $query->orWhere(function ($query) { $currentdate = date('Y-m-d H:i:s'); $query->where('votingstartdate', '<=', $currentdate); $query->where('votingenddate', '>=', $currentdate); }); })->where('contesttype', $contest_type)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } } } } elseif ($subtab == "tab5") { if (isset($tsearch) && $tsearch != '') { ///// upcoming with search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('conteststartdate', '>', $currentdate)->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($tsearch) && $tsearch != '' && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('conteststartdate', '>', $currentdate)->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->where('contest.status', '1')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($interest) && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('conteststartdate', '>', $currentdate)->where('contesttype', $contest_type)->where('contest.status', '1')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { ///// upcoming without search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('conteststartdate', '>', $currentdate)->where('contesttype', $contest_type)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } } } } elseif ($subtab == "tab6") { if (isset($tsearch) && $tsearch != '' && $interest == '') { ///// Archieve with search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('contestenddate', '<', $currentdate)->where('votingenddate', '<', $currentdate)->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($tsearch) && $tsearch != '' && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('contestenddate', '<', $currentdate)->where('votingenddate', '<', $currentdate)->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($interest) && $interest != '') { $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('contestenddate', '<', $currentdate)->where('votingenddate', '<', $currentdate)->where('contesttype', $contest_type)->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { ///// Archieve without search //// $photocontest = contestModel::select('contest.themephoto', 'contest.contestenddate', 'contest.ID', 'contest.contest_name', 'contest.createdby')->where('contestenddate', '<', $currentdate)->where('votingenddate', '<', $currentdate)->where('contesttype', $contest_type)->where('contest.status', '1')->where('visibility', 'u')->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } } } } elseif ($subtab == "tab7") { if (isset($tsearch) && $tsearch != '' && $interest == '') { ///// private with search //// $photocontest = contestModel::where('visibility', 'p')->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->select('contest.ID', 'contest_name', 'themephoto', 'contestenddate', 'description', 'noofparticipant', 'contest.createdby')->leftJoin('private_contest_users', 'private_contest_users.contest_id', '=', 'contest.ID')->where('private_contest_users.user_id', Auth::User()->ID)->where('contest.status', 1)->where('private_contest_users.status', '1')->distinct()->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($tsearch) && $tsearch != '' && $interest != '') { $photocontest = contestModel::where('visibility', 'p')->where('contesttype', $contest_type)->where('contest_name', 'like', '%' . $tsearch . '%')->select('contest.ID', 'contest_name', 'themephoto', 'contestenddate', 'description', 'noofparticipant', 'contest.createdby')->leftJoin('private_contest_users', 'private_contest_users.contest_id', '=', 'contest.ID')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('private_contest_users.user_id', Auth::User()->ID)->where('contest.status', 1)->where('private_contest_users.status', '1')->distinct()->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { if (isset($interest) && $interest != '') { $photocontest = contestModel::where('visibility', 'p')->where('contesttype', $contest_type)->select('contest.ID', 'contest_name', 'themephoto', 'contestenddate', 'description', 'noofparticipant', 'contest.createdby')->leftJoin('private_contest_users', 'private_contest_users.contest_id', '=', 'contest.ID')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('contest_interest_categories.category_id', $interest)->where('private_contest_users.user_id', Auth::User()->ID)->where('contest.status', 1)->where('private_contest_users.status', '1')->distinct()->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } else { ///// private without search //// $photocontest = contestModel::where('visibility', 'p')->where('contesttype', $contest_type)->select('contest.ID', 'contest_name', 'themephoto', 'contestenddate', 'description', 'noofparticipant', 'contest.createdby')->leftJoin('private_contest_users', 'private_contest_users.contest_id', '=', 'contest.ID')->LeftJoin('contest_interest_categories', 'contest_interest_categories.contest_id', '=', 'contest.ID')->where('private_contest_users.user_id', Auth::User()->ID)->where('contest.status', 1)->where('private_contest_users.status', '1')->distinct()->leftJoin('user', 'user.ID', '=', 'contest.createdby')->where('user.status', 1)->get(); } } } } $contestcount = count($photocontest); $return_string = ""; $loginuser = Auth::user()->ID; for ($i = 0; $i < $contestcount; $i++) { if (strlen($photocontest[$i]['contest_name']) < 20) { $contest_name = $photocontest[$i]['contest_name']; } else { $contest_name = substr($photocontest[$i]['contest_name'], 0, 20) . "..."; } $backgroundclr = $photocontest[$i]['createdby'] == $loginuser ? "style='border:5px solid rgb(82, 195, 16)'" : ""; $return_string .= "<div class='crsl-item' " . ($i >= 14 ? "style='display:none'" : "") . $backgroundclr . " >\n\t\t\t <div class='thumbnail'>\n\t\t\t\t<a href='" . URL::to('contest_info/' . $photocontest[$i]['ID']) . "' >\n\t\t\t\t\t<img src='" . URL::to('public/assets/upload/contest_theme_photo/' . $photocontest[$i]['themephoto']) . "' alt='nyc subway'>\n\t\t\t\t\t</a>\n\t\t\t\t<span class='postdate'>Ends on : " . timezoneModel::convert($photocontest[$i]['contestenddate'], 'UTC', Auth::user()->timezone, 'd-M-Y h:i a') . "</span>\n\t\t\t </div>\n\t\t\t <h3><a href='" . URL::to('contest_info/' . $photocontest[$i]['ID']) . "'>" . $contest_name . "</a></h3>\n\t\t\t</div>"; } return $return_string . "||" . $contestcount; }
public function mycontestresponsive() { $tabname = $_GET['tabname']; if ($tabname == 'participate') { $created_user = Auth::user()->ID; $participants = contestparticipantModel::where('user_id', $created_user)->lists('contest_id'); if (isset($inputs['tsearch1']) && $inputs['tsearch1'] != '') { $photocontest = contestModel::whereIn('ID', $participants)->where('contest_name', 'like', "%" . $inputs['tsearch1'] . "%")->get(); } else { $photocontest = contestModel::whereIn('ID', $participants)->get(); } $contestcount = count($photocontest); } else { $created_user = Auth::user()->ID; if (isset($inputs['tsearch2']) && $inputs['tsearch2'] != '') { $photocontest = contestModel::where('createdby', $created_user)->where('contest_name', 'like', "%" . $inputs['tsearch2'] . "%")->get(); } else { $photocontest = contestModel::where('createdby', $created_user)->get(); } $contestcount = count($photocontest); } $contestcount = count($photocontest); $return_string = ""; for ($i = 0; $i < $contestcount; $i++) { $return_string .= "<div class='crsl-item' >\n\t\t\t <div class='thumbnail'>\n\t\t\t\t<a href='" . URL::to('contest_info/' . $photocontest[$i]['ID']) . "' >\n\t\t\t\t\t<img src='" . URL::to('public/assets/upload/contest_theme_photo/' . $photocontest[$i]['themephoto']) . "' alt='nyc subway'>\n\t\t\t\t\t</a>\n\t\t\t\t<span class='postdate'>Ends on : " . timezoneModel::convert($photocontest[$i]['contestenddate'], 'UTC', Auth::user()->timezone, 'Y-m-d h:i a') . "</span>\n\t\t\t </div>\n\t\t\t <h3><a href='" . URL::to('contest_info/' . $photocontest[$i]['ID']) . "'>" . $photocontest[$i]['contest_name'] . "</a></h3>\n\t\t\t</div>"; } return $return_string . "||" . $contestcount; }