ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilLOEditorStatus Class Reference

Presentation of the status of single steps during the configuration process. More...

+ Collaboration diagram for ilLOEditorStatus:

Public Member Functions

 __construct (ilObject $a_parent)
 Constructor. More...
 
 getObjectives ()
 
 setSection ($a_section)
 Set current section. More...
 
 getSection ()
 
 getFailures ($a_section)
 Get failures by section. More...
 
 setCmdClass ($a_cmd_class)
 Command class. More...
 
 getCmdClass ()
 Get cmd class. More...
 
 getParentObject ()
 Get parent object. More...
 
 getSettings ()
 
 getFirstFailedStep ()
 Get first failed step. More...
 
 getHTML ()
 Get html. More...
 
 getErrorMessages ($a_section)
 Get error messages. More...
 

Static Public Member Functions

static getInstance (ilObject $a_parent)
 Get instance. More...
 

Data Fields

const SECTION_SETTINGS = 1
 
const SECTION_MATERIALS = 2
 
const SECTION_ITES = 3
 
const SECTION_QTEST = 4
 
const SECTION_OBJECTIVES = 5
 
const SECTION_OBJECTIVES_NEW = 6
 

Protected Member Functions

 appendFailure ($a_section, $a_failure_msg_key)
 Append failure. More...
 
 getSettingsStatus ()
 Check if course is lo confgured. More...
 
 getObjectivesAvailableStatus ()
 Get objectives. More...
 
 getMaterialsStatus ($a_set_errors=true)
 Get status of materials. More...
 
 getInitialTestStatus ($a_set_errors=true)
 
 getQualifiedTestStatus ($a_set_errors=true)
 
 lookupQuestionsAssigned ($a_test_ref_id)
 Check if questions are assigned. More...
 
 getObjectivesStatus ($a_set_errors=true)
 
 getStartStatus ()
 
 checkNumberOfTries ()
 

Protected Attributes

 $section = NULL
 
 $failures_by_section = array()
 
 $objectives = array()
 
 $settings = NULL
 
 $parent_obj = NULL
 
 $cmd_class = NULL
 
 $html = ''
 
 $tpl = NULL
 
 $ctrl = NULL
 
 $lng = NULL
 

Static Protected Attributes

static $instance = NULL
 

Detailed Description

Presentation of the status of single steps during the configuration process.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 10 of file class.ilLOEditorStatus.php.

Constructor & Destructor Documentation

◆ __construct()

ilLOEditorStatus::__construct ( ilObject  $a_parent)

Constructor.

Parameters
ilObject

Definition at line 41 of file class.ilLOEditorStatus.php.

42 {
43 $this->parent_obj = $a_parent;
44 $this->settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId());
45
46 $this->ctrl = $GLOBALS['ilCtrl'];
47 $this->lng = $GLOBALS['lng'];
48
49 include_once './Modules/Course/classes/class.ilCourseObjective.php';
50 $this->objectives = ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId());
51 }
static _getObjectiveIds($course_id, $a_activated_only=false)
getParentObject()
Get parent object.
static getInstanceByObjId($a_obj_id)
get singleton instance
$GLOBALS['ct_recipient']

References $GLOBALS, ilCourseObjective\_getObjectiveIds(), ilLOSettings\getInstanceByObjId(), and getParentObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ appendFailure()

ilLOEditorStatus::appendFailure (   $a_section,
  $a_failure_msg_key 
)
protected

Append failure.

Parameters
type$a_section
type$a_failure_msg_key

Definition at line 99 of file class.ilLOEditorStatus.php.

100 {
101 $this->failures_by_section[$a_section][] = $a_failure_msg_key;
102 }

Referenced by getInitialTestStatus(), getMaterialsStatus(), getObjectivesStatus(), and getQualifiedTestStatus().

+ Here is the caller graph for this function:

◆ checkNumberOfTries()

ilLOEditorStatus::checkNumberOfTries ( )
protected

Definition at line 487 of file class.ilLOEditorStatus.php.

488 {
489 $qt = $this->getSettings()->getQualifiedTest();
490 if(!$qt)
491 {
492 return true;
493 }
494
495 include_once './Services/Object/classes/class.ilObjectFactory.php';
496 $factory = new ilObjectFactory();
497 $tst = $factory->getInstanceByRefId($qt,false);
498
499 if(!$tst instanceof ilObjTest)
500 {
501 return true;
502 }
503 $tries = $tst->getNrOfTries();
504 if(!$tries)
505 {
506 return true;
507 }
508
509 $obj_tries = 0;
510 foreach($this->getObjectives() as $objective)
511 {
512 include_once './Modules/Course/classes/class.ilCourseObjective.php';
513 $obj_tries += ilCourseObjective::lookupMaxPasses($objective);
514 }
515 $GLOBALS['ilLog']->write(__METHOD__.': '.$obj_tries);
516 return $obj_tries <= $tries;
517 }
static lookupMaxPasses($a_objective_id)
Class ilObjectFactory.

References $GLOBALS, getObjectives(), getSettings(), and ilCourseObjective\lookupMaxPasses().

Referenced by getObjectivesStatus().

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

◆ getCmdClass()

ilLOEditorStatus::getCmdClass ( )

Get cmd class.

Returns
type

Definition at line 117 of file class.ilLOEditorStatus.php.

118 {
119 return $this->cmd_class;
120 }

References $cmd_class.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getErrorMessages()

ilLOEditorStatus::getErrorMessages (   $a_section)

Get error messages.

Parameters

return

Definition at line 290 of file class.ilLOEditorStatus.php.

291 {
292 $mess = array();
293 foreach($this->getFailures($a_section) as $failure_code)
294 {
295 $mess[] = $this->lng->txt($failure_code);
296 }
297 return $mess;
298 }
getFailures($a_section)
Get failures by section.

References getFailures().

+ Here is the call graph for this function:

◆ getFailures()

ilLOEditorStatus::getFailures (   $a_section)

Get failures by section.

Parameters
type$a_section

Definition at line 89 of file class.ilLOEditorStatus.php.

90 {
91 return (array) $this->failures_by_section[$a_section];
92 }

Referenced by getErrorMessages().

+ Here is the caller graph for this function:

◆ getFirstFailedStep()

ilLOEditorStatus::getFirstFailedStep ( )

Get first failed step.

Definition at line 143 of file class.ilLOEditorStatus.php.

144 {
145 if(!$this->getSettingsStatus(false))
146 {
147 return 'settings';
148 }
149 #if(!$this->getMaterialsStatus(false))
150 #{
151 # return 'materials';
152 #}
153 if(!$this->getObjectivesAvailableStatus())
154 {
155 return 'showObjectiveCreation';
156 }
157 if($this->getSettings()->worksWithInitialTest())
158 {
159 if(!$this->getInitialTestStatus(false))
160 {
162 return 'testOverview';
163 }
164 }
165 if(!$this->getQualifiedTestStatus(false))
166 {
168 return 'testOverview';
169 }
170 if(!$this->getObjectivesStatus(false))
171 {
172 return 'listObjectives';
173 }
174 return 'listObjectives';
175 }
getSettingsStatus()
Check if course is lo confgured.
getObjectivesAvailableStatus()
Get objectives.
getInitialTestStatus($a_set_errors=true)
getQualifiedTestStatus($a_set_errors=true)
getObjectivesStatus($a_set_errors=true)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, getInitialTestStatus(), getObjectivesAvailableStatus(), getObjectivesStatus(), getQualifiedTestStatus(), getSettings(), getSettingsStatus(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

◆ getHTML()

ilLOEditorStatus::getHTML ( )

Get html.

Definition at line 181 of file class.ilLOEditorStatus.php.

182 {
183 include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
184 $list = new ilChecklistGUI();
185 $list->setHeading($this->lng->txt('crs_objective_status_configure'));
186
187
188 // Step 1
189 // course settings
190 $done = $this->getSettingsStatus();
191
192 $list->addEntry($this->lng->txt('crs_objective_status_settings'),
193 $this->ctrl->getLinkTarget($this->getCmdClass(),'settings'),
194 $done
197 ($this->section == self::SECTION_SETTINGS),
198 $this->getErrorMessages(self::SECTION_SETTINGS)
199 );
200
201
202 // Step 1.1
203 $done = $this->getObjectivesAvailableStatus();
204
205 $list->addEntry($this->lng->txt('crs_objective_status_objective_creation'),
206 $done
207 ? $this->ctrl->getLinkTarget($this->getCmdClass(),'listObjectives')
208 : $this->ctrl->getLinkTarget($this->getCmdClass(),'showObjectiveCreation'),
209 $done
212 ($this->section == self::SECTION_OBJECTIVES_NEW),
213 $this->getErrorMessages(self::SECTION_OBJECTIVES_NEW)
214 );
215
216 // Step 2
217 // course material
218 $done = $this->getMaterialsStatus(true);
219
220 $this->ctrl->setParameterByClass('ilobjcoursegui','cmd','enableAdministrationPanel');
221 $list->addEntry($this->lng->txt('crs_objective_status_materials'),
222 $this->ctrl->getLinkTargetByClass('ilobjcoursegui',''),
223 $done
226 ($this->section == self::SECTION_MATERIALS),
227 $this->getErrorMessages(self::SECTION_MATERIALS)
228 );
229
230
231 // Step 3
232 // course itest
233 if(ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->worksWithInitialTest())
234 {
235 $done = $this->getInitialTestStatus();
236
237 $this->ctrl->setParameter($this->getCmdClass(),'tt', 1);
238
239 $list->addEntry($this->lng->txt('crs_objective_status_itest'),
240 $this->ctrl->getLinkTarget($this->getCmdClass(),'testOverview'),
241 $done
244 ($this->section == self::SECTION_ITES),
245 $this->getErrorMessages(self::SECTION_ITES)
246 );
247 }
248
249 // Step 4
250 // course qtest
251 $done = $this->getQualifiedTestStatus();
252
253 $this->ctrl->setParameter($this->getCmdClass(),'tt', 2);
254
255 $list->addEntry($this->lng->txt('crs_objective_status_qtest'),
256 $this->ctrl->getLinkTarget($this->getCmdClass(),'testOverview'),
257 $done
260 ($this->section == self::SECTION_QTEST),
261 $this->getErrorMessages(self::SECTION_QTEST)
262 );
263
264 $this->ctrl->setParameter($this->getCmdClass(),'tt', $_GET["tt"]);
265
266 // Step 5
267 // course qtest
268 $done = $this->getObjectivesStatus();
269
270 $list->addEntry($this->lng->txt('crs_objective_status_objectives'),
271 $this->ctrl->getLinkTarget($this->getCmdClass(),'listObjectives'),
272 $done
275 ($this->section == self::SECTION_OBJECTIVES),
276 $this->getErrorMessages(self::SECTION_OBJECTIVES)
277 );
278
279 return $list->getHTML();
280 }
$_GET["client_id"]
getMaterialsStatus($a_set_errors=true)
Get status of materials.
getCmdClass()
Get cmd class.

References $_GET, getCmdClass(), getInitialTestStatus(), ilLOSettings\getInstanceByObjId(), getMaterialsStatus(), getObjectivesAvailableStatus(), getObjectivesStatus(), getParentObject(), getQualifiedTestStatus(), getSettingsStatus(), ilChecklistGUI\STATUS_NOT_OK, and ilChecklistGUI\STATUS_OK.

+ Here is the call graph for this function:

◆ getInitialTestStatus()

ilLOEditorStatus::getInitialTestStatus (   $a_set_errors = true)
protected

Definition at line 348 of file class.ilLOEditorStatus.php.

349 {
350 $tst_ref = $this->getSettings()->getInitialTest();
351 if(!$GLOBALS['tree']->isInTree($tst_ref))
352 {
353 if($a_set_errors)
354 {
355 $this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_no_it');
356 }
357 return false;
358 }
359 return true;
360 }
appendFailure($a_section, $a_failure_msg_key)
Append failure.

References $GLOBALS, appendFailure(), and getSettings().

Referenced by getFirstFailedStep(), and getHTML().

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

◆ getInstance()

static ilLOEditorStatus::getInstance ( ilObject  $a_parent)
static

Get instance.

Parameters
ilObject$a_parent

Definition at line 57 of file class.ilLOEditorStatus.php.

58 {
59 if(self::$instance)
60 {
61 return self::$instance;
62 }
63 return self::$instance = new self($a_parent);
64 }

References $instance.

Referenced by ilLOEditorGUI\executeCommand().

+ Here is the caller graph for this function:

◆ getMaterialsStatus()

ilLOEditorStatus::getMaterialsStatus (   $a_set_errors = true)
protected

Get status of materials.

Definition at line 322 of file class.ilLOEditorStatus.php.

323 {
324 $childs = $GLOBALS['tree']->getChilds($this->getParentObject()->getRefId());
325 foreach((array) $childs as $tnode)
326 {
327 if($tnode['type'] == 'rolf')
328 {
329 continue;
330 }
331 if($tnode['child'] == $this->getSettings()->getInitialTest())
332 {
333 continue;
334 }
335 if($tnode['child'] == $this->getSettings()->getQualifiedTest())
336 {
337 continue;
338 }
339 return true;
340 }
341 if($a_set_errors)
342 {
343 $this->appendFailure(self::SECTION_MATERIALS, 'crs_loc_err_stat_no_materials');
344 }
345 return false;
346 }

References $GLOBALS, appendFailure(), getParentObject(), and getSettings().

Referenced by getHTML().

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

◆ getObjectives()

ilLOEditorStatus::getObjectives ( )

Definition at line 66 of file class.ilLOEditorStatus.php.

References $objectives.

Referenced by checkNumberOfTries(), getObjectivesAvailableStatus(), and lookupQuestionsAssigned().

+ Here is the caller graph for this function:

◆ getObjectivesAvailableStatus()

ilLOEditorStatus::getObjectivesAvailableStatus ( )
protected

Get objectives.

Returns
type

Definition at line 314 of file class.ilLOEditorStatus.php.

315 {
316 return count($this->getObjectives());
317 }

References getObjectives().

Referenced by getFirstFailedStep(), getHTML(), and getObjectivesStatus().

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

◆ getObjectivesStatus()

ilLOEditorStatus::getObjectivesStatus (   $a_set_errors = true)
protected

Definition at line 415 of file class.ilLOEditorStatus.php.

416 {
417 if(!$this->getObjectivesAvailableStatus($a_set_errors))
418 {
419 return false;
420 }
421
422 include_once './Modules/Course/classes/class.ilCourseObjective.php';
423 $num_active = ilCourseObjective::_getCountObjectives($this->getParentObject()->getId(),true);
424 if(!$num_active)
425 {
426 if($a_set_errors)
427 {
428 $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_lo');
429 }
430 return false;
431 }
432 foreach(ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId(),true) as $objective_id)
433 {
434 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
435 $obj = new ilCourseObjectiveMaterials($objective_id);
436 if(!count($obj->getMaterials()))
437 {
438 if($a_set_errors)
439 {
440 $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_mat');
441 }
442 return false;
443 }
444 }
445 // check for assigned initial test questions
446 if($this->getSettings()->worksWithInitialTest())
447 {
448 // check for assigned questions
449 if(!$this->lookupQuestionsAssigned($this->getSettings()->getInitialTest()))
450 {
451 if($a_set_errors)
452 {
453 $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
454 }
455 return false;
456 }
457 }
458 // check for assigned questions
459 if(!$this->lookupQuestionsAssigned($this->getSettings()->getQualifiedTest()))
460 {
461 if($a_set_errors)
462 {
463 $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
464 }
465 return false;
466 }
467
468 if(!$this->checkNumberOfTries())
469 {
470 if($a_set_errors)
471 {
472 $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_nr_tries_exceeded');
473 }
474 return false;
475 }
476
477
478
479 return true;
480 }
class ilCourseObjectiveMaterials
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
lookupQuestionsAssigned($a_test_ref_id)
Check if questions are assigned.

References ilCourseObjective\_getCountObjectives(), ilCourseObjective\_getObjectiveIds(), appendFailure(), checkNumberOfTries(), getObjectivesAvailableStatus(), getParentObject(), getSettings(), and lookupQuestionsAssigned().

Referenced by getFirstFailedStep(), and getHTML().

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

◆ getParentObject()

ilLOEditorStatus::getParentObject ( )

Get parent object.

Returns
ilObject

Definition at line 127 of file class.ilLOEditorStatus.php.

128 {
129 return $this->parent_obj;
130 }

References $parent_obj.

Referenced by __construct(), getHTML(), getMaterialsStatus(), and getObjectivesStatus().

+ Here is the caller graph for this function:

◆ getQualifiedTestStatus()

ilLOEditorStatus::getQualifiedTestStatus (   $a_set_errors = true)
protected

Definition at line 362 of file class.ilLOEditorStatus.php.

363 {
364 $tst_ref = $this->getSettings()->getQualifiedTest();
365 if(!$GLOBALS['tree']->isInTree($tst_ref))
366 {
367 if($a_set_errors)
368 {
369 $this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_no_qt');
370 }
371 return false;
372 }
373 return true;
374 }

References $GLOBALS, appendFailure(), and getSettings().

Referenced by getFirstFailedStep(), and getHTML().

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

◆ getSection()

ilLOEditorStatus::getSection ( )

Definition at line 80 of file class.ilLOEditorStatus.php.

References $section.

◆ getSettings()

ilLOEditorStatus::getSettings ( )

◆ getSettingsStatus()

ilLOEditorStatus::getSettingsStatus ( )
protected

Check if course is lo confgured.

Returns
type

Definition at line 305 of file class.ilLOEditorStatus.php.

306 {
307 return $this->getSettings()->settingsExist();
308 }

References getSettings().

Referenced by getFirstFailedStep(), and getHTML().

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

◆ getStartStatus()

ilLOEditorStatus::getStartStatus ( )
protected

Definition at line 482 of file class.ilLOEditorStatus.php.

483 {
484 return true;
485 }

◆ lookupQuestionsAssigned()

ilLOEditorStatus::lookupQuestionsAssigned (   $a_test_ref_id)
protected

Check if questions are assigned.

Parameters
type$a_test_ref_id

Definition at line 380 of file class.ilLOEditorStatus.php.

381 {
382 include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
384 {
385 foreach($this->getObjectives() as $objective_id)
386 {
387 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
389 $this->parent_obj->getId(),
390 $objective_id,
391 ilObject::_lookupObjId($a_test_ref_id)
392 );
393 if(!$seq)
394 {
395 return false;
396 }
397 }
398 }
399 else
400 {
401 foreach($this->getObjectives() as $objective_id)
402 {
403 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
405 if(!count($qsts))
406 {
407 return false;
408 }
409 }
410 }
411 return true;
412 }
static lookupQuestionsByObjective($a_test_id, $a_objective)
static lookupSequence($a_container_id, $a_objective_id, $a_test_id)
static lookupRandomTest($a_test_obj_id)
Check if test is a random test.
static _lookupObjId($a_id)

References ilObject\_lookupObjId(), getObjectives(), ilCourseObjectiveQuestion\lookupQuestionsByObjective(), ilLOUtils\lookupRandomTest(), and ilLORandomTestQuestionPools\lookupSequence().

Referenced by getObjectivesStatus().

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

◆ setCmdClass()

ilLOEditorStatus::setCmdClass (   $a_cmd_class)

Command class.

Parameters
type$a_cmd_class

Definition at line 108 of file class.ilLOEditorStatus.php.

109 {
110 $this->cmd_class = $a_cmd_class;
111 }

◆ setSection()

ilLOEditorStatus::setSection (   $a_section)

Set current section.

Parameters
type$a_section

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

76 {
77 $this->section = $a_section;
78 }

Field Documentation

◆ $cmd_class

ilLOEditorStatus::$cmd_class = NULL
protected

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

Referenced by getCmdClass().

◆ $ctrl

ilLOEditorStatus::$ctrl = NULL
protected

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

◆ $failures_by_section

ilLOEditorStatus::$failures_by_section = array()
protected

Definition at line 24 of file class.ilLOEditorStatus.php.

◆ $html

ilLOEditorStatus::$html = ''
protected

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

◆ $instance

ilLOEditorStatus::$instance = NULL
staticprotected

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

Referenced by getInstance().

◆ $lng

ilLOEditorStatus::$lng = NULL
protected

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

◆ $objectives

ilLOEditorStatus::$objectives = array()
protected

Definition at line 26 of file class.ilLOEditorStatus.php.

Referenced by getObjectives().

◆ $parent_obj

ilLOEditorStatus::$parent_obj = NULL
protected

Definition at line 29 of file class.ilLOEditorStatus.php.

Referenced by getParentObject().

◆ $section

ilLOEditorStatus::$section = NULL
protected

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

Referenced by getSection().

◆ $settings

ilLOEditorStatus::$settings = NULL
protected

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

Referenced by getSettings().

◆ $tpl

ilLOEditorStatus::$tpl = NULL
protected

Definition at line 33 of file class.ilLOEditorStatus.php.

◆ SECTION_ITES

const ilLOEditorStatus::SECTION_ITES = 3

◆ SECTION_MATERIALS

const ilLOEditorStatus::SECTION_MATERIALS = 2

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

Referenced by ilLOEditorGUI\materials().

◆ SECTION_OBJECTIVES

const ilLOEditorStatus::SECTION_OBJECTIVES = 5

◆ SECTION_OBJECTIVES_NEW

const ilLOEditorStatus::SECTION_OBJECTIVES_NEW = 6

Definition at line 17 of file class.ilLOEditorStatus.php.

Referenced by ilLOEditorGUI\showObjectiveCreation().

◆ SECTION_QTEST

const ilLOEditorStatus::SECTION_QTEST = 4

◆ SECTION_SETTINGS

const ilLOEditorStatus::SECTION_SETTINGS = 1

Definition at line 12 of file class.ilLOEditorStatus.php.

Referenced by ilLOEditorGUI\settings().


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