180 $nextClass = $this->ctrl->getNextClass();
182 $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
185 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
188 switch ($nextClass) {
189 case strtolower(__CLASS__):
209 case self::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM:
210 case self::CMD_UPDATE_SKILL_QUEST_ASSIGNS:
222 if (is_array(
$_POST[
'skill_points'])) {
223 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
225 for (
$i = 0;
$i < 2;
$i++) {
226 foreach (
$_POST[
'skill_points'] as $assignmentKey => $skillPoints) {
227 $assignmentKey = explode(
':', $assignmentKey);
228 $skillBaseId = (int) $assignmentKey[0];
229 $skillTrefId = (int) $assignmentKey[1];
230 $questionId = (int) $assignmentKey[2];
236 if (!$assignment->isValidSkillPoint($skillPoints)) {
244 $assignment->setQuestionId($questionId);
245 $assignment->setSkillBaseId($skillBaseId);
246 $assignment->setSkillTrefId($skillTrefId);
248 if ($assignment->dbRecordExists()) {
249 $assignment->loadFromDb();
251 if (!$assignment->hasEvalModeBySolution()) {
252 $assignment->setSkillPoints((
int) $skillPoints);
253 $assignment->saveToDb();
262 ilUtil::sendSuccess($this->lng->txt(
'tst_msg_skl_qst_assign_points_saved'),
true);
263 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
272 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
274 $questionId = (int)
$_GET[
'question_id'];
279 $assignmentList->loadFromDb();
281 $handledSkills = array();
285 $skillIds = $sgui->getSelectedSkills();
287 foreach ($skillIds as $skillId) {
288 $skill = explode(
':', $skillId);
289 $skillBaseId = (int) $skill[0];
290 $skillTrefId = (int) $skill[1];
293 if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
297 $assignment->setQuestionId($questionId);
298 $assignment->setSkillBaseId($skillBaseId);
299 $assignment->setSkillTrefId($skillTrefId);
303 $assignment->saveToDb();
306 $handledSkills[$skillId] = $skill;
310 foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
311 if (isset($handledSkills[
"{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
315 $assignment->deleteFromDb();
318 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assigns_updated'),
true);
322 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
326 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
331 $this->ctrl->saveParameter($this,
'question_id');
332 $questionId = (int)
$_GET[
'question_id'];
334 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
337 $assignmentList->loadFromDb();
340 $assignmentList->getAssignmentsByQuestionId($questionId)
343 if (!$skillSelectorExplorerGUI->handleCommand()) {
344 $tpl =
new ilTemplate(
'tpl.qpl_qst_skl_assign_selection.html',
false,
false,
'Modules/TestQuestionPool');
350 $skillSelectorToolbarGUI->setOpenFormTag(
true);
351 $skillSelectorToolbarGUI->setCloseFormTag(
false);
353 $tpl->setVariable(
'SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
355 $tpl->setVariable(
'SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
357 $skillSelectorToolbarGUI->setOpenFormTag(
false);
358 $skillSelectorToolbarGUI->setCloseFormTag(
true);
360 $tpl->setVariable(
'SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
362 $this->tpl->setContent(
$tpl->get());
375 if ($questionGUI === null) {
376 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
380 if ($assignment === null) {
382 (
int)
$_GET[
'question_id'],
383 (
int) $_GET[
'skill_base_id'],
384 (
int) $_GET[
'skill_tref_id']
388 if (
$form === null) {
396 $this->tpl->setContent($this->ctrl->getHTML(
$form) .
'<br />' . $questionPageHTML . $lacLegendHTML);
401 $questionId = (int)
$_GET[
'question_id'];
404 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
408 (
int)
$_GET[
'question_id'],
409 (
int) $_GET[
'skill_base_id'],
410 (
int) $_GET[
'skill_tref_id']
415 if (!
$form->checkInput()) {
416 $form->setValuesByPost();
420 $form->setValuesByPost();
422 if (
$form->getItemByPostVar(
'eval_mode')) {
423 $assignment->setEvalMode(
$form->getItemByPostVar(
'eval_mode')->getValue());
428 if ($assignment->hasEvalModeBySolution()) {
429 $solCmpExprInput =
$form->getItemByPostVar(
'solution_compare_expressions');
437 $assignment->initSolutionComparisonExpressionList();
438 $assignment->getSolutionComparisonExpressionList()->reset();
440 foreach ($solCmpExprInput->getValues() as $expression) {
441 $assignment->getSolutionComparisonExpressionList()->add($expression);
444 $assignment->setSkillPoints(
$form->getItemByPostVar(
'q_res_skill_points')->getValue());
447 $assignment->saveToDb();
449 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assign_properties_modified'),
true);
452 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
456 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
461 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
464 $form->setQuestion($question);
465 $form->setAssignment($assignment);
478 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
481 $assignmentList->loadFromDb();
482 $assignmentList->loadAdditionalSkillData();
483 $table->setSkillQuestionAssignmentList($assignmentList);
486 $this->tpl->setContent($this->ctrl->getHTML(
$table));
491 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
493 if (!$questionData[
'original_id']) {
497 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
505 if ($this->access->checkAccess(
'write',
'', $parentRefId)) {
515 $questionId = (int)
$_GET[
'question_id'];
517 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
520 $confirmation->setHeaderText($this->lng->txt(
'qpl_sync_quest_skl_assigns_confirmation'));
522 $confirmation->setFormAction($this->ctrl->getFormAction($this));
523 $confirmation->addHiddenItem(
'question_id', $questionId);
524 $confirmation->setConfirm($this->lng->txt(
'yes'), self::CMD_SYNC_ORIGINAL);
525 $confirmation->setCancel($this->lng->txt(
'no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
527 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
532 $questionId = (int)
$_POST[
'question_id'];
537 $question->syncSkillAssignments(
538 $question->getObjId(),
540 $question->lookupParentObjId($question->getOriginalId()),
541 $question->getOriginalId()
544 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assign_synced_to_orig'),
true);
547 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
552 require_once
'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
562 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
566 return $assignmentList;
574 require_once
'Services/Skill/classes/class.ilSkillSelectorGUI.php';
578 self::CMD_SHOW_SKILL_SELECT,
580 self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
581 self::PARAM_SKILL_SELECTION
584 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION,
true);
590 foreach ($assignments as $assignment) {
591 $id =
"{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
593 $skillSelectorExplorerGUI->setSkillSelected(
$id);
596 return $skillSelectorExplorerGUI;
604 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
608 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
609 $skillSelectorToolbarGUI->addFormButton($this->lng->txt(
'qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
610 $skillSelectorToolbarGUI->addFormButton($this->lng->txt(
'qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
612 return $skillSelectorToolbarGUI;
617 $this->tpl->addCss(
'Services/COPage/css/content.css');
619 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
623 $pageGUI->setRenderPageContainer(
true);
625 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
627 $questionGUI->object->setShuffle(
false);
628 $questionHTML = $questionGUI->
getSolutionOutput(0, 0,
false,
false,
true,
false,
true,
false,
true);
629 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
631 $pageHTML = $pageGUI->presentation();
632 $pageHTML = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $pageHTML);
642 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
647 $assignment->setQuestionId($questionId);
648 $assignment->setSkillBaseId($skillBaseId);
649 $assignment->setSkillTrefId($skillTrefId);
651 $assignment->loadFromDb();
652 $assignment->loadAdditionalSkillData();
659 return $this->questionList->isInList($questionId);
666 foreach ($input->
getValues() as $expression) {
670 $errors[] =
"{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
675 $alert = $this->lng->txt(
'ass_lac_validation_error');
676 $alert .=
'<br />' . implode(
'<br />',
$errors);
686 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
687 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
688 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
692 $conditionComposite = $conditionParser->parse($expression->
getExpression());
694 $questionProvider->setQuestion($question);
697 $conditionValidator->validate($conditionComposite);
700 return $e->getFormAlert($this->lng);
711 $this->ctrl->saveParameter($this,
'question_id');
712 $this->ctrl->saveParameter($this,
'skill_base_id');
713 $this->ctrl->saveParameter($this,
'skill_tref_id');
718 $orderedQuestionsData = array();
722 $orderedQuestionsData[$questionId] = $questionData[$questionId];
725 return $orderedQuestionsData;
728 foreach ($questionData as $questionId =>
$data) {
729 $orderedQuestionsData[$questionId] =
$data[
'title'];
734 foreach ($orderedQuestionsData as $questionId => $questionTitle) {
735 $orderedQuestionsData[$questionId] = $questionData[$questionId];
738 return $orderedQuestionsData;
750 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
752 return sprintf($this->lng->txt(
'qpl_qst_skl_selection_for_question_header'), $questionData[
'title']);
757 $flags = SORT_REGULAR;
759 if (defined(
'SORT_NATURAL')) {
760 $flags = SORT_NATURAL;
761 } elseif (defined(
'SORT_STRING')) {
762 $flags = SORT_STRING;
765 if (defined(
'SORT_FLAG_CASE')) {
766 $flags = $flags | SORT_FLAG_CASE;
769 asort($array, $flags);
789 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
791 $legend->setQuestionOBJ($questionOBJ);
793 $lacLegendHTML = $this->ctrl->getHTML(
$legend);
794 return $lacLegendHTML;
This class provides processing control methods.
const CMD_UPDATE_SKILL_QUEST_ASSIGNS
Class iQuestionCondition.
const CMD_SHOW_SKILL_SELECT
setAssignmentConfigurationHintMessage($assignmentConfigurationHintMessage)
sortAlphabetically($array)
setQuestionContainerId($questionContainerId)
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
const PARAM_SKILL_SELECTION
saveSkillQuestionAssignmentPropertiesFormCmd()
keepAssignmentParameters()
Abstract basic class which is to be extended by the concrete assessment question type classes...
isSyncOriginalPossibleAndAllowed($questionId)
doesObjectTypeMatch($objectId)
if(!array_key_exists('StateId', $_REQUEST)) $id
isAssignmentEditingEnabled()
setAssignmentEditingEnabled($assignmentEditingEnabled)
getSkillSelectorHeader($questionId)
$assignmentConfigurationHintMessage
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db)
showSyncOriginalConfirmationCmd()
const CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM
$assignmentEditingEnabled
const CMD_SAVE_SKILL_POINTS
static lookupParentObjId($questionId)
ilDBInterface $ilDB
static _getAllReferences($a_id)
get all reference ids of object
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)
Interface ilAccessHandler.
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class CompositeValidator.
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
special template class to simplify handling of ITX/PEAR
setQuestionList($questionList)
setQuestionOrderSequence($questionOrderSequence)
Basic GUI class for assessment questions.
buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getAssignmentConfigurationHintMessage()
checkSolutionCompareExpressionInput(ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
getQuestionOrderSequence()
isAvoidManipulationRedirectRequired($command)
Explorer class that works on tree objects (Services/Tree)
const DEFAULT_COMPETENCE_POINTS
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)
Class ilParserQuestionProvider.
buildSkillSelectorExplorerGUI($assignments)
buildSkillSelectorToolbarGUI()
isTestQuestion($questionId)
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
if(empty($password)) $table
const CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION
buildSkillQuestionAssignmentList()
const EVAL_MODE_BY_QUESTION_RESULT
handleAssignmentConfigurationHintMessage()
updateSkillQuestionAssignmentsCmd()
const CMD_SHOW_SKILL_QUEST_ASSIGNS
orderQuestionData($questionData)
buildQuestionPage(assQuestionGUI $questionGUI)
const CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.
Confirmation screen class.