本文整理汇总了PHP中TBGContext::getI18n方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::getI18n方法的具体用法?PHP TBGContext::getI18n怎么用?PHP TBGContext::getI18n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::getI18n方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFixtures
public function loadFixtures(TBGScope $scope)
{
$i18n = TBGContext::getI18n();
$crit = $this->getCriteria();
$crit->addInsert(self::SCOPE, $scope->getID());
$crit->addInsert(self::NAME, "Default workflow scheme");
$crit->addInsert(self::DESCRIPTION, "This is the default workflow scheme. It is used by all projects with no specific workflow scheme selected. This scheme cannot be edited or removed.");
$this->doInsert($crit);
}
示例2: getFinalTemplateName
protected static function getFinalTemplateName($template, $module_file = null)
{
if (!isset($module_file)) {
$module_file = self::getModuleAndTemplate($template);
}
if (($template_name = TBGContext::getI18n()->hasTranslatedTemplate($template, true)) === false) {
$template_name = THEBUGGENIE_MODULES_PATH . $module_file['module'] . DS . 'templates' . DS . "_{$module_file['file']}.inc.php";
}
return $template_name;
}
示例3: componentFilter
public function componentFilter()
{
$i18n = TBGContext::getI18n();
$this->selected_value = isset($this->selected_value) ? $this->selected_value : 0;
$this->selected_operator = isset($this->selected_operator) ? $this->selected_operator : '=';
$filters = array();
$filters['status'] = array('description' => $i18n->__('Status'), 'options' => TBGStatus::getAll());
$filters['category'] = array('description' => $i18n->__('Category'), 'options' => TBGCategory::getAll());
$filters['priority'] = array('description' => $i18n->__('Priority'), 'options' => TBGPriority::getAll());
$filters['severity'] = array('description' => $i18n->__('Severity'), 'options' => TBGSeverity::getAll());
$filters['reproducability'] = array('description' => $i18n->__('Reproducability'), 'options' => TBGReproducability::getAll());
$filters['resolution'] = array('description' => $i18n->__('Resolution'), 'options' => TBGResolution::getAll());
$filters['issuetype'] = array('description' => $i18n->__('Issue type'), 'options' => TBGIssuetype::getAll());
$this->filters = $filters;
}
示例4: componentAccountSettings
public function componentAccountSettings()
{
$i18n = TBGContext::getI18n();
$general_settings = array();
$issues_settings = array();
$general_settings['notify_add_friend'] = $i18n->__('Notify me when someone adds me as their friend');
$issues_settings[TBGMailing::NOTIFY_ISSUE_POSTED_UPDATED] = $i18n->__('Notify me when an issue I posted gets updated or created');
$issues_settings[TBGMailing::NOTIFY_ISSUE_ONCE] = $i18n->__('Only notify me once per issue until I open the issue');
$issues_settings[TBGMailing::NOTIFY_ISSUE_ASSIGNED_UPDATED] = $i18n->__("Notify me when an issue I'm assigned to gets updated or created");
$issues_settings[TBGMailing::NOTIFY_ISSUE_UPDATED_SELF] = $i18n->__('Notify me when I update or create an issue');
$issues_settings[TBGMailing::NOTIFY_ISSUE_TEAMASSIGNED_UPDATED] = $i18n->__("Notify me when an issue assigned to one of my teams is updated or created");
$issues_settings[TBGMailing::NOTIFY_ISSUE_RELATED_PROJECT_TEAMASSIGNED] = $i18n->__("Notify me when an issue assigned to one of my team projects is updated or created");
$issues_settings[TBGMailing::NOTIFY_ISSUE_PROJECT_ASSIGNED] = $i18n->__("Notify me when an issue assigned to one of my projects is updated or created");
$this->general_settings = $general_settings;
$this->issues_settings = $issues_settings;
$this->uid = TBGContext::getUser()->getID();
}
示例5: 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');
}
}
}
示例6: 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')));
}
示例7: 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');
}
}
}
示例8: _getFieldsArray
/**
* Return an array specifying visibility, requirement and choices for fields in issues
*
* @param integer $issue_type
* @param boolean $reportable[optional] Whether to only include fields that can be reported
*
* @return array
*/
protected function _getFieldsArray($issue_type, $reportable = true)
{
$issue_type = is_object($issue_type) ? $issue_type->getID() : $issue_type;
if (!isset($this->_fieldsarrays[$issue_type][(int) $reportable])) {
$retval = array();
$res = B2DB::getTable('TBGIssueFieldsTable')->getBySchemeIDandIssuetypeID($this->getIssuetypeScheme()->getID(), $issue_type);
if ($res) {
$builtin_types = TBGDatatype::getAvailableFields(true);
while ($row = $res->getNextRow()) {
if (!$reportable || (bool) $row->get(TBGIssueFieldsTable::REPORTABLE) == true) {
if ($reportable) {
if (in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) {
continue;
} elseif (!in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable, true) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) {
continue;
}
}
$field_key = $row->get(TBGIssueFieldsTable::FIELD_KEY);
$retval[$field_key] = array('required' => (bool) $row->get(TBGIssueFieldsTable::REQUIRED), 'additional' => (bool) $row->get(TBGIssueFieldsTable::ADDITIONAL));
if (!in_array($field_key, $builtin_types)) {
$retval[$field_key]['custom'] = true;
$custom_type = TBGCustomDatatype::getByKey($field_key);
if ($custom_type instanceof TBGCustomDatatype) {
$retval[$field_key]['custom_type'] = $custom_type->getType();
} else {
unset($retval[$field_key]);
}
}
}
}
if (array_key_exists('user_pain', $retval)) {
$retval['pain_bug_type'] = array('required' => $retval['user_pain']['required']);
$retval['pain_likelihood'] = array('required' => $retval['user_pain']['required']);
$retval['pain_effect'] = array('required' => $retval['user_pain']['required']);
}
if ($reportable) {
foreach ($retval as $key => $return_details) {
if ($key == 'edition' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::EDITIONS_CHOICE))) {
$retval[$key]['values'] = array();
$retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
foreach ($this->getEditions() as $edition) {
$retval[$key]['values'][$edition->getID()] = $edition->getName();
}
if (!$this->isEditionsEnabled() || empty($retval[$key]['values'])) {
if (!$retval[$key]['required']) {
unset($retval[$key]);
} else {
unset($retval[$key]['values']);
}
}
if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
asort($retval[$key]['values'], SORT_STRING);
}
} elseif ($key == 'status' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::STATUS_CHOICE))) {
$retval[$key]['values'] = array();
foreach (TBGStatus::getAll() as $status) {
$retval[$key]['values'][$status->getID()] = $status->getName();
}
if (empty($retval[$key]['values'])) {
if (!$retval[$key]['required']) {
unset($retval[$key]);
} else {
unset($retval[$key]['values']);
}
}
if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
asort($retval[$key]['values'], SORT_STRING);
}
} elseif ($key == 'component' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::COMPONENTS_LIST, TBGCustomDatatype::COMPONENTS_CHOICE))) {
$retval[$key]['values'] = array();
$retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
foreach ($this->getComponents() as $component) {
$retval[$key]['values'][$component->getID()] = $component->getName();
}
if (!$this->isComponentsEnabled() || empty($retval[$key]['values'])) {
if (!$retval[$key]['required']) {
unset($retval[$key]);
} else {
unset($retval[$key]['values']);
}
}
if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
asort($retval[$key]['values'], SORT_STRING);
}
} elseif ($key == 'build' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::RELEASES_LIST, TBGCustomDatatype::RELEASES_CHOICE))) {
$retval[$key]['values'] = array();
$retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
foreach ($this->getBuilds() as $build) {
$retval[$key]['values'][$build->getID()] = $build->getName() . ' (' . $build->getVersion() . ')';
}
if (!$this->isBuildsEnabled() || empty($retval[$key]['values'])) {
if (!$retval[$key]['required']) {
//.........这里部分代码省略.........
示例9: runSaveColumnSettings
public function runSaveColumnSettings(TBGRequest $request)
{
TBGSettings::saveSetting('search_scs_' . $request['template'], join(',', $request['columns']));
return $this->renderJSON(array('failed' => false, 'message' => TBGContext::getI18n()->__('Visible columns has been set successfully')));
}
示例10: runListFieldvalues
public function runListFieldvalues(TBGRequest $request)
{
$field_key = $request['field_key'];
$return_array = array('description' => null, 'type' => null, 'choices' => null);
if ($field_key == 'title' || in_array($field_key, TBGDatatypeBase::getAvailableFields(true))) {
switch ($field_key) {
case 'title':
$return_array['description'] = TBGContext::getI18n()->__('Single line text input without formatting');
$return_array['type'] = 'single_line_input';
break;
case 'description':
case 'reproduction_steps':
$return_array['description'] = TBGContext::getI18n()->__('Text input with wiki formatting capabilities');
$return_array['type'] = 'wiki_input';
break;
case 'status':
case 'resolution':
case 'reproducability':
case 'priority':
case 'severity':
case 'category':
$return_array['description'] = TBGContext::getI18n()->__('Choose one of the available values');
$return_array['type'] = 'choice';
$classname = "TBG" . ucfirst($field_key);
$choices = $classname::getAll();
foreach ($choices as $choice_key => $choice) {
$return_array['choices'][$choice_key] = $choice->getName();
}
break;
case 'percent_complete':
$return_array['description'] = TBGContext::getI18n()->__('Value of percentage completed');
$return_array['type'] = 'choice';
$return_array['choices'][] = "1-100%";
break;
case 'owner':
case 'assignee':
$return_array['description'] = TBGContext::getI18n()->__('Select an existing user or <none>');
$return_array['type'] = 'select_user';
break;
case 'estimated_time':
case 'spent_time':
$return_array['description'] = TBGContext::getI18n()->__('Enter time, such as points, hours, minutes, etc or <none>');
$return_array['type'] = 'time';
break;
case 'milestone':
$return_array['description'] = TBGContext::getI18n()->__('Select from available project milestones');
$return_array['type'] = 'choice';
if ($this->selected_project instanceof TBGProject) {
$milestones = $this->selected_project->getAvailableMilestones();
foreach ($milestones as $milestone) {
$return_array['choices'][$milestone->getID()] = $milestone->getName();
}
}
break;
}
} else {
}
$this->field_info = $return_array;
}
示例11: make_url
<rss version="2.0">
<channel>
<title><?php
echo TBGSettings::getTBGname() . ' ~ ' . $searchtitle;
?>
</title>
<link><?php
echo make_url('home', array(), false);
?>
</link>
<description><?php
echo strip_tags(TBGSettings::getTBGname());
?>
</description>
<language><?php
echo mb_strtolower(str_replace('_', '-', TBGContext::getI18n()->getCurrentLanguage()));
?>
</language>
<image>
<?php
if (TBGSettings::isUsingCustomHeaderIcon() == '2') {
?>
<url><?php
echo TBGSettings::getHeaderIconURL();
?>
</url>
<?php
} elseif (TBGSettings::isUsingCustomHeaderIcon() == '1') {
?>
<url><?php
echo TBGContext::getUrlHost() . TBGContext::getTBGPath() . 'header.png';
示例12: tbg_decodeUTF8
/**
* Returns an ISO-8859-1 encoded string if UTF-8 encoded and current charset not UTF-8
*
* @param string $str the encode string
* @param boolean $htmlentities [optional] whether to convert applicable characters to HTML entities
*
* @return string
*/
function tbg_decodeUTF8($str, $htmlentities = false)
{
if (tbg_isUTF8($str) && !stristr(TBGContext::getI18n()->getCharset(), 'UTF-8')) {
$str = utf8_decode($str);
}
if ($htmlentities) {
$str = htmlentities($str, ENT_NOQUOTES + ENT_IGNORE, TBGContext::getI18n()->getCharset());
}
return $str;
}
示例13: getTBGname
public static function getTBGname()
{
try {
if (!TBGContext::isReadySetup()) {
return 'The Bug Genie';
}
$name = self::get(self::SETTING_TBG_NAME);
if (!self::isHeaderHtmlFormattingAllowed()) {
$name = htmlspecialchars($name, ENT_COMPAT, TBGContext::getI18n()->getCharset());
}
return $name;
} catch (Exception $e) {
return 'The Bug Genie';
}
}
示例14: getMenuTitle
public function getMenuTitle($project_context = null)
{
$project_context = $project_context !== null ? $project_context : TBGContext::isProjectContext();
$i18n = TBGContext::getI18n();
if (($menu_title = $this->getSetting('menu_title')) !== null) {
switch ($menu_title) {
case 5:
return $project_context ? $i18n->__('Project archive') : $i18n->__('Archive');
case 3:
return $project_context ? $i18n->__('Project documentation') : $i18n->__('Documentation');
case 4:
return $project_context ? $i18n->__('Project documents') : $i18n->__('Documents');
case 2:
return $project_context ? $i18n->__('Project help') : $i18n->__('Help');
}
}
return $project_context ? $i18n->__('Project wiki') : $i18n->__('Wiki');
}
示例15: connect
/**
* Create an imap connection for this account
*/
public function connect()
{
if ($this->_connection === null) {
$options = array();
if ($this->usesPlaintextAuthentication()) {
$options['DISABLE_AUTHENTICATOR'] = 'GSSAPI';
}
$this->_connection = imap_open($this->getConnectionString(), $this->getUsername(), $this->getPassword(), $options);
}
if (!is_resource($this->_connection)) {
$error = imap_last_error();
$error = $error === false ? TBGContext::getI18n()->__('No error message provided') : $error;
throw new Exception(TBGContext::getI18n()->__('Could not connect to the specified email server(%connection_string): %error_message', array('%connection_string' => $this->getConnectionString(), '%error_message' => $error)));
}
}