示例#1
0
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs. Additional options:
  *   - mailbox: (string) Mailbox to use for quota query.
  */
 public function __construct(array $config = array())
 {
     $config['templatePath'] = IMP_TEMPLATES . '/basic';
     parent::__construct($config);
     $quotadata = $GLOBALS['injector']->getInstance('IMP_Quota_Ui')->quota(isset($config['mailbox']) ? $config['mailbox'] : null, true);
     if (!empty($quotadata)) {
         $this->quotaClass = $quotadata['class'];
         $this->quotaText = $quotadata['message'];
     }
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     if (empty($config['templatePath'])) {
         $config['templatePath'] = $GLOBALS['registry']->get('templates', 'horde') . '/sidebar';
     }
     parent::__construct($config);
     $this->addHelper('Text');
     $this->containers = array();
     $this->width = $GLOBALS['prefs']->getValue('sidebar_width');
     $this->left = ($GLOBALS['registry']->nlsconfig->curr_rtl ? 'right:' : 'left:') . $this->width;
     $pageOutput = $GLOBALS['injector']->getInstance('Horde_PageOutput');
     $pageOutput->addScriptFile('sidebar.js', 'horde');
     $pageOutput->addInlineJsVars(array('HordeSidebar.text' => array('collapse' => _("Collapse"), 'expand' => _("Expand")), 'HordeSidebar.opts' => array('cookieDomain' => $GLOBALS['conf']['cookie']['domain'], 'cookiePath' => $GLOBALS['conf']['cookie']['path'])));
 }
示例#3
0
文件: Topbar.php 项目: DSNS-LAB/Dmail
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $injector, $prefs, $registry;
     if (empty($config['templatePath'])) {
         $config['templatePath'] = $registry->get('templates', 'horde') . '/topbar';
     }
     parent::__construct($config);
     $this->addHelper('Text');
     /* Logo. */
     $this->portalUrl = $registry->getServiceLink('portal', $registry->getApp());
     if (class_exists('Horde_Bundle')) {
         $this->version = Horde_Bundle::SHORTNAME . ' ' . Horde_Bundle::VERSION;
     } else {
         $this->version = $registry->getVersion('horde');
     }
     /* Main menu. */
     $topbar = $injector->getInstance('Horde_Core_Factory_Topbar')->create('Horde_Tree_Renderer_Menu', array('nosession' => true));
     $this->menu = $topbar->getTree();
     /* Search form. */
     $this->searchAction = '#';
     $this->searchIcon = Horde_Themes::img('search-topbar.png');
     $this->searchLabel = _("Search");
     /* Login/Logout. */
     if ($registry->getAuth()) {
         if ($registry->showService('logout')) {
             $this->logoutUrl = $registry->getServiceLink('logout', $registry->getApp())->setRaw(false);
         }
     } else {
         if ($registry->showService('login')) {
             $this->loginUrl = $registry->getServiceLink('login', $registry->getApp())->setRaw(false)->add('url', Horde::selfUrl(true, true, true));
         }
     }
     /* Sub bar. */
     $this->date = strftime($prefs->getValue('date_format'));
     $pageOutput = $injector->getInstance('Horde_PageOutput');
     $pageOutput->addScriptPackage('Horde_Core_Script_Package_Datejs');
     $pageOutput->addScriptFile('topbar.js', 'horde');
     $pageOutput->addInlineJsVars(array('HordeTopbar.conf' => array('URI_AJAX' => $registry->getServiceLink('ajax', 'horde')->url, 'app' => $registry->getApp(), 'format' => Horde_Core_Script_Package_Datejs::translateFormat($prefs->getValue('date_format')), 'hash' => $topbar->getHash(), 'refresh' => intval($prefs->getValue('menu_refresh_time')))));
     /* Sidebar. */
     $this->sidebarWidth = $prefs->getValue('sidebar_width');
 }
示例#4
0
文件: Attendees.php 项目: horde/horde
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $conf, $injector, $registry, $session;
     $config['templatePath'] = KRONOLITH_TEMPLATES . '/attendees';
     parent::__construct($config);
     $this->addHelper('Text');
     $this->formInput = Horde_Util::formInput();
     $this->view = Horde_Util::getFormData('view', 'Day');
     $this->date = $config['start']->dateString();
     $this->end = $config['end']->dateString();
     $this->freeBusy = $config['fbView']->render($config['start']);
     $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
     if ($auth->hasCapability('list') && ($conf['auth']['list_users'] == 'list' || $conf['auth']['list_users'] == 'both')) {
         $this->userList = $auth->listNames();
     }
     $this->resourcesEnabled = !empty($conf['resources']['enabled']);
     if ($registry->hasMethod('contacts/search')) {
         $this->addressbookLink = Horde::url('#')->link(array('class' => 'widget', 'onclick' => 'window.open(\'' . Horde::url('contacts.php') . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=270,left=100,top=100\'); return false;')) . Horde::img('addressbook_browse.png') . '<br />' . _("Address Book") . '</a>';
     }
     $vars = Horde_Variables::getDefaultVariables();
     $tabs = new Horde_Core_Ui_Tabs(null, $vars);
     $tabs->addTab(_("Day"), new Horde_Url('javascript:switchView(\'Day\')'), 'Day');
     $tabs->addTab(_("Work Week"), new Horde_Url('javascript:switchView(\'Workweek\')'), 'Workweek');
     $tabs->addTab(_("Week"), new Horde_Url('javascript:switchView(\'Week\')'), 'Week');
     $tabs->addTab(_("Month"), new Horde_Url('javascript:switchView(\'Month\')'), 'Month');
     $this->tabs = $tabs->render($this->view);
     $attendees = $session->get('kronolith', 'attendees');
     if ($attendees) {
         $roles = array(Kronolith::PART_REQUIRED, Kronolith::PART_OPTIONAL, Kronolith::PART_NONE);
         $responses = array(Kronolith::RESPONSE_ACCEPTED, Kronolith::RESPONSE_DECLINED, Kronolith::RESPONSE_TENTATIVE, Kronolith::RESPONSE_NONE);
         $this->attendees = array();
         foreach ($attendees as $attendee) {
             $viewAttendee = array('id' => $attendee->id, 'name' => strval($attendee), 'deleteLink' => Horde::url('#')->link(array('title' => sprintf(_("Remove %s"), $attendee->displayName), 'onclick' => "performAction('remove', decodeURIComponent('" . rawurlencode($attendee->id) . "')); return false;")) . Horde::img('delete.png') . '</a>');
             if ($attendee->user) {
                 unset($this->userList[$attendee->user]);
             } else {
                 $viewAttendee['editLink'] = Horde::url('#')->link(array('title' => sprintf(_("Edit %s"), $attendee->displayName), 'onclick' => "performAction('edit', decodeURIComponent('" . rawurlencode($attendee->id) . "')); return false;")) . Horde::img('edit.png') . '</a>';
             }
             foreach ($roles as $role) {
                 $viewAttendee['roles'][$role] = array('selected' => $attendee->role == $role, 'label' => Kronolith::partToString($role));
             }
             foreach ($responses as $response) {
                 $viewAttendee['responses'][$response] = array('selected' => $attendee->response == $response, 'label' => Kronolith::responseToString($response));
             }
             $this->attendees[] = $viewAttendee;
         }
     }
     $this->resources = $session->get('kronolith', 'resources', Horde_Session::TYPE_ARRAY);
     foreach ($this->resources as $id => &$resource) {
         $resource['id'] = $id;
         $resource['deleteLink'] = Horde::url('#')->link(array('title' => sprintf(_("Remove %s"), $resource['name']), 'onclick' => "performAction('removeResource', decodeURIComponent('" . $id . "')); return false;")) . Horde::img('delete.png') . '</a>';
         foreach ($roles as $role) {
             $resource['roles'][$role] = array('selected' => $resource['attendance'] == $role, 'label' => Kronolith::partToString($role));
         }
         foreach ($responses as $response) {
             $resource['responses'][$response] = array('selected' => $resource['response'] == $response, 'label' => Kronolith::responseToString($response));
         }
     }
     /* Get list of resources for select list, and remove those we already
      * added. */
     if ($this->resourcesEnabled) {
         $this->allResources = array_diff_key(Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array(), 'name'), $this->resources);
     }
 }
示例#5
0
文件: View.php 项目: horde/horde
 /**
  * Constructor
  */
 public function __construct()
 {
     /* Set default data. */
     parent::__construct(array('templatePath' => AGORA_TEMPLATES));
 }