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)) {
71 $this->ctrl->redirectByClass(
'ilObjTestGUI');
74 $cmd = $this->ctrl->getCmd();
75 $next_class = $this->ctrl->getNextClass($this);
77 switch ($next_class) {
85 switch (strtolower($cmd)) {
86 case 'savescoringfortest':
87 $this->saveQuestion();
90 case 'adjustscoringfortest':
94 case 'showquestionlist':
96 $this->questionsObject();
100 protected function questionsObject()
105 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
108 $this->ctrl->redirect($this,
"infoScreen");
111 if (
$_GET[
'browse']) {
113 return $this->
object->questionbrowser();
117 $this->ctrl->setParameter($this,
'q_id',
$_GET[
"eqid"]);
118 $this->ctrl->setParameter($this,
'qpl_id',
$_GET[
"eqpl"]);
119 $this->ctrl->redirect($this,
'adjustscoringfortest');
123 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_questions.html",
"Modules/Test");
125 $this->tpl->setCurrentBlock(
"adm_content");
127 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
128 $checked_move = is_array(
$_SESSION[
'tst_qst_move_' . $this->
object->getTestId()])
134 (($ilAccess->checkAccess(
"write",
"", $this->ref_id) ? true :
false)),
139 $data = $this->
object->getTestQuestions();
142 $this->
object->getPotentialRandomTestQuestions();
145 $filtered_data =
array();
146 foreach ($data as $question) {
150 $filtered_data[] = $question;
153 $table_gui->setData($filtered_data);
155 $table_gui->clearActionButtons();
156 $table_gui->clearCommandButtons();
157 $table_gui->multi =
array();
158 $table_gui->setRowTemplate(
'tpl.il_as_tst_adjust_questions_row.html',
'Modules/Test');
159 $table_gui->header_commands =
array();
160 $table_gui->setSelectAllCheckbox(null);
162 $this->tpl->setVariable(
'QUESTIONBROWSER', $table_gui->getHTML());
163 $this->tpl->setVariable(
"ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this,
'showquestionlist'));
164 $this->tpl->parseCurrentBlock();
191 $types = explode(
',', $setting->get(
'assessment_scoring_adjustment'));
192 require_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
194 foreach ($types as
$type) {
199 if (in_array($type, $type_def)) {
207 $form = $this->buildAdjustQuestionForm((
int)
$_GET[
'q_id'], (
int) $_GET[
'qpl_id']);
216 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_as_tst_questions.html",
"Modules/Test");
217 $this->tpl->setCurrentBlock(
"adm_content");
218 $this->tpl->setVariable(
'QUESTIONBROWSER',
$form->getHTML());
219 $this->tpl->parseCurrentBlock();
228 protected function buildAdjustQuestionForm($question_id, $question_pool_id)
230 require_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
231 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
234 $form->setFormAction($this->ctrl->getFormAction($this));
235 $form->setMultipart(
false);
236 $form->setTableWidth(
"100%");
237 $form->setId(
"adjustment");
242 $form->setTitle($question->object->getTitle() .
'<br /><small>(' . $question->outQuestionType() .
')</small>');
245 $hidden_question_id->setValue($question_id);
246 $form->addItem($hidden_question_id);
249 $hidden_qpl_id->setValue($question_pool_id);
250 $form->addItem($hidden_qpl_id);
255 $manscoring_section->setTitle($this->lng->txt(
'manscoring'));
256 $form->addItem($manscoring_section);
258 $manscoring_preservation =
new ilCheckboxInputGUI($this->lng->txt(
'preserve_manscoring'),
'preserve_manscoring');
260 $manscoring_preservation->setInfo($this->lng->txt(
'preserve_manscoring_info'));
261 $form->addItem($manscoring_preservation);
263 $form->addCommandButton(
"savescoringfortest", $this->lng->txt(
"save"));
265 $participants = $this->
object->getParticipants();
266 $active_ids = array_keys($participants);
269 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
271 foreach ($active_ids as $active_id) {
273 $passesSelector->setActiveId($active_id);
274 $passesSelector->loadLastFinishedPass();
276 foreach ($passesSelector->getClosedPasses() as
$pass) {
277 $results[] = $question->object->getSolutionValues($active_id,
$pass);
281 $relevant_answers =
array();
283 foreach ($result as $answer) {
284 if ($answer[
'question_fi'] == $question->object->getId()) {
285 $relevant_answers[] = $answer;
290 $this->tpl->addCss(
'Modules/Test/templates/default/ta.css');
291 $answers_view = $question->getAggregatedAnswersView($relevant_answers);
293 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
295 include_once
'Services/YUI/classes/class.ilYuiUtil.php';
298 $this->tpl->addJavascript(
'./Services/UIComponent/Overlay/js/ilOverlay.js');
299 $this->tpl->addJavaScript(
"./Services/JavaScript/js/Basic.js");
301 $container =
new ilTemplate(
'tpl.il_as_tst_adjust_answer_aggregation_container.html',
true,
true,
'Modules/Test');
302 $container->setVariable(
'FORM_ELEMENT_NAME',
'aggr_usr_answ');
304 $container->setVariable(
'TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt(
'show_answer_overview'));
305 $container->setVariable(
'TXT_CLOSE', $this->lng->txt(
'close'));
306 $container->setVariable(
'ANSWER_OVERVIEW', $answers_view);
310 $form->addItem($custom_input);
316 foreach ($postvars_to_suppress as $postvar) {
319 $item->setDisabled(
true);
324 protected function saveQuestion()
326 $question_id =
$_POST[
'q_id'];
327 $question_pool_id =
$_POST[
'qpl_id'];
328 $form = $this->buildAdjustQuestionForm($question_id, $question_pool_id);
338 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
344 $question->writeQuestionSpecificPostData($form);
348 $question->object->saveAdditionalQuestionDataToDb();
352 $question->writeAnswerSpecificPostData($form);
356 $question->object->saveAnswerSpecificDataToDb();
359 $question->object->setPoints($question->object->getMaximumPoints());
360 $question->object->saveQuestionDataToDb();
362 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
364 $scoring->setPreserveManualScores(
$_POST[
'preserve_manscoring'] == 1 ?
true :
false);
365 $scoring->recalculateSolutions();
368 $this->questionsObject();
377 $question->setAdjustmentEditContext();
380 $question->populateQuestionSpecificFormPart($form);
382 $this->suppressPostParticipationFormElements(
384 $question->getAfterParticipationSuppressionQuestionPostVars()
389 $question->populateAnswerSpecificFormPart($form);
391 $this->suppressPostParticipationFormElements(
393 $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.
static initOverlay(ilTemplate $a_main_tpl=null)
Init YUI Overlay module.
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment.
if(isset($_POST['submit'])) $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) ...
populateScoringAdjustments($question, $form)
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.
Create new PHPExcel object
obj_idprivate
Interface ilObjQuestionScoringAdjustable.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
Interface ilGuiAnswerScoringAdjustable.
__construct(ilObjTest $a_object)
Default constructor.
Class ilScoringAdjustmentGUI.
Interface ilGuiQuestionScoringAdjustable.
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.