本文整理汇总了PHP中TBGContext::getModules方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::getModules方法的具体用法?PHP TBGContext::getModules怎么用?PHP TBGContext::getModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::getModules方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _listInstalled
protected function _listInstalled()
{
$this->cliEcho("\nInstalled modules:\n", 'green', 'bold');
foreach (TBGContext::getModules() as $module_key => $module) {
$this->cliEcho("{$module_key}: ", 'white', 'bold');
$this->cliEcho($module->getDescription());
$this->cliEcho("\n");
}
$this->cliEcho("\n");
}
示例2: initialize
public function initialize()
{
$filename = THEBUGGENIE_PATH . 'i18n' . DS . $this->_language . DS . 'initialize.inc.php';
if (file_exists($filename)) {
TBGLogging::log("Initiating with file '{$filename}", 'i18n');
include $filename;
}
$this->loadStrings();
foreach (TBGContext::getModules() as $module_name => $module) {
$this->loadStrings($module_name);
}
}
示例3: 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');
}
}
}
示例4: __
<input type="submit" id="submit_settings_button" style="float: right; padding: 0 10px 0 10px; font-size: 14px; font-weight: bold;" value="<?php
echo __('Save');
?>
">
<span id="profile_settings_save_indicator" style="display: none; float: right;"><?php
echo image_tag('spinning_20.gif');
?>
</span>
</div>
</form>
</div>
<?php
TBGEvent::createNew('core', 'account_tab_panes')->trigger();
?>
<?php
foreach (TBGContext::getModules() as $module_name => $module) {
?>
<?php
if ($module->hasAccountSettings()) {
?>
<div id="tab_settings_<?php
echo $module_name;
?>
_pane" style="display: none;">
<form accept-charset="<?php
echo TBGContext::getI18n()->getCharset();
?>
" action="<?php
echo make_url('account_save_module_settings', array('target_module' => $module_name));
?>
" onsubmit="updateProfileModuleSettings('<?php
示例5: runConfigureAuthentication
public function runConfigureAuthentication(TBGRequest $request)
{
$modules = array();
$allmods = TBGContext::getModules();
foreach ($allmods as $mod) {
if ($mod->getType() == TBGModule::MODULE_AUTH) {
$modules[] = $mod;
}
}
$this->modules = $modules;
}
示例6: include_template
<?php
include_template('configuration/permissionsblock', array('base_id' => $base_id . 'project_page_permissions', 'permissions_list' => TBGContext::getAvailablePermissions('project_pages'), 'mode' => 'project_pages', 'target_id' => 0, 'module' => 'core', 'user_id' => $user_id, 'access_level' => $access_level));
?>
</ul>
</div>
<div id="<?php
echo $base_id;
?>
_tab_modules_pane" class="tab_pane" style="display: none;">
<p><?php
echo __('Module-specific permissions are also available from the "%configure_modules%" configuration page', array('%configure_modules%' => link_tag(make_url('configure_modules'), __('Configure modules'))));
?>
</p>
<ul>
<?php
foreach (TBGContext::getModules() as $module_key => $module) {
?>
<li>
<a href="javascript:void(0);" onclick="$('module_permission_details_<?php
echo $module_key;
?>
').toggle();"><?php
echo image_tag('icon_project_permissions.png', array('style' => 'float: right;'));
echo $module->getLongName();
?>
<span class="faded_out smaller"><?php
echo $module_key;
?>
</span></a>
<ul style="display: none;" id="module_permission_details_<?php
echo $module_key;
示例7: getConfigSections
public static function getConfigSections($i18n)
{
$config_sections = array('general' => array(), self::CONFIGURATION_SECTION_MODULES => array());
if (TBGContext::getScope()->getID() == 1) {
$config_sections['general'][self::CONFIGURATION_SECTION_SCOPES] = array('route' => 'configure_scopes', 'description' => $i18n->__('Scopes'), 'icon' => 'scopes', 'details' => $i18n->__('Scopes are self-contained Bug Genie environments. Configure them here.'));
}
$config_sections['general'][self::CONFIGURATION_SECTION_SETTINGS] = array('route' => 'configure_settings', 'description' => $i18n->__('Settings'), 'icon' => 'general_small', 'details' => $i18n->__('Every setting in the bug genie can be adjusted in this section.'));
// $config_sections['general'][self::CONFIGURATION_SECTION_PERMISSIONS] = array('route' => 'configure_permissions', 'description' => $i18n->__('Permissions'), 'icon' => 'permissions', 'details' => $i18n->__('Configure permissions in this section'));
$config_sections['general'][self::CONFIGURATION_SECTION_ROLES] = array('route' => 'configure_roles', 'description' => $i18n->__('Roles'), 'icon' => 'roles', 'details' => $i18n->__('Configure roles (permission templates) in this section'));
$config_sections['general'][self::CONFIGURATION_SECTION_AUTHENTICATION] = array('route' => 'configure_authentication', 'description' => $i18n->__('Authentication'), 'icon' => 'authentication', 'details' => $i18n->__('Configure the authentication method in this section'));
if (TBGContext::getScope()->isUploadsEnabled()) {
$config_sections['general'][self::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads & attachments'), 'icon' => 'files', 'details' => $i18n->__('All settings related to file uploads are controlled from this section.'));
}
$config_sections['general'][self::CONFIGURATION_SECTION_IMPORT] = array('route' => 'configure_import', 'description' => $i18n->__('Import data'), 'icon' => 'import_small', 'details' => $i18n->__('Import data from CSV files and other sources.'));
$config_sections['general'][self::CONFIGURATION_SECTION_PROJECTS] = array('route' => 'configure_projects', 'description' => $i18n->__('Projects'), 'icon' => 'projects', 'details' => $i18n->__('Set up all projects in this configuration section.'));
$config_sections['general'][self::CONFIGURATION_SECTION_ISSUETYPES] = array('route' => 'configure_issuetypes', 'icon' => 'issuetypes', 'description' => $i18n->__('Issue types'), 'details' => $i18n->__('Manage issue types and configure issue fields for each issue type here'));
$config_sections['general'][self::CONFIGURATION_SECTION_ISSUEFIELDS] = array('route' => 'configure_issuefields', 'icon' => 'resolutiontypes', 'description' => $i18n->__('Issue fields'), 'details' => $i18n->__('Status types, resolution types, categories, custom fields, etc. are configurable from this section.'));
$config_sections['general'][self::CONFIGURATION_SECTION_WORKFLOW] = array('route' => 'configure_workflow', 'icon' => 'workflow', 'description' => $i18n->__('Workflow'), 'details' => $i18n->__('Set up and edit workflow configuration from this section'));
$config_sections['general'][self::CONFIGURATION_SECTION_USERS] = array('route' => 'configure_users', 'description' => $i18n->__('Users, teams & clients'), 'icon' => 'users', 'details' => $i18n->__('Manage users, user teams and clients from this section.'));
$config_sections[self::CONFIGURATION_SECTION_MODULES][] = array('route' => 'configure_modules', 'description' => $i18n->__('Module settings'), 'icon' => 'modules', 'details' => $i18n->__('Manage Bug Genie extensions from this section. New modules are installed from here.'), 'module' => 'core');
foreach (TBGContext::getModules() as $module) {
if ($module->hasConfigSettings() && $module->isEnabled()) {
$config_sections[self::CONFIGURATION_SECTION_MODULES][] = array('route' => array('configure_module', array('config_module' => $module->getName())), 'description' => TBGContext::geti18n()->__($module->getConfigTitle()), 'icon' => $module->getName(), 'details' => TBGContext::geti18n()->__($module->getConfigDescription()), 'module' => $module->getName());
}
}
return $config_sections;
}
示例8: uploadModule
/**
* Upload a new module from ZIP archive
*
* @param file $module_archive the module archive file (.zip)
* @return string the module name uploaded
*/
public static function uploadModule($module_archive, $scope = null)
{
$zip = new ZipArchive();
if ($zip->open($module_archive['tmp_name']) === false) {
throw new Exception('Can not open module archive ' . $module_archive['name']);
} else {
$module_name = preg_replace('/(\\w*)\\.zip$/i', '$1', $module_archive['name']);
$module_info = $zip->getFromName('module');
$module_details = explode('|', $zip->getFromName('class'));
list($module_classname, $module_version) = $module_details;
$module_basepath = THEBUGGENIE_MODULES_PATH . $module_name;
if (($module_info & $module_details) === false) {
throw new Exception('Invalid module archive ' . $module_archive['name']);
}
$modules = TBGContext::getModules();
foreach ($modules as $module) {
if ($module->getName() == $module_name || $module->getClassname() == $module_classname) {
throw new Exception('Conflict with the module ' . $module->getLongName() . ' that is already installed with version ' . $module->getVersion());
}
}
if (is_dir($module_basepath) === false) {
if (mkdir($module_basepath) === false) {
TBGLogging::log('Try to upload module archive ' . $module_archive['name'] . ': unable to create module directory ' . $module_basepath);
throw new Exception('Unable to create module directory ' . $module_basepath);
}
if ($zip->extractTo($module_basepath) === false) {
TBGLogging::log('Try to upload module archive ' . $module_archive['name'] . ': unable to extract archive into ' . $module_basepath);
throw new Exception('Unable to extract module into ' . $module_basepath);
}
}
return $module_name;
}
return null;
}
示例9: _upgradeFrom3dot0
protected function _upgradeFrom3dot0()
{
// Add new tables
TBGScopeHostnamesTable::getTable()->create();
// Add classpath for existing old tables used for upgrade
TBGContext::addClasspath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.0');
// Upgrade old tables
TBGScopesTable::getTable()->upgrade(TBGScopesTable3dot0::getTable());
TBGIssueFieldsTable::getTable()->upgrade(TBGIssueFieldsTable3dot0::getTable());
// Upgrade all modules
foreach (TBGContext::getModules() as $module) {
if (method_exists($module, 'upgradeFrom3dot0')) {
$module->upgradeFrom3dot0();
}
}
// Start a transaction to preserve the upgrade path
$transaction = B2DB::startTransaction();
// Add votes to feature requests for default issue type scheme
$its = new TBGIssuetypeScheme(1);
foreach (TBGIssuetype::getAll() as $fr) {
if ($fr instanceof TBGIssuetype) {
if (in_array($fr->getKey(), array('featurerequest', 'bugreport', 'enhancement'))) {
$its->setFieldAvailableForIssuetype($fr, 'votes');
}
}
}
$ut = TBGUsersTable::getTable();
$crit = $ut->getCriteria();
$crit->addUpdate(TBGUsersTable::PRIVATE_EMAIL, true);
$ut->doUpdate($crit);
// Add default gravatar setting
TBGSettings::saveSetting(TBGSettings::SETTING_ENABLE_GRAVATARS, 1);
$trans_crit = TBGWorkflowTransitionsTable::getTable()->getCriteria();
$trans_crit->addWhere(TBGWorkflowTransitionsTable::NAME, 'Request more information');
$trans_crit->addWhere(TBGWorkflowTransitionsTable::WORKFLOW_ID, 1);
$trans_row = TBGWorkflowTransitionsTable::getTable()->doSelectOne($trans_crit);
if ($trans_row) {
$transition = new TBGWorkflowTransition($trans_row->get(TBGWorkflowTransitionsTable::ID), $trans_row);
$transition->setTemplate('main/updateissueproperties');
$transition->save();
}
// End transaction and finalize upgrade
$transaction->commitAndEnd();
$this->upgrade_complete = true;
}
示例10: runMyAccount
/**
* "My account" page
*
* @param TBGRequest $request
*/
public function runMyAccount(TBGRequest $request)
{
$this->forward403unless($this->getUser()->hasPageAccess('account'));
$notificationsettings = array();
$i18n = $this->getI18n();
$notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES] = $i18n->__('Automatically subscribe to issues I get involved in');
$notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ARTICLES] = $i18n->__('Automatically subscribe to article I get involved in');
$notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new issues that are created in my project(s)');
$notificationsettings[TBGSettings::SETTINGS_USER_SUBSCRIBE_NEW_ARTICLES_MY_PROJECTS] = $i18n->__('Automatically subscribe to new articles that are created in my project(s)');
$this->notificationsettings = $notificationsettings;
$this->has_autopassword = TBGContext::hasMessage('auto_password');
if ($this->has_autopassword) {
$this->autopassword = TBGContext::getMessage('auto_password');
}
if ($request->isPost() && $request->hasParameter('mode')) {
switch ($request['mode']) {
case 'information':
if (!$request['buddyname'] || !$request['email']) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => TBGContext::getI18n()->__('Please fill out all the required fields')));
}
$this->getUser()->setBuddyname($request['buddyname']);
$this->getUser()->setRealname($request['realname']);
$this->getUser()->setHomepage($request['homepage']);
$this->getUser()->setEmailPrivate((bool) $request['email_private']);
$this->getUser()->setUsesGravatar((bool) $request['use_gravatar']);
$this->getUser()->setTimezone($request->getRawParameter('timezone'));
$this->getUser()->setLanguage($request['profile_language']);
if ($this->getUser()->getEmail() != $request['email']) {
if (TBGEvent::createNew('core', 'changeEmail', $this->getUser(), array('email' => $request['email']))->triggerUntilProcessed()->isProcessed() == false) {
$this->getUser()->setEmail($request['email']);
}
}
$this->getUser()->save();
return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Profile information saved')));
break;
case 'settings':
$this->getUser()->setPreferredWikiSyntax($request['syntax_articles']);
$this->getUser()->setPreferredIssuesSyntax($request['syntax_issues']);
$this->getUser()->setPreferredCommentsSyntax($request['syntax_comments']);
$this->getUser()->setKeyboardNavigationEnabled($request['enable_keyboard_navigation']);
foreach ($notificationsettings as $setting => $description) {
if ($request->hasParameter('core_' . $setting)) {
$this->getUser()->setNotificationSetting($setting, true)->save();
} else {
$this->getUser()->setNotificationSetting($setting, false)->save();
}
}
TBGEvent::createNew('core', 'mainActions::myAccount::saveNotificationSettings')->trigger(compact('request'));
$this->getUser()->save();
return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Profile settings saved')));
break;
case 'module':
foreach (TBGContext::getModules() as $module_name => $module) {
if ($request['target_module'] == $module_name && $module->hasAccountSettings()) {
if ($module->postAccountSettings($request)) {
return $this->renderJSON(array('title' => TBGContext::getI18n()->__('Settings saved')));
} else {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => TBGContext::getI18n()->__('An error occured')));
}
}
}
break;
}
}
$this->rnd_no = rand();
$this->languages = TBGI18n::getLanguages();
$this->timezones = TBGI18n::getTimezones();
$this->error = TBGContext::getMessageAndClear('error');
$this->username_chosen = TBGContext::getMessageAndClear('username_chosen');
$this->openid_used = TBGContext::getMessageAndClear('openid_used');
$this->rsskey_generated = TBGContext::getMessageAndClear('rsskey_generated');
$this->selected_tab = 'profile';
if ($this->rsskey_generated) {
$this->selected_tab = 'security';
}
}
示例11: getAvailablePermissions
/**
* Returns all permissions available for a specific identifier
*
* @param string $applies_to The identifier
*
* @return array
*/
public static function getAvailablePermissions($applies_to = null)
{
self::_cacheAvailablePermissions();
if ($applies_to === null) {
$list = self::$_available_permissions;
$retarr = array();
foreach ($list as $key => $details) {
foreach ($details as $dkey => $dd) {
$retarr[$dkey] = $dd;
}
}
foreach (TBGContext::getModules() as $module_key => $module) {
$retarr['module_' . $module_key] = array();
foreach ($module->getAvailablePermissions() as $mpkey => $mp) {
$retarr['module_' . $module_key][$mpkey] = $mp;
}
}
return $retarr;
}
if (array_key_exists($applies_to, self::$_available_permissions)) {
return self::$_available_permissions[$applies_to];
} elseif (substr($applies_to, 0, 7) == 'module_') {
$module_name = substr($applies_to, 7);
if (self::isModuleLoaded($module_name)) {
return self::getModule($module_name)->getAvailablePermissions();
}
} else {
return array();
}
}
示例12: runMyAccount
/**
* "My account" page
*
* @param TBGRequest $request
*/
public function runMyAccount(TBGRequest $request)
{
$this->forward403unless(TBGContext::getUser()->hasPageAccess('account'));
if ($request->isMethod(TBGRequest::POST) && $request->hasParameter('mode')) {
switch ($request->getParameter('mode')) {
case 'information':
if (!$request->getParameter('buddyname') || !$request->getParameter('email')) {
return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please fill out all the required fields')));
}
TBGContext::getUser()->setBuddyname($request->getParameter('buddyname'));
TBGContext::getUser()->setRealname($request->getParameter('realname'));
TBGContext::getUser()->setHomepage($request->getParameter('homepage'));
TBGContext::getUser()->setEmailPrivate((bool) $request->getParameter('email_private'));
if (TBGContext::getUser()->getEmail() != $request->getParameter('email')) {
if (TBGEvent::createNew('core', 'changeEmail', TBGContext::getUser(), array('email' => $request->getParameter('email')))->triggerUntilProcessed()->isProcessed() == false) {
TBGContext::getUser()->setEmail($request->getParameter('email'));
}
}
TBGContext::getUser()->save();
return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Account information saved'), 'content' => ''));
break;
case 'settings':
TBGContext::getUser()->setUsesGravatar((bool) $request->getParameter('use_gravatar'));
TBGContext::getUser()->setTimezone($request->getParameter('timezone'));
TBGContext::getUser()->setLanguage($request->getParameter('profile_language'));
TBGContext::getUser()->save();
return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Profile settings saved'), 'content' => ''));
break;
case 'module':
foreach (TBGContext::getModules() as $module_name => $module) {
if ($request->getParameter('target_module') == $module_name && $module->hasAccountSettings()) {
if ($module->postAccountSettings($request)) {
return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('Settings saved'), 'content' => ''));
} else {
return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('An error occured')));
}
}
}
break;
}
}
$this->rnd_no = rand();
$this->languages = TBGI18n::getLanguages();
$this->getResponse()->setPage('account');
}