Ejemplo n.º 1
0
 /**
  * Method to get cities item data
  *
  * @access public
  * @return array
  */
 function getData()
 {
     // Lets load the types if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_db->setQuery($query);
         $rows = $this->_db->loadObjectList();
         //establish the hierarchy of the categories
         $children = array();
         //set depth limit
         $levellimit = 10;
         foreach ($rows as $child) {
             $parent = $child->parent_id;
             $list = @$children[$parent] ? $children[$parent] : array();
             array_push($list, $child);
             $children[$parent] = $list;
         }
         //get list of the items
         $list = hotelguide_city::treerecurse(0, '', array(), $children, false, max(0, $levellimit - 1));
         $total = count($list);
         jimport('joomla.html.pagination');
         $this->_pagination = new JPagination($total, $this->getState('limitstart'), $this->getState('limit'));
         $this->_data = array_slice($list, $this->_pagination->limitstart, $this->_pagination->limit);
     }
     return $this->_data;
 }
Ejemplo n.º 2
0
 function search_city($country, $city)
 {
     if ($country < 1) {
         $country = 0;
     }
     $cityoption = hotelguide_city::getCityTree($country, 2);
     $output = hotelguide_city::buildcityselect($cityoption, 'filter_city', $city, 0, 'class="inputbox" size="1" style="font-size: 10px; width: 200px; text-align:left;"');
     echo $output;
 }
Ejemplo n.º 3
0
 /**
  * Get the room tree
  * based on the joomla 1.0 treerecurse 
  *
  * @access public
  * @return array
  */
 function treerecurse($id, $indent, $list, &$children, $title, $maxlevel = 9999, $level = 0, $type = 1)
 {
     if (@$children[$id] && $level <= $maxlevel) {
         foreach ($children[$id] as $v) {
             $id = $v->id;
             if ($type) {
                 $pre = '<sup>|_</sup>&nbsp;';
                 $spacer = '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
             } else {
                 $pre = '- ';
                 $spacer = '&nbsp;&nbsp;';
             }
             if ($title) {
                 if ($v->parent_id == 0) {
                     $txt = '' . $v->name;
                 } else {
                     $txt = $pre . $v->name;
                 }
             } else {
                 if ($v->parent_id == 0) {
                     $txt = '';
                 } else {
                     $txt = $pre;
                 }
             }
             $pt = $v->parent_id;
             $list[$id] = $v;
             $list[$id]->treename = "{$indent}{$txt}";
             $list[$id]->children = count(@$children[$id]);
             $list = hotelguide_city::treerecurse($id, $indent . $spacer, $list, $children, $title, $maxlevel, $level + 1, $type);
         }
     }
     return $list;
 }
Ejemplo n.º 4
0
 function ChangeLocalHotel()
 {
     $city = JRequest::getVar('city');
     $cities = hotelguide_city::getCityTree($city, 1);
     $javascript = 'onChange="ChangeHotelRoom(this.value)"';
     $output = hotelguide_city::buildcityselect($cities, 'city', 0, true, 'class="inputbox" size="1" style="font-size: 10px; width: 200px; text-align:left;"' . $javascript);
     echo $output;
 }
Ejemplo n.º 5
0
        $states[] = JHTML::_('select.option', 0, JText::_('HG_NOT_AVAILABLE'));
        $states = @array_merge($states, $result);
        $javascript = 'onChange="ChangeStateCity(this.value)"';
        $states = JHTML::_('select.genericlist', $states, 'filter_states', 'class="inputbox" size="1" style="font-size: 10px; width: 100%; text-align:left;"' . $javascript . 'disabled', 'value', 'text', '');
    }
    echo $states;
    echo '</div>' . "\n";
    echo '</div>' . "\n";
}
if ($parameters[2] == 1) {
    echo '<div class="search_col1">' . JText::_('HG_CITY') . ':&nbsp;</div>' . "\n";
    echo '<div class="search_col2">' . "\n";
    echo '<div id="AjaxCity">';
    $country = 0;
    $cityoption = hotelguide_city::getCityTree($country, 2);
    $output = hotelguide_city::buildcityselect($cityoption, 'filter_city', 0, 0, 'class="inputbox" size="1" style="font-size: 10px; width: 100%; text-align:left;"');
    echo $output;
    echo '</div>';
    echo '</div>' . "\n";
}
if ($parameters[3] == 1) {
    echo '<div class="search_col1">' . JText::_('HG_ARRIVE') . ':&nbsp;</div>' . "\n";
    echo '<div class="search_col2">' . "\n";
    echo JHTML::_('hotelguide.list.incalendar', 'checkin', '', NULL);
    echo '</div>' . "\n";
    echo '<div class="search_col1">' . JText::_('HG_DEPART') . ':&nbsp;</div>' . "\n";
    echo '<div class="search_col2">' . "\n";
    echo JHTML::_('hotelguide.list.outcalendar', 'checkout', '', NULL);
    echo '</div>' . "\n";
}
echo '<div class="search_col1"></div>' . "\n";
Ejemplo n.º 6
0
 function ChangeCity_planroute2()
 {
     $country = (int) JRequest::getVar('country2');
     $cityoption = hotelguide_city::getCityTree($country, 2);
     $javascript = 'onChange="toAddress()"';
     $output = hotelguide_city::buildcityselect($cityoption, 'filter_city2', 0, 0, 'class="inputbox" size="1" style="font-size: 10px; width: 100%; text-align:left;"' . $javascript);
     echo $output;
 }
Ejemplo n.º 7
0
 function ChangeCity()
 {
     $country = (int) JRequest::getVar('country');
     $cityoption = hotelguide_city::getCityTree($country, 2);
     $output = hotelguide_city::buildcityselect($cityoption, 'filter_city', 0, 0, 'class="inputbox" size="1" style="font-size: 10px; width: 100%; text-align:left;"');
     echo $output;
 }