本文整理汇总了PHP中JUDownloadHelper::getCategoryOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getCategoryOptions方法的具体用法?PHP JUDownloadHelper::getCategoryOptions怎么用?PHP JUDownloadHelper::getCategoryOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::getCategoryOptions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
protected function getOptions()
{
$app = JFactory::getApplication();
$view = $app->input->getCmd('view', '');
$parentId = $app->input->getInt('parent_id', 1);
$catId = $app->input->getInt('id', 0);
$options = array();
$_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('JUDownloadFrontHelperCategory', JPATH_SITE . '/components/com_judownload/helpers/category.php', false);
JLoader::register('JUDownloadHelper', JPATH_ADMINISTRATOR . '/components/com_judownload/helpers/judownload.php', false);
$checkPublished = $this->element['checkpublished'] == 'true' || $this->element['checkpublished'] == '1' ? true : false;
$checkCreatePermission = false;
if (isset($this->element['checkcreatepermissiononcat'])) {
if ($this->element['checkcreatepermissiononcat'] == 'true' || $this->element['checkcreatepermissiononcat'] == '1') {
$checkCreatePermission = 'category';
}
} else {
if ($this->element['checkcreatepermissionondoc'] == 'true' || $this->element['checkcreatepermissionondoc'] == '1') {
$checkCreatePermission = 'document';
}
}
$getSelf = $this->element['fetchself'] == 'true' || $this->element['fetchself'] == '1' ? true : false;
$startLevel = $this->element['startlevel'] ? $this->element['startlevel'] : 0;
$separation = $this->element['separation'] ? $this->element['separation'] : '|—';
$ignorecat = $this->element['ignorecat'] ? explode(',', $this->element['ignorecat']) : array();
if ($view == 'category') {
if ($catId) {
$_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, array($catId), $startLevel, $separation);
} elseif ($parentId) {
$_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, $ignorecat, $startLevel, $separation);
if ($this->value == "") {
$this->value = $parentId;
}
}
} else {
$_options = JUDownloadHelper::getCategoryOptions(1, $getSelf, $checkCreatePermission, $checkPublished, $ignorecat, $startLevel, $separation);
}
reset($options);
$options = array_merge($options, $_options);
return $options;
}
示例2:
$optionUnFeatured->value = 0;
$optionUnFeatured->text = JText::_("COM_JUDOWNLOAD_UNFEATURED");
$featuredArr[] = $optionUnFeatured;
?>
<?php
echo JHtml::_('select.options', $featuredArr, 'value', 'text', $this->state->get('filter.featured'));
?>
</select>
<select name="filter_catid" class="input-medium" onchange="this.form.submit()">
<option value=""><?php
echo JText::_('COM_JUDOWNLOAD_SELECT_CATEGORY');
?>
</option>
<?php
$categoryArr = JUDownloadHelper::getCategoryOptions();
?>
<?php
echo JHtml::_('select.options', $categoryArr, 'value', 'text', $this->state->get('filter.catid'));
?>
</select>
<select name="filter_licenseid" class="input-medium" onchange="this.form.submit()">
<option value=""><?php
echo JText::_('COM_JUDOWNLOAD_SELECT_LICENSE');
?>
</option>
<?php
$licenseArr = JUDownloadHelper::getLicenseOptions();
?>
<?php
示例3: isset
?>
<select name="condition" id="condition">
<option
value="1" <?php echo $defaultValue == 1 ? "selected" : "" ?>><?php echo JText::_('COM_JUDOWNLOAD_ALL'); ?></option>
<option
value="2" <?php echo $defaultValue == 2 ? "selected" : "" ?>><?php echo JText::_('COM_JUDOWNLOAD_ANY'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label id="jform_categories-lbl" for="categories" class="control-label"
title=""><?php echo JText::_('COM_JUDOWNLOAD_CATEGORIES'); ?></label>
<div class="controls">
<?php
$options = JUDownloadHelper::getCategoryOptions(1, true, false, true);
$defaultValue = isset($dataSearch['categories']) ? $dataSearch['categories'] : 1;
echo JHtml::_('select.genericList', $options, 'categories[]', 'multiple size="10"', 'value', 'text', $defaultValue);
?>
</div>
</div>
<div class="control-group">
<label id="jform_subcategories-lbl" for="search-sub-categories" class="control-label"
title=""><?php echo JText::_('COM_JUDOWNLOAD_SUBCATEGORIES'); ?></label>
<div class="controls">
<?php
$defaultValue = isset($dataSearch['search_sub_categories']) ? $dataSearch['search_sub_categories'] : "1";
?>
<select name="search_sub_categories" id="search-sub-categories">
<option
示例4:
<option value="0" <?php
echo $this->state->get('filter.featured') === '0' ? "selected" : "";
?>
><?php
echo JText::_('COM_JUDOWNLOAD_UNFEATURED');
?>
</option>
</select>
<select name="filter_catid" class="input-medium" onchange="this.form.submit()">
<option value=""><?php
echo JText::_('COM_JUDOWNLOAD_SELECT_CATEGORY');
?>
</option>
<?php
$options = JUDownloadHelper::getCategoryOptions();
echo JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.catid'));
?>
</select>
<select name="filter_licenseid" class="input-medium" onchange="this.form.submit()">
<option value=""><?php
echo JText::_('COM_JUDOWNLOAD_SELECT_LICENSE');
?>
</option>
<?php
$options = JUDownloadHelper::getLicenseOptions();
echo JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.license'));
?>
</select>
示例5:
<legend><?php
echo JText::_('COM_JUDOWNLOAD_MOVE_CATEGORIES');
?>
</legend>
<div class="span6">
<div class="form-horizontal">
<div class="control-group">
<div class="control-label">
<label><?php
echo JText::_('COM_JUDOWNLOAD_MOVE_TO_CATEGORY');
?>
</label>
</div>
<div class="controls">
<?php
$options = JUDownloadHelper::getCategoryOptions(1, true, "category", false, $ignored_cat_id);
echo JHtml::_('select.genericList', $options, 'categories', '', 'value', 'text', "");
?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<label class="<?php
echo $classTooltip;
?>
" for="extra_fields" title="<?php
echo JText::_('COM_JUDOWNLOAD_KEEP_EXTRA_FIELDS') . $separator . JText::_('COM_JUDOWNLOAD_KEEP_EXTRA_FIELDS_DESC');
?>
"><?php
echo JText::_('COM_JUDOWNLOAD_KEEP_EXTRA_FIELDS');
?>
示例6: foreach
?>
</legend>
<div class="form-horizontal">
<div class="row-fluid">
<div class="span6">
<div class="control-group ">
<div class="control-label">
<label for="categories"><?php
echo JText::_('COM_JUDOWNLOAD_COPY_TO_CATEGORIES');
?>
</label>
</div>
<div class="controls">
<?php
$options = JUDownloadHelper::getCategoryOptions(1, true, "document");
$params = JUDownloadHelper::getParams();
if (!$params->get('allow_add_doc_to_root', 0)) {
$rootCat = JUDownloadFrontHelperCategory::getRootCategory();
foreach ($options as $key => $option) {
if ($option->value == $rootCat->id) {
unset($options[$key]);
break;
}
}
}
echo JHtml::_('select.genericList', $options, 'categories[]', 'multiple size="10"', 'value', 'text', '', 'categories');
?>
</div>
</div>
示例7:
echo JText::_('COM_JUDOWNLOAD_COPY_CATEGORIES');
?>
</legend>
<div class="form-horizontal">
<div class="row-fluid">
<div class="span6">
<div class="control-group ">
<div class="control-label">
<label for="categories"><?php
echo JText::_('COM_JUDOWNLOAD_COPY_TO_CATEGORIES');
?>
</label>
</div>
<div class="controls">
<?php
$options = JUDownloadHelper::getCategoryOptions(1, true, "category");
echo JHtml::_('select.genericList', $options, 'categories[]', 'class="inputbox" multiple size="6"', 'value', 'text', 1, 'categories');
?>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<div class="control-group ">
<div class="control-label">
<label class="<?php
echo $classTooltip;
?>
" for="subcategories" title="<?php
echo JText::_('COM_JUDOWNLOAD_COPY_SUB_CATEGORIES') . $separator . JText::_('COM_JUDOWNLOAD_COPY_SUB_CATEGORIES_DESC');