示例#1
0
 public static function getAddressPath($id)
 {
     include_once JPATH_ADMINISTRATOR . '/components/com_judirectory/tables/address.php';
     $db = JFactory::getDbo();
     $addressTable = new JUDirectoryTableAddress($db);
     $html = '';
     if ($addressTable->load($id)) {
         $addressPath = $addressTable->getPath();
         $optionsArray = $selectedIds = array();
         foreach ($addressPath as $address) {
             $selectedIds[] = $address->id;
             $options = JUDirectoryHelper::getAddressOptionsByParentId($address->id);
             if ($options) {
                 $optionsArray[] = JUDirectoryHelper::getAddressOptionsByParentId($address->id);
             }
         }
         foreach ($optionsArray as $key => $options) {
             $html .= JHtml::_('select.genericlist', $options, 'address_path', 'class="nochosen address-path"', 'value', 'text', $selectedIds, '');
         }
     }
     return $html;
 }