📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
otelscripti.demodesign.com.tr
/
admin
/
controllers
📝
ReservationAdminController.php
← Geri Dön
<?php use Sirius\Admin\Manager; /** * Class ReservationAdminController * * @subpackage Controller * @author Fırat ÖZPINAR * @link firat.pl */ class ReservationAdminController extends Manager { /** * Modül başlığı * * @var string */ public $moduleTitle = 'Rezervasyonlar'; /** * @var string */ public $module = 'reservation'; /** * @var string */ public $table = 'reservations'; /** * @var string */ public $model = 'reservation'; /** * @var string */ public $type = 'public'; /** * @var array */ public $menuPattern = [ 'title' => 'title', 'hint' => 'title', 'link' => ['slug', 'id'], 'moduleLink' => true, 'language' => true ]; /** * Arama yapılacak kolonlar * * @var array */ public $search = ['fulname', 'email']; /** * Filtreleme yapılacak querystring/kolonlar. * * @var array */ public $filter = ['viewed']; /** * Yollar * * @var array */ public $actions = [ 'records' => 'list', 'calendar' => 'calendar', 'view' => 'view', 'delete' => 'delete', 'musaitlik' => 'musaitlik', 'musaitlikDuzenle' => 'musaitlikDuzenle', ]; /** * Takvimi verir * * @return Response */ public function calendar() { $ay = $this->uri->segment(3); $yil = $this->uri->segment(4); // Yoksa oluştur $ay = $ay ? $ay : date('m'); $yil = $yil ? $yil : date('Y'); // Türkçe tarih sınıfını yükle $this->load->helper('turkcetarih'); $tarih = sayitarih($ay).' '.$yil; $baslangicTarihi = "$yil-$ay-01"; $bitisTarihi = "$yil-$ay-".cal_days_in_month(CAL_GREGORIAN, $ay, $yil); // günleri dizide topla $diziGun = []; for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN, $ay, $yil); $i++): $diziGun[] = $i; endfor; // Rezervasyon modülü $this->load->model('Reservation','reservation'); // Oda listesini tut $rooms = []; // Odaları oku foreach ($this->reservation->rooms() as $room) { // Müsaitlik durumunu depola $musatlik = []; // Toplma günleri al foreach ($diziGun as $gun) { $date = date('Y-m-d', strtotime("$yil-$ay-$gun")); $sqlMusaitlikKontrol = $this->reservation->getMusaitlikKontrol([ 'room_id' => $room->id, 'date'=> $date ]); if($sqlMusaitlikKontrol): $musatlik[] = array( 'id' => $sqlMusaitlikKontrol->id, 'room_id' => $sqlMusaitlikKontrol->room_id, 'musteri' => $sqlMusaitlikKontrol->musteri, 'acenta'=> $sqlMusaitlikKontrol->acenta, ); else: $musatlik[] = array( 'musteri' => 0, 'acenta'=> 0, ); endif; } // Depola $rooms[] = [ 'title' => $room->title, 'id' => $room->id, 'musaitlik' => $musatlik, ]; } // takvim ileri ve geri hesaplaması $geriAy = $ay-1; $geriYil = $yil; $ileriAy= $ay+1; $ileriYil= $yil; if($ay == 1): $geriAy = 12; $geriYil = $yil-1; elseif($ay == 12): $ileriAy = 1; $ileriYil = $yil+1; endif; $this->viewData['takvim'] = [ 'gun' => cal_days_in_month(CAL_GREGORIAN, $ay, $yil), 'baslik' => $tarih, 'geri' => $geriAy.'/'.$geriYil, 'ileri' => $ileriAy.'/'.$ileriYil, 'rooms' => $rooms ]; $this->load->vars('public', array('css' => array( '../public/admin/css/reservation.css' ))); $this->render('takvim/list'); } /** * Müsaitlik ekler * * */ public function musaitlik() { // Post yoksa hata bas if (!$this->input->post()) { show_404(); } $this->load->model('Reservation'); // Verileri kaydet $this->reservation->insertMusaitlik(); // geldiği syafaya ger gönder return redirect($this->input->server('HTTP_REFERER')); } /** * Gelen id dğeeirne göre limiti günceller * * @return Redirect */ public function musaitlikDuzenle() { // Post yoksa hata bas if (!$this->input->post()) { show_404(); } $this->load->model('Reservation'); // Verileri kaydet $this->reservation->updateMusaitlik(); // geldiği syafaya ger gönder return redirect($this->input->server('HTTP_REFERER')); } /** * Gelen rezervasyonun görüntülenmesini sağlar * * @return Response */ public function view() { if (! $record = $this->appmodel->id($this->uri->segment(3))) { show_404(); } $this->appmodel->viewed($record); $this->breadcrumb('Detaylar'); $this->viewData['record'] = $record; $room = $this->appmodel->roomName($record); $this->viewData['room'] = $room; $this->render('view'); } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula