Exemplo n.º 1
0
 public function preProcess()
 {
     parent::preProcess();
     if (self::$cookie->RoleID == 1) {
         $this->mid = self::$cookie->HotelID;
     } else {
         $this->mid = Tools::getValue("mid");
     }
     /*else
     		{
     			$error['no'] = 1;
     			$error['message'] = 'User can not access this page';
     			self::$smarty->assign("error", $error);
     			self::$smarty->display(_TAS_THEME_DIR_.'error_redirect.tpl');
     			exit();
     		}
     		*/
     // $this->mid = Tools::getValue("mid")!="" ? Tools::getValue("mid") : ((self::$cookie->RoleID==1) ? self::$cookie->HotelID : "");
     if ((self::$cookie->RoleID == 1 || (self::$cookie->RoleID == 4 || self::$cookie->RoleID == 5)) && $_GET['setOrder']) {
         $hotel_roomplan_list = RoomPlan::getRoomPlanListDetailByHotelIdHotelAndAdmin($this->mid);
         print_r($hotel_roomplan_list);
         $order_list = explode(",", trim($_REQUEST['orderList'], ','));
         $new_orders = array();
         foreach ($order_list as $key => $rpid) {
             $new_orders[$rpid] = $key + 1;
         }
         foreach ($hotel_roomplan_list as $roomplan) {
             $rpid = $roomplan['RoomPlanId'];
             $rp_order = 1;
             // default order value is 1
             if (array_key_exists($rpid, $new_orders)) {
                 $rp_order = $new_orders[$rpid];
             }
             $sql = "\n\t\t\t\t\tUPDATE HT_HotelRoomPlanLink SET ShowOrder = {$rp_order} WHERE RoomPlanId = {$rpid}\n\t\t\t\t";
             Db::getInstance()->ExecuteS($sql);
         }
         $search_form['HotelId'] = $this->mid;
         $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID);
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) {
             $search_form['ContinentCode'] = $continentCode;
             $search_form['Role'] = 'Agent';
         }
         $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form);
         parent::pagination($hotel_roomplan_count);
         $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n);
         // $hotel_roomplan_list = RoomPlan::getRoomPlanListDetailByHotelId($this->mid);
         self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list);
         self::$smarty->assign("mid", $this->mid);
         self::$smarty->display(_TAS_THEME_DIR_ . 'hotelpage_roomplan_list.tpl');
         exit;
     }
     if (self::$cookie->RoleID > 1) {
         global $cookie;
         $iso = Language::getIsoById((int) $cookie->LanguageID);
         $hotel = new HotelDetail($this->mid);
         $HotelNameKey = 'HotelName_' . $iso;
         $this->brandNavi[] = array("name" => $hotel->{$HotelNameKey}, "url" => "hotelpage.php?mid=" . $this->mid);
     }
 }