ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLOTestAssignmentForm Class Reference
+ Collaboration diagram for ilLOTestAssignmentForm:

Public Member Functions

 __construct (object $gui, ilObject $a_container_obj, int $a_type)
 Constructor. More...
 
 getContainer ()
 
 getGUI ()
 
 getSettings ()
 
 getTestType ()
 
 initForm (bool $a_as_multi_assignment=false)
 

Data Fields

const TEST_NEW = 1
 
const TEST_ASSIGN = 2
 

Protected Member Functions

 getAssignableTests ()
 

Private Attributes

ilLanguage $lng
 
ilCtrlInterface $ctrl
 
ilTree $tree
 
ilObject $container
 
object $gui
 
ilLOSettings $settings
 
int $type = 0
 

Detailed Description

Definition at line 25 of file class.ilLOTestAssignmentForm.php.

Constructor & Destructor Documentation

◆ __construct()

ilLOTestAssignmentForm::__construct ( object  $gui,
ilObject  $a_container_obj,
int  $a_type 
)

Constructor.

Definition at line 42 of file class.ilLOTestAssignmentForm.php.

43 {
44 global $DIC;
45
46 $this->lng = $DIC->language();
47 $this->ctrl = $DIC->ctrl();
48 $this->tree = $DIC->repositoryTree();
49 $this->gui = $gui;
50 $this->container = $a_container_obj;
52 $this->type = $a_type;
53 }
static getInstanceByObjId(int $a_obj_id)
global $DIC
Definition: shib_login.php:26

References $DIC, $gui, ILIAS\Repository\ctrl(), getContainer(), ILIAS\Survey\Mode\getId(), ilLOSettings\getInstanceByObjId(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignableTests()

ilLOTestAssignmentForm::getAssignableTests ( )
protected

Definition at line 198 of file class.ilLOTestAssignmentForm.php.

198 : array
199 {
200 $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
201
202 $tests = array();
203 foreach ($this->tree->getChildsByType($this->getContainer()->getRefId(), 'tst') as $tree_node) {
204 if (!in_array($tree_node['child'], $assignments->getTests())) {
205 $tests[] = $tree_node['child'];
206 }
207 }
208 return $tests;
209 }
static getInstance(int $a_container_id)

References getContainer(), ILIAS\Survey\Mode\getId(), and ilLOTestAssignments\getInstance().

Referenced by initForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContainer()

ilLOTestAssignmentForm::getContainer ( )

Definition at line 55 of file class.ilLOTestAssignmentForm.php.

55 : ilObject
56 {
57 return $this->container;
58 }
Class ilObject Basic functions for all objects.

References $container.

Referenced by __construct(), getAssignableTests(), and initForm().

+ Here is the caller graph for this function:

◆ getGUI()

ilLOTestAssignmentForm::getGUI ( )

Definition at line 60 of file class.ilLOTestAssignmentForm.php.

60 : object
61 {
62 return $this->gui;
63 }

References $gui.

◆ getSettings()

ilLOTestAssignmentForm::getSettings ( )

Definition at line 65 of file class.ilLOTestAssignmentForm.php.

66 {
67 return $this->settings;
68 }
Settings for LO courses.

References $settings.

◆ getTestType()

ilLOTestAssignmentForm::getTestType ( )

Definition at line 70 of file class.ilLOTestAssignmentForm.php.

70 : int
71 {
72 return $this->type;
73 }

References $type.

Referenced by initForm().

+ Here is the caller graph for this function:

◆ initForm()

ilLOTestAssignmentForm::initForm ( bool  $a_as_multi_assignment = false)

Definition at line 75 of file class.ilLOTestAssignmentForm.php.

76 {
77 $form = new ilPropertyFormGUI();
78 $form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
79 $form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
80
81 if ($a_as_multi_assignment) {
82 $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
83 } else {
84 $form->addCommandButton('saveTest', $this->lng->txt('save'));
85 }
86
87 switch ($this->getTestType()) {
89 $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl'));
90 break;
91
93 $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl'));
94 break;
95 }
96
97 $assignable = $this->getAssignableTests();
98
99 $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode');
100 $cr_mode->setRequired(true);
101 $cr_mode->setValue((string) self::TEST_NEW);
102
103 $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), (string) self::TEST_NEW);
104
105 switch ($this->getTestType()) {
107 $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
108 break;
109
111 $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
112 break;
113 }
114
115 // title
116 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
117 $ti->setMaxLength(128);
118 $ti->setSize(40);
119 $ti->setRequired(true);
120 $new->addSubItem($ti);
121
122 // description
123 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
124 $ta->setCols(40);
125 $ta->setRows(2);
126 $new->addSubItem($ta);
127
128 // Question assignment type
129 $this->lng->loadLanguageModule('assessment');
130 $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype');
131 $qst->setRequired(true);
132
133 $random = new ilRadioOption(
134 $this->lng->txt('tst_question_set_type_random'),
136 );
137 $qst->addOption($random);
138
139 $fixed = new ilRadioOption(
140 $this->lng->txt('tst_question_set_type_fixed'),
142 );
143 $qst->addOption($fixed);
144 $new->addSubItem($qst);
145 $cr_mode->addOption($new);
146
147 // assign existing
148 $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), (string) self::TEST_ASSIGN);
149
150 switch ($this->getTestType()) {
152 $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
153 break;
154
156 $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
157 break;
158 }
159
160 if ($assignable === []) {
161 $existing->setDisabled(true);
162 }
163 $cr_mode->addOption($existing);
164
165 $options = array();
166 $options[''] = $this->lng->txt('select_one');
167 foreach ($assignable as $tst_ref_id) {
168 $tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
169 $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
170 }
171 $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst');
172 $selectable->setRequired(true);
173 $selectable->setOptions($options);
174 $existing->addSubItem($selectable);
175 $form->addItem($cr_mode);
176 if ($a_as_multi_assignment) {
177 $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
178
179 $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), false);
180
181 $options = array();
182 $options[''] = $this->lng->txt('select_one');
183 foreach ($objective_ids as $oid) {
184 $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
185 if (!$already_assigned_tst) {
186 $options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid);
187 }
188 }
189
190 $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective');
191 $objective->setRequired(true);
192 $objective->setOptions($options);
193 $form->addItem($objective);
194 }
195 return $form;
196 }
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
const QUESTION_SET_TYPE_RANDOM
const QUESTION_SET_TYPE_FIXED
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References ilCourseObjective\_getObjectiveIds(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), getAssignableTests(), getContainer(), ILIAS\Survey\Mode\getId(), ilLOTestAssignments\getInstance(), getTestType(), ILIAS\Repository\lng(), ilCourseObjective\lookupObjectiveTitle(), ilObjTest\QUESTION_SET_TYPE_FIXED, ilObjTest\QUESTION_SET_TYPE_RANDOM, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

Field Documentation

◆ $container

ilObject ilLOTestAssignmentForm::$container
private

Definition at line 34 of file class.ilLOTestAssignmentForm.php.

Referenced by getContainer().

◆ $ctrl

ilCtrlInterface ilLOTestAssignmentForm::$ctrl
private

Definition at line 31 of file class.ilLOTestAssignmentForm.php.

◆ $gui

object ilLOTestAssignmentForm::$gui
private

Definition at line 35 of file class.ilLOTestAssignmentForm.php.

Referenced by __construct(), and getGUI().

◆ $lng

ilLanguage ilLOTestAssignmentForm::$lng
private

Definition at line 30 of file class.ilLOTestAssignmentForm.php.

◆ $settings

ilLOSettings ilLOTestAssignmentForm::$settings
private

Definition at line 36 of file class.ilLOTestAssignmentForm.php.

Referenced by getSettings().

◆ $tree

ilTree ilLOTestAssignmentForm::$tree
private

Definition at line 32 of file class.ilLOTestAssignmentForm.php.

◆ $type

int ilLOTestAssignmentForm::$type = 0
private

Definition at line 37 of file class.ilLOTestAssignmentForm.php.

Referenced by getTestType().

◆ TEST_ASSIGN

const ilLOTestAssignmentForm::TEST_ASSIGN = 2

Definition at line 28 of file class.ilLOTestAssignmentForm.php.

◆ TEST_NEW

const ilLOTestAssignmentForm::TEST_NEW = 1

Definition at line 27 of file class.ilLOTestAssignmentForm.php.


The documentation for this class was generated from the following file: