本文整理汇总了PHP中JUDirectoryHelper::getAddressOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::getAddressOptions方法的具体用法?PHP JUDirectoryHelper::getAddressOptions怎么用?PHP JUDirectoryHelper::getAddressOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDirectoryHelper
的用法示例。
在下文中一共展示了JUDirectoryHelper::getAddressOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
protected function getOptions()
{
$app = JFactory::getApplication();
$view = $app->input->getCmd('view', '');
$options = array();
foreach ($this->element->children() as $option) {
if ($option->getName() != 'option') {
continue;
}
$tmp = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
$tmp->class = (string) $option['class'];
$tmp->onclick = (string) $option['onclick'];
$options[] = $tmp;
}
JLoader::register('JUDirectoryHelper', JPATH_ADMINISTRATOR . '/components/com_judirectory/helpers/judirectory.php', false);
$checkPublished = $this->element['checkpublished'] == 'true' || $this->element['checkpublished'] == '1' ? true : false;
$getSelf = $this->element['fetchself'] == 'true' || $this->element['fetchself'] == '1' ? true : false;
$parentId = $this->element['parentid'] ? $this->element['parentid'] : 1;
$startLevel = $this->element['startlevel'] ? $this->element['startlevel'] : 0;
$separation = $this->element['separation'] ? $this->element['separation'] : '|—';
$ignoreaddress = $this->element['ignoreaddress'] ? explode(',', $this->element['ignoreaddress']) : array();
if ($view == 'address') {
$addressId = $app->input->get('id', 0);
$ignoreaddress = $addressId ? array($addressId) : array();
$_options = JUDirectoryHelper::getAddressOptions($parentId, $getSelf, $checkPublished, $ignoreaddress, $startLevel, $separation);
} else {
$_options = JUDirectoryHelper::getAddressOptions($parentId, $getSelf, $checkPublished, $ignoreaddress, $startLevel, $separation);
}
reset($options);
$options = array_merge($options, $_options);
return $options;
}