ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getAssignments ()
 
 setSection (int $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...
 
 getFailureMessages ($a_section)
 Get error messages. More...
 
 determineStatus (bool $done, int $section)
 Determines workflow status of section. More...
 
 determineActiveSection ()
 Determines active section position of workflow. More...
 
 hasSectionErrors ($a_section)
 

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 (int $a_section, string $a_failure_msg_key, bool $is_error=false)
 Append failure. More...
 
 getSettingsStatus ()
 Check if course is lo confgured. More...
 
 getObjectivesAvailableStatus ($a_set_errors=false)
 
 getMaterialsStatus ($a_set_errors=true)
 Get status of materials. More...
 
 getInitialTestStatus ($a_set_errors=true)
 Get initial test status. More...
 
 getQualifiedTestStatus ($a_set_errors=true)
 Check status of qualified test. More...
 
 lookupQuestionsAssigned ($a_test_ref_id)
 Check if questions are assigned. More...
 
 getObjectivesStatus ($a_set_errors=true)
 
 getStartStatus ()
 
 checkNumberOfTries ()
 
 checkTestOnline ($a_ref_id)
 Check if test is online. More...
 

Protected Attributes

 $section = null
 
 $failures_by_section = array()
 
 $error_by_section = array()
 
 $objectives = array()
 
 $settings = null
 
 $assignments = 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 14 of file class.ilLOEditorStatus.php.

Constructor & Destructor Documentation

◆ __construct()

ilLOEditorStatus::__construct ( ilObject  $a_parent)

Constructor.

Parameters
ilObject

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

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

60  {
61  $this->parent_obj = $a_parent;
62  $this->settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId());
63  $this->assignments = ilLOTestAssignments::getInstance($this->getParentObject()->getId());
64 
65  $this->ctrl = $GLOBALS['DIC']['ilCtrl'];
66  $this->lng = $GLOBALS['DIC']['lng'];
67 
68  include_once './Modules/Course/classes/class.ilCourseObjective.php';
69  $this->objectives = ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId());
70  }
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
settings()
Definition: settings.php:2
static _getObjectiveIds($course_id, $a_activated_only=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getParentObject()
Get parent object.
+ Here is the call graph for this function:

Member Function Documentation

◆ appendFailure()

ilLOEditorStatus::appendFailure ( int  $a_section,
string  $a_failure_msg_key,
bool  $is_error = false 
)
protected

Append failure.

Parameters
int$a_section
string$a_failure_msg_key
bool$is_error

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

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

137  {
138  $this->failures_by_section[$a_section][] = $a_failure_msg_key;
139  if ($is_error) {
140  $this->error_by_section[$a_section] = $a_section;
141  }
142  }
+ Here is the caller graph for this function:

◆ checkNumberOfTries()

ilLOEditorStatus::checkNumberOfTries ( )
protected

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

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

626  {
627  $qt = $this->getSettings()->getQualifiedTest();
628  if (!$qt) {
629  return true;
630  }
631 
632  include_once './Services/Object/classes/class.ilObjectFactory.php';
633  $factory = new ilObjectFactory();
634  $tst = $factory->getInstanceByRefId($qt, false);
635 
636  if (!$tst instanceof ilObjTest) {
637  return true;
638  }
639  $tries = $tst->getNrOfTries();
640  if (!$tries) {
641  return true;
642  }
643 
644  $obj_tries = 0;
645  foreach ($this->getObjectives() as $objective) {
646  include_once './Modules/Course/classes/class.ilCourseObjective.php';
647  $obj_tries += ilCourseObjective::lookupMaxPasses($objective);
648  }
649  $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . $obj_tries);
650  return $obj_tries <= $tries;
651  }
Class ilObjectFactory.
static lookupMaxPasses($a_objective_id)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:

◆ checkTestOnline()

ilLOEditorStatus::checkTestOnline (   $a_ref_id)
protected

Check if test is online.

Parameters
int$a_ref_id
Returns
bool

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

References ilObjTestAccess\_isOffline(), and ilObject\_lookupObjId().

Referenced by getInitialTestStatus(), and getQualifiedTestStatus().

658  : bool
659  {
660  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
662  }
static _isOffline($a_obj_id)
returns the objects&#39;s OFFline status
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineActiveSection()

ilLOEditorStatus::determineActiveSection ( )

Determines active section position of workflow.

Returns
int

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

References $section, ilLOSettings\getInstanceByObjId(), and getParentObject().

Referenced by getHTML().

359  : int
360  {
361  $itest_enabled = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->worksWithInitialTest();
362  $active_map = array(
363  self::SECTION_SETTINGS => 0,
364  self::SECTION_OBJECTIVES_NEW => 1,
365  self::SECTION_MATERIALS => 2,
366  self::SECTION_ITES => 3,
367  self::SECTION_QTEST => $itest_enabled ? 4 : 3,
368  self::SECTION_OBJECTIVES => $itest_enabled ? 5 : 4
369  );
370 
371  return $active_map[$this->section];
372  }
static getInstanceByObjId($a_obj_id)
get singleton instance
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineStatus()

ilLOEditorStatus::determineStatus ( bool  $done,
int  $section 
)

Determines workflow status of section.

Parameters
bool$done
$section
Returns
int

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

References hasSectionErrors().

Referenced by getHTML().

339  : int
340  {
341  if ($done) {
342  return Step::SUCCESSFULLY;
343  } elseif ($this->hasSectionErrors($section)) {
344  return Step::UNSUCCESSFULLY;
345  } else {
346  if ($this->section == $section) {
347  return Step::IN_PROGRESS;
348  } else {
349  return Step::NOT_STARTED;
350  }
351  }
352  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignments()

ilLOEditorStatus::getAssignments ( )
Returns
ilLOTestAssignments

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

References $assignments.

Referenced by getInitialTestStatus(), and getQualifiedTestStatus().

98  {
99  return $this->assignments;
100  }
+ Here is the caller graph for this function:

◆ getCmdClass()

ilLOEditorStatus::getCmdClass ( )

Get cmd class.

Returns
object

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

References $cmd_class.

Referenced by getHTML().

158  {
159  return $this->cmd_class;
160  }
+ Here is the caller graph for this function:

◆ getFailureMessages()

ilLOEditorStatus::getFailureMessages (   $a_section)

Get error messages.

Parameters

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

References getFailures().

Referenced by getHTML().

324  {
325  $mess = array();
326  foreach ($this->getFailures($a_section) as $failure_code) {
327  $mess[] = $this->lng->txt($failure_code);
328  }
329  return $mess;
330  }
getFailures($a_section)
Get failures by section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFailures()

ilLOEditorStatus::getFailures (   $a_section)

Get failures by section.

Parameters
int$a_section
Returns
array

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

Referenced by getFailureMessages().

126  {
127  return (array) $this->failures_by_section[$a_section];
128  }
+ Here is the caller graph for this function:

◆ getFirstFailedStep()

ilLOEditorStatus::getFirstFailedStep ( )

Get first failed step.

Returns
string

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

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

185  : string
186  {
187  if (!$this->getSettingsStatus()) {
188  return 'settings';
189  }
190  #if(!$this->getMaterialsStatus(false))
191  #{
192  # return 'materials';
193  #}
194  if (!$this->getObjectivesAvailableStatus()) {
195  return 'showObjectiveCreation';
196  }
197  if ($this->getSettings()->worksWithInitialTest()) {
198  if (!$this->getInitialTestStatus(false)) {
199  $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_INITIAL;
200  if ($this->getSettings()->hasSeparateInitialTests()) {
201  return 'testsOverview';
202  } else {
203  return 'testOverview';
204  }
205  }
206  }
207  if (!$this->getQualifiedTestStatus(false)) {
208  $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
209  if ($this->getSettings()->hasSeparateQualifiedTests()) {
210  return 'testsOverview';
211  } else {
212  return 'testOverview';
213  }
214  }
215  if (!$this->getObjectivesStatus(false)) {
216  return 'listObjectives';
217  }
218  return 'listObjectives';
219  }
getQualifiedTestStatus($a_set_errors=true)
Check status of qualified test.
getObjectivesAvailableStatus($a_set_errors=false)
getInitialTestStatus($a_set_errors=true)
Get initial test status.
getSettingsStatus()
Check if course is lo confgured.
getObjectivesStatus($a_set_errors=true)
+ Here is the call graph for this function:

◆ getHTML()

ilLOEditorStatus::getHTML ( )

Get html.

string

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

References $_GET, $DIC, $steps, determineActiveSection(), determineStatus(), getCmdClass(), getFailureMessages(), getInitialTestStatus(), ilLOSettings\getInstanceByObjId(), getMaterialsStatus(), getObjectivesAvailableStatus(), getObjectivesStatus(), getParentObject(), getQualifiedTestStatus(), getSettings(), getSettingsStatus(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

227  : string
228  {
229  global $DIC;
230  $steps = [];
231  $workflow = $DIC->ui()->factory()->listing()->workflow();
232  // Step 1
233  // course settings
234  $done = $this->getSettingsStatus();
235 
236  $steps[] = $workflow->step(
237  $this->lng->txt('crs_objective_status_settings'),
238  implode(" ", $this->getFailureMessages(self::SECTION_SETTINGS)),
239  $this->ctrl->getLinkTarget($this->getCmdClass(), 'settings')
240  )->withStatus($this->determineStatus($done, self::SECTION_SETTINGS));
241 
242 
243  // Step 1.1
244  $done = $this->getObjectivesAvailableStatus(true);
245 
246  $steps[] = $workflow->step(
247  $this->lng->txt('crs_objective_status_objective_creation'),
248  implode(" ", $this->getFailureMessages(self::SECTION_OBJECTIVES_NEW)),
249  $done
250  ? $this->ctrl->getLinkTarget($this->getCmdClass(), 'listObjectives')
251  : $this->ctrl->getLinkTarget($this->getCmdClass(), 'showObjectiveCreation')
252  )->withStatus($this->determineStatus($done, self::SECTION_OBJECTIVES_NEW));
253 
254  // Step 2
255  // course material
256  $done = $this->getMaterialsStatus(true);
257  $this->ctrl->setParameterByClass('ilobjcoursegui', 'cmd', 'enableAdministrationPanel');
258 
259  $steps[] = $workflow->step(
260  $this->lng->txt('crs_objective_status_materials'),
261  implode(" ", $this->getFailureMessages(self::SECTION_MATERIALS)),
262  $this->ctrl->getLinkTargetByClass('ilobjcoursegui', '')
263  )->withStatus($this->determineStatus($done, self::SECTION_MATERIALS));
264 
265  // Step 3
266  // course itest
267  if (ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->worksWithInitialTest()) {
268  $done = $this->getInitialTestStatus();
269  $command = $this->getSettings()->hasSeparateInitialTests() ?
270  'testsOverview' :
271  'testOverview';
272  $this->ctrl->setParameter($this->getCmdClass(), 'tt', ilLOSettings::TYPE_TEST_INITIAL);
273 
274  $steps[] = $workflow->step(
275  $this->lng->txt('crs_objective_status_itest'),
276  implode(" ", $this->getFailureMessages(self::SECTION_ITES)),
277  $this->ctrl->getLinkTarget($this->getCmdClass(), $command)
278  )->withStatus($this->determineStatus($done, self::SECTION_ITES));
279  }
280 
281  // Step 4
282  // course qtest
283  $done = $this->getQualifiedTestStatus();
284  $command = $this->getSettings()->hasSeparateQualifiedTests() ?
285  'testsOverview' :
286  'testOverview';
287  $this->ctrl->setParameter($this->getCmdClass(), 'tt', ilLOSettings::TYPE_TEST_QUALIFIED);
288 
289  $steps[] = $workflow->step(
290  $this->lng->txt('crs_objective_status_qtest'),
291  implode(" ", $this->getFailureMessages(self::SECTION_QTEST)),
292  $this->ctrl->getLinkTarget($this->getCmdClass(), $command)
293  )->withStatus($this->determineStatus($done, self::SECTION_QTEST));
294 
295  // Step 5
296  // course qtest
297  $done = $this->getObjectivesStatus();
298  $this->ctrl->setParameter($this->getCmdClass(), 'tt', $_GET["tt"]);
299 
300  $steps[] = $workflow->step(
301  $this->lng->txt('crs_objective_status_objectives'),
302  implode(" ", $this->getFailureMessages(self::SECTION_OBJECTIVES)),
303  $this->ctrl->getLinkTarget($this->getCmdClass(), 'listObjectives')
304  )->withStatus($this->determineStatus($done, self::SECTION_OBJECTIVES));
305 
306  $list = $workflow->linear(
307  $this->lng->txt('crs_objective_status_configure'),
308  $steps
309  )
310  ->withActive($this->determineActiveSection());
311 
312  $renderer = $DIC->ui()->renderer();
313  return $renderer->render($list);
314  }
determineStatus(bool $done, int $section)
Determines workflow status of section.
getQualifiedTestStatus($a_set_errors=true)
Check status of qualified test.
static getInstanceByObjId($a_obj_id)
get singleton instance
determineActiveSection()
Determines active section position of workflow.
getFailureMessages($a_section)
Get error messages.
getObjectivesAvailableStatus($a_set_errors=false)
getMaterialsStatus($a_set_errors=true)
Get status of materials.
$steps
Definition: latex.php:3
$_GET["client_id"]
getParentObject()
Get parent object.
getCmdClass()
Get cmd class.
$DIC
Definition: xapitoken.php:46
getInitialTestStatus($a_set_errors=true)
Get initial test status.
getSettingsStatus()
Check if course is lo confgured.
getObjectivesStatus($a_set_errors=true)
+ Here is the call graph for this function:

◆ getInitialTestStatus()

ilLOEditorStatus::getInitialTestStatus (   $a_set_errors = true)
protected

Get initial test status.

Parameters
bool$a_set_errors
Returns
boolean

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

References $GLOBALS, appendFailure(), checkTestOnline(), getAssignments(), getObjectives(), getSettings(), and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by getFirstFailedStep(), and getHTML().

440  : bool
441  {
442  if ($this->getSettings()->hasSeparateInitialTests()) {
443  if (count($this->objectives) <= 0) {
444  return false;
445  }
446 
447  foreach ($this->getObjectives() as $objective_id) {
448  $tst_ref = $this->getAssignments()->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
449  if (!$GLOBALS['DIC']['tree']->isInTree($tst_ref)) {
450  if ($a_set_errors) {
451  $this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_no_it');
452  }
453  return false;
454  }
455  if (!$this->checkTestOnline($tst_ref)) {
456  if ($a_set_errors) {
457  $this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_tst_offline', true);
458  }
459  return false;
460  }
461  }
462  return true;
463  }
464 
465 
466  $tst_ref = $this->getSettings()->getInitialTest();
467  if (!$GLOBALS['DIC']['tree']->isInTree($tst_ref)) {
468  if ($a_set_errors) {
469  $this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_no_it');
470  }
471  return false;
472  }
473  if (!$this->checkTestOnline($tst_ref)) {
474  if ($a_set_errors) {
475  $this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_tst_offline', true);
476  }
477  return false;
478  }
479  return true;
480  }
appendFailure(int $a_section, string $a_failure_msg_key, bool $is_error=false)
Append failure.
checkTestOnline($a_ref_id)
Check if test is online.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ 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
Returns
ilLOEditorStatus

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

Referenced by ilLOEditorGUI\executeCommand().

78  {
79  if (self::$instance) {
80  return self::$instance;
81  }
82  return self::$instance = new self($a_parent);
83  }
+ Here is the caller graph for this function:

◆ getMaterialsStatus()

ilLOEditorStatus::getMaterialsStatus (   $a_set_errors = true)
protected

Get status of materials.

Parameters
bool$a_set_errors
Returns
bool

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

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

Referenced by getHTML().

414  : bool
415  {
416  $childs = $GLOBALS['DIC']['tree']->getChilds($this->getParentObject()->getRefId());
417  foreach ((array) $childs as $tnode) {
418  if ($tnode['type'] == 'rolf') {
419  continue;
420  }
421  if ($tnode['child'] == $this->getSettings()->getInitialTest()) {
422  continue;
423  }
424  if ($tnode['child'] == $this->getSettings()->getQualifiedTest()) {
425  continue;
426  }
427  return true;
428  }
429  if ($a_set_errors) {
430  $this->appendFailure(self::SECTION_MATERIALS, 'crs_loc_err_stat_no_materials');
431  }
432  return false;
433  }
appendFailure(int $a_section, string $a_failure_msg_key, bool $is_error=false)
Append failure.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectives()

ilLOEditorStatus::getObjectives ( )
Returns
array

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

References $objectives.

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

89  {
90  return $this->objectives;
91  }
+ Here is the caller graph for this function:

◆ getObjectivesAvailableStatus()

ilLOEditorStatus::getObjectivesAvailableStatus (   $a_set_errors = false)
protected

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

References $ret, appendFailure(), and getObjectives().

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

399  {
400  $ret = count($this->getObjectives());
401 
402  if (!$ret && $a_set_errors) {
403  $this->appendFailure(self::SECTION_OBJECTIVES_NEW, 'crs_no_objectives_created');
404  }
405 
406  return $ret;
407  }
appendFailure(int $a_section, string $a_failure_msg_key, bool $is_error=false)
Append failure.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectivesStatus()

ilLOEditorStatus::getObjectivesStatus (   $a_set_errors = true)
protected
Parameters
bool$a_set_errors
Returns
bool

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

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

Referenced by getFirstFailedStep(), and getHTML().

563  : bool
564  {
565  if (!$this->getObjectivesAvailableStatus($a_set_errors)) {
566  return false;
567  }
568 
569  include_once './Modules/Course/classes/class.ilCourseObjective.php';
570  $num_active = ilCourseObjective::_getCountObjectives($this->getParentObject()->getId(), true);
571  if (!$num_active) {
572  if ($a_set_errors) {
573  $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_lo');
574  }
575  return false;
576  }
577  foreach (ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId(), true) as $objective_id) {
578  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
579  $obj = new ilCourseObjectiveMaterials($objective_id);
580  if (!count($obj->getMaterials())) {
581  if ($a_set_errors) {
582  $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_mat');
583  }
584  return false;
585  }
586  }
587  // check for assigned initial test questions
588  if ($this->getSettings()->worksWithInitialTest() && !$this->getSettings()->hasSeparateInitialTests()) {
589  // check for assigned questions
590  if (!$this->lookupQuestionsAssigned($this->getSettings()->getInitialTest())) {
591  if ($a_set_errors) {
592  $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
593  }
594  return false;
595  }
596  }
597  // check for assigned questions
598  if (!$this->getSettings()->hasSeparateQualifiedTests() and !$this->lookupQuestionsAssigned($this->getSettings()->getQualifiedTest())) {
599  if ($a_set_errors) {
600  $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
601  }
602  return false;
603  }
604 
605  // @deprecated
606  /*
607  if(!$this->checkNumberOfTries())
608  {
609  if($a_set_errors)
610  {
611  $this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_nr_tries_exceeded');
612  }
613  return false;
614  }
615  */
616 
617  return true;
618  }
appendFailure(int $a_section, string $a_failure_msg_key, bool $is_error=false)
Append failure.
getObjectivesAvailableStatus($a_set_errors=false)
lookupQuestionsAssigned($a_test_ref_id)
Check if questions are assigned.
static _getObjectiveIds($course_id, $a_activated_only=false)
class ilCourseObjectiveMaterials
getParentObject()
Get parent object.
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
+ 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 167 of file class.ilLOEditorStatus.php.

References $parent_obj.

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

168  {
169  return $this->parent_obj;
170  }
+ Here is the caller graph for this function:

◆ getQualifiedTestStatus()

ilLOEditorStatus::getQualifiedTestStatus (   $a_set_errors = true)
protected

Check status of qualified test.

Parameters
bool$a_set_errors
Returns
boolean

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

References $GLOBALS, appendFailure(), checkTestOnline(), getAssignments(), getObjectives(), getSettings(), and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by getFirstFailedStep(), and getHTML().

487  : bool
488  {
489  if ($this->getSettings()->hasSeparateQualifiedTests()) {
490  if (count($this->objectives) <= 0) {
491  return false;
492  }
493 
494  foreach ($this->getObjectives() as $objective_id) {
495  $tst_ref = $this->getAssignments()->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
496  if (!$GLOBALS['DIC']['tree']->isInTree($tst_ref)) {
497  if ($a_set_errors) {
498  $this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_no_qt');
499  }
500  return false;
501  }
502  if (!$this->checkTestOnline($tst_ref)) {
503  if ($a_set_errors) {
504  $this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_tst_offline', true);
505  }
506  return false;
507  }
508  }
509  return true;
510  }
511  $tst_ref = $this->getSettings()->getQualifiedTest();
512  if (!$GLOBALS['DIC']['tree']->isInTree($tst_ref)) {
513  if ($a_set_errors) {
514  $this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_no_qt');
515  }
516  return false;
517  }
518  if (!$this->checkTestOnline($tst_ref)) {
519  if ($a_set_errors) {
520  $this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_tst_offline', true);
521  }
522  return false;
523  }
524  return true;
525  }
appendFailure(int $a_section, string $a_failure_msg_key, bool $is_error=false)
Append failure.
checkTestOnline($a_ref_id)
Check if test is online.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSection()

ilLOEditorStatus::getSection ( )
Returns
int

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

References $section.

116  {
117  return $this->section;
118  }

◆ getSettings()

ilLOEditorStatus::getSettings ( )

◆ getSettingsStatus()

ilLOEditorStatus::getSettingsStatus ( )
protected

Check if course is lo confgured.

Returns
bool

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

References getSettings().

Referenced by getFirstFailedStep(), and getHTML().

387  : bool
388  {
389  return $this->getSettings()->settingsExist();
390  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartStatus()

ilLOEditorStatus::getStartStatus ( )
protected

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

621  {
622  return true;
623  }

◆ hasSectionErrors()

ilLOEditorStatus::hasSectionErrors (   $a_section)
Parameters
$a_section
Returns
bool

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

Referenced by determineStatus().

378  : bool
379  {
380  return isset($this->error_by_section[$a_section]);
381  }
+ Here is the caller graph for this function:

◆ lookupQuestionsAssigned()

ilLOEditorStatus::lookupQuestionsAssigned (   $a_test_ref_id)
protected

Check if questions are assigned.

Parameters
int$a_test_ref_id
Returns
bool

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

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

Referenced by getObjectivesStatus().

532  : bool
533  {
534  include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
536  foreach ($this->getObjectives() as $objective_id) {
537  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
539  $this->parent_obj->getId(),
540  $objective_id,
541  ilObject::_lookupObjId($a_test_ref_id)
542  );
543  if (!$seq) {
544  return false;
545  }
546  }
547  } else {
548  foreach ($this->getObjectives() as $objective_id) {
549  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
551  if (!count($qsts)) {
552  return false;
553  }
554  }
555  }
556  return true;
557  }
static lookupSequences($a_container_id, $a_objective_id, $a_test_id)
Lookup sequence ids type $ilDB.
static lookupRandomTest($a_test_obj_id)
Check if test is a random test.
static _lookupObjId($a_id)
static lookupQuestionsByObjective($a_test_id, $a_objective)
+ 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
object$a_cmd_class

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

149  {
150  $this->cmd_class = $a_cmd_class;
151  }

◆ setSection()

ilLOEditorStatus::setSection ( int  $a_section)

Set current section.

Parameters
int$a_section

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

108  {
109  $this->section = $a_section;
110  }

Field Documentation

◆ $assignments

ilLOEditorStatus::$assignments = null
protected

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

Referenced by getAssignments().

◆ $cmd_class

ilLOEditorStatus::$cmd_class = null
protected

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

Referenced by getCmdClass().

◆ $ctrl

ilLOEditorStatus::$ctrl = null
protected

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

◆ $error_by_section

ilLOEditorStatus::$error_by_section = array()
protected

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

◆ $failures_by_section

ilLOEditorStatus::$failures_by_section = array()
protected

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

◆ $html

ilLOEditorStatus::$html = ''
protected

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

◆ $instance

ilLOEditorStatus::$instance = null
staticprotected

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

◆ $lng

ilLOEditorStatus::$lng = null
protected

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

◆ $objectives

ilLOEditorStatus::$objectives = array()
protected

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

Referenced by getObjectives().

◆ $parent_obj

ilLOEditorStatus::$parent_obj = null
protected

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

Referenced by getParentObject().

◆ $section

ilLOEditorStatus::$section = null
protected

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

Referenced by determineActiveSection(), and getSection().

◆ $settings

ilLOEditorStatus::$settings = null
protected

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

Referenced by getSettings().

◆ $tpl

ilLOEditorStatus::$tpl = null
protected

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

◆ SECTION_ITES

◆ SECTION_MATERIALS

const ilLOEditorStatus::SECTION_MATERIALS = 2

Definition at line 17 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 21 of file class.ilLOEditorStatus.php.

Referenced by ilLOEditorGUI\showObjectiveCreation().

◆ SECTION_QTEST

◆ SECTION_SETTINGS

const ilLOEditorStatus::SECTION_SETTINGS = 1

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

Referenced by ilLOEditorGUI\settings().


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