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


PHP FOFFormFieldList::getOptionName方法代码示例

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


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

示例1: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     return '<span class="' . $this->id . ' ' . $class . '">' . htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(), $this->value), ENT_COMPAT, 'UTF-8') . '</span>';
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:13,代码来源:plugins.php

示例2: getOptionName

 /**
  * Gets the active option's label given an array of JHtml options
  *
  * @param   array   $data      The JHtml options to parse
  * @param   mixed   $selected  The currently selected value
  * @param   string  $groupKey  Group name
  * @param   string  $optKey    Key name
  * @param   string  $optText   Value name
  *
  * @return  mixed   The label of the currently selected option
  */
 public static function getOptionName($data, $selected = null, $groupKey = 'items', $optKey = 'value', $optText = 'text')
 {
     $ret = null;
     foreach ($data as $dataKey => $group) {
         $label = $dataKey;
         $noGroup = is_int($dataKey);
         if (is_array($group)) {
             $subList = $group[$groupKey];
             $label = $group[$optText];
             $noGroup = false;
         } elseif (is_object($group)) {
             // Sub-list is in a property of an object
             $subList = $group->{$groupKey};
             $label = $group->{$optText};
             $noGroup = false;
         } else {
             throw new RuntimeException('Invalid group contents.', 1);
         }
         if ($noGroup) {
             $label = '';
         }
         $match = FOFFormFieldList::getOptionName($data, $selected, $optKey, $optText);
         if (!is_null($match)) {
             $ret = array('group' => $label, 'item' => $match);
             break;
         }
     }
     return $ret;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:40,代码来源:groupedlist.php

示例3: getStatic

 /**
  * Get the rendering of this field type for static display, e.g. in a single
  * item view (typically a "read" task).
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getStatic()
 {
     $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     return '<span id="' . $this->id . '" ' . $class . '>' . htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(), $this->value), ENT_COMPAT, 'UTF-8') . '</span>';
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:13,代码来源:published.php

示例4: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     $params = $this->getOptions();
     $db = FOFPlatform::getInstance()->getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__viewlevels AS a');
     $query->group('a.id, a.title, a.ordering');
     $query->order('a.ordering ASC');
     $query->order($query->qn('title') . ' ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     // If params is an array, push these options to the array
     if (is_array($params)) {
         $options = array_merge($params, $options);
     } elseif ($params) {
         array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
     }
     return '<span class="' . $this->id . ' ' . $class . '">' . htmlspecialchars(FOFFormFieldList::getOptionName($options, $this->value), ENT_COMPAT, 'UTF-8') . '</span>';
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:30,代码来源:accesslevel.php

示例5: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $class = $this->id;
     $format_string = '';
     $show_link = false;
     $link_url = '';
     $empty_replacement = '';
     // Get field parameters
     if ($this->element['class']) {
         $class = (string) $this->element['class'];
     }
     if ($this->element['format']) {
         $format_string = (string) $this->element['format'];
     }
     if ($this->element['show_link'] == 'true') {
         $show_link = true;
     }
     if ($this->element['url']) {
         $link_url = $this->element['url'];
     } else {
         $show_link = false;
     }
     if ($show_link && $this->item instanceof FOFTable) {
         // Replace [ITEM:ID] in the URL with the item's key value (usually:
         // the auto-incrementing numeric ID)
         $keyfield = $this->item->getKeyName();
         $replace = $this->item->{$keyfield};
         $link_url = str_replace('[ITEM:ID]', $replace, $link_url);
         // Replace the [ITEMID] in the URL with the current Itemid parameter
         $link_url = str_replace('[ITEMID]', JFactory::getApplication()->input->getInt('Itemid', 0), $link_url);
         // Replace other field variables in the URL
         $fields = $this->item->getFields();
         foreach ($fields as $fielddata) {
             $fieldname = $fielddata->Field;
             if (empty($fieldname)) {
                 $fieldname = $fielddata->column_name;
             }
             $search = '[ITEM:' . strtoupper($fieldname) . ']';
             $replace = $this->item->{$fieldname};
             $link_url = str_replace($search, $replace, $link_url);
         }
     } else {
         $show_link = false;
     }
     if ($this->element['empty_replacement']) {
         $empty_replacement = (string) $this->element['empty_replacement'];
     }
     $value = FOFFormFieldList::getOptionName($this->getOptions(), $this->value);
     // Get the (optionally formatted) value
     if (!empty($empty_replacement) && empty($value)) {
         $value = JText::_($empty_replacement);
     }
     if (empty($format_string)) {
         $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     } else {
         $value = sprintf($format_string, $value);
     }
     // Create the HTML
     $html = '<span class="' . $class . '">';
     if ($show_link) {
         $html .= '<a href="' . $link_url . '">';
     }
     $html .= $value;
     if ($show_link) {
         $html .= '</a>';
     }
     $html .= '</span>';
     return $html;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:77,代码来源:model.php

示例6: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__usergroups AS a');
     $query->group('a.id, a.title');
     $query->order('a.id ASC');
     $query->order($query->qn('title') . ' ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     return '<span class="' . $this->id . ' ' . $class . '">' . htmlspecialchars(FOFFormFieldList::getOptionName($options, $this->value), ENT_COMPAT, 'UTF-8') . '</span>';
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:23,代码来源:usergroup.php

示例7: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $class = $this->id;
     $format_string = '';
     $show_link = false;
     $link_url = '';
     $empty_replacement = '';
     // Get field parameters
     if ($this->element['class']) {
         $class = (string) $this->element['class'];
     }
     if ($this->element['format']) {
         $format_string = (string) $this->element['format'];
     }
     if ($this->element['show_link'] == 'true') {
         $show_link = true;
     }
     if ($this->element['url']) {
         $link_url = $this->element['url'];
     } else {
         $show_link = false;
     }
     if ($show_link && $this->item instanceof FOFTable) {
         $link_url = $this->parseFieldTags($link_url);
     } else {
         $show_link = false;
     }
     if ($this->element['empty_replacement']) {
         $empty_replacement = (string) $this->element['empty_replacement'];
     }
     $value = FOFFormFieldList::getOptionName($this->getOptions(), $this->value);
     // Get the (optionally formatted) value
     if (!empty($empty_replacement) && empty($value)) {
         $value = JText::_($empty_replacement);
     }
     if (empty($format_string)) {
         $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     } else {
         $value = sprintf($format_string, $value);
     }
     // Create the HTML
     $html = '<span class="' . $class . '">';
     if ($show_link) {
         $html .= '<a href="' . $link_url . '">';
     }
     $html .= $value;
     if ($show_link) {
         $html .= '</a>';
     }
     $html .= '</span>';
     return $html;
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:60,代码来源:model.php

示例8: getRepeatable

 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $show_link = false;
     $link_url = '';
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     if ($this->element['show_link'] == 'true') {
         $show_link = true;
     }
     if ($this->element['url']) {
         $link_url = $this->element['url'];
     } else {
         $show_link = false;
     }
     if ($show_link && $this->item instanceof FOFTable) {
         // Replace [ITEM:ID] in the URL with the item's key value (usually:
         // the auto-incrementing numeric ID)
         $keyfield = $this->item->getKeyName();
         $replace = $this->item->{$keyfield};
         $link_url = str_replace('[ITEM:ID]', $replace, $link_url);
         // Replace other field variables in the URL
         $fields = $this->item->getFields();
         foreach ($fields as $fielddata) {
             $fieldname = $fielddata->Field;
             $search = '[ITEM:' . strtoupper($fieldname) . ']';
             $replace = $this->item->{$fieldname};
             $link_url = str_replace($search, $replace, $link_url);
         }
     } else {
         $show_link = false;
     }
     $html = '<span class="' . $this->id . ' ' . $class . '">';
     if ($show_link) {
         $html .= '<a href="' . $link_url . '">';
     }
     $html .= htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(), $this->value), ENT_COMPAT, 'UTF-8');
     if ($show_link) {
         $html .= '</a>';
     }
     $html .= '</span>';
     return $html;
 }
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:49,代码来源:list.php


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