getAccessKeyAndTitle() public static method

Returns the appropriate "accesskey" and "title" attributes for an HTML tag and the given label.
public static getAccessKeyAndTitle ( string $label, boolean $nocheck = false, boolean $return_array = false ) : string
$label string The title of an HTML element
$nocheck boolean Don't check if the access key already has been used?
$return_array boolean Return attributes as a hash?
return string The title, and if appropriate, the accesskey attributes for the element.
Esempio n. 1
0
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $prefs, $registry;
     parent::__construct($config);
     $blank = new Horde_Url();
     $this->addNewButton(_("_New Event"), $blank, array('id' => 'kronolithNewEvent'));
     $this->newExtra = $blank->link(array_merge(array('id' => 'kronolithQuickEvent'), Horde::getAccessKeyAndTitle(_("Quick _insert"), false, true)));
     $sidebar = $GLOBALS['injector']->createInstance('Horde_View');
     /* Minical. */
     $today = new Horde_Date($_SERVER['REQUEST_TIME']);
     $sidebar->today = $today->format('F Y');
     $sidebar->weekdays = array();
     for ($i = $prefs->getValue('week_start_monday'), $c = $i + 7; $i < $c; $i++) {
         $weekday = Horde_Nls::getLangInfo(constant('DAY_' . ($i % 7 + 1)));
         $sidebar->weekdays[$weekday] = Horde_String::substr($weekday, 0, 2);
     }
     /* Calendars. */
     $sidebar->newShares = $registry->getAuth() && !$prefs->isLocked('default_share');
     $sidebar->admin = $registry->isAdmin();
     $sidebar->resourceAdmin = $registry->isAdmin() || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management');
     $sidebar->resources = $GLOBALS['conf']['resources']['enabled'];
     $sidebar->addRemote = !$prefs->isLocked('remote_cals');
     $remotes = unserialize($prefs->getValue('remote_cals'));
     $sidebar->showRemote = !($prefs->isLocked('remote_cals') && empty($remotes));
     $this->content = $sidebar->render('dynamic/sidebar');
 }
Esempio n. 2
0
 /**
  * Adds a "New ..." button to the sidebar.
  *
  * @param string $label  The button text, including access key.
  * @param string $url    The button URL.
  * @param array $extra   Extra attributes for the link tag.
  */
 public function addNewButton($label, $url, $extra = array())
 {
     $ak = Horde::getAccessKey($label);
     $attributes = $ak ? Horde::getAccessKeyAndTitle($label, true, true) : array();
     $this->newLink = $url->link($attributes + $extra);
     $this->newText = Horde::highlightAccessKey($label, $ak);
 }
Esempio n. 3
0
 /**
  * Wrapper around the Horde::getAccessKeyAndTitle() method.
  *
  * @see Horde::getAccessKeyAndTitle()
  */
 public function hordeAccessKeyAndTitle($label, $nocheck = false, $return_array = false)
 {
     return Horde::getAccessKeyAndTitle($label, $nocheck, $return_array);
 }
Esempio n. 4
0
 /**
  * @param object $renderer  A Kronolith view.
  */
 public static function tabs($renderer)
 {
     global $injector, $prefs;
     $view = $injector->createInstance('Horde_View');
     $date = self::currentDate();
     $date_stamp = array('date' => $date->dateString());
     $tabname = basename($_SERVER['PHP_SELF']) == 'index.php' ? $GLOBALS['prefs']->getValue('defaultview') : str_replace('.php', '', basename($_SERVER['PHP_SELF']));
     $view->active = $tabname;
     $view->previous = $renderer->link(-1);
     $view->next = $renderer->link(1);
     switch ($tabname) {
         case 'day':
             $view->current = $renderer->getTime($prefs->getValue('date_format'));
             break;
         case 'workweek':
         case 'week':
             $view->current = $renderer->days[$renderer->startDay]->getTime($prefs->getValue('date_format')) . ' - ' . $renderer->days[$renderer->endDay]->getTime($prefs->getValue('date_format'));
             break;
         case 'month':
             $view->current = $renderer->date->strftime('%B %Y');
             break;
         case 'year':
             $view->current = $renderer->year;
             break;
     }
     $view->today = Horde::url($prefs->getValue('defaultview') . '.php')->link(Horde::getAccessKeyAndTitle(_("_Today"), false, true)) . _("Today") . '</a>';
     $view->day = Horde::widget(array('url' => Horde::url('day.php')->add($date_stamp), 'id' => 'kronolithNavDay', 'accesskey' => '1', 'title' => _("Day")));
     $view->workWeek = Horde::widget(array('url' => Horde::url('workweek.php')->add($date_stamp), 'id' => 'kronolithNavWorkweek', 'accesskey' => '2', 'title' => _("Work Week")));
     $view->week = Horde::widget(array('url' => Horde::url('week.php')->add($date_stamp), 'id' => 'kronolithNavWeek', 'accesskey' => '3', 'title' => _("Week")));
     $view->month = Horde::widget(array('url' => Horde::url('month.php')->add($date_stamp), 'id' => 'kronolithNavMonth', 'accesskey' => '4', 'title' => _("Month")));
     $view->year = Horde::widget(array('url' => Horde::url('year.php')->add($date_stamp), 'id' => 'kronolithNavYear', 'accesskey' => '5', 'title' => _("Year")));
     echo $view->render('buttonbar');
 }
Esempio n. 5
0
 /**
  * Add additional items to the sidebar.
  *
  * @param Horde_View_Sidebar $sidebar  The sidebar object.
  */
 public function sidebar($sidebar)
 {
     // @TODO: Implement an injector factory for this.
     global $display_tasklists, $page_output, $prefs;
     $perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
     if (Nag::getDefaultTasklist(Horde_Perms::EDIT) && ($perms->hasAppPermission('max_tasks') === true || $perms->hasAppPermission('max_tasks') > Nag::countTasks())) {
         $sidebar->addNewButton(_("_New Task"), Horde::url('task.php')->add('actionID', 'add_task'));
         if ($GLOBALS['browser']->hasFeature('dom')) {
             $page_output->addScriptFile('scriptaculous/effects.js', 'horde');
             $page_output->addScriptFile('redbox.js', 'horde');
             $blank = new Horde_Url();
             $sidebar->newExtra = $blank->link(array_merge(array('onclick' => 'RedBox.showInline(\'quickAddInfoPanel\'); $(\'quickText\').focus(); return false;'), Horde::getAccessKeyAndTitle(_("_Quick Add"), false, true)));
             require_once NAG_TEMPLATES . '/quick.inc';
         }
     }
     $list = Horde::url('list.php');
     $edit = Horde::url('tasklists/edit.php');
     $user = $GLOBALS['registry']->getAuth();
     $sidebar->containers['my'] = array('header' => array('id' => 'nag-toggle-my', 'label' => _("My Task Lists"), 'collapsed' => false));
     if (!$GLOBALS['prefs']->isLocked('default_tasklist')) {
         $sidebar->containers['my']['header']['add'] = array('url' => Horde::url('tasklists/create.php'), 'label' => _("Create a new Task List"));
     }
     if ($GLOBALS['registry']->isAdmin()) {
         $sidebar->containers['system'] = array('header' => array('id' => 'nag-toggle-system', 'label' => _("System Task Lists"), 'collapsed' => true));
         $sidebar->containers['system']['header']['add'] = array('url' => Horde::url('tasklists/create.php')->add('system', 1), 'label' => _("Create a new System Task List"));
     }
     $sidebar->containers['shared'] = array('header' => array('id' => 'nag-toggle-shared', 'label' => _("Shared Task Lists"), 'collapsed' => true));
     foreach (Nag::listTasklists(false, Horde_Perms::SHOW, false) as $name => $tasklist) {
         $url = $list->add(array('display_tasklist' => $name, 'actionID' => in_array($name, $display_tasklists) ? 'remove_displaylist' : 'add_displaylist'));
         $row = array('selected' => in_array($name, $display_tasklists), 'url' => $url, 'label' => Nag::getLabel($tasklist), 'color' => $tasklist->get('color') ?: '#dddddd', 'edit' => $edit->add('t', $tasklist->getName()), 'type' => 'checkbox');
         if ($GLOBALS['registry']->isAdmin() && is_null($tasklist->get('owner'))) {
             $sidebar->addRow($row, 'system');
         } elseif ($tasklist->get('owner') == $user) {
             $sidebar->addRow($row, 'my');
         } else {
             $sidebar->addRow($row, 'shared');
         }
     }
 }
Esempio n. 6
0
                $hdr['label'] = _("Group");
                $hdr['align'] = 'right';
                break;
        }
        if ($sort !== null) {
            if ($sortby == $sort) {
                $hdr['class'] = $sortdir ? 'sortup' : 'sortdown';
                $params = array('actionID' => 'change_sortdir', 'sortdir' => 1 - $sortdir);
            } else {
                $params = array('actionID' => 'change_sortby', 'sortby' => $sort);
            }
            $hdr['label'] = '<a href="' . Horde::selfUrl()->add($params) . '" class="sortlink">' . htmlspecialchars($hdr['label']) . '</a>';
        }
        $headers[] = $hdr;
    }
    /* Set up the template tags. */
    $template->headers = $headers;
    $template->entries = $entry;
    $template->page_caption = $page_caption;
    $template->checkall = Horde::getAccessKeyAndTitle(_("Check _All/None"));
} else {
    $template->empty_dir = true;
}
$template->itemcount = sprintf(ngettext(_("%d item"), _("%d items"), $total), $total);
$page_output->addScriptFile('manager.js');
$page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
$page_output->addInlineJsVars(array('var GollemVar' => array('actionUrl' => strval(Horde::url('manager.php')), 'empty_input' => intval($GLOBALS['browser']->hasQuirk('empty_file_input_value')), 'warn_recursive' => intval($prefs->getValue('recursive_deletes') == 'warn')), 'var GollemText' => array('change_directory' => _("Change Folder"), 'create_folder' => _("Create Folder"), 'delete_confirm_1' => _("The following items will be permanently deleted:"), 'delete_confirm_2' => _("Are you sure?"), 'delete_recurs_1' => _("The following item(s) are folders:"), 'delete_recurs_2' => _("Are you sure you wish to continue?"), 'file' => _("File"), 'permissions' => _("Permissions"), 'rename' => _("Rename"), 'select_item' => _("Please select an item before this action."), 'specify_upload' => _("Please specify at least one file to upload."))));
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
echo $template->render('manager');
$page_output->footer();