Пример #1
0
    /**
     * Renders a label for a fieldset.
     *
     * @param   object  	$field  	The field of the label to render
     * @param   F0FForm   	&$form      The form to render
     * @param 	string		$title		The title of the label
     *
     * @return 	string		The rendered label
     */
    protected function renderFieldsetLabel($field, F0FForm &$form, $title)
    {
        $html = '';
        $labelClass = $field->labelClass;
        $required = $field->required;
        $tooltip = $form->getFieldAttribute($field->fieldname, 'tooltip', '', $field->group);
        if (!empty($tooltip)) {
            if (version_compare(JVERSION, '3.0', 'ge')) {
                static $loadedTooltipScript = false;
                if (!$loadedTooltipScript) {
                    $js = <<<JS
(function(\$)
{
\t\$(document).ready(function()
\t{
\t\t\$('.fof-tooltip').tooltip({placement: 'top'});
\t});
})(akeeba.jQuery);
JS;
                    $document = F0FPlatform::getInstance()->getDocument();
                    if ($document instanceof JDocument) {
                        $document->addScriptDeclaration($js);
                    }
                    $loadedTooltipScript = true;
                }
                $tooltipText = '<strong>' . JText::_($title) . '</strong><br />' . JText::_($tooltip);
                $html .= "\t\t\t\t" . '<label class="control-label fof-tooltip ' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" data-toggle="fof-tooltip">';
            } else {
                // Joomla! 2.5 has a conflict with the jQueryUI tooltip, therefore we
                // have to use native Joomla! 2.5 tooltips
                JHtml::_('behavior.tooltip');
                $tooltipText = JText::_($title) . '::' . JText::_($tooltip);
                $html .= "\t\t\t\t" . '<label class="control-label hasTip ' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" rel="tooltip">';
            }
        } else {
            $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">';
        }
        $html .= JText::_($title);
        if ($required) {
            $html .= ' *';
        }
        $html .= '</label>' . PHP_EOL;
        return $html;
    }
Пример #2
0
 /**
  * Renders a label for a fieldset.
  *
  * @param   object  	$field  	The field of the label to render
  * @param   F0FForm   	&$form      The form to render
  * @param 	string		$title		The title of the label
  *
  * @return 	string		The rendered label
  */
 protected function renderFieldsetLabel($field, F0FForm &$form, $title)
 {
     $html = '';
     $labelClass = $field->labelClass ? $field->labelClass : $field->labelclass;
     // Joomla! 2.5/3.x use different case for the same name
     $required = $field->required;
     if ($required) {
         $labelClass .= ' required';
     }
     $tooltip = $form->getFieldAttribute($field->fieldname, 'tooltip', '', $field->group);
     if (!empty($tooltip)) {
         JHtml::_('behavior.tooltip');
         $tooltipText = JText::_($title) . '::' . JText::_($tooltip);
         $labelClass .= ' hasTip';
         $html .= "\t\t\t\t" . '<label id="' . $field->id . '-lbl" class="' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" rel="tooltip">';
     } else {
         $html .= "\t\t\t\t" . '<label class="' . $labelClass . '" for="' . $field->id . '">';
     }
     $html .= JText::_($title);
     if ($required) {
         $html .= '<span class="star">&nbsp;*</span>';
     }
     $html .= "\t\t\t\t" . '</label>' . PHP_EOL;
     return $html;
 }
Пример #3
0
 /**
  * Renders a label for a fieldset.
  *
  * @param   object  	$field  	The field of the label to render
  * @param   F0FForm   	&$form      The form to render
  * @param 	string		$title		The title of the label
  *
  * @return 	string		The rendered label
  */
 protected function renderFieldsetLabel($field, F0FForm &$form, $title)
 {
     $html = '';
     $labelClass = $field->labelClass ? $field->labelClass : $field->labelclass;
     // Joomla! 2.5/3.x use different case for the same name
     $required = $field->required;
     $tooltip = $form->getFieldAttribute($field->fieldname, 'tooltip', '', $field->group);
     if (!empty($tooltip)) {
         JHtml::_('bootstrap.tooltip');
         $tooltipText = '<strong>' . JText::_($title) . '</strong><br />' . JText::_($tooltip);
         $html .= "\t\t\t\t" . '<label class="control-label hasTooltip ' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" rel="tooltip">';
     } else {
         $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">';
     }
     $html .= JText::_($title);
     if ($required) {
         $html .= ' *';
     }
     $html .= '</label>' . PHP_EOL;
     return $html;
 }