ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLOTestAssignmentForm Class Reference
+ Collaboration diagram for ilLOTestAssignmentForm:

Public Member Functions

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

Data Fields

const TEST_NEW = 1
 
const TEST_ASSIGN = 2
 

Protected Member Functions

 getAssignableTests ()
 Get assignable tests. More...
 

Private Attributes

 $lng = null
 
 $ctrl = null
 
 $container = null
 
 $gui = null
 
 $settings = null
 
 $type = 0
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

31 {
32 $this->lng = $GLOBALS['DIC']['lng'];
33 $this->ctrl = $GLOBALS['DIC']['ilCtrl'];
34
35 $this->gui = $gui;
36 $this->container = $a_container_obj;
37 $this->settings = ilLOSettings::getInstanceByObjId($this->getContainer()->getId());
38
39 $this->type = $a_type;
40 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByObjId($a_obj_id)
get singleton instance
settings()
Definition: settings.php:2
$a_type
Definition: workflow.php:92

References $a_type, $GLOBALS, $gui, getContainer(), ilLOSettings\getInstanceByObjId(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignableTests()

ilLOTestAssignmentForm::getAssignableTests ( )
protected

Get assignable tests.

Returns
array

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

206 {
207 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
208 $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
209
210 $tests = array();
211 foreach ($GLOBALS['DIC']['tree']->getChildsByType($this->getContainer()->getRefId(), 'tst') as $tree_node) {
212 if (!in_array($tree_node['child'], $assignments->getTests())) {
213 $tests[] = $tree_node['child'];
214 }
215 }
216 return $tests;
217 }
static getInstance($a_container_id)
Get instance by container id.

References $GLOBALS, getContainer(), 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 ( )
Returns
ilObject

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

References $container.

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

+ Here is the caller graph for this function:

◆ getGUI()

ilLOTestAssignmentForm::getGUI ( )

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

51 {
52 return $this->gui;
53 }

References $gui.

◆ getSettings()

ilLOTestAssignmentForm::getSettings ( )
Returns
ilLOSettings

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

References $settings.

◆ getTestType()

ilLOTestAssignmentForm::getTestType ( )

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

References $type.

Referenced by initForm().

+ Here is the caller graph for this function:

◆ initForm()

ilLOTestAssignmentForm::initForm (   $a_as_multi_assignment = false)

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

70 {
71 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
72 $form = new ilPropertyFormGUI();
73 $form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
74 $form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
75
76 if ($a_as_multi_assignment) {
77 $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
78 } else {
79 $form->addCommandButton('saveTest', $this->lng->txt('save'));
80 }
81
82 switch ($this->getTestType()) {
84 $form->setTitle($this->lng->txt('crs_loc_settings_itest_tbl'));
85 break;
86
88 $form->setTitle($this->lng->txt('crs_loc_settings_qtest_tbl'));
89 break;
90
91 }
92
93 $assignable = $this->getAssignableTests();
94
95 $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'), 'mode');
96 $cr_mode->setRequired(true);
97 $cr_mode->setValue(self::TEST_NEW);
98
99 $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'), self::TEST_NEW);
100
101 switch ($this->getTestType()) {
103 $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
104 break;
105
107 $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
108 break;
109 }
110
111 // title
112 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
113 $ti->setMaxLength(128);
114 $ti->setSize(40);
115 $ti->setRequired(true);
116 $new->addSubItem($ti);
117
118 // description
119 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
120 $ta->setCols(40);
121 $ta->setRows(2);
122 $new->addSubItem($ta);
123
124 // Question assignment type
125 include_once './Modules/Test/classes/class.ilObjTest.php';
126 $this->lng->loadLanguageModule('assessment');
127 $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'), 'qtype');
128 $qst->setRequired(true);
129
130 $random = new ilRadioOption(
131 $this->lng->txt('tst_question_set_type_random'),
133 );
134 $qst->addOption($random);
135
136 $fixed = new ilRadioOption(
137 $this->lng->txt('tst_question_set_type_fixed'),
139 );
140 $qst->addOption($fixed);
141 $new->addSubItem($qst);
142 $cr_mode->addOption($new);
143
144 // assign existing
145 $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'), self::TEST_ASSIGN);
146
147 switch ($this->getTestType()) {
149 $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
150 break;
151
153 $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
154 break;
155 }
156
157 if (!$assignable) {
158 $existing->setDisabled(true);
159 }
160 $cr_mode->addOption($existing);
161
162 $options = array();
163 $options[''] = $this->lng->txt('select_one');
164 foreach ((array) $assignable as $tst_ref_id) {
165 $tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
166 $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
167 }
168 $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'), 'tst');
169 $selectable->setRequired(true);
170 $selectable->setOptions($options);
171 $existing->addSubItem($selectable);
172
173 $form->addItem($cr_mode);
174
175
176 if ($a_as_multi_assignment) {
177 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
178 $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
179
180 include_once './Modules/Course/classes/class.ilCourseObjective.php';
181 $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), false);
182
183 $options = array();
184 $options[''] = $this->lng->txt('select_one');
185 foreach ($objective_ids as $oid) {
186 $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
187 if (!$already_assigned_tst) {
188 $options[$oid] = ilCourseObjective::lookupObjectiveTitle($oid);
189 }
190 }
191
192 $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'), 'objective');
193 $objective->setRequired(true);
194 $objective->setOptions($options);
195 $form->addItem($objective);
196 }
197
198 return $form;
199 }
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static _getObjectiveIds($course_id, $a_activated_only=false)
getAssignableTests()
Get assignable tests.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
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(), getAssignableTests(), getContainer(), ilLOTestAssignments\getInstance(), getTestType(), 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

ilLOTestAssignmentForm::$container = null
private

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

Referenced by getContainer().

◆ $ctrl

ilLOTestAssignmentForm::$ctrl = null
private

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

◆ $gui

ilLOTestAssignmentForm::$gui = null
private

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

Referenced by __construct(), and getGUI().

◆ $lng

ilLOTestAssignmentForm::$lng = null
private

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

◆ $settings

ilLOTestAssignmentForm::$settings = null
private

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

Referenced by getSettings().

◆ $type

ilLOTestAssignmentForm::$type = 0
private

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

Referenced by getTestType().

◆ TEST_ASSIGN

const ilLOTestAssignmentForm::TEST_ASSIGN = 2

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

◆ TEST_NEW

const ilLOTestAssignmentForm::TEST_NEW = 1

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


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