本文整理汇总了PHP中getlocal函数的典型用法代码示例。如果您正苦于以下问题:PHP getlocal函数的具体用法?PHP getlocal怎么用?PHP getlocal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getlocal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showFormAction
/**
* Builds a page with form for edit operator's permissions.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
* @throws NotFoundException If the operator with specified ID is not found
* in the system.
*/
public function showFormAction(Request $request)
{
$operator = $this->getOperator();
$op_id = $request->attributes->get('operator_id');
$page = array('opid' => $op_id, 'canmodify' => is_capable(CAN_ADMINISTRATE, $operator) ? '1' : '', 'errors' => array());
$op = operator_by_id($op_id);
if (!$op) {
throw new NotFoundException('The operator is not found.');
}
// Check if the target operator exists
$page['currentop'] = $op ? get_operator_name($op) . ' (' . $op['vclogin'] . ')' : getlocal('-not found-');
// Build list of permissions which belongs to the target operator.
$checked_permissions = array();
foreach (permission_ids() as $perm => $id) {
if (is_capable($perm, $op)) {
$checked_permissions[] = $id;
}
}
// Build list of all available permissions
$page['permissionsList'] = array();
foreach (get_permission_list() as $perm) {
$perm['checked'] = in_array($perm['id'], $checked_permissions);
$page['permissionsList'][] = $perm;
}
$page['stored'] = $request->query->has('stored');
$page['title'] = getlocal('Permissions');
$page['menuid'] = $operator['operatorid'] == $op_id ? 'profile' : 'operators';
$page = array_merge($page, prepare_menu($operator));
$page['tabs'] = $this->buildTabs($request);
return $this->render('operator_permissions', $page);
}
示例2: buildTabs
/**
* Builds list of the localization tabs.
*
* @param Request $request Current request.
* @return array Tabs list. The keys of the array are tabs titles and the
* values are tabs URLs.
*/
protected function buildTabs(Request $request)
{
$tabs = array();
$route = $request->attributes->get('_route');
$tabs[getlocal('Translations')] = ($route != 'translations')
? $this->generateUrl('translations')
: '';
$import = ($route == 'translation_import'
|| $route == 'translation_import_process');
$tabs[getlocal('Translations import')] = !$import
? $this->generateUrl('translation_import')
: '';
$export = ($route == 'translation_export'
|| $route == 'translation_export_process');
$tabs[getlocal('Translations export')] = !$export
? $this->generateUrl('translation_export')
: '';
$tabs[getlocal('Locales')] = ($route != 'locales')
? $this->generateUrl('locales')
: '';
return $tabs;
}
示例3: indexAction
/**
* Generates list of all available groups.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
*/
public function indexAction(Request $request)
{
$operator = $this->getOperator();
$page = array('errors' => array());
$sort_by = $request->query->get('sortby');
if (!in_array($sort_by, array('name', 'lastseen', 'weight'))) {
$sort_by = 'name';
}
$sort['by'] = $sort_by;
$sort['desc'] = $request->query->get('sortdirection', 'desc') == 'desc';
// Load and prepare groups
$groups = get_sorted_groups($sort);
foreach ($groups as &$group) {
$group['vclocalname'] = $group['vclocalname'];
$group['vclocaldescription'] = $group['vclocaldescription'];
$group['isOnline'] = group_is_online($group);
$group['isAway'] = group_is_away($group);
$group['lastTimeOnline'] = time() - ($group['ilastseen'] ? $group['ilastseen'] : time());
$group['inumofagents'] = $group['inumofagents'];
}
unset($group);
// Set values that are needed to build sorting block.
$page['groups'] = $groups;
$page['formsortby'] = $sort['by'];
$page['formsortdirection'] = $sort['desc'] ? 'desc' : 'asc';
$page['canmodify'] = is_capable(CAN_ADMINISTRATE, $operator);
$page['availableOrders'] = array(array('id' => 'name', 'name' => getlocal('Name')), array('id' => 'lastseen', 'name' => getlocal('Last active')), array('id' => 'weight', 'name' => getlocal('Weight')));
$page['availableDirections'] = array(array('id' => 'desc', 'name' => getlocal('descending')), array('id' => 'asc', 'name' => getlocal('ascending')));
// Set other variables and render the response.
$page['title'] = getlocal('Groups');
$page['menuid'] = 'groups';
$page = array_merge($page, prepare_menu($operator));
$this->getAssetManager()->attachJs('js/compiled/groups.js');
return $this->render('groups', $page);
}
示例4: indexAction
/**
* Generates a page with awaiting visitors.
*
* @param Request $request
* @return string Rendered page content
*/
public function indexAction(Request $request)
{
$operator = $this->getOperator();
// Operator becomes online as soon as he open "operator/users" page
notify_operator_alive($operator['operatorid'], 0);
$operator['istatus'] = 0;
$this->getAuthenticationManager()->setOperator($operator);
$_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']);
$page = array();
$page['havemenu'] = !$request->query->has('nomenu');
$page['showonline'] = (Settings::get('showonlineoperators') == '1');
$page['showvisitors'] = (Settings::get('enabletracking') == '1');
$page['title'] = getlocal("List of visitors waiting");
$page['menuid'] = "users";
$page = array_merge($page, prepare_menu($operator));
// Attach files of the client side application and start it
$this->getAssetManager()->attachJs('js/compiled/users_app.js');
$this->getAssetManager()->attachJs(
$this->startJsApplication($request, $operator),
\Mibew\Asset\AssetManagerInterface::INLINE,
1000
);
return $this->render('users', $page);
}
示例5: showFormAction
/**
* Builds a page with form for edit operator's groups.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
* @throws NotFoundException If the operator with specified ID is not found
* in the system.
*/
public function showFormAction(Request $request)
{
$operator = $this->getOperator();
$operator_in_isolation = in_isolation($operator);
$op_id = $request->attributes->getInt('operator_id');
// Check if the target user exists
$op = operator_by_id($op_id);
if (!$op) {
throw new NotFoundException('The operator is not found.');
}
$page = array('opid' => $op_id, 'errors' => array());
$groups = $operator_in_isolation ? get_groups_for_operator($operator) : get_all_groups();
$can_modify = is_capable(CAN_ADMINISTRATE, $operator);
$page['currentop'] = $op ? get_operator_name($op) . ' (' . $op['vclogin'] . ')' : getlocal('-not found-');
$page['canmodify'] = $can_modify ? '1' : '';
// Get IDs of groups the operator belongs to.
$checked_groups = array();
if ($op) {
$checked_groups = get_operator_group_ids($op_id);
}
// Get all available groups
$page['groups'] = array();
foreach ($groups as $group) {
$group['vclocalname'] = $group['vclocalname'];
$group['vclocaldescription'] = $group['vclocaldescription'];
$group['checked'] = in_array($group['groupid'], $checked_groups);
$page['groups'][] = $group;
}
$page['stored'] = $request->query->has('stored');
$page['title'] = getlocal('Operator groups');
$page['menuid'] = $operator['operatorid'] == $op_id ? 'profile' : 'operators';
$page = array_merge($page, prepare_menu($operator));
$page['tabs'] = $this->buildTabs($request);
return $this->render('operator_groups', $page);
}
示例6: tpl_menu
function tpl_menu()
{
global $page, $webimroot, $errors, $current_locale;
?>
<li>
<h2><b><?php
echo getlocal("lang.choose");
?>
</b></h2>
<ul class="locales">
<?php
foreach ($page['localeLinks'] as $id => $title) {
?>
<li<?php
menuloc($id);
?>
><a href='?locale=<?php
echo $id;
?>
'><?php
echo $title;
?>
</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
示例7: showFormAction
/**
* Builds a page with members edit form.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
* @throws NotFoundException If the operator's group with specified ID is
* not found in the system.
*/
public function showFormAction(Request $request)
{
$operator = $this->getOperator();
$group_id = $request->attributes->getInt('group_id');
$page = array('groupid' => $group_id, 'errors' => $request->attributes->get('errors', array()));
$operators = get_operators_list();
$group = group_by_id($group_id);
// Check if the group exists
if (!$group) {
throw new NotFoundException('The group is not found.');
}
$page['formop'] = array();
$page['currentgroup'] = $group ? htmlspecialchars($group['vclocalname']) : '';
// Get list of group's members
$checked_operators = get_group_members($group_id);
// Prepare the list of all operators
$page['operators'] = array();
foreach ($operators as $op) {
$op['vclocalename'] = $op['vclocalename'];
$op['vclogin'] = $op['vclogin'];
$op['checked'] = in_array($op['operatorid'], $checked_operators);
$page['operators'][] = $op;
}
// Set other values and render the page
$page['stored'] = $request->query->get('stored');
$page['title'] = getlocal('Members');
$page['menuid'] = 'groups';
$page = array_merge($page, prepare_menu($operator));
$page['tabs'] = $this->buildTabs($request);
return $this->render('group_members', $page);
}
示例8: runUpdateAction
/**
* Runs the Updater.
*
* @param Request $request Incoming request.
* @return Response|string Rendered page contents or Symfony's response
* object.
*/
public function runUpdateAction(Request $request)
{
$upd = $this->getUpdater();
$upd->run();
$parameters = array('version' => MIBEW_VERSION, 'fixedwrap' => true, 'title' => getlocal('Update'), 'done' => $this->getUpdater()->getLog(), 'errors' => $this->getUpdater()->getErrors());
return $this->render('update_progress', $parameters);
}
示例9: showFormAction
/**
* Builds a page with form for features system settings.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
*/
public function showFormAction(Request $request)
{
$operator = $this->getOperator();
$page = array(
'agentId' => '',
'errors' => array(),
);
// Load all needed options and fill form with them.
$options = $this->getOptionsList();
foreach ($options as $opt) {
$page['form' . $opt] = (Settings::get($opt) == '1');
}
$page['canmodify'] = is_capable(CAN_ADMINISTRATE, $operator);
$page['stored'] = $request->query->get('stored');
$page['title'] = getlocal('Messenger settings');
$page['menuid'] = 'settings';
$page = array_merge($page, prepare_menu($operator));
$page['tabs'] = $this->buildTabs($request);
$this->getAssetManager()->attachJs('js/compiled/features.js');
return $this->render('settings_features', $page);
}
示例10: tpl_menu
function tpl_menu()
{
global $page, $mibewroot, $errors, $current_locale;
?>
<li>
<h2><b><?php
echo getlocal("lang.choose");
?>
</b></h2>
<ul class="locales">
<?php
foreach ($page['localeLinks'] as $id => $title) {
?>
<li<?php
menuloc($id);
?>
><a href="?locale=<?php
echo urlencode($id);
?>
"><?php
echo safe_htmlspecialchars($title);
?>
</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
示例11: execute
/**
* {@inheritdoc}
*/
public function execute(Template $template, Context $context, $args, $source)
{
// Check if there is at least one argument
$parsed_arguments = $template->parseArguments($args);
if (count($parsed_arguments) == 0) {
throw new \InvalidArgumentException('"l10n" helper expects at least one argument.');
}
$text = $context->get(array_shift($parsed_arguments));
// We need to escape extra arguments passed to the helper. Thus we need
// to get escape function and its arguments from the template engine.
$escape_func = $template->getEngine()->getEscape();
$escape_args = $template->getEngine()->getEscapeArgs();
// Check if there are any other arguments passed into helper and escape
// them.
$local_args = array();
foreach ($parsed_arguments as $parsed_argument) {
// Get locale argument string and add it to escape function
// arguments.
array_unshift($escape_args, $context->get($parsed_argument));
// Escape locale argument's value
$local_args[] = call_user_func_array($escape_func, array_values($escape_args));
// Remove locale argument's value from escape function argument
array_shift($escape_args);
}
$result = getlocal($text, $local_args);
return new SafeString($result);
}
示例12: dashboardAction
/**
* Renders operator's home page.
*
* @param Request $request Incoming request
* @return string Rendered page content.
*/
public function dashboardAction(Request $request)
{
$operator = $this->getOperator();
$is_online = is_operator_online($operator['operatorid']);
$page = array('version' => MIBEW_VERSION, 'localeLinks' => get_locale_links(), 'needUpdate' => version_compare(Settings::get('dbversion'), MIBEW_VERSION, '<'), 'profilePage' => $this->generateUrl('operator_edit', array('operator_id' => $operator['operatorid'])), 'isOnline' => $is_online, 'warnOffline' => true, 'title' => getlocal('Home'), 'menuid' => 'main');
$page = array_merge($page, prepare_menu($operator));
return $this->render('index', $page);
}
示例13: setup_group_settings_tabs
function setup_group_settings_tabs($gid, $active)
{
global $page, $webimroot, $settings;
if ($gid) {
$page['tabs'] = array(getlocal("page_group.tab.main") => $active != 0 ? "{$webimroot}/operator/group.php?gid={$gid}" : "", getlocal("page_group.tab.members") => $active != 1 ? "{$webimroot}/operator/groupmembers.php?gid={$gid}" : "");
} else {
$page['tabs'] = array();
}
}
示例14: setup_group_settings_tabs
function setup_group_settings_tabs($gid, $active)
{
global $page, $webimroot, $settings;
if ($gid) {
$page['tabselected'] = $active;
$page['tabs'] = array(array('title' => getlocal("page_group.tab.main"), 'link' => "{$webimroot}/operator/group.php?gid={$gid}"), array('title' => getlocal("page_group.tab.members"), 'link' => "{$webimroot}/operator/groupmembers.php?gid={$gid}"));
} else {
$page['tabs'] = array();
}
}
示例15: buildTabs
/**
* Builds list of the styles tabs.
*
* @param Request $request Current request.
* @return array Tabs list. The keys of the array are tabs titles and the
* values are tabs URLs.
*/
protected function buildTabs(Request $request)
{
$tabs = array();
$type = $request->attributes->get('type');
$tabs[getlocal("Operator pages themes preview")] = $type != self::TYPE_PAGE ? $this->generateUrl('style_preview', array('type' => self::TYPE_PAGE)) : '';
$tabs[getlocal("Chat themes preview")] = $type != self::TYPE_CHAT ? $this->generateUrl('style_preview', array('type' => self::TYPE_CHAT)) : '';
if (Settings::get('enabletracking')) {
$tabs[getlocal("Invitation themes preview")] = $type != self::TYPE_INVITATION ? $this->generateUrl('style_preview', array('type' => self::TYPE_INVITATION)) : '';
}
return $tabs;
}