Пример #1
0
 function makeOverlib($tooltip, $caption = '', $caption_color = '', $mode = 0, $locale = '', $extra_parameters = '')
 {
     global $roster, $tooltips, $tooltipss;
     //$tooltip = stripslashes($tooltip);
     // Use main locale if one is not specified
     if ($locale == '') {
         $locale = $roster->config['locale'];
     }
     // Detect caption text and display accordingly
     $caption_mode = 1;
     if ($caption_color != '') {
         if (strlen($caption_color) > 6) {
             $caption_color = substr($caption_color, 2);
         }
     }
     if ($caption != '') {
         if ($caption_color != '') {
             $caption = '<span style="color:#' . $caption_color . ';">' . $caption . '</span>';
         }
         $caption = ",CAPTION,'" . addslashes($caption) . "'";
         $caption_mode = 0;
     }
     switch ($mode) {
         case 0:
             $tooltip = colorTooltip($tooltip, $caption_color, $locale, $caption_mode);
             break;
         case 1:
             $tooltip = cleanTooltip($tooltip, $caption_color, $caption_mode);
             break;
         case 2:
             break;
         default:
             $tooltip = colorTooltip($tooltip, $caption_color, $locale, $caption_mode);
             break;
     }
     $this->tooltipss = $this->tooltipss + 1;
     //echo $this->tooltipss;
     $num_of_tips = $this->tooltipss;
     //setTooltip($num_of_tips,$tooltip);
     return 'onmouseover="return overlib(\'' . $tooltip . '\'' . $caption . $extra_parameters . ');" onmouseout="return nd();"';
 }
Пример #2
0
/**
 * Easy all in one function to make overlib tooltips
 * Creates a string for insertion into any html tag that has "onmouseover" and "onmouseout" events
 *
 * @param string $tooltip | Tooltip as a string (delimited by "\n" character)
 * @param string $caption | (optional) Text to set as a true OverLib caption
 * @param string $caption_color | (optional) Color for the caption
 * Default is 'ffffff' - white
 * @param bool $mode| (optional) Options 0=colorize,1=clean,2=pass through
 * Default 0 (colorize)
 * @param string $locale | Locale so color parser can work correctly
 * Only needed when $colorize is true
 * Default is $roster->config['locale']
 * @param string $extra_parameters | (optional) Extra OverLib parameters you wish to pass
 * @param string $item_id
 * @return unknown
 */
function makeOverlib($tooltip, $caption = '', $caption_color = '', $mode = 0, $locale = '', $extra_parameters = '', $type = 'text', $member_id = null)
{
    global $roster, $tooltips;
    $tooltip = stripslashes($tooltip);
    if ($type == 'text') {
        // Use main locale if one is not specified
        if ($locale == '') {
            $locale = $roster->config['locale'];
        }
        // Detect caption text and display accordingly
        $caption_mode = 1;
        if ($caption_color != '') {
            if (strlen($caption_color) > 6) {
                $caption_color = substr($caption_color, 2);
            }
        }
        if ($caption != '') {
            if ($caption_color != '') {
                $caption = '<span style="color:#' . $caption_color . ';">' . $caption . '</span>';
            }
            $caption = addslashes($caption) . '<br>';
            $caption_mode = 0;
        }
        switch ($mode) {
            case 0:
                $tooltip = colorTooltip($tooltip, $caption_color, $locale, $caption_mode);
                break;
            case 1:
                $tooltip = cleanTooltip($tooltip, $caption_color, $caption_mode);
                break;
            case 2:
                break;
            default:
                $tooltip = colorTooltip($tooltip, $caption_color, $locale, $caption_mode);
                break;
        }
        //$t =
        return 'data-tooltip="text-' . base64_encode($tooltip) . '" data-caption="' . base64_encode($caption) . '"';
    } else {
        if ($type == 'item') {
            return 'data-tooltip="item-' . $tooltip . (isset($member_id) ? '|' . $member_id : '') . '"';
        } else {
            if ($type == 'talent') {
                return 'data-tooltip="talent-' . $tooltip . '"';
            } else {
                return null;
            }
        }
    }
    //return 'onmouseover="return overlib(overlib_' . $num_of_tips . $caption . $extra_parameters . ');" onmouseout="return nd();"';
}