<? /** * TITLE: Главная страница * AVAILABLE_ONLY_IN_ADVANCED_MODE */ ?> <?php $created = new Carbon(Config::get('site.date_over_action')); $now = Carbon::now(); $difference = $created->diff($now)->days < 1 ? 'Сегодня заканчивается регистрация в конкурсе.' : 'До окончания регистрации в конкурсе осталось ' . $created->diffInDays($now) . ' ' . Lang::choice('день|дня|дней', $created->diffInDays($now)) . '.'; $created = new Carbon(Config::get('site.date_final_action')); $now = Carbon::now(); $difference_final = $created->diff($now)->days < 1 ? 'Сегодня шоу-финал.' : 'До шоу-финала остается ' . $created->diffInDays($now) . ' ' . Lang::choice('день|дня|дней', $created->diffInDays($now)) . '. Зарегистрируйся на сайте и покажи свой талант всем!'; $map = array(); if (isset($page->blocks['map']['meta']['content']) && !empty($page->blocks['map']['meta']['content'])) { $map = json_decode($page->blocks['map']['meta']['content'], TRUE); } $participants = Accounts::where('group_id', 4)->where('in_main_page', 1)->with('ulogin', 'likes')->take(15)->get(); foreach ($participants as $index => $participant) { $participants[$index]['like_disabled'] = FALSE; } if (isset($_COOKIE['votes_list'])) { $users_ids = json_decode($_COOKIE['votes_list']); foreach ($participants as $index => $participant) { if (in_array($participant->id, $users_ids)) { $participants[$index]['like_disabled'] = TRUE; } } } ?> @extends(Helper::layout())
public static function karmaMeetingPendingCount($receiver_id, $id) { //echo 'here';exit; $giver_value = DB::table('requests')->where('status', '<>', 'completed')->where('user_id_giver', '=', $id)->where('user_id_receiver', '=', $receiver_id)->take(1)->orderBy('created_at', 'DESC')->get(); $giver_value_count = DB::table('requests')->where('status', '<>', 'completed')->where('user_id_giver', '=', $id)->where('user_id_receiver', '=', $receiver_id)->orderBy('created_at', 'DESC')->count(); if ($giver_value_count >= 1) { $first_created_date = Carbon::now(); $second_created_date = $giver_value[0]->created_at; $created = new Carbon($first_created_date); $now = new Carbon($second_created_date); $date_difference = $created->diff($now)->days; if ($date_difference < 7) { $MeetingRequestPending = DB::table('requests')->where('status', '<>', 'completed')->where('user_id_giver', '=', $id)->where('user_id_receiver', '=', $receiver_id)->orderBy('created_at', 'DESC')->count(); return $MeetingRequestPending; } else { $MeetingRequestPending = 0; return $MeetingRequestPending; } } else { $MeetingRequestPending = 0; return $MeetingRequestPending; } return $MeetingRequestPending; }
public function updatespj($id) { $oss = OSS::find($id); $oss->oss_type = "spj"; $oss->tanggal = Carbon::parse(Input::get('tanggal')); $oss->bantek = Input::get('bantek'); $oss->permasalahan = Input::get('permasalahan'); $oss->action = Input::get('action'); $oss->mulai = Carbon::parse(Input::get('mulai')); $oss->selesai = Carbon::parse(Input::get('selesai')); $oss->kode_rks = Input::get('kode_rks'); $oss->deskripsi_rks = Input::get('deskripsi_rks'); $oss->transport = Input::get('transport'); $oss->user_mengerjakan = Input::get('mengerjakan'); $oss->user_mengetahui = Input::get('mengetahui'); $oss->save(); $list_site = Input::get('namasite'); $oldsites = OSSBantekSite::where('oss_id', '=', $oss->id)->delete(); for ($si = 0; $si < count($list_site); $si++) { $ns = new OSSBantekSite(); $ns->oss_id = $oss->id; $ns->site_id = $list_site[$si]; $ns->save(); } $transport = ''; foreach ($oss->shoplists as $sl) { if ($sl->type == 'transport') { $transport = $sl; } } OSShop::where('oss_id', '=', $id)->delete(); $shopping_list = Input::get('shoplist'); $harga = 0; for ($i = 0; $i < count($shopping_list); $i++) { $ss = new OSShop(); $ss->oss_id = $oss->id; $ss->shoplist_id = $shopping_list[$i]; $ss->save(); $sl = Shoplist::find($shopping_list[$i]); $harga += $sl->harga; } $oss->harga = $harga; $oss->save(); $menyetujui = Input::get('menyetujui'); MenyetujuiOSS::where('oss_id', '=', $id)->delete(); for ($j = 0; $j < count($menyetujui); $j++) { $stj = new MenyetujuiOSS(); $stj->oss_id = $oss->id; $stj->user_id = $menyetujui[$j]; $stj->save(); } //perhitungan RKS $biaya_rks = 0; $st = new Carbon(Input::get('mulai')); $nd = new Carbon(Input::get('selesai')); $diff = $nd->diff($st)->days; if ($diff > 1) { $biaya_rks += 350000 * ($diff - 1); $biaya_rks += 150000; } else { if ($diff == 1) { $biaya_rks = 350000; } else { $biaya_rks = 150000; } } $oss->harga_rks = $biaya_rks; //biaya perjalanan $biayafee = 0; if (Input::get('transport') == 'no') { $oss->harga += $biaya_rks; } else { if ($transport == '') { $shopl = new Shoplist(); } else { $shopl = $transport; } $shopl->kode = Input::get('kode_sl_trans'); $shopl->deskripsi = Input::get('deskripsi_sl_trans'); $shopl->satuan = Input::get('satuan_sl_trans'); $shopl->harga = Input::get('harga_sl_trans'); $shopl->type = 'transport'; $shopl->save(); $ss = new OSShop(); $ss->oss_id = $oss->id; $ss->shoplist_id = $shopl->id; $ss->save(); if ($shopl->harga <= 500000) { $biayafee = 15 / 100 * $shopl->harga; } else { $biayafee = 10 / 100 * $shopl->harga; } $oss->harga += $biaya_rks + $biayafee + $shopl->harga; } $oss->save(); Session::flash('success', 'Data telah diubah.'); return Redirect::to('/admin/oss/spj'); }
<? /** * TITLE: О проекте * AVAILABLE_ONLY_IN_ADVANCED_MODE */ ?> <?php $created = new Carbon(Config::get('site.date_over_action')); $now = Carbon::now(); $difference = $created->diff($now)->days < 1 ? 'Сегодня заканчивается регистраця в конкурсе.' : 'До окончания регистрации в конкурсе осталось ' . $created->diffInDays($now) . ' ' . Lang::choice('день|дня|дней', $created->diffInDays($now)) . '.'; $steps = array(); if (isset($page['blocks']['etap_1'])) { if (isset($page['blocks']['etap_1']['meta']['content']) && !empty($page['blocks']['etap_1']['meta']['content'])) { $steps['etap_1'] = json_decode($page['blocks']['etap_1']['meta']['content'], TRUE); } } if (isset($page['blocks']['etap_2'])) { if (isset($page['blocks']['etap_2']['meta']['content']) && !empty($page['blocks']['etap_2']['meta']['content'])) { $steps['etap_2'] = json_decode($page['blocks']['etap_2']['meta']['content'], TRUE); } } if (isset($page['blocks']['etap_3'])) { if (isset($page['blocks']['etap_3']['meta']['content']) && !empty($page['blocks']['etap_3']['meta']['content'])) { $steps['etap_3'] = json_decode($page['blocks']['etap_3']['meta']['content'], TRUE); } } $nominations = array(); if (isset($page['blocks']['nom_1'])) { if (isset($page['blocks']['nom_1']['meta']['content']) && !empty($page['blocks']['nom_1']['meta']['content'])) { $nominations['nom_1'] = json_decode($page['blocks']['nom_1']['meta']['content'], TRUE); }
public function bookingStep2($id) { $i = Input::all(); $i['checkin'] = $i['checkin'] . ' 12:00:00'; // $i['checkout'] = $i['checkout'] . ' 11:59:00'; $total_price = null; $tax = null; $booking_session = []; $count = 0; //for test $count1 = 0; //for test $booked_room = []; //all picked rooms from available rooms $booked_room_id = []; //foreach(Session::get('reservation')['reservation_room'] as $rooms){ $count++; $room_id = $id; $available_rooms = []; $room_qty = RoomQty::with(array('roomPrice', 'roomReserved' => function ($query) use($i, $room_id) { $query->where(function ($query2) use($i, $room_id) { $query2->whereBetween('check_in', array($i['checkin'], $i['checkout']))->orWhereBetween('check_out', array($i['checkin'], $i['checkout']))->orWhereRaw('"' . $i["checkin"] . '" between check_in and check_out')->orWhereRaw('"' . $i["checkout"] . '" between check_in and check_out'); })->where(function ($query3) { $query3->where('status', '!=', 5)->where('status', '!=', 3); }); }))->where('status', 1)->where('room_id', $room_id)->get(); foreach ($room_qty as $available) { if (count($available->roomReserved) == 0) { array_push($available_rooms, $available); } else { } } if (!empty($available_rooms)) { for ($counter = 0; $counter < $i['quantity']; $counter++) { array_push($booked_room, $available_rooms[$counter]); } } else { return '0'; //not available } //} //end of foreach $total_price = 0; if (!isset($_GET['bookingId'])) { $new_booking = new Booking(); $new_booking->firstname = 'WALK-IN'; $new_booking->lastname = 'WALK-IN'; $new_booking->address = 'WALK-IN'; $new_booking->contact_number = '000'; $new_booking->check_in = $i['checkin']; $new_booking->check_out = $i['checkout']; $new_booking->email_address = 'WALK-IN'; $new_booking->code = 'N/A'; $new_booking->status = 0; $new_booking->save(); } foreach ($booked_room as $b) { $ci = new Carbon($i['checkin']); $co = new Carbon($i['checkout']); $total_nights = $co->diff($ci)->days; $total_nights += 1; $total_price += $total_nights * $b->roomPrice->price; $total_price2 = $total_nights * $b->roomPrice->price; //$tax = $total_price2 * 0.12; //$total_price2+=$tax; $reserveRoom = new ReservedRoom(); $reserveRoom->room_id = $b->id; $reserveRoom->room_type = $b->room_id; $reserveRoom->booking_id = isset($_GET['bookingId']) ? $_GET['bookingId'] : $new_booking->id; $reserveRoom->check_in = $i['checkin']; $reserveRoom->check_out = $i['checkout']; $reserveRoom->code = 'N/A'; /*$reserveRoom->firstname = 'WALK-IN'; $reserveRoom->lastname = 'WALK-IN';*/ $reserveRoom->price = $total_price2; /*$reserveRoom->address = 'WALK-IN'; $reserveRoom->contact_number = '000'; $reserveRoom->email_address = 'WALK-IN';*/ $reserveRoom->status = '0'; if ($reserveRoom->save()) { array_push($booked_room_id, $reserveRoom->id); } } if (isset($_GET['bookingId'])) { $existing_booking = Booking::where('id', $_GET['bookingId'])->first(); if ($existing_booking) { $existing_booking->price = $total_price; } } else { $new_booking->price = $total_price; $new_booking->save(); } // return Session::get('reservation'); //return $booked_room; //return $counter; //return $room_qty1; $booking_session['booking_id'] = isset($_GET['bookingId']) ? $_GET['bookingId'] : $new_booking->id; $booking_session['rooms'] = $booked_room_id; return $booking_session; }