本文整理汇总了PHP中JUDownloadHelper::getCatFields方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getCatFields方法的具体用法?PHP JUDownloadHelper::getCatFields怎么用?PHP JUDownloadHelper::getCatFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::getCatFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
JHtml::_('behavior.modal');
$document = JFactory::getDocument();
$script = "jQuery(document).ready(function(\$){\r\n\t\t\t\t\t\t\$('#" . $this->id . " li select.blv').change(function(){\r\n\t\t\t\t\t\t\t\$(this).parent().find('input.blv-value').val(\$(this).val());\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\$(\"#" . $this->id . "\").dragsort({ dragSelector: \"li\", dragEnd: saveOrder, placeHolderTemplate: \"<li class='placeHolder'><div></div></li>\", dragSelectorExclude: \"select, .chzn-container\"});\r\n\t\t\t\t\t\tfunction saveOrder() {\r\n\t\t\t var data = jQuery('#" . $this->id . " li').map(function() { return \$(this).data('itemid'); }).get();\r\n\t\t }\r\n\t\t\t\t\t});";
$document->addScriptDeclaration($script);
$fields = JUDownloadHelper::getCatFields();
$values = $this->value;
$html = '';
$html .= '<ul class="category-fieldorder" id="' . $this->id . '">';
if ($values) {
foreach ($values as $key => $value) {
if (isset($fields[$key])) {
$html .= '<li>';
$html .= '<div>';
$html .= '<span class="field-name">' . $fields[$key] . '</span>';
$html .= '<select class="blv">';
$html .= '<option value="0" ' . ($key == 'title' ? 'disabled ' : '') . ($value == 0 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_HIDE') . '</option>';
$html .= '<option value="1" ' . ($key == 'title' ? 'disabled ' : '') . ($value == 1 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_LIST_VIEW') . '</option>';
$html .= '<option value="2" ' . ($value == 2 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_LIST_VIEW_AND_SHOW') . '</option>';
$html .= '</select>';
$html .= '<input type="hidden" class="blv-value" value="' . $value[0] . '" name="' . $this->name . '[' . $key . ']" />';
$html .= '</div>';
$html .= '</li>';
unset($fields[$key]);
}
}
}
if ($fields) {
foreach ($fields as $key => $field) {
$value = 0;
$html .= '<li>';
$html .= '<div>';
$html .= '<span class="field-name" title="Field name">' . $fields[$key] . '</span>';
$html .= '<select class="blv">';
$html .= '<option value="0" ' . ($key == 'title' ? 'disabled ' : '') . ($value == 0 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_HIDE') . '</option>';
$html .= '<option value="1" ' . ($key == 'title' ? 'disabled ' : '') . ($value == 1 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_LIST_VIEW') . '</option>';
$html .= '<option value="2" ' . ($value == 2 ? 'selected' : '') . '>' . JText::_('COM_JUDOWNLOAD_LIST_VIEW_AND_SHOW') . '</option>';
$html .= '</select>';
$html .= '<input type="hidden" class="blv-value" value="' . $value . '" name="' . $this->name . '[' . $key . ']" />';
$html .= '</div>';
$html .= '</li>';
}
}
$html .= '</ul>';
return $html;
}
示例2: __construct
public function __construct($config = array())
{
$app = JFactory::getApplication();
$rootCat = JUDownloadFrontHelperCategory::getRootCategory();
$cat_id = $app->input->getInt('cat_id', $rootCat->id);
$this->params = JUDownloadHelper::getParams($cat_id);
if (!$cat_id) {
$app->input->set('cat_id', $rootCat->id);
}
$fields = array_filter($app->input->get("fields", array(), 'array'));
$apply_layout = $app->input->getInt("apply_layout", 0);
$reset_layout = $app->input->getInt("reset_layout", 0);
if ($fields && $apply_layout) {
$app->setUserState("com_judownload.listcats." . $cat_id . ".fields", $fields);
}
$this->fields = $this->getFields($cat_id);
if ($reset_layout || !$app->getUserState("com_judownload.listcats." . $cat_id . ".fields", array())) {
$fieldIds = array();
foreach ($this->fields as $field) {
if ($field->backend_list_view == 2) {
$fieldIds[] = $field->id;
}
}
$app->setUserState("com_judownload.listcats." . $cat_id . ".fields", $fieldIds);
}
$fieldIds = $app->getUserState("com_judownload.listcats." . $cat_id . ".fields", array());
if (empty($fieldIds)) {
$fieldIds = array();
foreach ($this->fields as $field) {
if (in_array($field->field_name, array("title", "id"))) {
$fieldIds[] = $field->id;
}
}
}
$sortedFields = array();
foreach ($this->fields as $field) {
if (in_array($field->id, $fieldIds)) {
$sortedFields[] = $field->id;
$this->dropdown_fields_selected[] = array("value" => $field->id, "text" => $field->caption);
$this->fields_use[] = $field;
}
$this->dropdown_fields[] = array("value" => $field->id, "text" => $field->caption);
}
$config['filter_fields'] = $sortedFields;
$this->cat_fields = JUDownloadHelper::getCatFields();
$cat_field_selected = array_filter($app->input->get("category_fields", array(), 'array'));
$apply_cat_layout = $app->input->getInt("apply_cat_layout", 0);
$reset_cat_layout = $app->input->getInt("reset_cat_layout", 0);
if ($cat_field_selected && $apply_cat_layout) {
$app->setUserState("com_judownload.listcats." . $cat_id . ".categoryfields", $cat_field_selected);
}
$cat_dropdown_field_selected = (array) $this->params->get('category_fields_listview_ordering');
$cat_field = array();
foreach ($cat_dropdown_field_selected as $field => $value) {
if ($value == 2) {
$cat_field[] = $field;
}
$this->cat_dropdown_fields[] = array("value" => $field, "text" => $this->cat_fields[$field]);
}
if ($reset_cat_layout || !$app->getUserState("com_judownload.listcats." . $cat_id . ".categoryfields", array())) {
$app->setUserState("com_judownload.listcats." . $cat_id . ".categoryfields", $cat_field);
}
$this->cat_fields_use = $app->getUserState("com_judownload.listcats." . $cat_id . ".categoryfields", array());
if (empty($this->cat_fields_use)) {
$this->cat_fields_use = array("title", "id");
}
foreach ($this->cat_fields_use as $field) {
$this->cat_dropdown_fields_selected[] = array("value" => $field, "text" => $this->cat_fields[$field]);
}
parent::__construct($config);
}