4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 include_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
37 parent::__construct();
38 include_once
"./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
40 $this->newUnitId = null;
42 $this->
object->loadFromDb(
$id);
48 if (preg_match(
"/suggestrange_(.*?)/", $cmd, $matches)) {
49 $cmd =
"suggestRange";
72 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
74 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
87 if (
$_POST[
'flash'][
'delete'] == 1) {
88 $this->
object->deleteApplet();
90 $this->
object->setApplet(
$_POST[
'flash'][
'filename']);
92 if ($_FILES[
"flash"][
"tmp_name"]) {
93 $this->
object->deleteApplet();
94 $filename = $this->
object->moveUploadedFile($_FILES[
"flash"][
"tmp_name"], $_FILES[
"flash"][
"name"]);
97 $this->
object->clearParameters();
98 if (is_array(
$_POST[
"flash"][
"flash_param_name"])) {
99 foreach (
$_POST[
'flash'][
'flash_param_name'] as $idx => $val) {
100 $this->
object->addParameter($val,
$_POST[
'flash'][
'flash_param_value'][$idx]);
103 if (is_array(
$_POST[
'flash'][
'flash_param_delete'])) {
104 foreach (
$_POST[
'flash'][
'flash_param_delete'] as
$key => $value) {
105 $this->
object->removeParameter(
$_POST[
'flash'][
'flash_param_name'][
$key]);
109 $this->
object->setWidth(
$_POST[
"flash"][
"width"]);
110 $this->
object->setHeight(
$_POST[
"flash"][
"height"]);
111 $this->
object->setPoints(
$_POST[
"points"]);
125 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
127 $this->editForm =
$form;
129 $form->setFormAction($this->ctrl->getFormAction($this));
131 $form->setMultipart(
true);
132 $form->setTableWidth(
"100%");
133 $form->setId(
"flash");
145 $form->setValuesByPost();
147 $form->setValuesByPost();
154 $this->tpl->setVariable(
"QUESTION_DATA",
$form->getHTML());
164 if (strlen($this->
object->getApplet())) {
165 $flash->setApplet($this->
object->getApplet());
166 $flash->setAppletPathWeb($this->
object->getFlashPathWeb());
168 $flash->setWidth($this->
object->getWidth());
169 $flash->setHeight($this->
object->getHeight());
170 $flash->setParameters($this->
object->getParameters());
172 if ($this->
object->getId()) {
174 $hidden->setValue($this->
object->getId());
180 $points->setRequired(
true);
182 $points->setMinValue(0.0);
191 $this->
object->addParameter(
"",
"");
211 $graphicalOutput =
false,
212 $result_output =
false,
213 $show_question_only =
true,
214 $show_feedback =
false,
215 $show_correct_solution =
false,
216 $show_manual_scoring =
false,
217 $show_question_text =
true 220 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
223 if (is_array($this->
object->getParameters())) {
224 foreach ($this->
object->getParameters() as
$name => $value) {
225 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
230 array_push(
$params,
"client=" . urlencode(CLIENT_ID));
231 array_push(
$params,
"points_max=" . urlencode($this->
object->getPoints()));
233 if (!is_null(
$pass)) {
236 include_once
"./Modules/Test/classes/class.ilObjTest.php";
240 array_push(
$params,
"active_id=" . $active_id);
242 array_push(
$params,
"question_id=" . $this->
object->getId());
244 if ($show_correct_solution) {
245 array_push(
$params,
"solution=correct");
247 array_push(
$params,
"solution=user");
250 if (($active_id > 0) && (!$show_correct_solution)) {
251 if ($graphicalOutput) {
253 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
254 if ($reached_points == $this->
object->getMaximumPoints()) {
257 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
261 if ($reached_points > 0) {
263 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
266 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
274 $template->setCurrentBlock(
"flash_vars");
277 $template->setCurrentBlock(
"applet_parameters");
281 if ($show_question_text==
true) {
282 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(),
true));
287 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
291 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
292 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
293 $solutionoutput = $solutiontemplate->get();
294 if (!$show_question_only) {
298 return $solutionoutput;
301 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
303 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",
true,
true,
"Modules/TestQuestionPool");
305 if (is_array($this->
object->getParameters())) {
306 foreach ($this->
object->getParameters() as
$name => $value) {
307 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
311 $template->setCurrentBlock(
"flash_vars");
314 $template->setCurrentBlock(
"applet_parameters");
318 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(),
true));
322 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
325 if (!$show_question_only) {
329 return $questionoutput;
333 public function getTestOutput($active_id,
$pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false)
337 $template =
new ilTemplate(
"tpl.il_as_qpl_flash_question_output.html",
true,
true,
"Modules/TestQuestionPool");
339 if (is_array($this->
object->getParameters())) {
340 foreach ($this->
object->getParameters() as
$name => $value) {
341 array_push(
$params, urlencode($name) .
"=" . urlencode($value));
346 array_push(
$params,
"client=" . urlencode(CLIENT_ID));
347 array_push(
$params,
"points_max=" . urlencode($this->
object->getPoints()));
352 include_once
"./Modules/Test/classes/class.ilObjTest.php";
356 array_push(
$params,
"active_id=" . $active_id);
358 array_push(
$params,
"question_id=" . $this->
object->getId());
361 $template->setCurrentBlock(
"flash_vars");
364 $template->setCurrentBlock(
"applet_parameters");
368 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(),
true));
372 $template->setVariable(
"APPLET_PATH", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
373 $template->setVariable(
"APPLET_FILE", $this->
object->getFlashPathWeb() . $this->
object->getApplet());
376 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
389 global $rbacsystem, $ilTabs;
391 $ilTabs->clearTargets();
393 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
394 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
395 $q_type = $this->
object->getQuestionType();
397 if (strlen($q_type)) {
398 $classname = $q_type .
"GUI";
399 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
400 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
404 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
408 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
409 array(
"edit",
"insert",
"exec_pg"),
419 $force_active =
false;
420 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
423 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
425 $commands =
$_POST[
"cmd"];
426 if (is_array($commands)) {
427 foreach ($commands as
$key => $value) {
428 if (preg_match(
"/^suggestrange_.*/",
$key, $matches)) {
429 $force_active =
true;
437 array(
"editQuestion",
"save",
"flashAddParam",
"saveEdit",
"originalSyncForm"),
457 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
470 return $this->
object->prepareTextareaOutput(
$output,
true);
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
Get the question solution output.
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
The assFlashQuestionGUI class encapsulates the GUI representation for flash questions.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
if(!array_key_exists('StateId', $_REQUEST)) $id
writePostData($always=false)
{}
Class for Flash based questions.
getQuestionTemplate()
get question template
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct($id=-1)
assFlashQuestionGUI constructor
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
writeQuestionGenericPostData()
if(isset($_POST['submit'])) $form
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
getSpecificFeedbackOutput($active_id, $pass)
special template class to simplify handling of ITX/PEAR
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
setQuestionTabs()
Sets the ILIAS tabs for this question type.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
Basic GUI class for assessment questions.
static removeTrailingPathSeparators($path)
setErrorMessage($errormessage)
Create styles array
The data for the language used.
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
saveTaxonomyAssignments()
Create new PHPExcel object
obj_idprivate
addBackTab(ilTabsGUI $ilTabs)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
Interface ilGuiQuestionScoringAdjustable.
getPreview($show_question_only=false, $showInlineFeedback=false)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
suggestRange()
Suggest a range for a result.