4 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
56 $this->
object = $a_object;
58 $this->ref_id = $a_object->ref_id;
60 require_once
'./Modules/Test/classes/class.ilTestService.php';
70 if( ! (
bool)$setting->get(
'assessment_adjustments_enabled',
false) )
72 $this->ctrl->redirectByClass(
'ilObjTestGUI');
75 $cmd = $this->ctrl->getCmd();
76 $next_class = $this->ctrl->getNextClass($this);
87 switch (strtolower(
$cmd))
89 case 'savescoringfortest':
90 $this->saveQuestion();
93 case 'adjustscoringfortest':
97 case 'showquestionlist':
99 $this->questionsObject();
103 protected function questionsObject()
108 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
112 $this->ctrl->redirect($this,
"infoScreen");
118 return $this->
object->questionbrowser();
123 $this->ctrl->setParameter($this,
'q_id',
$_GET[
"eqid"]);
124 $this->ctrl->setParameter($this,
'qpl_id',
$_GET[
"eqpl"]);
125 $this->ctrl->redirect($this,
'adjustscoringfortest');
129 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_questions.html",
"Modules/Test");
131 $this->tpl->setCurrentBlock(
"adm_content");
133 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
134 $checked_move = is_array(
$_SESSION[
'tst_qst_move_' . $this->
object->getTestId()])
140 (($ilAccess->checkAccess(
"write",
"", $this->ref_id) ? true :
false)),
143 $data = $this->
object->getTestQuestions();
147 $this->
object->getPotentialRandomTestQuestions();
150 $filtered_data =
array();
151 foreach($data as $question)
157 $filtered_data[] = $question;
160 $table_gui->setData($filtered_data);
162 $table_gui->clearActionButtons();
163 $table_gui->clearCommandButtons();
164 $table_gui->multi =
array();
165 $table_gui->setRowTemplate(
'tpl.il_as_tst_adjust_questions_row.html',
'Modules/Test');
166 $table_gui->header_commands =
array();
167 $table_gui->setSelectAllCheckbox(null);
169 $this->tpl->setVariable(
'QUESTIONBROWSER', $table_gui->getHTML());
170 $this->tpl->setVariable(
"ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this,
'showquestionlist'));
171 $this->tpl->parseCurrentBlock();
198 $types = explode(
',',$setting->get(
'assessment_scoring_adjustment'));
199 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
201 foreach ($types as $type)
207 if (in_array($type,$type_def))
216 $form = $this->buildAdjustQuestionForm( (
int)
$_GET[
'q_id'], (
int)$_GET[
'qpl_id'] );
225 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_questions.html",
"Modules/Test" );
226 $this->tpl->setCurrentBlock(
"adm_content" );
227 $this->tpl->setVariable(
'QUESTIONBROWSER', $form->getHTML() );
228 $this->tpl->parseCurrentBlock();
237 protected function buildAdjustQuestionForm($question_id, $question_pool_id)
239 require_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
240 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
243 $form->setFormAction( $this->ctrl->getFormAction( $this ) );
244 $form->setMultipart( FALSE );
245 $form->setTableWidth(
"100%" );
246 $form->setId(
"adjustment" );
251 $form->setTitle( $question->object->getTitle() .
'<br /><small>(' . $question->outQuestionType() .
')</small>' );
254 $hidden_question_id->setValue( $question_id );
255 $form->addItem( $hidden_question_id );
258 $hidden_qpl_id->setValue( $question_pool_id );
259 $form->addItem( $hidden_qpl_id );
264 $manscoring_section->setTitle($this->lng->txt(
'manscoring'));
265 $form->addItem($manscoring_section);
267 $manscoring_preservation =
new ilCheckboxInputGUI($this->lng->txt(
'preserve_manscoring'),
'preserve_manscoring');
269 $manscoring_preservation->setInfo($this->lng->txt(
'preserve_manscoring_info'));
270 $form->addItem($manscoring_preservation);
272 $form->addCommandButton(
"savescoringfortest", $this->lng->txt(
"save"));
274 $participants = $this->
object->getParticipants();
275 $active_ids = array_keys($participants);
278 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
280 foreach( $active_ids as $active_id )
283 $passesSelector->setActiveId($active_id);
284 $passesSelector->loadLastFinishedPass();
286 foreach( $passesSelector->getClosedPasses() as
$pass )
288 $results[] = $question->object->getSolutionValues($active_id,
$pass);
292 $relevant_answers =
array();
295 foreach ($result as $answer)
297 if( $answer[
'question_fi'] == $question->object->getId() )
299 $relevant_answers[] = $answer;
304 $this->tpl->addCss(
'Modules/Test/templates/default/ta.css');
305 $answers_view = $question->getAggregatedAnswersView($relevant_answers);
307 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
309 include_once
'Services/YUI/classes/class.ilYuiUtil.php';
312 $this->tpl->addJavascript(
'./Services/UIComponent/Overlay/js/ilOverlay.js');
313 $this->tpl->addJavaScript(
"./Services/JavaScript/js/Basic.js");
315 $container =
new ilTemplate(
'tpl.il_as_tst_adjust_answer_aggregation_container.html',
true,
true,
'Modules/Test');
316 $container->setVariable(
'FORM_ELEMENT_NAME',
'aggr_usr_answ');
318 $container->setVariable(
'TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt(
'show_answer_overview'));
319 $container->setVariable(
'TXT_CLOSE', $this->lng->txt(
'close'));
320 $container->setVariable(
'ANSWER_OVERVIEW', $answers_view);
323 $custom_input->setHtml($container->get());
324 $form->addItem($custom_input);
328 protected function suppressPostParticipationFormElements(\
ilPropertyFormGUI $form, $postvars_to_suppress)
330 foreach ($postvars_to_suppress as $postvar)
334 $item->setDisabled(
true);
339 protected function saveQuestion()
341 $question_id =
$_POST[
'q_id'];
342 $question_pool_id =
$_POST[
'qpl_id'];
343 $form = $this->buildAdjustQuestionForm($question_id, $question_pool_id);
354 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
361 $question->writeQuestionSpecificPostData($form);
367 $question->object->saveAdditionalQuestionDataToDb();
372 $question->writeAnswerSpecificPostData($form);
377 $question->object->saveAnswerSpecificDataToDb();
380 $question->object->setPoints($question->object->getMaximumPoints());
381 $question->object->saveQuestionDataToDb();
383 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
385 $scoring->setPreserveManualScores(
$_POST[
'preserve_manscoring'] == 1 ?
true :
false);
386 $scoring->recalculateSolutions();
389 $this->questionsObject();
399 $question->setAdjustmentEditContext();
403 $question->populateQuestionSpecificFormPart($form);
405 $this->suppressPostParticipationFormElements(
406 $form, $question->getAfterParticipationSuppressionQuestionPostVars()
412 $question->populateAnswerSpecificFormPart($form);
414 $this->suppressPostParticipationFormElements(
415 $form, $question->getAfterParticipationSuppressionAnswerPostVars()
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
executeCommand()
execute command
allowedInAdjustment(\assQuestionGUI $question_object)
Returns if the question type is allowed for adjustments in the global test administration.
outputAdjustQuestionForm($form)
static getQuestionTypeByTypeId($type_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($a_glyph, $a_text="")
Get glyph html.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment.
populateScoringAdjustments( $question, $form)
special template class to simplify handling of ITX/PEAR
Interface ilObjAnswerScoringAdjustable.
const EDIT_CONTEXT_ADJUSTMENT
redirection script todo: (a better solution should control the processing via a xml file) ...
getQuestionType()
Returns the question type string.
Basic GUI class for assessment questions.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static initPanel($a_resize=false)
Init yui panel.
Create new PHPExcel object
obj_idprivate
Interface ilObjQuestionScoringAdjustable.
static initOverlay()
Init YUI Overlay module.
static initjQuery($a_tpl=null)
Init jQuery.
Interface ilGuiAnswerScoringAdjustable.
__construct(ilObjTest $a_object)
Default constructor.
Class ilScoringAdjustmentGUI.
Interface ilGuiQuestionScoringAdjustable.
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.