function display($tpl = null) { $this->context = 'com_solidres.reservation.process'; $this->config = JComponentHelper::getParams('com_solidres'); $this->showPoweredByLink = $this->config->get('show_solidres_copyright', '1'); if ($this->_layout == 'default') { $model = $this->getModel(); $modelName = $model->getName(); $this->reservation = $model->getItem(); $this->app = JFactory::getApplication(); $this->checkin = $model->getState($modelName . '.checkin'); $this->checkout = $model->getState($modelName . '.checkout'); $this->totalReservedRoom = $model->getState($modelName . '.totalReservedRoom'); $this->countries = SolidresHelper::getCountryOptions(); $this->geoStates = SolidresHelper::getGeoStateOptions($model->getState($modelName . '.countryId')); $this->userState = $this->app->getUserState($this->context); $this->raid = $model->getState($modelName . '.reservationAssetId'); $this->uri = JURI::getInstance()->__toString(); $this->roomTypeObj = SRFactory::get('solidres.roomtype.roomtype'); $this->numberOfNights = $this->roomTypeObj->calculateDateDiff($this->checkin, $this->checkout); JHtml::_('jquery.framework'); } JHtml::stylesheet('com_solidres/assets/main.css', false, true, false); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } parent::display($tpl); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $html = array(); $country_id = (int) $this->form->getValue('country_id'); $selectedId = (int) $this->form->getValue('geo_state_id'); $options = SolidresHelper::getGeoStateOptions($country_id); $html[] = JHtml::_('select.genericlist', $options, $this->name, 'class="state_select"', 'value', 'text', $selectedId); return implode($html); }
public function find() { $countryId = JFactory::getApplication()->input->get('id', 0, 'int'); $states = SolidresHelper::getGeoStateOptions($countryId); $html = ''; foreach ($states as $state) { $html .= '<option value="' . $state->value . '">' . $state->text . '</option>'; } echo $html; die(1); }
/** * Return html to display guest form in one-page reservation, data is retrieved from user session * * @return string HTML */ public function getHtmlGuest() { $this->countries = SolidresHelper::getCountryOptions(); $this->reservationDetails = $this->app->getUserState($this->context); // Try to get the customer information if he/she logged in if (!isset($this->reservationDetails->guest)) { // Process customer group JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables', 'SolidresTable'); $customerTable = JTable::getInstance('Customer', 'SolidresTable'); $user = JFactory::getUser(); $customerTable->load(array('user_id' => $user->get('id'))); if (!empty($customerTable->id)) { $this->reservationDetails->guest["customer_firstname"] = $customerTable->firstname; $this->reservationDetails->guest["customer_middlename"] = $customerTable->middlename; $this->reservationDetails->guest["customer_lastname"] = $customerTable->lastname; $this->reservationDetails->guest["customer_email"] = $user->get('email'); } } $selectedCountryId = isset($this->reservationDetails->guest["customer_country_id"]) ? $this->reservationDetails->guest["customer_country_id"] : 0; $options = array(); $options[] = JHTML::_('select.option', NULL, JText::_('SR_SELECT')); $this->geoStates = $selectedCountryId > 0 ? SolidresHelper::getGeoStateOptions($selectedCountryId) : $options; $html = ' <div class="reservation-box-inner"> <form enctype="multipart/form-data" id="sr-reservation-form-guest" class="sr-reservation-form form-stacked sr-validate" action="' . JRoute::_("index.php?option=com_solidres&task=reservation.process&step=guest&format=json") . '" method="POST"> <div class="row-fluid"> <div class="span6"> <fieldset> <label for="firstname"> ' . JText::_("SR_FIRSTNAME") . ' </label> <input id="firstname" required name="jform[customer_firstname]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_firstname"]) ? $this->reservationDetails->guest["customer_firstname"] : "") . '" /> <label for="middlename"> ' . JText::_("SR_MIDDLENAME") . ' </label> <input id="middlename" name="jform[customer_middlename]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_middlename"]) ? $this->reservationDetails->guest["customer_middlename"] : "") . '" /> <label for="lastname"> ' . JText::_("SR_LASTNAME") . ' </label> <input id="lastname" required name="jform[customer_lastname]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_lastname"]) ? $this->reservationDetails->guest["customer_lastname"] : "") . '" /> <label for="email"> ' . JText::_("SR_EMAIL") . ' </label> <input id="email" required name="jform[customer_email]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_email"]) ? $this->reservationDetails->guest["customer_email"] : "") . '" /> <label for="phonenumber"> ' . JText::_("SR_PHONENUMBER") . ' </label> <input id="phonenumber" required name="jform[customer_phonenumber]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_phonenumber"]) ? $this->reservationDetails->guest["customer_phonenumber"] : "") . '" /> <label for="company"> ' . JText::_("SR_COMPANY") . ' </label> <input id="company" name="jform[customer_company]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_company"]) ? $this->reservationDetails->guest["customer_company"] : "") . '" /> </fieldset> </div> <div class="span6"> <fieldset> <label for="address_1"> ' . JText::_("SR_ADDRESS_1") . ' </label> <input id="address_1" required name="jform[customer_address1]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_address1"]) ? $this->reservationDetails->guest["customer_address1"] : "") . '" /> <label for="address_2"> ' . JText::_("SR_ADDRESS_2") . ' </label> <input id="address_2" name="jform[customer_address2]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_address2"]) ? $this->reservationDetails->guest["customer_address2"] : "") . '" /> <label for="city">' . JText::_("SR_CITY") . '</label> <input id="city" required name="jform[customer_city]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_city"]) ? $this->reservationDetails->guest["customer_city"] : "") . '" /> <label for="zip">' . JText::_("SR_ZIP") . '</label> <input id="zip" name="jform[customer_zipcode]" type="text" class="inputbox" value="' . (isset($this->reservationDetails->guest["customer_zipcode"]) ? $this->reservationDetails->guest["customer_zipcode"] : "") . '" /> <label for="jform[country_id]">' . JText::_("SR_COUNTRY") . '</label>'; $selectedCountryId = isset($this->reservationDetails->guest["customer_country_id"]) ? $this->reservationDetails->guest["customer_country_id"] : 0; $html .= JHtml::_("select.genericlist", $this->countries, "jform[customer_country_id]", array("class" => "country_select inputbox", 'required'), "value", "text", $selectedCountryId, "country"); $html .= ' <label for="jform[customer_geo_state_id]">' . JText::_("SR_STATE") . '</label>'; $selectedGeoStateId = isset($this->reservationDetails->guest["customer_geo_state_id"]) ? $this->reservationDetails->guest["customer_geo_state_id"] : 0; $html .= JHtml::_("select.genericlist", $this->geoStates, "jform[customer_geo_state_id]", array("class" => "state_select inputbox"), "value", "text", $selectedGeoStateId, "state"); $html .= '<label for="note">' . JText::_("SR_NOTE") . '</label> <textarea id="note" name="jform[note]" rows="10" cols="30">' . (isset($this->reservationDetails->guest["note"]) ? $this->reservationDetails->guest["note"] : "") . '</textarea> <p class="help-block">' . JText::_("SR_RESERVATION_NOTE") . '</p> </fieldset> </div> </div> <div class="processing-indicator nodisplay"></div> <button class="btn btn-primary" id="" type="submit"> ' . JText::_("SR_BUTTON_RESERVATION_PARTIAL_SUBMIT") . ' </button> ' . JHtml::_("form.token") . ' <input type="hidden" name="jform[next_step]" value="payment" /> </form> </div> '; echo $html; die(1); }