예제 #1
0
 function ChangeRoom()
 {
     $hotel = JRequest::getVar('hotel');
     $rooms = hotelguide_rooms::getRoomsTree($hotel);
     $javascript = '';
     $output = hotelguide_rooms::buildroomselect($rooms, 'parent_id', 0, true, 'class="inputbox" size="1" style="font-size: 10px; width: 200px; text-align:left;"' . $javascript);
     echo $output;
 }
예제 #2
0
 function SelectAjaxRoom($row, $hotel)
 {
     $rooms = hotelguide_rooms::getRoomsTree($hotel);
     $javascript = '';
     $output = hotelguide_rooms::buildroomselect($rooms, 'parent_id', $row->parent_id, false, 'class="inputbox" size="1" style="font-size: 10px; width: 200px; text-align:left;"' . $javascript);
     return $output;
 }
예제 #3
0
 function displayDefault()
 {
     global $mainframe, $hgconf;
     jimport('joomla.html.pane');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.calendar');
     //initialise variables
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $lang =& JFactory::getLanguage();
     $tabs =& JPane::getInstance('tabs');
     //get vars
     $cid = JRequest::getVar('cid');
     $document->addScript(JURI::base() . 'components/com_hotelguide/assets/js/ratescreen.js');
     //Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Item');
     //		$rates		= & $this->get('Rates');
     if ($row->hotel) {
         $query = 'SELECT c.name, c.symbol' . ' FROM #__hg_hotelitems AS i' . ' LEFT JOIN #__hg_currency AS c ON c.id = i.currency' . ' WHERE i.id = ' . $row->hotel;
         $db->setQuery($query);
         $currency = $db->loadObject();
     }
     //create the toolbar
     if ($cid) {
         JToolBarHelper::title(JText::_('HG_EDIT_ROOM'), 'room');
     } else {
         JToolBarHelper::title(JText::_('HG_NEW_ROOM'), 'room');
     }
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'HG_SAVE_AND_NEW', false);
     JToolBarHelper::cancel();
     $rooms = hotelguide_rooms::getRoomsTree($row->hotel);
     //remove the current room to prevent selection as parent for itself
     foreach ($rooms as $room) {
         if ($room->id == $row->id) {
             unset($rooms[$room->id]);
         }
     }
     // fail if checked out not by 'me'
     if ($row->id) {
         if ($model->isCheckedOut($user->get('id'))) {
             JError::raiseWarning('SOME_ERROR_CODE', $row->title . ' ' . JText::_('HG_EDITED_BY_ANOTHER_ADMIN'));
             $mainframe->redirect('index.php?option=com_hotelguide&view=roomitems');
         }
     }
     //clean data
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
     $lists = array();
     $lists['parent_id'] = hotelguide_rooms::buildroomselect($rooms, 'parent_id', $row->parent_id, true);
     //assign data to template
     $this->assignRef('tabs', $tabs);
     $this->assignRef('lists', $lists);
     $this->assignRef('row', $row);
     $this->assignRef('hgconf', $hgconf);
     $this->assignRef('currency', $currency);
     $this->assignRef('rates', $rates);
     /*		
     		echo "<pre>";
     		echo "view=";
     		print_r($rates);
     		echo "</pre>"; */
 }