ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

31  {
32  $this->lng = $GLOBALS['lng'];
33  $this->ctrl = $GLOBALS['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 
41  }
static getInstanceByObjId($a_obj_id)
get singleton instance
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$a_type
Definition: workflow.php:93
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignableTests()

ilLOTestAssignmentForm::getAssignableTests ( )
protected

Get assignable tests.

Returns
array

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

References $GLOBALS, array, getContainer(), and ilLOTestAssignments\getInstance().

Referenced by initForm().

219  {
220  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
221  $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
222 
223  $tests = array();
224  foreach($GLOBALS['tree']->getChildsByType($this->getContainer()->getRefId(),'tst') as $tree_node)
225  {
226  if(!in_array($tree_node['child'], $assignments->getTests()))
227  {
228  $tests[] = $tree_node['child'];
229  }
230  }
231  return $tests;
232  }
static getInstance($a_container_id)
Get instance by container id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContainer()

ilLOTestAssignmentForm::getContainer ( )
Returns
ilObject

Definition at line 46 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 51 of file class.ilLOTestAssignmentForm.php.

References $gui.

◆ getSettings()

ilLOTestAssignmentForm::getSettings ( )
Returns
ilLOSettings

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

References $settings.

◆ getTestType()

ilLOTestAssignmentForm::getTestType ( )

Definition at line 65 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 70 of file class.ilLOTestAssignmentForm.php.

References $new, $options, ilCourseObjective\_getObjectiveIds(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), array, getAssignableTests(), getContainer(), ilLOTestAssignments\getInstance(), getTestType(), ilCourseObjective\lookupObjectiveTitle(), ilObjTest\QUESTION_SET_TYPE_FIXED, ilObjTest\QUESTION_SET_TYPE_RANDOM, ilTextAreaInputGUI\setCols(), ilTextInputGUI\setMaxLength(), ilFormPropertyGUI\setRequired(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

71  {
72  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
73  $form = new ilPropertyFormGUI();
74  $form->setTitle($this->lng->txt('crs_loc_tst_assignment'));
75  $form->setFormAction($this->ctrl->getFormAction($this->getGUI()));
76 
77  if($a_as_multi_assignment)
78  {
79  $form->addCommandButton('saveMultiTestAssignment', $this->lng->txt('save'));
80  }
81  else
82  {
83  $form->addCommandButton('saveTest', $this->lng->txt('save'));
84  }
85 
86  switch($this->getTestType())
87  {
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 
98  $assignable = $this->getAssignableTests();
99 
100  $cr_mode = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_form_assign_it'),'mode');
101  $cr_mode->setRequired(true);
102  $cr_mode->setValue(self::TEST_NEW);
103 
104  $new = new ilRadioOption($this->lng->txt('crs_loc_form_tst_new'),self::TEST_NEW);
105 
106  switch($this->getTestType())
107  {
109  $new->setInfo($this->lng->txt("crs_loc_form_tst_new_initial_info"));
110  break;
111 
113  $new->setInfo($this->lng->txt("crs_loc_form_tst_new_qualified_info"));
114  break;
115  }
116 
117  // title
118  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
119  $ti->setMaxLength(128);
120  $ti->setSize(40);
121  $ti->setRequired(true);
122  $new->addSubItem($ti);
123 
124  // description
125  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
126  $ta->setCols(40);
127  $ta->setRows(2);
128  $new->addSubItem($ta);
129 
130  // Question assignment type
131  include_once './Modules/Test/classes/class.ilObjTest.php';
132  $this->lng->loadLanguageModule('assessment');
133  $qst = new ilRadioGroupInputGUI($this->lng->txt('tst_question_set_type'),'qtype');
134  $qst->setRequired(true);
135 
136  $random = new ilRadioOption(
137  $this->lng->txt('tst_question_set_type_random'),
139  );
140  $qst->addOption($random);
141 
142  $fixed = new ilRadioOption(
143  $this->lng->txt('tst_question_set_type_fixed'),
145  );
146  $qst->addOption($fixed);
147  $new->addSubItem($qst);
148  $cr_mode->addOption($new);
149 
150  // assign existing
151  $existing = new ilRadioOption($this->lng->txt('crs_loc_form_assign'),self::TEST_ASSIGN);
152 
153  switch($this->getTestType())
154  {
156  $existing->setInfo($this->lng->txt("crs_loc_form_assign_initial_info"));
157  break;
158 
160  $existing->setInfo($this->lng->txt("crs_loc_form_assign_qualified_info"));
161  break;
162  }
163 
164  if(!$assignable)
165  {
166  $existing->setDisabled(true);
167  }
168  $cr_mode->addOption($existing);
169 
170  $options = array();
171  $options[''] = $this->lng->txt('select_one');
172  foreach((array) $assignable as $tst_ref_id)
173  {
174  $tst_obj_id = ilObject::_lookupObjId($tst_ref_id);
175  $options[$tst_ref_id] = ilObject::_lookupTitle($tst_obj_id);
176  }
177  $selectable = new ilSelectInputGUI($this->lng->txt('crs_loc_form_available_tsts'),'tst');
178  $selectable->setRequired(true);
179  $selectable->setOptions($options);
180  $existing->addSubItem($selectable);
181 
182  $form->addItem($cr_mode);
183 
184 
185  if($a_as_multi_assignment)
186  {
187  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
188  $assignments = ilLOTestAssignments::getInstance($this->getContainer()->getId());
189 
190  include_once './Modules/Course/classes/class.ilCourseObjective.php';
191  $objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainer()->getId(), FALSE);
192 
193  $options = array();
194  $options[''] = $this->lng->txt('select_one');
195  foreach($objective_ids as $oid)
196  {
197  $already_assigned_tst = $assignments->getTestByObjective($oid, $this->getTestType());
198  if(!$already_assigned_tst)
199  {
201  }
202  }
203 
204  $objective = new ilSelectInputGUI($this->lng->txt('crs_objectives'),'objective');
205  $objective->setRequired(TRUE);
206  $objective->setOptions($options);
207  $form->addItem($objective);
208  }
209 
210  return $form;
211 
212  }
This class represents an option in a radio group.
static getInstance($a_container_id)
Get instance by container id.
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
This class represents a selection list property in a property form.
This class represents a property form user interface.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
static _getObjectiveIds($course_id, $a_activated_only=false)
static _lookupTitle($a_id)
lookup object title
This class represents a property in a property form.
if(!is_array($argv)) $options
static _lookupObjId($a_id)
This class represents a text property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
Create styles array
The data for the language used.
getAssignableTests()
Get assignable tests.
This class represents a text area property in a property form.
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
setRequired($a_required)
Set Required.
+ 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: