當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Context::getI18n方法代碼示例

本文整理匯總了PHP中Context::getI18n方法的典型用法代碼示例。如果您正苦於以下問題:PHP Context::getI18n方法的具體用法?PHP Context::getI18n怎麽用?PHP Context::getI18n使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Context的用法示例。


在下文中一共展示了Context::getI18n方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: forward403unless

 /**
  * Forward the user with HTTP status code 403 and an (optional) message
  * based on a boolean check
  *
  * @param boolean $condition
  * @param string $message [optional] The message
  */
 public function forward403unless($condition, $message = null)
 {
     if (!$condition) {
         $message = $message === null ? Context::getI18n()->__("You are not allowed to access this page") : htmlentities($message);
         if (Context::getUser()->isGuest()) {
             Context::setMessage('login_message_err', $message);
             Context::setMessage('login_force_redirect', true);
             Context::setMessage('login_referer', Context::getRouting()->generate(Context::getRouting()->getCurrentRouteName(), Context::getRequest()->getParameters()));
             $this->forward(Context::getRouting()->generate('login_page'), 403);
         } else {
             $this->getResponse()->setHttpStatus(403);
             $this->getResponse()->setTemplate('main/forbidden');
         }
     }
 }
開發者ID:RTechSoft,項目名稱:thebuggenie,代碼行數:22,代碼來源:Action.php

示例2: getI18n

 /**
  * Return the i18n object
  *
  * @return \thebuggenie\core\framework\I18n
  */
 protected function getI18n()
 {
     return Context::getI18n();
 }
開發者ID:founderio,項目名稱:thebuggenie,代碼行數:9,代碼來源:ActionComponent.php

示例3: getPredefinedBreadcrumbLinks

 public function getPredefinedBreadcrumbLinks($type, $project = null)
 {
     $i18n = Context::getI18n();
     $links = array();
     switch ($type) {
         case 'main_links':
             $links[] = array('url' => Context::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage'));
             $links[] = array('url' => Context::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard'));
             $links[] = array('title' => $i18n->__('Issues'));
             if (Context::getUser()->hasPageAccess('teamlist')) {
                 $links[] = array('url' => make_url('team_list'), 'title' => $i18n->__('Teams'));
             }
             if (Context::getUser()->hasPageAccess('clientlist')) {
                 $links[] = array('url' => make_url('client_list'), 'title' => $i18n->__('Clients'));
             }
             $links = Event::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList();
             if (Context::getUser()->canAccessConfigurationPage()) {
                 $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure %sitename', array('%sitename' => Settings::getSiteHeaderName())));
             }
             $links[] = array('url' => Context::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename', array('%sitename' => Settings::getSiteHeaderName())));
             $links[] = array('url' => Context::getRouting()->generate('account'), 'title' => $i18n->__('Account details'));
             $root_projects = array_merge(\thebuggenie\core\entities\Project::getAllRootProjects(true), \thebuggenie\core\entities\Project::getAllRootProjects(false));
             $first = true;
             foreach ($root_projects as $project) {
                 if (!$project->hasAccess()) {
                     continue;
                 }
                 if ($first) {
                     $first = false;
                     $links[] = array('separator' => true);
                 }
                 $links[] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $project->getName());
             }
             break;
         case 'project_summary':
             $links['project_dashboard'] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard'));
             $links['project_releases'] = array('url' => Context::getRouting()->generate('project_releases', array('project_key' => $project->getKey())), 'title' => $i18n->__('Releases'));
             $links['project_roadmap'] = array('url' => Context::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap'));
             $links['project_team'] = array('url' => Context::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview'));
             $links['project_statistics'] = array('url' => Context::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics'));
             $links['project_timeline'] = array('url' => Context::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline'));
             $links['project_issues'] = array('url' => Context::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues'));
             $links = Event::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList();
             $links['project_release_center'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Release center'));
             $links['project_settings'] = array('url' => Context::getRouting()->generate('project_settings', array('project_key' => $project->getKey())), 'title' => $i18n->__('Settings'));
             break;
         case 'client_list':
             foreach (\thebuggenie\core\entities\Client::getAll() as $client) {
                 if ($client->hasAccess()) {
                     $links[] = array('url' => Context::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName());
                 }
             }
             break;
         case 'team_list':
             foreach (\thebuggenie\core\entities\Team::getAll() as $team) {
                 if ($team->hasAccess()) {
                     $links[] = array('url' => Context::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName());
                 }
             }
             break;
         case 'configure':
             $config_sections = Settings::getConfigSections($i18n);
             foreach ($config_sections as $key => $sections) {
                 foreach ($sections as $section) {
                     if ($key == Settings::CONFIGURATION_SECTION_MODULES) {
                         $url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']);
                         $links[] = array('url' => $url, 'title' => $section['description']);
                     } else {
                         $links[] = array('url' => make_url($section['route']), 'title' => $section['description']);
                     }
                 }
             }
             break;
     }
     return $links;
 }
開發者ID:nrensen,項目名稱:thebuggenie,代碼行數:76,代碼來源:Response.php

示例4: getPredefinedBreadcrumbLinks

 public function getPredefinedBreadcrumbLinks($type, $project = null)
 {
     $i18n = Context::getI18n();
     $links = array();
     switch ($type) {
         case 'main_links':
             $links[] = array('url' => Context::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage'));
             $links[] = array('url' => Context::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard'));
             $links[] = array('title' => $i18n->__('Issues'));
             $links[] = array('title' => $i18n->__('Teams'));
             $links[] = array('title' => $i18n->__('Clients'));
             $links = Event::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList();
             if (Context::getUser()->canAccessConfigurationPage()) {
                 $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure %sitename', array('%sitename' => Settings::getSiteHeaderName())));
             }
             $links[] = array('url' => Context::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename', array('%sitename' => Settings::getSiteHeaderName())));
             $links[] = array('url' => Context::getRouting()->generate('account'), 'title' => $i18n->__('Account details'));
             break;
         case 'project_summary':
             $links['project_dashboard'] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard'));
             $links['project_releases'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Releases'));
             $links['project_roadmap'] = array('url' => Context::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap'));
             $links['project_team'] = array('url' => Context::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview'));
             $links['project_statistics'] = array('url' => Context::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics'));
             $links['project_timeline'] = array('url' => Context::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline'));
             $links['project_issues'] = array('url' => Context::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues'));
             $links = Event::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList();
             $links['project_release_center'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Release center'));
             $links['project_settings'] = array('url' => Context::getRouting()->generate('project_settings', array('project_key' => $project->getKey())), 'title' => $i18n->__('Settings'));
             break;
         case 'client_list':
             foreach (\thebuggenie\core\entities\Client::getAll() as $client) {
                 if ($client->hasAccess()) {
                     $links[] = array('url' => Context::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName());
                 }
             }
             break;
         case 'team_list':
             foreach (\thebuggenie\core\entities\Team::getAll() as $team) {
                 if ($team->hasAccess()) {
                     $links[] = array('url' => Context::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName());
                 }
             }
             break;
     }
     return $links;
 }
開發者ID:RTechSoft,項目名稱:thebuggenie,代碼行數:47,代碼來源:Response.php

示例5: forward403unless

 /**
  * Forward the user with HTTP status code 403 and an (optional) message
  * based on a boolean check
  *
  * @param boolean $condition
  * @param string $message [optional] The message
  */
 public function forward403unless($condition, $message = null)
 {
     if (!$condition) {
         $message = $message === null ? Context::getI18n()->__("You are either not allowed to access this page or don't have access to perform this action") : $message;
         if (Context::getUser()->isGuest()) {
             Context::setMessage('login_message_err', htmlentities($message));
             Context::setMessage('login_force_redirect', true);
             Context::setMessage('login_referer', Context::getRouting()->generate(Context::getRouting()->getCurrentRouteName(), Context::getRequest()->getParameters()));
             $this->forward(Context::getRouting()->generate('login_page'), Response::HTTP_STATUS_FORBIDDEN);
         } elseif (Context::getRequest()->isAjaxCall()) {
             $this->getResponse()->setHttpStatus(Response::HTTP_STATUS_FORBIDDEN);
             throw new \Exception($message);
         } else {
             throw new \thebuggenie\core\framework\exceptions\ActionNotAllowedException($message);
         }
     }
 }
開發者ID:founderio,項目名稱:thebuggenie,代碼行數:24,代碼來源:Action.php


注:本文中的Context::getI18n方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。