public static function getInstance() { if (!is_object(self::$_instance)) { //or if( is_null(self::$_instance) ) or if( self::$_instance == null ) self::$_instance = new Admin_Model_HotelCuisines(); } return self::$_instance; }
public function cuisinesDetailsAction() { $adminModel = Admin_Model_Users::getInstance(); $result = $adminModel->getAdminDetails(); // showing image if ($result) { $this->view->admindetails = $result; } $cuisinesModel = Admin_Model_FamousCuisines::getInstance(); $hotelModel = Admin_Model_HotelDetails::getInstance(); $hotelcuisinesModel = Admin_Model_HotelCuisines::getInstance(); $cuisines = $cuisinesModel->getCuisinesHotelBased(); if ($cuisines) { $this->view->cuisinesdetails = $cuisines; } $hotel = $hotelModel->selectAllHotels(); if ($hotel) { $this->view->hotellist = $hotel; } if ($this->getRequest()->isPost()) { $data['Cuisine_name'] = $this->getRequest()->getPost('cuisinename'); $data['cuisine_status'] = $this->getRequest()->getPost('cuisine_status'); $cuisine_id = $cuisinesModel->addCuisines($data); $hotelcuisinesdata['cuisine_id'] = $cuisine_id; $hotelcuisinesdata['hotel_id'] = $this->getRequest()->getPost('hotels'); $result2 = $hotelcuisinesModel->addCuisinesDetails($hotelcuisinesdata); if ($result2) { $this->redirect('/admin/cuisines-details'); } } }
public function viewHotelDetailsAction() { $adminModel = Admin_Model_Users::getInstance(); $result = $adminModel->getAdminDetails(); // showing image if ($result) { $this->view->admindetails = $result; } $hotelDetailsModel = Admin_Model_HotelDetails::getInstance(); $hotelCuisinesModel = Admin_Model_HotelCuisines::getInstance(); $hotel_id = $this->getRequest()->getParam('id'); $dt['hotel_id'] = $hotel_id; $cuisinesdDetails = $hotelCuisinesModel->getCuisinesByHotelId($hotel_id); $i = 0; if ($cuisinesdDetails) { foreach ($cuisinesdDetails as $value) { $array[$i] = $value['Cuisine_name']; } $i++; $this->view->cuisinesdDetails = $cuisinesdDetails; } $result = $hotelDetailsModel->getHotelDetailsByID($hotel_id); if ($result) { $this->view->allhoteldetails = $result; } else { echo 'controller error occured'; } }