forked from Combodo/customer-survey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_survey.php
147 lines (131 loc) · 4.33 KB
/
run_survey.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
// Copyright (C) 2010 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* iTop User Portal main page
*
* @author Erwan Taloc <[email protected]>
* @author Romain Quetiez <[email protected]>
* @author Denis Flaven <[email protected]>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
require_once('../../approot.inc.php');
require_once(APPROOT.'/application/application.inc.php');
require_once APPROOT.'setup/itopdesignformat.class.inc.php';
/////////////////////////////
//
// Main
//
try
{
require_once(APPROOT.'/application/startup.inc.php');
//if (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0') < 0) {
// require_once(APPROOT.'/application/nicewebpage.class.inc.php');
require_once(MODULESROOT.'/customer-survey/quizzwebpage.class.inc.php');
// }
require_once(MODULESROOT.'/customer-survey/quizzwizard.class.inc.php');
$oAppContext = new ApplicationContext();
$sOperation = utils::ReadParam('operation', '');
$sToken = utils::ReadParam('token', '', false, 'raw_data');
$iQuizz = utils::ReadParam('quizz_id', '');
switch($sOperation)
{
case 'async_action':
ini_set('max_execution_time', max(240, ini_get('max_execution_time')));
$sClass = utils::ReadParam('step_class', '');
$sState = utils::ReadParam('step_state', '');
$sActionCode = utils::ReadParam('code', '');
$aParams = utils::ReadParam('params', array(), false, 'raw_data');
if (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0') >= 0) {
$oPage = new AjaxPage('');
} else {
require_once(APPROOT.'/application/ajaxwebpage.class.inc.php');
$oPage = new ajax_page('');
}
if (is_subclass_of($sClass, 'WizardStep'))
{
$oDummyController = new QuizzController($sClass, 0, $iQuizz, $sToken);
$oStep = new $sClass($oDummyController, $sState);
$oStep->AsyncAction($oPage, $sActionCode, $aParams);
}
$oPage->output();
break;
default:
$oWizard = new QuizzController('QuizzWizStepQuestions', 'start', $iQuizz, $sToken);
$oWizard->Run();
}
}
catch(CoreException $e)
{
require_once(APPROOT.'/setup/setuppage.class.inc.php');
$oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
$oP->add("<h1>".Dict::S('UI:FatalErrorMessage')."</h1>\n");
$oP->error(Dict::Format('UI:Error_Details', $e->getHtmlDesc()));
$oP->output();
if (MetaModel::IsLogEnabledIssue())
{
if (MetaModel::IsValidClass('EventIssue'))
{
try
{
$oLog = new EventIssue();
$oLog->Set('message', $e->getMessage());
$oLog->Set('userinfo', '');
$oLog->Set('issue', $e->GetIssue());
$oLog->Set('impact', 'Page could not be displayed');
$oLog->Set('callstack', $e->getTrace());
$oLog->Set('data', $e->getContextData());
$oLog->DBInsertNoReload();
}
catch(Exception $e)
{
IssueLog::Error("Failed to log issue into the DB");
}
}
IssueLog::Error($e->getMessage());
}
// For debugging only
//throw $e;
}
catch(Exception $e)
{
require_once(APPROOT.'/setup/setuppage.class.inc.php');
$oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
$oP->add("<h1>".Dict::S('UI:FatalErrorMessage')."</h1>\n");
$oP->error(Dict::Format('UI:Error_Details', $e->getMessage()));
$oP->output();
if (MetaModel::IsLogEnabledIssue())
{
if (MetaModel::IsValidClass('EventIssue'))
{
try
{
$oLog = new EventIssue();
$oLog->Set('message', $e->getMessage());
$oLog->Set('userinfo', '');
$oLog->Set('issue', 'PHP Exception');
$oLog->Set('impact', 'Page could not be displayed');
$oLog->Set('callstack', $e->getTrace());
$oLog->Set('data', array());
$oLog->DBInsertNoReload();
}
catch(Exception $e)
{
IssueLog::Error("Failed to log issue into the DB");
}
}
IssueLog::Error($e->getMessage());
}
}