当前位置: 首页>>代码示例>>PHP>>正文


PHP Context::getRouting方法代码示例

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


在下文中一共展示了Context::getRouting方法的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: getRouting

 /**
  * Return the routing object
  *
  * @return \thebuggenie\core\framework\Routing
  */
 protected function getRouting()
 {
     return Context::getRouting();
 }
开发者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::getRouting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。