当前位置: 首页>>代码示例>>PHP>>正文


PHP K2HelperHTML::radiolist方法代码示例

本文整理汇总了PHP中K2HelperHTML::radiolist方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperHTML::radiolist方法的具体用法?PHP K2HelperHTML::radiolist怎么用?PHP K2HelperHTML::radiolist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在K2HelperHTML的用法示例。


在下文中一共展示了K2HelperHTML::radiolist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 public function getInput()
 {
     // Load javascript
     JHtml::_('jquery.framework');
     $document = JFactory::getDocument();
     $document->addScript(JURI::root(true) . '/media/k2app/assets/js/fields.js?v=3.0.0');
     // Set values if are not set
     if (!is_array($this->value)) {
         $this->value = array();
     }
     if (!isset($this->value['enabled'])) {
         $this->value['enabled'] = '0';
     }
     if (!isset($this->value['categories'])) {
         $this->value['categories'] = '';
     }
     if (!isset($this->value['recursive'])) {
         $this->value['recursive'] = '';
     }
     // Get some variables from XML
     $this->multiple = (bool) $this->element['k2multiple'];
     $this->recursive = (string) $this->element['k2recursive'];
     $this->mode = (string) $this->element['k2mode'];
     $this->size = (int) $this->element['size'];
     // Build attributes string
     $attributes = '';
     if ($this->multiple) {
         $attributes .= ' multiple="multiple"';
     }
     if ($this->size) {
         $attributes .= ' size="' . $this->size . '"';
     }
     if ($this->mode == 'menu') {
         $attributes .= ' data-mode="k2categoriesmenu"';
     }
     // Init output
     $output = '';
     // First show the category filter switch for multiple instances
     if ($this->multiple) {
         $options = array();
         $options[] = JHtml::_('select.option', '0', JText::_('K2_ALL'));
         $options[] = JHtml::_('select.option', '1', JText::_('K2_SELECT'));
         $output .= K2HelperHTML::radiolist($options, $this->name . '[enabled]', $this->value['enabled'], false, 'data-categories="' . $this->name . '[categories][]"');
         $placeholder = null;
     } else {
         $output .= '<input type="hidden" name="' . $this->name . '[enabled]" value="1" />';
         $placeholder = 'K2_NONE_ONSELECTLISTS';
     }
     // Then the categories list
     $output .= K2HelperHTML::categories($this->name . '[categories][]', $this->value['categories'], $placeholder, null, $attributes);
     // And finally the recursive switch
     if ($this->recursive == 'select') {
         $options = array();
         $options[] = JHtml::_('select.option', '1', JText::_('K2_YES'));
         $options[] = JHtml::_('select.option', '0', JText::_('K2_NO'));
         $output .= '<label>' . JText::_('K2_APPLY_RECUSRIVELY') . '</label>' . K2HelperHTML::radiolist($options, $this->name . '[recursive]', $this->value['recursive'], true);
     } else {
         $output .= '<input type="hidden" name="' . $this->name . '[recursive]" value="' . $this->recursive . '" />';
     }
     // Return
     return $output;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:62,代码来源:k2categories.php

示例2: categories

 public static function categories($name = 'catid', $value = null, $none = false, $exclude = null, $attributes = '', $recursive = false, $valueProperty = 'id', $inheritance = false, $batch = false)
 {
     $model = K2Model::getInstance('Categories', 'K2Model');
     $model->setState('sorting', 'ordering');
     $rows = $model->getRows();
     $options = array();
     if ($none) {
         $noneValue = $none === 'K2_LEAVE_UNCHANGED' ? '' : '0';
         $options[] = JHtml::_('select.option', $noneValue, JText::_($none));
     }
     if ($inheritance) {
         $options[] = JHtml::_('select.option', '1', JText::_('K2_FROM_K2_CATEGORY_PARAMETERS'));
     }
     if ($batch) {
         $options[] = JHtml::_('select.option', '1', JText::_('K2_NONE'));
     }
     foreach ($rows as $row) {
         if ($exclude != $row->id) {
             $title = str_repeat('-', intval($row->level) - 1) . $row->title;
             if ($row->state == -1) {
                 $title .= JText::_('K2_TRASHED_CATEGORY_NOTICE');
             } else {
                 if ($row->state == 0) {
                     $title .= JText::_('K2_UNPUBLISHED_CATEGORY_NOTICE');
                 }
             }
             $optionValue = $row->{$valueProperty};
             $options[] = JHtml::_('select.option', $optionValue, $title);
         }
     }
     $output = JHtml::_('select.genericlist', $options, $name, $attributes, 'value', 'text', $value);
     if ($recursive) {
         $options = array();
         $options[] = JHtml::_('select.option', '0', JText::_('K2_NO'));
         $options[] = JHtml::_('select.option', '1', JText::_('K2_YES'));
         $output .= '<label>' . JText::_($recursive->label) . '</label>' . K2HelperHTML::radiolist($options, $recursive->name, $recursive->value, true);
     }
     return $output;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:39,代码来源:html.php


注:本文中的K2HelperHTML::radiolist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。