mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 01:50:34 +03:00
Update setup_survey function to return data
This commit is contained in:
parent
23812038d9
commit
b8b73e82fe
@ -99,7 +99,10 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
|||||||
if(Settings::get('enablepresurvey') == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on') && !$visitor_is_invited) {
|
if(Settings::get('enablepresurvey') == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on') && !$visitor_is_invited) {
|
||||||
$page = array();
|
$page = array();
|
||||||
setup_logo($group);
|
setup_logo($group);
|
||||||
setup_survey($visitor['name'], $email, $groupid, $info, $referrer);
|
$page = array_merge_recursive(
|
||||||
|
$page,
|
||||||
|
setup_survey($visitor['name'], $email, $groupid, $info, $referrer)
|
||||||
|
);
|
||||||
expand("styles/dialogs", getchatstyle(), "survey.tpl");
|
expand("styles/dialogs", getchatstyle(), "survey.tpl");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -160,28 +160,41 @@ function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_survey($name, $email, $groupid, $info, $referrer)
|
/**
|
||||||
{
|
* Prepare data to dispaly pre-chat survey
|
||||||
global $page;
|
*
|
||||||
|
* @param string $name User name
|
||||||
|
* @param string $email User email
|
||||||
|
* @param int $groupid Id of selected group
|
||||||
|
* @param string $info User info
|
||||||
|
* @param string $referrer URL of referrer page
|
||||||
|
* @return array Array of survey data
|
||||||
|
*
|
||||||
|
* @todo Think about $info param. It seems to be meaningless.
|
||||||
|
*/
|
||||||
|
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||||
|
$data = array();
|
||||||
|
|
||||||
$page['formname'] = topage($name);
|
$data['formname'] = topage($name);
|
||||||
$page['formemail'] = topage($email);
|
$data['formemail'] = topage($email);
|
||||||
$page['formgroupid'] = $groupid;
|
$data['formgroupid'] = $groupid;
|
||||||
$page['forminfo'] = topage($info);
|
$data['forminfo'] = topage($info);
|
||||||
$page['referrer'] = urlencode(topage($referrer));
|
$data['referrer'] = urlencode(topage($referrer));
|
||||||
|
|
||||||
if (Settings::get('enablegroups') == '1' && Settings::get('surveyaskgroup') == '1') {
|
if (Settings::get('enablegroups') == '1' && Settings::get('surveyaskgroup') == '1') {
|
||||||
$groups = setup_groups_select($groupid, true);
|
$groups = setup_groups_select($groupid, true);
|
||||||
if ($groups) {
|
if ($groups) {
|
||||||
$page['groups'] = $groups['select'];
|
$data['groups'] = $groups['select'];
|
||||||
$page['group.descriptions'] = json_encode($groups['descriptions']);
|
$data['group.descriptions'] = json_encode($groups['descriptions']);
|
||||||
$page['default.department.description'] = $groups['defaultdescription'];
|
$data['default.department.description'] = $groups['defaultdescription'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$page['showemail'] = Settings::get("surveyaskmail") == "1" ? "1" : "";
|
$data['showemail'] = Settings::get("surveyaskmail") == "1" ? "1" : "";
|
||||||
$page['showmessage'] = Settings::get("surveyaskmessage") == "1" ? "1" : "";
|
$data['showmessage'] = Settings::get("surveyaskmessage") == "1" ? "1" : "";
|
||||||
$page['showname'] = Settings::get('usercanchangename') == "1" ? "1" : "";
|
$data['showname'] = Settings::get('usercanchangename') == "1" ? "1" : "";
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_groups_select($groupid, $markoffline)
|
function setup_groups_select($groupid, $markoffline)
|
||||||
|
Loading…
Reference in New Issue
Block a user