If containers/sections are not added explicitly to the view
through the "containers" property, these rows will be used
instead.
public addRow ( array $row, string $container = '' ) | ||
$row | array | A hash with the row information. Possible values: - label: (string) The row text. - selected: (boolean) Whether to mark the row as active. - style: (string) Additional CSS styles to apply to the row. - url (string) URL to link the row to. - type (string, optional) The row type, defaults to "tree". Further $row properties depending on the type: - tree: - cssClass: (string) CSS class for the icon. - id: (string) DOM ID for the row link. - checkbox: - radiobox: - color: (string, optional) Background color. - edit: (string, optional) URL for extra edit icon. |
$container | string | If using multiple sidebar sections, the ID of the section to add the row to. Sections will be rendered in the order of their first usage. |
/** * Adds additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { $sidebar->addNewButton(_("_Add Item"), Horde::url('new.php')); /* Checkbox lists are for resources that can be incrementally added to * the current content. */ $sidebar->containers['foo'] = array('header' => array('id' => 'skeleton-toggle-foo', 'label' => _("Foo"), 'collapsed' => false, 'add' => array('url' => Horde::url('foo.php'), 'label' => _("Create a new Foo")))); $sidebar->addRow(array('selected' => true, 'url' => Horde::url('foo.php')->add('foo', 1), 'label' => _("One"), 'color' => '#113355', 'edit' => Horde::url('edit.php')->add('foo', 1), 'type' => 'checkbox'), 'foo'); $sidebar->addRow(array('selected' => false, 'url' => Horde::url('foo.php')->add('foo', 2), 'label' => _("Two"), 'color' => '#557799', 'type' => 'checkbox'), 'foo'); /* Radiobox lists are for resources that can be displayed mutually * exclusive in the current content. */ $sidebar->containers['bar'] = array('header' => array('id' => 'skeleton-toggle-bar', 'label' => _("Bar"), 'collapsed' => true)); $sidebar->addRow(array('selected' => true, 'url' => Horde::url('bar.php')->add('bar', 1), 'label' => _("One"), 'color' => '#553311', 'edit' => Horde::url('edit.php')->add('bar', 1), 'type' => 'radiobox'), 'bar'); $sidebar->addRow(array('selected' => false, 'url' => Horde::url('bar.php')->add('bar', 2), 'label' => _("Two"), 'color' => '#997755', 'type' => 'radiobox'), 'bar'); }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { $sidebar->addNewButton(_("_New Bookmark"), Horde::url('add.php')); $sidebar->containers['tags'] = array('header' => array('id' => 'trean-toggle-tags', 'label' => _("Tags"), 'collapsed' => false)); $tagger = $GLOBALS['injector']->getInstance('Trean_Tagger'); $tags = $tagger->listBookmarkTags(); natcasesort($tags); foreach ($tags as $tag) { $url = Horde::url("tag/{$tag}"); $row = array('url' => $url, 'cssClass' => 'trean-tag', 'label' => $tag); $sidebar->addRow($row, 'tags'); } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { $backend = Gollem_Auth::getPreferredBackend(); $url = $GLOBALS['registry']->getServiceLink('login', 'horde')->add(array('url' => (string) Horde::url('manager.php', true), 'app' => 'gollem')); if ($GLOBALS['conf']['backend']['backend_list'] == 'shown') { foreach (Gollem_Auth::getBackend() as $key => $val) { $row = array('selected' => $backend == $key, 'url' => $url->add('backend_key', $key), 'label' => $val['name'], 'type' => 'radiobox'); $sidebar->addRow($row, 'backends'); } } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { global $injector, $session; $actions = array(); foreach ($injector->getInstance('Ingo_Factory_Script')->createAll() as $script) { $actions = array_merge($actions, $script->availableActions()); } if (!empty($actions) && !$injector->getInstance('Ingo_Factory_Storage')->create()->maxRules()) { $sidebar->addNewButton(_("New Rule"), Ingo_Basic_Rule::url()); } if ($injector->getInstance('Ingo_Shares') && count($all_rulesets = $this->_listRulesets()) > 1) { $url = Ingo_Basic_Filters::url(); $current = $session->get('ingo', 'current_share'); $sidebar->containers['rulesets'] = array('header' => array('id' => 'ingo-toggle-rules', 'label' => _("Ruleset"), 'collapsed' => false)); foreach ($all_rulesets as $id => $ruleset) { $row = array('selected' => $current == $id, 'url' => $url->add('ruleset', $id), 'label' => $ruleset->get('name'), 'type' => 'radiobox'); $sidebar->addRow($row, 'rulesets'); } } }
/** * Adds additional items to the sidebar. * * This is for the traditional view. For the dynamic view, see * Kronolith_View_Sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { global $calendar_manager, $conf, $injector, $prefs, $registry, $session; $admin = $registry->isAdmin(); $perms = $injector->getInstance('Horde_Core_Perms'); if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) && ($perms->hasAppPermission('max_events') === true || $perms->hasAppPermission('max_events') > Kronolith::countEvents())) { $sidebar->addNewButton(_("_New Event"), Horde::url('new.php')->add('url', Horde::selfUrl(true, false, true))); } if (strlen($session->get('kronolith', 'display_cal'))) { $calendars = Kronolith::displayedCalendars(); $sidebar->containers['calendars'] = array('header' => array('id' => 'kronolith-toggle-calendars', 'label' => ngettext("Showing calendar:", "Showing calendars:", count($calendars)), 'collapsed' => false)); foreach ($calendars as $calendar) { $row = array('label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox'); $sidebar->addRow($row, 'calendars'); } return; } $user = $registry->getAuth(); $url = Horde::selfUrl(); $edit = Horde::url('calendars/edit.php'); $sidebar->containers['my'] = array('header' => array('id' => 'kronolith-toggle-my', 'label' => _("My Calendars"), 'collapsed' => false)); if (!$prefs->isLocked('default_share')) { $sidebar->containers['my']['header']['add'] = array('url' => Horde::url('calendars/create.php'), 'label' => _("Create a new Local Calendar")); } if ($admin) { $sidebar->containers['system'] = array('header' => array('id' => 'kronolith-toggle-system', 'label' => _("System Calendars"), 'collapsed' => true)); $sidebar->containers['system']['header']['add'] = array('url' => Horde::url('calendars/create.php')->add('system', 1), 'label' => _("Create a new System Calendar")); } $sidebar->containers['shared'] = array('header' => array('id' => 'kronolith-toggle-shared', 'label' => _("Shared Calendars"), 'collapsed' => true)); foreach (Kronolith::listInternalCalendars() as $id => $calendar) { $owner = $calendar->get('owner'); if ($admin && empty($owner)) { continue; } $row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', $id), 'label' => Kronolith::getLabel($calendar), 'color' => Kronolith::backgroundColor($calendar), 'edit' => $edit->add('c', $calendar->getName()), 'type' => 'checkbox'); if ($calendar->get('owner') && $calendar->get('owner') == $user) { $sidebar->addRow($row, 'my'); } else { $sidebar->addRow($row, 'shared'); } } if ($admin) { foreach ($injector->getInstance('Kronolith_Shares')->listSystemShares() as $id => $calendar) { $row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', $id), 'label' => $calendar->get('name'), 'color' => Kronolith::backgroundColor($calendar), 'edit' => $edit->add('c', $calendar->getName()), 'type' => 'checkbox'); $sidebar->addRow($row, 'system'); } } if (!empty($conf['resources']['enabled']) && ($admin || $perms->hasAppPermission('resource_management'))) { $sidebar->containers['groups'] = array('header' => array('id' => 'kronolith-toggle-groups', 'label' => _("Resource Groups"), 'collapsed' => true, 'add' => array('url' => Horde::url('resources/groups/create.php'), 'label' => _("Create a new Resource Group")))); $editGroups = Horde::url('resources/groups/edit.php'); $sidebar->containers['resources'] = array('header' => array('id' => 'kronolith-toggle-resources', 'label' => _("Resources"), 'collapsed' => true, 'add' => array('url' => Horde::url('resources/create.php'), 'label' => _("Create a new Resource")))); $edit = Horde::url('resources/edit.php'); foreach (Kronolith::getDriver('Resource')->listResources() as $resource) { if ($resource->get('isgroup')) { $row = array('label' => $resource->get('name'), 'color' => '#dddddd', 'edit' => $editGroups->add('c', $resource->getId()), 'type' => 'radiobox'); $sidebar->addRow($row, 'groups'); } else { $calendar = new Kronolith_Calendar_Resource(array('resource' => $resource)); $row = array('selected' => in_array($resource->get('calendar'), $calendar_manager->get(Kronolith::DISPLAY_RESOURCE_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'resource_' . $resource->get('calendar')), 'label' => $calendar->name(), 'color' => $calendar->background(), 'edit' => $edit->add('c', $resource->getId()), 'type' => 'checkbox'); $sidebar->addRow($row, 'resources'); } } } foreach ($calendar_manager->get(Kronolith::ALL_EXTERNAL_CALENDARS) as $id => $calendar) { if (!$calendar->display()) { continue; } $app = $registry->get('name', $registry->hasInterface($calendar->api())); if (!strlen($app)) { $app = _("Other events"); } $container = 'external_' . $app; if (!isset($sidebar->containers[$container])) { $sidebar->containers[$container] = array('header' => array('id' => 'kronolith-toggle-external-' . $calendar->api(), 'label' => $app, 'collapsed' => true)); } $row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'external_' . $id), 'label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox'); $sidebar->addRow($row, $container); } $sidebar->containers['remote'] = array('header' => array('id' => 'kronolith-toggle-remote', 'label' => _("Remote Calendars"), 'collapsed' => true, 'add' => array('url' => Horde::url('calendars/remote_subscribe.php'), 'label' => _("Subscribe to a Remote Calendar")))); $edit = Horde::url('calendars/remote_edit.php'); foreach ($calendar_manager->get(Kronolith::ALL_REMOTE_CALENDARS) as $calendar) { $row = array('selected' => in_array($calendar->url(), $calendar_manager->get(Kronolith::DISPLAY_REMOTE_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'remote_' . $calendar->url()), 'label' => $calendar->name(), 'color' => $calendar->background(), 'edit' => $edit->add('url', $calendar->url()), 'type' => 'checkbox'); $sidebar->addRow($row, 'remote'); } if (!empty($conf['holidays']['enable'])) { $sidebar->containers['holidays'] = array('header' => array('id' => 'kronolith-toggle-holidays', 'label' => _("Holidays"), 'collapsed' => true)); foreach ($calendar_manager->get(Kronolith::ALL_HOLIDAYS) as $id => $calendar) { $row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_HOLIDAYS)), 'url' => $url->copy()->add('toggle_calendar', 'holiday_' . $id), 'label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox'); $sidebar->addRow($row, 'holidays'); } } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { foreach (Chora::sourceroots() as $key => $val) { $row = array('selected' => $GLOBALS['sourceroot'] == $key, 'url' => Chora::url('browsedir', '', array('rt' => $key)), 'label' => $val['name'], 'type' => 'radiobox'); $sidebar->addRow($row, 'backends'); } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { if (count($GLOBALS['addSources'])) { $sidebar->addNewButton(_("_New Contact"), Horde::url('add.php')); } $user = $GLOBALS['registry']->getAuth(); $url = Horde::url(''); $edit = Horde::url('addressbooks/edit.php'); $sidebar->containers['my'] = array('header' => array('id' => 'turba-toggle-my', 'label' => _("My Address Books"), 'collapsed' => false)); if ($GLOBALS['registry']->getAuth() && $GLOBALS['session']->get('turba', 'has_share')) { $sidebar->containers['my']['header']['add'] = array('url' => Horde::url('addressbooks/create.php'), 'label' => _("Create a new Address Book")); } $sidebar->containers['shared'] = array('header' => array('id' => 'turba-toggle-shared', 'label' => _("Shared Address Books"), 'collapsed' => true)); $shares = array(); foreach (Turba::listShares(false, Horde_Perms::SHOW) as $id => $abook) { $row = array('selected' => $id == Turba::$source, 'url' => $url->add('source', $id), 'label' => $abook->get('name'), 'edit' => $edit->add('a', $abook->getName()), 'type' => 'radiobox'); if ($abook->get('owner') && $abook->get('owner') == $user) { $sidebar->addRow($row, 'my'); if ($row['selected']) { $sidebar->containers['my']['header']['collapsed'] = false; } } else { if ($abook->get('owner')) { $row['label'] .= ' [' . $GLOBALS['registry']->convertUsername($abook->get('owner'), false) . ']'; } $sidebar->addRow($row, 'shared'); if ($row['selected']) { $sidebar->containers['shared']['header']['collapsed'] = false; } } $shares[$id] = true; } $sidebar->containers['other'] = array('header' => array('id' => 'turba-toggle-other', 'label' => _("Other Address Books"), 'collapsed' => true)); foreach (Turba::getAddressBooks(Horde_Perms::SHOW) as $id => $abook) { if (isset($shares[$id])) { continue; } $row = array('selected' => $id == Turba::$source, 'url' => $url->add('source', $id), 'label' => $abook['title'], 'type' => 'radiobox'); $sidebar->addRow($row, 'other'); if ($row['selected']) { $sidebar->containers['other']['header']['collapsed'] = false; } } }
/** * 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'); } } }
/** * Add additional items to the sidebar. * * @param Horde_View_Sidebar $sidebar The sidebar object. */ public function sidebar($sidebar) { $perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms'); if (Mnemo::getDefaultNotepad(Horde_Perms::EDIT) && ($perms->hasAppPermission('max_notes') === true || $perms->hasAppPermission('max_notes') > Mnemo::countMemos())) { $sidebar->addNewButton(_("_New Note"), Horde::url('memo.php')->add('actionID', 'add_memo')); } $url = Horde::url(''); $edit = Horde::url('notepads/edit.php'); $user = $GLOBALS['registry']->getAuth(); $sidebar->containers['my'] = array('header' => array('id' => 'mnemo-toggle-my', 'label' => _("My Notepads"), 'collapsed' => false)); if (!$GLOBALS['prefs']->isLocked('default_notepad')) { $sidebar->containers['my']['header']['add'] = array('url' => Horde::url('notepads/create.php'), 'label' => _("Create a new Notepad")); } $sidebar->containers['shared'] = array('header' => array('id' => 'mnemo-toggle-shared', 'label' => _("Shared Notepads"), 'collapsed' => true)); foreach (Mnemo::listNotepads() as $name => $notepad) { $url->add(array('display_notepad' => $name, 'actionID' => in_array($name, $GLOBALS['display_notepads']) ? 'remove_displaylist' : 'add_displaylist')); $row = array('selected' => in_array($name, $GLOBALS['display_notepads']), 'url' => $url, 'label' => Mnemo::getLabel($notepad), 'color' => $notepad->get('color') ?: '#dddddd', 'edit' => $edit->add('n', $notepad->getName()), 'type' => 'checkbox'); if ($notepad->get('owner') == $user) { $sidebar->addRow($row, 'my'); } else { $sidebar->addRow($row, 'shared'); } } }