Horde::widget PHP Method

widget() public static method

Returns an anchor sequence with the relevant parameters for a widget with accesskey and text.
public static widget ( array $params ) : string
$params array A hash with widget options (other options will be passed as attributes to the link tag): - url: (string) The full URL to be linked to. - title: (string) The link title/description. - nocheck: (boolean, optional) Don't check if the accesskey already already has been used. Defaults to false (= check).
return string The full Title sequence.
    public static function widget($params)
    {
        $params = array_merge(array('class' => '', 'target' => '', 'onclick' => '', 'nocheck' => false), $params);
        $url = $params['url'] instanceof Horde_Url ? $params['url'] : new Horde_Url($params['url']);
        $title = $params['title'];
        $params['accesskey'] = self::getAccessKey($title, $params['nocheck']);
        unset($params['url'], $params['title'], $params['nocheck']);
        return $url->link($params) . self::highlightAccessKey($title, $params['accesskey']) . '</a>';
    }

Usage Example

Beispiel #1
0
 $sortby = $prefs->getValue('sortby');
 $sortdir = $prefs->getValue('sortdir');
 $baseurl = Horde::url('list.php');
 if ($actionID == 'search_memos') {
     $baseurl->add(array('actionID' => 'search_memos', 'search_pattern' => $search_pattern, 'search_type' => $search_type));
 }
 $page_output->addInlineJsVars(array('Mnemo_List.ajaxUrl' => $registry->getServiceLink('ajax', 'mnemo')->url . 'setPrefValue'));
 $view->editImg = Horde::img('edit.png', _("Edit Note"), '');
 $view->showNotepad = $prefs->getValue('show_notepad');
 $view->sortdirclass = $sortdir ? 'sortup' : 'sortdown';
 $view->headers = array();
 if ($view->showNotepad) {
     $view->headers[] = array('id' => 's' . Mnemo::SORT_NOTEPAD, 'sorted' => $sortby == Mnemo::SORT_NOTEPAD, 'width' => '2%', 'label' => Horde::widget(array('url' => $baseurl->add('sortby', Mnemo::SORT_NOTEPAD), 'class' => 'sortlink', 'title' => _("Notepad"))));
 }
 $view->headers[] = array('id' => 's' . MNEMO::SORT_DESC, 'sorted' => $sortby == MNEMO::SORT_DESC, 'width' => '80%', 'label' => Horde::widget(array('url' => $baseurl->add('sortby', Mnemo::SORT_DESC), 'class' => 'sortlink', 'title' => _("No_te"))));
 $view->headers[] = array('id' => 's' . MNEMO::SORT_MOD_DATE, 'sorted' => $sortby == Mnemo::SORT_MOD_DATE, 'width' => '2%', 'label' => Horde::widget(array('url' => $baseurl->add('sortby', MNEMO::SORT_MOD_DATE), 'class' => 'sortlink', 'title' => _("Date"))));
 foreach ($memos as $memo_id => &$memo) {
     try {
         $share = $mnemo_shares->getShare($memo['memolist_id']);
     } catch (Horde_Share_Exception $e) {
         $notification->push($e);
         continue;
     }
     if ($view->showNotepad) {
         $memo['notepad'] = Mnemo::getLabel($share);
     }
     if ($share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
         $label = sprintf(_("Edit \"%s\""), $memo['desc']);
         $memo['edit'] = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'], 'actionID' => 'modify_memo'))->link(array('title' => $label)) . Horde::img('edit.png', $label, '') . '</a>';
     }
     $memo['link'] = Horde::linkTooltip(Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'])), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a>';
All Usage Examples Of Horde::widget