Remove global variable $page from setup_redirect_links func

This commit is contained in:
Dmitriy Simushev 2014-01-20 13:26:23 +00:00
parent 155c858fd6
commit 3feb32d6c9
2 changed files with 11 additions and 7 deletions

View File

@ -583,9 +583,8 @@ function logout_operator() {
$dispatcher->triggerEvent('operatorLogout'); $dispatcher->triggerEvent('operatorLogout');
} }
function setup_redirect_links($threadid, $operator, $token) function setup_redirect_links($threadid, $operator, $token) {
{ $result = array();
global $page;
$operator_in_isolation = in_isolation($operator); $operator_in_isolation = in_isolation($operator);
@ -607,7 +606,7 @@ function setup_redirect_links($threadid, $operator, $token)
} }
$p = pagination_info(max($operatorscount, $groupscount), 8); $p = pagination_info(max($operatorscount, $groupscount), 8);
$page['pagination'] = $p; $result['pagination'] = $p;
$operators = array_slice($operators, $p['start'], $p['end'] - $p['start']); $operators = array_slice($operators, $p['start'], $p['end'] - $p['start']);
$groups = array_slice($groups, $p['start'], $p['end'] - $p['start']); $groups = array_slice($groups, $p['start'], $p['end'] - $p['start']);
@ -627,7 +626,7 @@ function setup_redirect_links($threadid, $operator, $token)
topage(get_operator_name($agent)) . topage(get_operator_name($agent)) .
"</a> $status</li>"; "</a> $status</li>";
} }
$page['redirectToAgent'] = $agent_list; $result['redirectToAgent'] = $agent_list;
$group_list = ""; $group_list = "";
if (Settings::get('enablegroups') == "1") { if (Settings::get('enablegroups') == "1") {
@ -645,7 +644,9 @@ function setup_redirect_links($threadid, $operator, $token)
"</a> $status</li>"; "</a> $status</li>";
} }
} }
$page['redirectToGroup'] = $group_list; $result['redirectToGroup'] = $group_list;
return $result;
} }
function get_permission_list() function get_permission_list()

View File

@ -135,7 +135,10 @@ start_html_output();
$pparam = verifyparam("act", "/^(redirect)$/", "default"); $pparam = verifyparam("act", "/^(redirect)$/", "default");
if ($pparam == "redirect") { if ($pparam == "redirect") {
setup_redirect_links($threadid, $operator, $token); $page = array_merge_recursive(
$page,
setup_redirect_links($threadid, $operator, $token)
);
$chat_style->render('redirect', $page); $chat_style->render('redirect', $page);
} else { } else {
// Build js application options // Build js application options