• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_Core_Translation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Horde_Core_Translation的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Core_Translation类的具体用法?PHP Horde_Core_Translation怎么用?PHP Horde_Core_Translation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Horde_Core_Translation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * @throws Horde_Exception
  */
 public function create(Horde_Injector $injector)
 {
     global $conf, $injector;
     if (empty($conf['weather']['provider'])) {
         throw new Horde_Exception(Horde_Core_Translation::t("Weather support not configured."));
     }
     // Parameters for all driver types
     $params = array('cache' => $injector->getInstance('Horde_Cache'), 'cache_lifetime' => $conf['weather']['params']['lifetime'], 'http_client' => $injector->createInstance('Horde_Core_Factory_HttpClient')->create());
     $driver = $conf['weather']['provider'];
     switch ($driver) {
         case 'WeatherUnderground':
         case 'Wwo':
             $params['apikey'] = $conf['weather']['params']['key'];
             break;
         case 'Google':
             $l = explode('_', $GLOBALS['language']);
             $params['language'] = $l[0];
             break;
     }
     $class = $this->_getDriverName($driver, 'Horde_Service_Weather');
     try {
         return new $class($params);
     } catch (InvalidArgumentException $e) {
         throw new Horde_Exception($e);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:29,代码来源:Weather.php


示例2: getConfig

 /**
  * Returns the VFS driver parameters for the specified backend.
  *
  * @param string $name  The VFS system name being used.
  *
  * @return array  A hash with the VFS parameters; the VFS driver in 'type'
  *                and the connection parameters in 'params'.
  * @throws Horde_Exception
  */
 public function getConfig($name = 'horde')
 {
     global $conf;
     if ($name !== 'horde' && !isset($conf[$name]['type'])) {
         throw new Horde_Exception(Horde_Core_Translation::t("You must configure a VFS backend."));
     }
     $vfs = $name == 'horde' || $conf[$name]['type'] == 'horde' ? $conf['vfs'] : $conf[$name];
     switch (Horde_String::lower($vfs['type'])) {
         case 'none':
             $vfs['params'] = array();
             $vfs['type'] = 'null';
             break;
         case 'nosql':
             $nosql = $this->_injector->getInstance('Horde_Core_Factory_Nosql')->create('horde', 'vfs');
             if ($nosql instanceof Horde_Mongo_Client) {
                 $vfs['params']['mongo_db'] = $nosql;
                 $vfs['type'] = 'mongo';
             }
             break;
         case 'sql':
         case 'sqlfile':
         case 'musql':
             $config = Horde::getDriverConfig('vfs', 'sql');
             unset($config['umask'], $config['vfsroot']);
             $vfs['params']['db'] = $this->_injector->getInstance('Horde_Core_Factory_Db')->create('horde', $config);
             break;
     }
     return $vfs;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:38,代码来源:Vfs.php


示例3: __construct

 /**
  * Constructor
  *
  * @var params Horde_Variables  TODO
  */
 public function __construct(&$vars)
 {
     parent::__construct($vars, Horde_Core_Translation::t("Sign up for an account"));
     $this->setButtons(Horde_Core_Translation::t("Sign up"));
     $this->addHidden('', 'url', 'text', false);
     /* Use hooks get any extra fields required in signing up. */
     try {
         $extra = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('signup_getextra', 'horde');
     } catch (Horde_Exception_HookNotSet $e) {
     }
     if (!empty($extra)) {
         if (!isset($extra['user_name'])) {
             $this->addVariable(Horde_Core_Translation::t("Choose a username"), 'user_name', 'text', true);
         }
         if (!isset($extra['password'])) {
             $this->addVariable(Horde_Core_Translation::t("Choose a password"), 'password', 'passwordconfirm', true, false, Horde_Core_Translation::t("Type your password twice to confirm"));
         }
         foreach ($extra as $field_name => $field) {
             $readonly = isset($field['readonly']) ? $field['readonly'] : null;
             $desc = isset($field['desc']) ? $field['desc'] : null;
             $required = isset($field['required']) ? $field['required'] : false;
             $field_params = isset($field['params']) ? $field['params'] : array();
             $this->addVariable($field['label'], 'extra[' . $field_name . ']', $field['type'], $required, $readonly, $desc, $field_params);
         }
     } else {
         $this->addVariable(Horde_Core_Translation::t("Choose a username"), 'user_name', 'text', true);
         $this->addVariable(Horde_Core_Translation::t("Choose a password"), 'password', 'passwordconfirm', true, false, Horde_Core_Translation::t("Type your password twice to confirm"));
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Form.php


示例4: _handle

 /**
  * Variables required in form input:
  *   - imple_submit: vcard action. Contains import and source properties
  *   - mime_id
  *   - muid
  *
  * @return boolean  True on success.
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $registry, $injector, $notification;
     $iCal = new Horde_Icalendar();
     try {
         $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
         if (!($mime_part = $contents->getMimePart($vars->mime_id))) {
             throw new IMP_Exception(_("Cannot retrieve vCard data from message."));
         } elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
             throw new IMP_Exception(_("Error reading the contact data."));
         }
         $components = $iCal->getComponents();
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
     $import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false;
     $source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false;
     if ($import && $source && $registry->hasMethod('contacts/import')) {
         $count = 0;
         foreach ($components as $c) {
             if ($c->getType() == 'vcard') {
                 try {
                     $registry->call('contacts/import', array($c, null, $source));
                     ++$count;
                 } catch (Horde_Exception $e) {
                     $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
                 }
             }
         }
         $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:40,代码来源:VcardImport.php


示例5: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $ob = new Horde_Script_File_JsDir('dialog.js', 'horde');
     $ob->jsvars = array('HordeDialog.cancel_text' => Horde_Core_Translation::t("Cancel"), 'HordeDialog.ok_text' => Horde_Core_Translation::t("OK"));
     $this->_files[] = $ob;
     $this->_files[] = new Horde_Script_File_JsDir('redbox.js', 'horde');
     $this->_files[] = new Horde_Script_File_JsDir('scriptaculous/effects.js', 'horde');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:Dialog.php


示例6: _renderVarInput_tableset

    protected function _renderVarInput_tableset($form, &$var, &$vars)
    {
        $header = $var->type->getHeader();
        $name = $var->getVarName();
        $values = $var->getValues();
        $form_name = $form->getName();
        $var_name = $var->getVarName() . '[]';
        $checkedValues = $var->getValue($vars);
        $actions = $this->_getActionScripts($form, $var);
        $function_name = 'select' . $form_name . $var->getVarName();
        $enable = Horde_Core_Translation::t("Select all");
        $disable = Horde_Core_Translation::t("Select none");
        $invert = Horde_Core_Translation::t("Invert selection");
        $page = $GLOBALS['injector']->getInstance('Horde_PageOutput');
        $page->addScriptFile('tables.js', 'horde');
        $page->addInlineScript(sprintf('
function %s()
{
    for (var i = 0; i < document.%s.elements.length; i++) {
        f = document.%s$2.elements[i];
        if (f.name != \'%s$3\') {
            continue;
        }
        if (arguments.length) {
            f.checked = arguments[0];
        } else {
            f.checked = !f.checked;
        }
    }
}', $function_name, $form_name, $var_name));
        $html = <<<EOT
<a href="#" onclick="{$function_name}(true); return false;">{$enable}</a>,
<a href="#" onclick="{$function_name}(false); return false;">{$disable}</a>,
<a href="#" onclick="{$function_name}(); return false;">{$invert}</a>
<table style="width: 100%" class="sortable striped" id="tableset_' . {$name} . '"><thead><tr>
<th>&nbsp;</th>
EOT;
        foreach ($header as $col_title) {
            $html .= sprintf('<th class="leftAlign">%s</th>', $col_title);
        }
        $html .= '</tr></thead>';
        if (!is_array($checkedValues)) {
            $checkedValues = array();
        }
        $i = 0;
        foreach ($values as $value => $displays) {
            $checked = in_array($value, $checkedValues) ? ' checked="checked"' : '';
            $html .= '<tr>' . sprintf('<td style="text-align: center"><input id="%s[]" type="checkbox" name="%s[]" value="%s"%s%s /></td>', $name, $name, $value, $checked, $actions);
            foreach ($displays as $col) {
                $html .= sprintf('<td>&nbsp;%s</td>', $col);
            }
            $html .= '</tr>' . "\n";
            $i++;
        }
        $html .= '</table>' . '<a href="#" onclick="' . $function_name . '(true); return false;">' . $enable . '</a>, ' . '<a href="#" onclick="' . $function_name . '(false); return false;">' . $disable . '</a>, ' . '<a href="#" onclick="' . $function_name . '(); return false;">' . $invert . '</a>';
        return $html;
    }
开发者ID:jubinpatel,项目名称:horde,代码行数:57,代码来源:TablesetHtml.php


示例7: getQueuedSignup

 /**
  * Get a user's queued signup information.
  *
  * @param string $username  The username to retrieve the queued info for.
  *
  * @return Horde_Core_Auth_Signup_SqlObject $signup  The object for the
  *                                                   requested signup.
  * @throws Horde_Exception
  * @throws Horde_Db_Exception
  */
 public function getQueuedSignup($username)
 {
     $query = 'SELECT * FROM ' . $this->_params['table'] . ' WHERE user_name = ?';
     $values = array($username);
     $result = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')->create('horde', 'signup')->selectOne($query, $values);
     if (empty($result)) {
         throw new Horde_Exception(sprintf(Horde_Core_Translation::t("User \"%s\" does not exist."), $username));
     }
     $object = new Horde_Core_Auth_Signup_SqlObject($result['user_name']);
     $object->setData($result);
     return $object;
 }
开发者ID:horde,项目名称:horde,代码行数:22,代码来源:Sql.php


示例8: parseEmailAddress

 /**
  * Parses a valid email address out of a complete address string.
  *
  * Variables used:
  *   - email: (string) An email address.
  *
  * @return object  Object with the following properties:
  *   - email: (string) The parsed email address.
  *
  * @throws Horde_Exception
  * @throws Horde_Mail_Exception
  */
 public function parseEmailAddress()
 {
     $ob = new Horde_Mail_Rfc822_Address($this->vars->email);
     if (is_null($ob->mailbox)) {
         throw new Horde_Exception(Horde_Core_Translation::t("No valid email address found"));
     }
     if (is_null($ob->host) && !is_null($this->defaultDomain)) {
         $ob->host = $this->defaultDomain;
     }
     $ret = new stdClass();
     $ret->email = $ob->bare_address;
     return $ret;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:25,代码来源:Email.php


示例9: create

 public function create(Horde_Injector $injector)
 {
     global $conf;
     if (empty($conf['twitter']['key']) || empty($conf['twitter']['secret'])) {
         throw new Horde_Service_Twitter_Exception(Horde_Core_Translation::t("No OAuth Key or Secret found for the Twitter API"));
     }
     /* Keys - these are obtained when registering for the service */
     $consumer_key = $conf['twitter']['key'];
     $consumer_secret = $conf['twitter']['secret'];
     /* Parameters required for the Horde_Oauth_Consumer */
     $params = array('key' => $consumer_key, 'secret' => $consumer_secret, 'requestTokenUrl' => Horde_Service_Twitter::REQUEST_TOKEN_URL, 'authorizeTokenUrl' => Horde_Service_Twitter::USER_AUTHORIZE_URL, 'accessTokenUrl' => Horde_Service_Twitter::ACCESS_TOKEN_URL, 'signatureMethod' => new Horde_Oauth_SignatureMethod_HmacSha1(), 'callbackUrl' => $GLOBALS['registry']->getServiceLink('twitter'));
     /* Create the Consumer */
     $auth = new Horde_Service_Twitter_Auth_Oauth(new Horde_Oauth_Consumer($params));
     $request = new Horde_Service_Twitter_Request_Oauth($injector->getInstance('Horde_Controller_Request'));
     $twitter = new Horde_Service_Twitter($auth, $request);
     //$twitter->setCache($injector->getInstance('Horde_Cache'));
     $twitter->setLogger($injector->getInstance('Horde_Log_Logger'));
     $twitter->setHttpClient($injector->getInstance('Horde_Core_Factory_HttpClient')->create());
     return $twitter;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:20,代码来源:Twitter.php


示例10: smartmobileHeader

 /**
  * Output the title bar.
  *
  * @param array $params  A list of parameters:
  *   - backlink: (mixed) Show backlink. If an array, first is URL to link
  *               to, second is label. If true, shows a basic Back link.
  *   - logout: (boolean) If true, show logout link.
  *   - portal: (boolean) If true, show portal link.
  *   - taptoggle: (boolean) Enable tap-toggle?
  *   - title: (string) If given, used as the title.
  *
  * @return string  Generated HTML code.
  */
 public function smartmobileHeader(array $params = array())
 {
     global $registry;
     $out = '<div data-position="fixed" data-role="header" data-tap-toggle="' . (empty($params['taptoggle']) ? 'false' : 'true') . '">';
     if (!empty($params['backlink'])) {
         if (is_array($params['backlink'])) {
             $out .= '<a class="smartmobile-back ui-btn-left" href="' . $params['backlink'][0] . '" data-icon="arrow-l" data-direction="reverse">' . $params['backlink'][1] . '</a>';
         } else {
             $out .= '<a class="smartmobile-back ui-btn-left" href="#" ' . 'data-icon="arrow-l" data-rel="back">' . Horde_Core_Translation::t("Back") . '</a>';
         }
     }
     if (!empty($params['portal']) && ($portal = $registry->getServiceLink('portal', 'horde')->setRaw(false))) {
         $out .= '<a class="smartmobile-portal ui-btn-left" ' . 'data-ajax="false" href="' . $portal . '">' . Horde_Core_Translation::t("Applications") . '</a>';
     }
     if (isset($params['title']) && strlen($params['title'])) {
         $out .= '<h1 class="smartmobile-title">' . $params['title'] . '</h1>';
     }
     if (!empty($params['logout']) && $registry->showService('logout') && ($logout = $registry->getServiceLink('logout')->setRaw(false))) {
         $out .= '<a class="smartmobile-logout ui-btn-right" href="' . $logout . '" data-ajax="false" data-theme="e" data-icon="delete">' . Horde_Core_Translation::t("Log out") . '</a>';
     }
     return $out . '</div>';
 }
开发者ID:horde,项目名称:horde,代码行数:35,代码来源:Helper.php


示例11: _attach

 /**
  */
 protected function _attach($init)
 {
     global $page_output;
     if ($init) {
         $page_output->addScriptFile('scriptaculous/effects.js', 'horde');
         $page_output->addScriptFile('inplaceeditor.js', 'horde');
         $value_url = $this->getImpleUrl()->add(array('id' => $this->_params['dataid'], 'input' => 'value'))->setRaw(true);
         $load_url = $value_url->copy()->add(array('action' => 'load'))->setRaw(true);
         $config = new stdClass();
         $config->config = array('cancelClassName' => '', 'cancelText' => Horde_Core_Translation::t("Cancel"), 'emptyText' => Horde_Core_Translation::t("Click to add caption..."), 'okText' => Horde_Core_Translation::t("Ok"));
         $config->ids = new stdClass();
         $config->ids->{$this->getDomId()} = array('load_url' => (string) $load_url, 'rows' => $this->_params['rows'], 'value_url' => (string) $value_url);
         if (!empty($this->_params['width'])) {
             $config->ids->{$this->getDomId()}['width'] = $this->_params['width'];
         }
         $page_output->addInlineJsVars(array('HordeImple.InPlaceEditor' . $this->getDomId() => $config));
         $page_output->addInlineScript(array('$H(HordeImple.InPlaceEditor' . $this->getDomId() . '.ids).each(function(pair) {
                  new InPlaceEditor(pair.key, pair.value.value_url, Object.extend(HordeImple.InPlaceEditor' . $this->getDomId() . '.config, {
                      htmlResponse: false,
                      callback: function(form, value) {
                          return "value=" + encodeURIComponent(value);
                      },
                      onComplete: function(ipe, opts) {
                         if (opts) {
                             $("' . $this->getDomId() . '").update(opts.responseJSON)
                         }
                          ipe.checkEmpty()
                      },
                      loadTextURL: pair.value.load_url,
                      rows: pair.value.rows,
                      autoWidth: true
                  }));
              })'), true);
     }
     return false;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:38,代码来源:InPlaceEditor.php


示例12: fatal

    /**
     * Aborts with a fatal error, displaying debug information to the user.
     *
     * @param mixed $error  Either a string or an object with a getMessage()
     *                      method (e.g. PEAR_Error, Exception).
     */
    public static function fatal($error)
    {
        global $registry;
        if (is_object($error)) {
            switch (get_class($error)) {
                case 'Horde_Exception_AuthenticationFailure':
                    $auth_app = !$registry->clearAuthApp($error->application);
                    if ($auth_app && $registry->isAuthenticated(array('app' => $error->application, 'notransparent' => true))) {
                        break;
                    }
                    try {
                        Horde::log($error, 'NOTICE');
                    } catch (Exception $e) {
                    }
                    if (Horde_Cli::runningFromCLI()) {
                        $cli = new Horde_Cli();
                        $cli->fatal($error);
                    }
                    $params = array();
                    if ($registry->getAuth()) {
                        $params['app'] = $error->application;
                    }
                    switch ($error->getCode()) {
                        case Horde_Auth::REASON_MESSAGE:
                            $params['msg'] = $error->getMessage();
                            $params['reason'] = $error->getCode();
                            break;
                    }
                    $logout_url = $registry->getLogoutUrl($params);
                    /* Clear authentication here. Otherwise, there might be
                     * issues on the login page since we would otherwise need
                     * to do session token checking (which might not be
                     * available, so logout won't happen, etc...) */
                    if ($auth_app && array_key_exists('app', $params)) {
                        $registry->clearAuth();
                    }
                    $logout_url->redirect();
            }
        }
        try {
            Horde::log($error, 'EMERG');
        } catch (Exception $e) {
        }
        try {
            $cli = Horde_Cli::runningFromCLI();
        } catch (Exception $e) {
            die($e);
        }
        if ($cli) {
            $cli = new Horde_Cli();
            $cli->fatal($error);
        }
        if (!headers_sent()) {
            header('Content-type: text/html; charset=UTF-8');
        }
        echo <<<HTML
<html>
<head><title>Horde :: Fatal Error</title></head>
<body style="background:#fff; color:#000">
HTML;
        ob_start();
        try {
            $admin = isset($registry) && $registry->isAdmin();
            echo '<h1>' . Horde_Core_Translation::t("A fatal error has occurred") . '</h1>';
            if (is_object($error) && method_exists($error, 'getMessage')) {
                echo '<h3>' . htmlspecialchars($error->getMessage()) . '</h3>';
            } elseif (is_string($error)) {
                echo '<h3>' . htmlspecialchars($error) . '</h3>';
            }
            if ($admin) {
                $trace = $error instanceof Exception ? $error : debug_backtrace();
                echo '<div id="backtrace"><pre>' . strval(new Horde_Support_Backtrace($trace)) . '</pre></div>';
                if (is_object($error)) {
                    echo '<h3>' . Horde_Core_Translation::t("Details") . '</h3>';
                    echo '<h4>' . Horde_Core_Translation::t("The full error message is logged in Horde's log file, and is shown below only to administrators. Non-administrative users will not see error details.") . '</h4>';
                    ob_flush();
                    flush();
                    echo '<div id="details"><pre>' . htmlspecialchars(print_r($error, true)) . '</pre></div>';
                }
            } else {
                echo '<h3>' . Horde_Core_Translation::t("Details have been logged for the administrator.") . '</h3>';
            }
        } catch (Exception $e) {
            die($e);
        }
        ob_end_flush();
        echo '</body></html>';
        exit(1);
    }
开发者ID:horde,项目名称:horde,代码行数:95,代码来源:ErrorHandler.php


示例13: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $ob = new Horde_Script_File_JsDir('popup.js', 'horde');
     $ob->jsvars = array('HordePopup.popup_block_text' => Horde_Core_Translation::t("A popup window could not be opened. Your browser may be blocking popups."));
     $this->_files[] = $ob;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:9,代码来源:Popup.php


示例14: writePHPConfig

 /**
  * Generates and writes the content of the application's configuration
  * file.
  *
  * @param Horde_Variables $formvars  The processed configuration form
  *                                   data.
  * @param string $php                The content of the generated
  *                                   configuration file.
  *
  * @return boolean  True if the configuration file could be written
  *                  immediately to the file system.
  */
 public function writePHPConfig($formvars, &$php = null)
 {
     $php = $this->generatePHPConfig($formvars);
     $path = $GLOBALS['registry']->get('fileroot', $this->_app) . '/config';
     $configFile = $this->configFile();
     if (file_exists($configFile)) {
         if (@copy($configFile, $path . '/conf.bak.php')) {
             $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully saved the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.success');
         } else {
             $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Could not save the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.warning');
         }
     }
     if ($fp = @fopen($configFile, 'w')) {
         /* Can write, so output to file. */
         fwrite($fp, $php);
         fclose($fp);
         $GLOBALS['registry']->rebuild();
         $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully wrote %s"), Horde_Util::realPath($configFile)), 'horde.success');
         return true;
     }
     /* Cannot write. Save to session. */
     $GLOBALS['session']->set('horde', 'config/' . $this->_app, $php);
     return false;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:36,代码来源:Config.php


示例15: header

 /**
  * Output the page header.
  *
  * @param array $opts  Options:
  *   - body_class: (string)
  *   - body_id: (string)
  *   - html_id: (string)
  *   - smartmobileinit: (string) (@deprecated; use $this->smartmobileInit
  *                      instead)
  *   - stylesheet_opts: (array)
  *   - title: (string)
  *   - view: (integer)
  */
 public function header(array $opts = array())
 {
     global $injector, $language, $registry, $session;
     $view = new Horde_View(array('templatePath' => $registry->get('templates', 'horde') . '/common'));
     $view->outputJs = !$this->deferScripts;
     $view->stylesheetOpts = array();
     $this->_view = empty($opts['view']) ? $registry->hasView($registry->getView()) ? $registry->getView() : Horde_Registry::VIEW_BASIC : $opts['view'];
     if ($session->regenerate_due) {
         $session->regenerate();
     }
     switch ($this->_view) {
         case $registry::VIEW_BASIC:
             $this->_addBasicScripts();
             break;
         case $registry::VIEW_DYNAMIC:
             $this->ajax = true;
             $this->growler = true;
             $this->_addBasicScripts();
             $this->addScriptPackage('Horde_Core_Script_Package_Popup');
             break;
         case $registry::VIEW_MINIMAL:
             $view->stylesheetOpts['subonly'] = true;
             $view->minimalView = true;
             $this->sidebar = $this->topbar = false;
             break;
         case $registry::VIEW_SMARTMOBILE:
             $smobile_files = array($this->debug ? 'jquery.mobile/jquery.js' : 'jquery.mobile/jquery.min.js', 'growler-jquery.js', 'horde-jquery.js', 'smartmobile.js', 'horde-jquery-init.js', $this->debug ? 'jquery.mobile/jquery.mobile.js' : 'jquery.mobile/jquery.mobile.min.js');
             foreach ($smobile_files as $val) {
                 $ob = $this->addScriptFile(new Horde_Script_File_JsFramework($val, 'horde'));
                 $ob->cache = 'package_smartmobile';
             }
             $this->smartmobileInit = array_merge(array('$.mobile.page.prototype.options.backBtnText = "' . Horde_Core_Translation::t("Back") . '";', '$.mobile.dialog.prototype.options.closeBtnText = "' . Horde_Core_Translation::t("Close") . '";', '$.mobile.loader.prototype.options.text = "' . Horde_Core_Translation::t("loading") . '";'), isset($opts['smartmobileinit']) ? $opts['smartmobileinit'] : array(), $this->smartmobileInit);
             $this->addInlineJsVars(array('HordeMobile.conf' => array('ajax_url' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'logout_url' => strval($registry->getServiceLink('logout')), 'sid' => SID, 'token' => $session->getToken())));
             $this->addMetaTag('viewport', 'width=device-width, initial-scale=1', false);
             $view->stylesheetOpts['subonly'] = true;
             $this->addStylesheet($registry->get('jsfs', 'horde') . '/jquery.mobile/jquery.mobile.min.css', $registry->get('jsuri', 'horde') . '/jquery.mobile/jquery.mobile.min.css');
             $view->smartmobileView = true;
             // Force JS to load at top of page, so we don't see flicker when
             // mobile styles are applied.
             $view->outputJs = true;
             $this->sidebar = $this->topbar = false;
             break;
     }
     $view->stylesheetOpts['sub'] = Horde_Themes::viewDir($this->_view);
     if ($this->ajax || $this->growler) {
         $this->addScriptFile(new Horde_Script_File_JsFramework('hordecore.js', 'horde'));
         /* Configuration used in core javascript files. */
         $js_conf = array_filter(array('URI_AJAX' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'URI_DLOAD' => strval($registry->getServiceLink('download', $registry->getApp())), 'URI_LOGOUT' => strval($registry->getServiceLink('logout')), 'URI_SNOOZE' => strval(Horde::url($registry->get('webroot', 'horde') . '/services/snooze.php', true, -1)), 'SID' => SID, 'TOKEN' => $session->getToken(), 'growler_log' => $this->topbar, 'popup_height' => 610, 'popup_width' => 820));
         /* Gettext strings used in core javascript files. */
         $js_text = array('ajax_error' => Horde_Core_Translation::t("Error when communicating with the server."), 'ajax_recover' => Horde_Core_Translation::t("The connection to the server has been restored."), 'ajax_timeout' => Horde_Core_Translation::t("There has been no contact with the server for several minutes. The server may be temporarily unavailable or network problems may be interrupting your session. You will not see any updates until the connection is restored."), 'snooze' => sprintf(Horde_Core_Translation::t("You can snooze it for %s or %s dismiss %s it entirely"), '#{time}', '#{dismiss_start}', '#{dismiss_end}'), 'snooze_select' => array('0' => Horde_Core_Translation::t("Select..."), '5' => Horde_Core_Translation::t("5 minutes"), '15' => Horde_Core_Translation::t("15 minutes"), '60' => Horde_Core_Translation::t("1 hour"), '360' => Horde_Core_Translation::t("6 hours"), '1440' => Horde_Core_Translation::t("1 day")), 'dismissed' => Horde_Core_Translation::t("The alarm was dismissed."));
         if ($this->topbar) {
             $js_text['growlerclear'] = Horde_Core_Translation::t("Clear All");
             $js_text['growlerinfo'] = Horde_Core_Translation::t("This is the notification log.");
             $js_text['growlernoalerts'] = Horde_Core_Translation::t("No Alerts");
         }
         $this->addInlineJsVars(array('HordeCore.conf' => $js_conf, 'HordeCore.text' => $js_text), array('top' => true));
     }
     if ($this->growler) {
         $this->addScriptFile('growler.js', 'horde');
         $this->addScriptFile('scriptaculous/effects.js', 'horde');
         $this->addScriptFile('scriptaculous/sound.js', 'horde');
     }
     if (isset($opts['stylesheet_opts'])) {
         $view->stylesheetOpts = array_merge($view->stylesheetOpts, $opts['stylesheet_opts']);
     }
     $html = '';
     if (isset($language)) {
         $html .= ' lang="' . htmlspecialchars(strtr($language, '_', '-')) . '"';
     }
     if (isset($opts['html_id'])) {
         $html .= ' id="' . htmlspecialchars($opts['html_id']) . '"';
     }
     $view->htmlAttr = $html;
     $body = '';
     if (isset($opts['body_class'])) {
         $body .= ' class="' . htmlspecialchars($opts['body_class']) . '"';
     }
     if (isset($opts['body_id'])) {
         $body .= ' id="' . htmlspecialchars($opts['body_id']) . '"';
     }
     $view->bodyAttr = $body;
     $page_title = $registry->get('name');
     if (isset($opts['title'])) {
         $page_title .= ' :: ' . $opts['title'];
     }
     $view->pageTitle = htmlspecialchars($page_title);
     $view->pageOutput = $this;
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:PageOutput.php


示例16: toHtml

 /**
  * Render the current layout as HTML.
  *
  * @return string  HTML layout.
  */
 public function toHtml()
 {
     global $page_output;
     $tplDir = $GLOBALS['registry']->get('templates', 'horde');
     $interval = $GLOBALS['prefs']->getValue('summary_refresh_time');
     $page_output->ajax = $page_output->growler = true;
     $page_output->addScriptFile('hordeblocks.js', 'horde');
     $html = '<table id="portal" class="nopadding" cellspacing="8" width="100%">';
     $bc = $GLOBALS['injector']->getInstance('Horde_Core_Factory_BlockCollection')->create();
     $covered = array();
     $js = array();
     foreach ($this->_layout as $row_num => $row) {
         $width = floor(100 / count($row));
         $html .= '<tr>';
         foreach ($row as $col_num => $item) {
             if (isset($covered[$row_num]) && isset($covered[$row_num][$col_num])) {
                 continue;
             }
             if (is_array($item)) {
                 $block_id = 'block_' . $row_num . '_' . $col_num;
                 $this->_applications[$item['app']] = $item['app'];
                 $rowspan = $colspan = 1;
                 try {
                     $block = $bc->getBlock($item['app'], $item['params']['type2'], $item['params']['params']);
                     if (!$block->enabled) {
                         throw new Horde_Exception('Block not enabled.');
                     }
                     $rowspan = $item['height'];
                     $colspan = $item['width'];
                     for ($i = 0; $i < $item['height']; $i++) {
                         if (!isset($covered[$row_num + $i])) {
                             $covered[$row_num + $i] = array();
                         }
                         for ($j = 0; $j < $item['width']; $j++) {
                             $covered[$row_num + $i][$col_num + $j] = true;
                         }
                     }
                     if ($block instanceof Horde_Core_Block) {
                         $content = $block->getContent();
                         $header = $block->getTitle();
                         ob_start();
                         include $tplDir . '/portal/block.inc';
                         $html .= ob_get_clean();
                         if ($block->updateable && $GLOBALS['browser']->hasFeature('xmlhttpreq')) {
                             $refresh_time = isset($item['params']['params']['_refresh_time']) ? $item['params']['params']['_refresh_time'] : $interval;
                             if (!empty($refresh_time)) {
                                 $js[] = 'HordeBlocks.addUpdateableBlock(' . '"' . $block->getApp() . '", "' . get_class($block) . '", "' . $block_id . '", ' . intval($refresh_time * 1000) . ')';
                             }
                         }
                     } else {
                         $html .= '<td width="' . $width * $colspan . '%">&nbsp;</td>';
                     }
                 } catch (Horde_Exception $e) {
                     $header = Horde_Core_Translation::t("Error");
                     $content = $e->getMessage();
                     ob_start();
                     include $tplDir . '/portal/block.inc';
                     $html .= ob_get_clean();
                 }
             } else {
                 $html .= '<td width="' . $width . '%">&nbsp;</td>';
             }
         }
         $html .= '</tr>';
     }
     $html .= '</table>';
     $page_output->addInlineScript($js, true);
     return $html;
 }
开发者ID:Gomez,项目名称:horde,代码行数:74,代码来源:View.php


示例17: getTree

 /**
  * Generates the topbar tree object.
  *
  * @return Horde_Tree_Renderer_Base  The topbar tree object.
  */
 public function getTree()
 {
     if ($this->_generated) {
         return $this->_tree;
     }
     global $injector, $prefs, $registry;
     $current = $registry->getApp();
     $isAdmin = $registry->isAdmin();
     $menu = array();
     foreach ($registry->listApps(array('active', 'admin', 'noadmin', 'heading', 'link', 'notoolbar', 'topbar'), true, null) as $app => $params) {
         /* Check if the current user has permisson to see this application,
          * and if the application is active. Headings are visible to
          * everyone (but get filtered out later if they have no
          * children). Administrators always see all applications except
          * those marked 'inactive'. */
         if ($app != 'horde' && (in_array($params['status'], array('heading', 'link')) || in_array($params['status'], array('active', 'admin', 'noadmin', 'topbar')) && !($isAdmin && $params['status'] == 'noadmin') && $registry->hasPermission(!empty($params['app']) ? $params['app'] : $app, Horde_Perms::SHOW))) {
             $menu[$app] = $params;
         }
     }
     do {
         $children = array();
         foreach ($menu as $params) {
             if (isset($params['menu_parent'])) {
                 $children[$params['menu_parent']] = true;
             }
         }
         $found = false;
         foreach (array_keys($menu) as $key) {
             if ($menu[$key]['status'] == 'heading' && empty($children[$key])) {
                 unset($menu[$key]);
                 $found = true;
             }
         }
     } while ($found);
     /* Add the administration menu if the user is an admin or has any
      * admin permissions. */
     $perms = $injector->getInstance('Horde_Perms');
     $admin_item_count = 0;
     try {
         foreach ($registry->callByPackage('horde', 'admin_list') as $method => $val) {
             if ($isAdmin || $perms->hasPermission('horde:administration:' . $method, $registry->getAuth(), Horde_Perms::SHOW)) {
                 ++$admin_item_count;
                 $menu['administration_' . $method] = array('icon' => $val['icon'], 'menu_parent' => 'administration', 'name' => Horde::stripAccessKey($val['name']), 'status' => 'active', 'url' => Horde::url($registry->applicationWebPath($val['link'], 'horde')));
             }
         }
     } catch (Horde_Exception $e) {
     }
     if ($admin_item_count) {
         $menu['administration'] = array('name' => Horde_Core_Translation::t("Administration"), 'status' => 'heading', 'menu_parent' => 'settings');
     }
     $menu['settings'] = array('class' => 'horde-settings horde-icon-settings', 'name' => '', 'noarrow' => true, 'status' => 'active');
     /* Add preferences. */
     if ($registry->showService('prefs') && !$prefs instanceof Horde_Prefs_Session) {
         $menu['prefs'] = array('icon' => Horde_Themes::img('prefs.png'), 'menu_parent' => 'settings', 'name' => Horde_Core_Translation::t("Preferences"), 'status' => 'active', 'url' => $registry->getServiceLink('prefs', $current));
         /* Get a list of configurable applications. */
         $prefs_apps = $registry->listApps(array('active', 'admin'), true, Horde_Perms::READ);
         if (!empty($prefs_apps['horde'])) {
             $menu['prefs_' . 'horde'] = array('icon' => $registry->get('icon', 'horde'), 'menu_parent' => 'prefs', 'name' => Horde_Core_Translation::t("Global Preferences"), 'status' => 'active', 'url' => $registry->getServiceLink('prefs', 'horde'));
             unset($prefs_apps['horde']);
         }
         uasort($prefs_apps, array($this, '_sortByName'));
         foreach ($prefs_apps as $app => $params) {
             $menu['prefs_' . $app] = array('icon' => $registry->get('icon', $app), 'menu_parent' => 'prefs', 'name' => $params['name'], 'status' => 'active', 'url' => $registry->getServiceLink('prefs', $app));
         }
     }
     /* Add notification log. */
     $menu['growlerlog'] = array('icon' => 'info.png', 'menu_parent' => 'settings', 'name' => Horde_Core_Translation::t("Toggle Alerts Log"), 'status' => 'active', 'url' => 'javascript:void(HordeCore.Growler.toggleLog());');
     /* Add problem link. */
     if ($registry->showService('problem') && ($problem_link = $registry->getServiceLink('problem', $current))) {
         $menu['problem_' . $current] = array('icon' => 'problem.png', 'menu_parent' => 'settings', 'name' => Horde_Core_Translation::t("Problem"), 'status' => 'active', 'url' => $problem_link);
     }
     /* Add help link. */
     if ($registry->showService('help') && ($help_link = $registry->getServiceLink('help', $current))) {
         $menu['help_' . $current] = array('icon' => 'help_index.png', 'menu_parent' => 'settings', 'name' => Horde_Core_Translation::t("Help"), 'onclick' => Horde::popupJs($help_link, array('urlencode' => true)) . 'return fa 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Date类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Core_Block类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap