Ejemplo n.º 1
0
 public static function editar()
 {
     $hotel = new Hotel();
     $hotel->selecionarPorId($_GET['id']);
     if (!empty($_POST)) {
         $hotel->nome = $_POST['nome'];
         if ($_POST['apagar_imagem']) {
             unlink(__DIR__ . self::$diretorio . $hotel->imagem);
         }
         if (!empty($_FILES['imagem']['name'])) {
             if (filesize($_FILES['imagem']['tmp_name']) <= 10485760) {
                 if (file_exists(__DIR__ . self::$diretorio . $hotel->imagem) && !is_dir(__DIR__ . self::$diretorio . $hotel->imagem)) {
                     unlink(__DIR__ . self::$diretorio . $hotel->imagem);
                 }
                 $imagem = $_FILES["imagem"]["name"];
                 $imagem = Funcao::gerarNomeImagem($imagem, $hotel->nome);
                 $arquivo = __DIR__ . self::$diretorio . $imagem;
                 move_uploaded_file($_FILES['imagem']['tmp_name'], $arquivo);
                 //Funcao::redimensionarImagem($arquivo, null, '145'); // obs: tamanho width: 960 e height: 360
                 $hotel->imagem = $imagem;
             } else {
                 echo "<script>alert('O arquivo que você enviou é maior que 10MB, por favor envie um arquivo de tamanho menor'); document.location.href='" . Configuracao::$baseUrl . self::$viewController . "/editar/" . $hotel->id . '-' . Funcao::prepararLink($hotel->nome) . Configuracao::$extensaoPadrao . "';</script>";
                 exit;
             }
         }
         $hotel->salvar();
         self::redirecionar(Configuracao::$baseUrl . self::$viewController . '/listar' . Configuracao::$extensaoPadrao);
     }
     self::$variaveis = array('hotel' => $hotel);
     self::$corpo = "editar";
     self::renderizar(self::$viewController);
 }
Ejemplo n.º 2
0
 public function Callback($PSTData, $GETData)
 {
     //parsian gateway
     if (isset($GETData['au'], $GETData['rs'])) {
         $t = new Transaction();
         $trans = $t->get_by_au($GETData['au']);
         if ($trans && $GETData['rs'] == 0) {
             $totalamont = $trans['amount'];
             //var_dump($trans);exit;
             $u = new user();
             $guest = $u->Get_Guest_ID();
             //get invoice
             $invoice = new Invoice();
             $invc_num = $invoice->get_by_transID($trans['id']);
             //var_dump($invc_num);exit;
             //check tranaction by PaymentEnquiry
             $gt = new ParsianGateway(Parsian_PIN);
             //confirm reservation
             $ctrl = new HotelController();
             $refference = $invoice->get_By_id($invc_num);
             $refference = $refference['refference'];
             $r = new Request();
             $confirm = $r->get_FinalReserve($refid);
             if ($confirm) {
                 //if (true) {
                 //                    $confirm = array(
                 //                        'voucher' => '101010',
                 //                        'Reference' => '202020'
                 //                    );
                 //var_dump($confirm);exit;
                 if ($gt->PaymentEnquiry($GETData['au'], $GETData['rs'])) {
                     //if (TRUE) {
                     //add paydoc
                 } else {
                     $app = new AppController();
                     $app->Erro('در تایید تراکنش خطایی رخ داد ');
                     return FALSE;
                 }
                 //chang inoice status
                 $invoice->submit($invc_num, $confirm['voucher'], $confirm['Reference']);
                 $pd = new Paydoc();
                 if (isset($_SESSION['user']['id'])) {
                     $current_credit = $u->getcredit($_SESSION['user']['id'], 'IRR');
                     $remain = $current_credit - $totalamont;
                     if ($pd->Save($_SESSION['user']['id'], -1, $totalamont, $invc_num, 'IRR')) {
                         $u->change_credit($_SESSION['user']['id'], 'IRR', $remain);
                     }
                 } else {
                     $pd->Save($guest, -1, $totalamont, $invc_num, 'IRR');
                 }
                 $psgr = new passenger();
                 $rmmm = new InvoiceDetail();
                 $inv = new Invoice();
                 $transfer_data = $inv->get_Tranfer_Data($invc_num);
                 //print_r($transfer_data);exit;
                 //$invc_num
                 $variable = array();
                 $variable['voucher'] = $confirm['voucher'];
                 $variable['invoce_data'] = $invoice->get_By_id($invc_num);
                 $variable['passengers'] = $psgr->getByInvoice($invc_num);
                 $variable['rooms'] = $rmmm->getByInvoice($invc_num);
                 $variable['transfer'] = $transfer_data;
                 if ($variable) {
                     foreach ($variable as $k => $v) {
                         ${$k} = $v;
                     }
                 }
                 $ctrl->ShowReserve_info($confirm);
             } else {
                 $app = new AppController();
                 $app->Erro('در تکمیل رزرو خطایی رخ داد ');
                 return FALSE;
             }
             //add paydoc
         } else {
             if ($GETData['rs'] == 1) {
                 $app = new AppController();
                 $app->Erro('تراکنش موفق ');
             } else {
                 $app = new AppController();
                 $app->Erro('شماره تراکنش اشتباه است');
             }
             return FALSE;
         }
     } else {
         //err for now
         $app = new AppController();
         $app->Erro('شماره تراکنش اشتباه است');
         return FALSE;
     }
 }
Ejemplo n.º 3
0
        //get country cities
        case 'countries':
        case 'countrys':
            $htl = new CountryController();
            $htl->CityList($_GET['id']);
            break;
        default:
            echo json_encode(['err' => 1, 'message' => 'invalid action']);
    }
} elseif (isset($_GET['p1']) && $_GET['p1'] != 'index') {
    switch (strtolower($_GET['p1'])) {
        case 'hotels':
            //list all hotels
        //list all hotels
        case 'hotel':
            $htl = new HotelController();
            if (!isset($_GET['page'], $_GET['per_page'])) {
                $htl->Hotels();
            } else {
                $htl->Hotels($_GET['page'], $_GET['per_page']);
            }
            break;
        case 'countrys':
            //list all country
        //list all country
        case 'countries':
        case 'country':
            $ctry = new CountryController();
            $ctry->Countries();
            break;
        default:
Ejemplo n.º 4
0
require_once './model/Model.php';
require_once './actions/GetHotelCommonAction.php';
require_once MODEL_PATH . 'HotelAmenitiesModel.php';
require_once MODEL_PATH . 'HotelAmenitiesPhotoModel.php';
require_once MODEL_PATH . 'HotelModel.php';
require_once MODEL_PATH . 'HotelPhotoModel.php';
require_once MODEL_PATH . 'HotelRoomCategoryDetailModel.php';
require_once MODEL_PATH . 'HotelRoomCategoryModel.php';
require_once MODEL_PATH . 'HotelRoomModel.php';
require_once MODEL_PATH . 'HotelRoomPhotoModel.php';
require_once MODEL_PATH . 'NewsModel.php';
require_once MODEL_PATH . 'HotelEmployeesModel.php';
require_once MODEL_PATH . 'HotelEmployeesJobModel.php';
require_once MODEL_PATH . 'HotelCommentsModel.php';
require_once MODEL_PATH . 'HotelRoomAmenitiesModel.php';
require_once MODEL_PATH . 'HotelRoomAmenitiesDetailModel.php';
require_once VIEW_PATH . 'AdminPage.php';
require_once VIEW_PATH . 'GuestPage.php';
require_once VIEW_PATH . 'HotelPage.php';
require_once VIEW_PATH . 'RoomPage.php';
require_once VIEW_PATH . 'NewsPage.php';
require_once VIEW_PATH . 'CommentsPage.php';
require_once VIEW_PATH . 'EmployeesPage.php';
$event = new Event($_GET, $_POST, $_FILES);
// 建立 Event 物件
$controller = new HotelController($event);
// 建立 HotelController 物件
$controller->doAction();
?>

Ejemplo n.º 5
0
             $temp['en_name'] = $passenger['name'][$cnt];
             $temp['en_family'] = $passenger['family'][$cnt];
             $temp['name'] = $passenger['name'][$cnt];
             $temp['family'] = $passenger['family'][$cnt];
             $temp['birthday'] = str_replace('/', '-', $passenger['birthday'][$cnt]);
             $temp['code_melli_pass'] = "";
             $temp["pass_expire"] = "";
             $temp["pass_issue_country"] = "";
             $temp["doc_type"] = "3";
             $temp["nationality"] = "IR";
             $passengers[$pgr + 1][] = $temp;
         }
     }
     $cnt++;
 }
 $ctrl = new HotelController();
 $totalamont = 0;
 //calc total amount
 foreach ($_POST['invoice'] as $detail) {
     $totalamont += $detail['price'];
 }
 // reserve step1
 $u = new user();
 $guest = $u->Get_Guest_ID();
 $result = $ctrl->Reseve_step1(json_encode($room_id), $_SESSION['date-in'], $_SESSION['date-out'], json_encode($passengers));
 //var_dump($result);exit;
 if ($result) {
     //if (true) {
     //save invoice
     $invoice = new Invoice();
     $invoice->date = date('Y-n-d H:i:s');