本文整理汇总了PHP中TBGContext::getRouting方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::getRouting方法的具体用法?PHP TBGContext::getRouting怎么用?PHP TBGContext::getRouting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::getRouting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: componentPagination
public function componentPagination()
{
$this->currentpage = ceil($this->offset / $this->ipp) + 1;
$this->pagecount = ceil($this->resultcount / $this->ipp);
$parameters = array();
foreach ($this->filters as $key => $filter) {
if (is_array($filter)) {
foreach ($filter as $subkey => $subfilter) {
if (is_array($subfilter)) {
foreach ($subfilter as $subsubkey => $subsubfilter) {
$parameters[] = "filters[{$key}][{$subkey}][{$subsubkey}]=" . urlencode($subsubfilter);
}
} else {
$parameters[] = "filters[{$key}][{$subkey}]=" . urlencode($subfilter);
}
}
} else {
$parameters[] = "filters[{$key}]=" . urlencode($filter);
}
}
$parameters[] = 'template=' . $this->templatename;
$parameters[] = 'template_parameter=' . $this->template_parameter;
$parameters[] = 'searchterm=' . $this->searchterm;
$parameters[] = 'groupby=' . $this->groupby;
$parameters[] = 'grouporder=' . $this->grouporder;
$parameters[] = 'issues_per_page=' . $this->ipp;
$route = TBGContext::isProjectContext() ? TBGContext::getRouting()->generate('project_search_paginated', array('project_key' => TBGContext::getCurrentProject()->getKey())) : TBGContext::getRouting()->generate('search_paginated');
$this->route = $route;
$this->parameters = join('&', $parameters);
}
示例2: componentLeftmenu
public function componentLeftmenu()
{
$i18n = TBGContext::getI18n();
$config_sections = array();
if (TBGContext::getUser()->getScope()->getID() == 1) {
$config_sections[TBGSettings::CONFIGURATION_SECTION_SCOPES] = array('route' => 'configure_scopes', 'description' => $i18n->__('Scopes'), 'icon' => 'scopes', 'module' => 'core');
}
$config_sections[TBGSettings::CONFIGURATION_SECTION_SETTINGS] = array('route' => 'configure_settings', 'description' => $i18n->__('Settings'), 'icon' => 'general', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_PERMISSIONS] = array('route' => 'configure_permissions', 'description' => $i18n->__('Permissions'), 'icon' => 'permissions', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_AUTHENTICATION] = array('route' => 'configure_authentication', 'description' => $i18n->__('Authentication'), 'icon' => 'authentication', 'module' => 'core');
if (TBGContext::getScope()->isUploadsEnabled()) {
$config_sections[TBGSettings::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads & attachments'), 'icon' => 'files', 'module' => 'core');
}
$config_sections[TBGSettings::CONFIGURATION_SECTION_IMPORT] = array('route' => 'configure_import', 'description' => $i18n->__('Import data'), 'icon' => 'import', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_PROJECTS] = array('route' => 'configure_projects', 'description' => $i18n->__('Projects'), 'icon' => 'projects', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_ISSUETYPES] = array('icon' => 'issuetypes', 'description' => $i18n->__('Issue types'), 'route' => 'configure_issuetypes', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_ISSUEFIELDS] = array('icon' => 'resolutiontypes', 'description' => $i18n->__('Issue fields'), 'route' => 'configure_issuefields', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_WORKFLOW] = array('icon' => 'workflow', 'description' => $i18n->__('Workflow'), 'route' => 'configure_workflow', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_USERS] = array('route' => 'configure_users', 'description' => $i18n->__('Users, teams, clients & groups'), 'icon' => 'users', 'module' => 'core');
$config_sections[TBGSettings::CONFIGURATION_SECTION_MODULES][] = array('route' => 'configure_modules', 'description' => $i18n->__('Modules'), 'icon' => 'modules', 'module' => 'core');
foreach (TBGContext::getModules() as $module) {
if ($module->hasConfigSettings() && $module->isEnabled()) {
$config_sections[TBGSettings::CONFIGURATION_SECTION_MODULES][] = array('route' => array('configure_module', array('config_module' => $module->getName())), 'description' => $module->getConfigTitle(), 'icon' => $module->getName(), 'module' => $module->getName());
}
}
$breadcrumblinks = array();
foreach ($config_sections as $section) {
if (is_array($section) && !array_key_exists('route', $section)) {
foreach ($section as $subsection) {
$url = is_array($subsection['route']) ? make_url($subsection['route'][0], $subsection['route'][1]) : make_url($subsection['route']);
$breadcrumblinks[] = array('url' => $url, 'title' => $subsection['description']);
}
} else {
$breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']);
}
}
$this->breadcrumblinks = $breadcrumblinks;
$this->config_sections = $config_sections;
if ($this->selected_section == TBGSettings::CONFIGURATION_SECTION_MODULES) {
if (TBGContext::getRouting()->getCurrentRouteName() == 'configure_modules') {
$this->selected_subsection = 'core';
} else {
$this->selected_subsection = TBGContext::getRequest()->getParameter('config_module');
}
}
}
示例3: runTestEmail
/**
* Send a test email
*
* @param TBGRequest $request
*/
public function runTestEmail(TBGRequest $request)
{
if ($email_to = $request->getParameter('test_email_to')) {
try {
if (TBGMailing::getModule()->sendTestEmail($email_to)) {
TBGContext::setMessage('module_message', TBGContext::getI18n()->__('The email was successfully accepted for delivery'));
} else {
TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent'));
TBGContext::setMessage('module_error_details', TBGLogging::getMessagesForCategory('mailing', TBGLogging::LEVEL_NOTICE));
}
} catch (Exception $e) {
TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent'));
TBGContext::setMessage('module_error_details', $e->getMessage());
}
} else {
TBGContext::setMessage('module_error', TBGContext::getI18n()->__('Please specify an email address'));
}
$this->forward(TBGContext::getRouting()->generate('configure_module', array('config_module' => 'mailing')));
}
示例4: componentLeftmenu
public function componentLeftmenu()
{
$config_sections = TBGSettings::getConfigSections(TBGContext::getI18n());
$breadcrumblinks = array();
foreach ($config_sections as $key => $sections) {
foreach ($sections as $section) {
if ($key == TBGSettings::CONFIGURATION_SECTION_MODULES) {
$url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']);
$breadcrumblinks[] = array('url' => $url, 'title' => $section['description']);
} else {
$breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']);
}
}
}
$this->breadcrumblinks = $breadcrumblinks;
$this->config_sections = $config_sections;
if ($this->selected_section == TBGSettings::CONFIGURATION_SECTION_MODULES) {
if (TBGContext::getRouting()->getCurrentRouteName() == 'configure_modules') {
$this->selected_subsection = 'core';
} else {
$this->selected_subsection = TBGContext::getRequest()->getParameter('config_module');
}
}
}
示例5: listen_MenustripLinks
public function listen_MenustripLinks(TBGEvent $event)
{
$project_url = TBGContext::isProjectContext() ? TBGContext::getRouting()->generate('publish_article', array('article_name' => ucfirst(TBGContext::getCurrentProject()->getKey()) . ':MainPage')) : null;
$url = TBGContext::getRouting()->generate('publish');
TBGActionComponent::includeTemplate('publish/menustriplinks', array('url' => $url, 'project_url' => $project_url, 'selected_tab' => $event->getParameter('selected_tab')));
}
示例6: runSiteIcons
public function runSiteIcons(TBGRequest $request)
{
if ($this->getAccessLevel($request['section'], 'core') == TBGSettings::ACCESS_FULL) {
if ($request->isPost()) {
switch ($request['small_icon_action']) {
case 'upload_file':
$file = $request->handleUpload('small_icon');
TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, TBGSettings::APPEARANCE_FAVICON_CUSTOM);
TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_ID, $file->getID());
break;
case 'clear_file':
TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, TBGSettings::APPEARANCE_FAVICON_THEME);
break;
}
switch ($request['large_icon_action']) {
case 'upload_file':
$file = $request->handleUpload('large_icon');
TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, TBGSettings::APPEARANCE_HEADER_CUSTOM);
TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_ID, $file->getID());
break;
case 'clear_file':
TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, TBGSettings::APPEARANCE_HEADER_THEME);
break;
}
}
$route = TBGContext::getRouting()->generate('configure_settings');
if ($request->isAjaxCall()) {
return $this->renderJSON(array('forward' => $route));
} else {
$this->forward($route);
}
}
return $this->forward403($this->getI18n()->__("You don't have access to perform this action"));
}
示例7: image_tag
?>
><?php
echo image_tag($tbg_user->getAvatarURL(true), array('alt' => '[avatar]', 'class' => 'guest_avatar'), true) . __('You are not logged in');
?>
</a>
<?php
} else {
?>
<?php
echo link_tag(make_url('dashboard'), image_tag($tbg_user->getAvatarURL(true), array('alt' => '[avatar]', 'id' => 'header_avatar'), true) . '<span id="header_user_fullname">' . tbg_decodeUTF8($tbg_user->getDisplayName()) . '</span>');
?>
<?php
}
?>
<?php
if (TBGContext::getRouting()->getCurrentRouteName() != 'login_page') {
?>
<?php
echo javascript_link_tag(image_tag('tabmenu_dropdown.png', array('class' => 'menu_dropdown')), array('onmouseover' => ""));
?>
<?php
}
?>
</div>
<?php
if (TBGEvent::createNew('core', 'header_usermenu_decider')->trigger()->getReturnValue() !== false) {
?>
<?php
require THEBUGGENIE_CORE_PATH . 'templates/headerusermenu.inc.php';
?>
<?php
示例8: runBulkUpdateIssues
public function runBulkUpdateIssues(TBGRequest $request)
{
$issue_ids = $request['issue_ids'];
$options = array('issue_ids' => array_values($issue_ids));
TBGContext::loadLibrary('common');
$options['last_updated'] = tbg_formatTime(time(), 20);
if (!empty($issue_ids)) {
$options['bulk_action'] = $request['bulk_action'];
switch ($request['bulk_action']) {
case 'assign_milestone':
$milestone = null;
if ($request['milestone'] == 'new') {
$milestone = new TBGMilestone();
$milestone->setProject(TBGContext::getCurrentProject());
$milestone->setName($request['milestone_name']);
$milestone->save();
$options['milestone_url'] = TBGContext::getRouting()->generate('project_planning_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID()));
} elseif ($request['milestone']) {
$milestone = new TBGMilestone($request['milestone']);
}
$milestone_id = $milestone instanceof TBGMilestone ? $milestone->getID() : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$issue->setMilestone($milestone_id);
$issue->save();
}
}
$options['milestone_id'] = $milestone_id;
$options['milestone_name'] = $milestone_id ? $milestone->getName() : '-';
break;
case 'set_status':
if (is_numeric($request['status'])) {
$status = new TBGStatus($request['status']);
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$issue->setStatus($status->getID());
$issue->save();
}
}
$options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
}
break;
case 'set_severity':
if (is_numeric($request['severity'])) {
$severity = $request['severity'] ? new TBGSeverity($request['severity']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$severity_id = $severity instanceof TBGSeverity ? $severity->getID() : 0;
$issue->setSeverity($severity_id);
$issue->save();
}
}
$options['severity'] = array('name' => $severity instanceof TBGSeverity ? $severity->getName() : '-', 'id' => $severity instanceof TBGSeverity ? $severity->getID() : 0);
}
break;
case 'set_resolution':
if (is_numeric($request['resolution'])) {
$resolution = $request['resolution'] ? new TBGResolution($request['resolution']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$resolution_id = $resolution instanceof TBGResolution ? $resolution->getID() : 0;
$issue->setResolution($resolution_id);
$issue->save();
}
}
$options['resolution'] = array('name' => $resolution instanceof TBGResolution ? $resolution->getName() : '-', 'id' => $resolution instanceof TBGResolution ? $resolution->getID() : 0);
}
break;
case 'set_priority':
if (is_numeric($request['priority'])) {
$priority = $request['priority'] ? new TBGPriority($request['priority']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$priority_id = $priority instanceof TBGPriority ? $priority->getID() : 0;
$issue->setPriority($priority_id);
$issue->save();
}
}
$options['priority'] = array('name' => $priority instanceof TBGPriority ? $priority->getName() : '-', 'id' => $priority instanceof TBGPriority ? $priority->getID() : 0);
}
break;
case 'set_category':
if (is_numeric($request['category'])) {
$category = $request['category'] ? new TBGCategory($request['category']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new TBGIssue($issue_id);
$category_id = $category instanceof TBGCategory ? $category->getID() : 0;
$issue->setCategory($category_id);
$issue->save();
}
}
$options['category'] = array('name' => $category instanceof TBGCategory ? $category->getName() : '-', 'id' => $category instanceof TBGCategory ? $category->getID() : 0);
}
break;
//.........这里部分代码省略.........
示例9: getRemoteURL
protected function getRemoteURL($route_name, $params = array())
{
$real_params = array_merge(array('api_username' => $this->_getCurrentRemoteUser(), 'api_token' => $this->_getCurrentRemotePasswordHash()), $params);
$url = TBGContext::getRouting()->generate($route_name, $real_params, true);
$host = $this->_getCurrentRemoteServer();
if (mb_substr($host, mb_strlen($host) - 2) != '/') {
$host .= '/';
}
return $host . mb_substr($url, 1);
}
示例10:
}
?>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<?php
TBGEvent::createNew('core', 'header_ends')->trigger();
?>
</head>
<body id="body">
<?php
require THEBUGGENIE_CORE_PATH . 'templates/backdrops.inc.php';
?>
<div id="main_container">
<?php
if (!in_array(TBGContext::getRouting()->getCurrentRouteName(), array('login_page', 'elevated_login_page', 'reset_password'))) {
?>
<?php
TBGLogging::log('Rendering header');
?>
<?php
require THEBUGGENIE_CORE_PATH . 'templates/headertop.inc.php';
?>
<?php
TBGLogging::log('done (rendering header)');
?>
<?php
}
?>
<div id="content_container">
<?php
示例11: getRSSUrl
public function getRSSUrl()
{
switch ($this->getType()) {
case self::VIEW_PREDEFINED_SEARCH:
case self::VIEW_SAVED_SEARCH:
return TBGContext::getRouting()->generate('search', $this->getSearchParameters(true));
break;
case self::VIEW_PROJECT_RECENT_ACTIVITIES:
return TBGContext::getRouting()->generate('project_timeline', array('project_key' => $this->getProject()->getKey(), 'format' => 'rss'));
break;
}
}
示例12: runUpgrade
public function runUpgrade(TBGRequest $request)
{
$version_info = explode(',', file_get_contents(THEBUGGENIE_PATH . 'installed'));
$this->current_version = $version_info[0];
$this->upgrade_available = $this->current_version != '3.1';
if ($this->upgrade_available) {
$scope = new TBGScope();
$scope->setID(1);
$scope->setEnabled();
TBGContext::setScope($scope);
}
$this->upgrade_complete = false;
if ($this->upgrade_available && $request->isMethod(TBGRequest::POST)) {
$this->upgrade_complete = false;
switch ($this->current_version) {
case '3.0':
$this->_upgradeFrom3dot0();
break;
}
if ($this->upgrade_complete) {
$existing_installed_content = file_get_contents(THEBUGGENIE_PATH . 'installed');
file_put_contents(THEBUGGENIE_PATH . 'installed', TBGSettings::getVersion(false, false) . ', upgraded ' . date('d.m.Y H:i') . "\n" . $existing_installed_content);
unlink(THEBUGGENIE_PATH . 'upgrade');
$this->current_version = '3.1';
$this->upgrade_available = false;
}
} elseif ($this->current_version != '3.1') {
$this->permissions_ok = false;
if (is_writable(THEBUGGENIE_PATH . 'installed') && is_writable(THEBUGGENIE_PATH . 'upgrade')) {
$this->permissions_ok = true;
}
} else {
$this->forward(TBGContext::getRouting()->generate('home'));
}
}
示例13: _loadRoutes
protected final function _loadRoutes()
{
foreach ($this->_routes as $route) {
$this->log('adding route ' . $route[0]);
call_user_func_array(array(TBGContext::getRouting(), 'addRoute'), $route);
$this->log('done (adding route ' . $route[0] . ')');
}
}
示例14: runAddScope
public function runAddScope(TBGRequest $request)
{
if ($request->isPost()) {
$scope = TBGContext::getScope();
$this->getUser()->addScope($scope, false);
$this->getUser()->confirmScope($scope->getID());
$route = TBGSettings::getLoginReturnRoute() != 'referer' ? TBGSettings::getLoginReturnRoute() : 'home';
$this->forward(TBGContext::getRouting()->generate($route));
}
}
示例15: make_url
/**
* Generate a url based on a route
*
* @param string $name The route key
* @param array $params key => value pairs of route parameters
* @param bool $relative[optional] Whether to generate a full url or relative
*
* @return string
*/
function make_url($name, $params = array(), $relative = true)
{
return TBGContext::getRouting()->generate($name, $params, $relative);
}