示例#1
0
    /**
     * Renders a label for a fieldset.
     *
     * @param   object  	$field  	The field of the label to render
     * @param   Form   	&$form      The form to render
     * @param 	string		$title		The title of the label
     *
     * @return 	string		The rendered label
     */
    public function renderFieldsetLabel($field, Form &$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)) {
            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 = $this->container->platform->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 {
            $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">';
        }
        $html .= \JText::_($title);
        if ($required) {
            $html .= ' *';
        }
        $html .= '</label>' . "\n";
        return $html;
    }
示例#2
0
文件: Joomla3.php 项目: Joal01/fof
 /**
  * Renders a label for a fieldset.
  *
  * @param   object  $field  The field of the label to render
  * @param   Form   	&$form  The form to render
  * @param 	string  $title  The title of the label
  *
  * @return 	string  The rendered label
  */
 public function renderFieldsetLabel($field, Form &$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>\n";
     return $html;
 }