Horde::linkTooltip PHP Method

linkTooltip() public static method

Uses DOM Tooltips to display the 'title' attribute for link() calls.
public static linkTooltip ( string $url, string $status = '', string $class = '', string $target = '', string $onclick = '', string $title = '', string $accesskey = '', array $attributes = [] ) : string
$url string The full URL to be linked to
$status string The JavaScript mouse-over string
$class string The CSS class of the link
$target string The window target to point to.
$onclick string JavaScript action for the 'onclick' event.
$title string The link title (tooltip). Most not contain HTML data other than <br>, which will be converted to a linebreak.
$accesskey string The access key to use.
$attributes array Any other name/value pairs to add to the <a> tag.
return string The full tag.
    public static function linkTooltip($url, $status = '', $class = '', $target = '', $onclick = '', $title = '', $accesskey = '', $attributes = array())
    {
        if (strlen($title)) {
            $attributes['nicetitle'] = Horde_Serialize::serialize(explode("\n", preg_replace('/<br\\s*\\/?\\s*>/', "\n", $title)), Horde_Serialize::JSON);
            $title = null;
            $GLOBALS['injector']->getInstance('Horde_PageOutput')->addScriptFile('tooltips.js', 'horde');
        }
        return self::link($url, $title, $class, $target, $onclick, null, $accesskey, $attributes, false);
    }

Usage Example

Example #1
0
 /**
  */
 protected function _content()
 {
     global $registry, $prefs;
     if (!empty($this->_params['show_notepad'])) {
         $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create();
     }
     $html = '';
     $memos = Mnemo::listMemos($prefs->getValue('sortby'), $prefs->getValue('sortdir'));
     foreach ($memos as $id => $memo) {
         $html .= '<tr>';
         if (!empty($this->_params['show_actions'])) {
             $editImg = Horde_Themes::img('edit.png');
             $editurl = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
             $html .= '<td width="1%">' . Horde::link(htmlspecialchars(Horde::url($editurl, true)->add('actionID', 'modify_memo')), _("Edit Note")) . Horde::img($editImg, _("Edit Note")) . '</a></td>';
         }
         if (!empty($this->_params['show_notepad'])) {
             $html .= '<td>' . htmlspecialchars(Mnemo::getLabel($shares->getShare($memo['memolist_id']))) . '</td>';
         }
         $viewurl = Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
         $html .= '<td>' . Horde::linkTooltip(htmlspecialchars(Horde::url($viewurl, true)), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a> <ul class="horde-tags">';
         foreach ($memo['tags'] as $tag) {
             $html .= '<li>' . htmlspecialchars($tag) . '</li>';
         }
         $html .= '</ul></td></tr>';
     }
     if (!$memos) {
         return '<p><em>' . _("No notes to display") . '</em></p>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
All Usage Examples Of Horde::linkTooltip