function display($tpl = null)
 {
     if (JRequest::getString('task') != 'edit' && JRequest::getString('task') != 'add') {
         JToolBarHelper::title('J-Hotel Reservation : ' . JText::_('LNG_MANAGE_ARRIVAL_OPTIONS', true), 'generic.png');
         //JRequest::setVar( 'hidemainmenu', 1 );
         JToolBarHelper::custom('back', JUtil::getDashBoardIcon(), 'home', 'Back', false, false);
         $hotel_id =& $this->get('HotelId');
         if ($hotel_id > 0) {
             JToolBarHelper::deleteList(JText::_('LNG_ARE_YOU_SURE_YOU_WANT_TO_DELETE', true), 'Delete', 'Delete', 'Detele button', false, false);
             JToolBarHelper::editList();
             JToolBarHelper::addNewX();
         }
         $this->hotel_id = $hotel_id;
         $items =& $this->get('Datas');
         $this->items = $items;
         $hotels =& $this->get('Hotels');
         $hotels = checkHotels(JFactory::getUser()->id, $hotels);
         $this->hotels = $hotels;
     } else {
         $item =& $this->get('Data');
         $this->item = $item;
         $hotel_id =& $this->get('HotelId');
         $this->hotel_id = $hotel_id;
         $hotel =& $this->get('Hotel');
         $this->hotel = $hotel;
         JToolBarHelper::title('J-Hotel Reservation : ' . ($item->arrival_option_id > 0 ? JText::_('LNG_EDIT', true) : JText::_('LNG_ADD_NEW', true)) . ' ' . JText::_('LNG_MANAGE_ARRIVAL_OPTION', true), 'generic.png');
         JRequest::setVar('hidemainmenu', 1);
         JToolBarHelper::cancel();
         JToolBarHelper::save();
     }
     parent::display($tpl);
 }
		public function _insert() {
			$r= new JTUser($_SESSION['login_user_id']);
			JUtil::empty2null($_POST['id']);
			$r->setFields($_POST);
			$id = $r->insert();
			$this->addAlert(new JAlert('新增完成','告知訊息',"./?action=edit&id={$id}"));
			$this->action('edit', $id);
		}
		public function _update() {
			$r= new JTAdvisory($_SESSION['login_user_id']);
			JUtil::empty2null($_POST['price']);
			$r->select($_POST['id']);
			$r->setFields($_POST);
			$r->update();
			$this->addAlert(new JAlert('更新完成','告知訊息',"./?action=edit&id={$_POST['id']}"));
			$this->action('edit', $_POST['id']);
		}
 function display($tpl = null)
 {
     // $itemCurrency		=& $this->get('Currency');
     // $this->itemCurrency =  $itemCurrency;
     // $itemRooms		=& $this->get('Rooms');
     // $this->itemRooms =  $itemRooms;
     $appSettings = JUtil::getApplicationSettings();
     parent::display($tpl);
 }
 function includeFunctions()
 {
     $doc =& JFactory::getDocument();
     $doc->addStyleSheet('components/' . getBookingExtName() . '/assets/js/validation/css/validationEngine.jquery.css');
     $tag = JUtil::getJoomlaLanguage();
     $doc->addScript('components/' . getBookingExtName() . '/assets/js/validation/js/languages/jquery.validationEngine-' . $tag . '.js');
     $doc->addScript('components/' . getBookingExtName() . '/assets/js/validation/js/jquery.validationEngine.js');
     $doc->addScript('components/' . getBookingExtName() . '/assets/js/jquery.selectlist.js');
 }
	switch($action)	{
		case 'form':
			$smarty = new JSmartyTemplate($templateName);
			if( isset($_REQUEST['error']) )
				$smarty->assign('error', $_REQUEST['error']);
			$smarty->display(dirname(__FILE__).'/login.tpl.htm');
			break;
		case 'login':
			if( !Vercode::verify( $_POST['vercode_instance_id'], $_POST['vercode']) )	{
				Vercode::clear();
				$smarty = new JSmartyTemplate( $templateName );
				$smarty->assign( 'error', '驗証碼錯誤' );
				$smarty->display( dirname(__FILE__).'/login.tpl.htm' );
				exit;
			}
			Vercode::clear();
			if( !JTUser::login( $_POST['account'], $_POST['password'] ) )	{
				$smarty = new JSmartyTemplate($templateName);
				$smarty->assign('error', JTUser::$errorMessage);
				$smarty->display(dirname(__FILE__).'/login.tpl.htm');
			}	else	{
				$uri = JUtil::ifv($_POST['uri']=='','/admin/',$_POST['uri']);
				JWStdio::location($uri);
			}
			break;
		case 'logout':
			JTUser::logout();
			JWStdio::location("/admin/");
			break;
	}
?>
			$r->select($_POST['id']);
			if( empty($r->data['reply']) && !empty($_POST['reply']) || ($r->data['reply']!=$_POST['reply']) )	$_POST['reply_date']=JDate::now();
			$r->setFields($_POST);
			$r->update();
			$this->addAlert(new JAlert('更新完成','告知訊息',"./?action=edit&id={$_POST['id']}"));
			$this->action('edit', $_POST['id']);
		}
		public function _delete() {
			//	check data
				$arrId = array();
				if( is_array($_REQUEST['ids']) )	{
					$arrId = $_REQUEST['ids'];
				}	else	{
					$arrId[] = $_REQUEST['ids'];
				}
				foreach( $arrId as $id )	{
					$r= new JTContactus();
					$r->select($id);
				//	delete data
					$r->delete();
				}

			//	list data
				$this->addAlert(new JAlert('刪除完成','告知訊息',"./"));
				$this->action('list');
		}
	}
	$action = JUtil::issetv(@$_REQUEST['action'],'list');
	$oa = new JLocalControl();
	$oa->action($action);
?>
 function display($tpl = null)
 {
     $this->appSettings = JUtil::getInstance()->getApplicationSettings();
     parent::display($tpl);
 }
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.session.session');
//JHTML::_('stylesheet',					'modules/mod_jhotelreservation/assets/luxury.css');
JHTML::_('script', 'administrator/components/com_jhotelreservation/assets/utils.js');
JHTML::_('script', 'components/com_jhotelreservation/assets/js/search.js');
JHTML::_('script', 'components/com_jhotelreservation/assets/jhotelreservationcalendar.js');
$appSetings = JUtil::getInstance()->getApplicationSettings();
//dump($userData->roomGuests);
?>
<script>
	var dateFormat = "<?php 
echo $appSetings->dateFormat;
?>
";
	var message = "<?php 
echo JText::_('LNG_ERROR_PERIOD', true);
?>
";
	var defaultEndDate = "<?php 
echo $params->get('end-date');
?>
";