ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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.
 getObjectives ()
 setSection ($a_section)
 Set current section.
 getSection ()
 getFailures ($a_section)
 Get failures by section.
 setCmdClass ($a_cmd_class)
 Command class.
 getCmdClass ()
 Get cmd class.
 getParentObject ()
 Get parent object.
 getSettings ()
 getFirstFailedStep ()
 Get first failed step.
 getHTML ()
 Get html.
 getErrorMessages ($a_section)
 Get error messages.

Static Public Member Functions

static getInstance (ilObject $a_parent)
 Get instance.

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.
 getSettingsStatus ()
 Check if course is lo confgured.
 getObjectivesAvailableStatus ()
 Get objectives.
 getMaterialsStatus ($a_set_errors=true)
 Get status of materials.
 getInitialTestStatus ($a_set_errors=true)
 getQualifiedTestStatus ($a_set_errors=true)
 lookupQuestionsAssigned ($a_test_ref_id)
 Check if questions are assigned.
 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

ilLOEditorStatus::__construct ( ilObject  $a_parent)

Constructor.

Parameters
ilObject

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

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

{
$this->parent_obj = $a_parent;
$this->settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId());
$this->ctrl = $GLOBALS['ilCtrl'];
$this->lng = $GLOBALS['lng'];
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$this->objectives = ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId());
}

+ Here is the call graph for this function:

Member Function Documentation

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.

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

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

+ Here is the caller graph for this function:

ilLOEditorStatus::checkNumberOfTries ( )
protected

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

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

Referenced by getObjectivesStatus().

{
$qt = $this->getSettings()->getQualifiedTest();
if(!$qt)
{
return true;
}
include_once './Services/Object/classes/class.ilObjectFactory.php';
$factory = new ilObjectFactory();
$tst = $factory->getInstanceByRefId($qt,false);
if(!$tst instanceof ilObjTest)
{
return true;
}
$tries = $tst->getNrOfTries();
if(!$tries)
{
return true;
}
$obj_tries = 0;
foreach($this->getObjectives() as $objective)
{
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$obj_tries += ilCourseObjective::lookupMaxPasses($objective);
}
$GLOBALS['ilLog']->write(__METHOD__.': '.$obj_tries);
return $obj_tries <= $tries;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getCmdClass ( )

Get cmd class.

Returns
type

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

References $cmd_class.

Referenced by getHTML().

{
}

+ Here is the caller graph for this function:

ilLOEditorStatus::getErrorMessages (   $a_section)

Get error messages.

Parameters
@return

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

References getFailures().

Referenced by getHTML().

{
$mess = array();
foreach($this->getFailures($a_section) as $failure_code)
{
$mess[] = $this->lng->txt($failure_code);
}
return $mess;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getFailures (   $a_section)

Get failures by section.

Parameters
type$a_section

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

Referenced by getErrorMessages().

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

+ Here is the caller graph for this function:

ilLOEditorStatus::getFirstFailedStep ( )

Get first failed step.

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

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

{
if(!$this->getSettingsStatus(false))
{
return 'settings';
}
#if(!$this->getMaterialsStatus(false))
#{
# return 'materials';
#}
{
return 'showObjectiveCreation';
}
if($this->getSettings()->worksWithInitialTest())
{
if(!$this->getInitialTestStatus(false))
{
return 'testOverview';
}
}
if(!$this->getQualifiedTestStatus(false))
{
return 'testOverview';
}
if(!$this->getObjectivesStatus(false))
{
return 'listObjectives';
}
return 'listObjectives';
}

+ Here is the call graph for this function:

ilLOEditorStatus::getHTML ( )

Get html.

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

References $_GET, getCmdClass(), getErrorMessages(), getInitialTestStatus(), ilLOSettings\getInstanceByObjId(), getMaterialsStatus(), getObjectivesAvailableStatus(), getObjectivesStatus(), getParentObject(), getQualifiedTestStatus(), getSettingsStatus(), SECTION_ITES, SECTION_MATERIALS, SECTION_OBJECTIVES, SECTION_OBJECTIVES_NEW, SECTION_QTEST, SECTION_SETTINGS, ilChecklistGUI\STATUS_NOT_OK, and ilChecklistGUI\STATUS_OK.

{
include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
$list = new ilChecklistGUI();
$list->setHeading($this->lng->txt('crs_objective_status_configure'));
// Step 1
// course settings
$done = $this->getSettingsStatus();
$list->addEntry($this->lng->txt('crs_objective_status_settings'),
$this->ctrl->getLinkTarget($this->getCmdClass(),'settings'),
$done
($this->section == self::SECTION_SETTINGS),
$this->getErrorMessages(self::SECTION_SETTINGS)
);
// Step 1.1
$done = $this->getObjectivesAvailableStatus();
$list->addEntry($this->lng->txt('crs_objective_status_objective_creation'),
$done
? $this->ctrl->getLinkTarget($this->getCmdClass(),'listObjectives')
: $this->ctrl->getLinkTarget($this->getCmdClass(),'showObjectiveCreation'),
$done
($this->section == self::SECTION_OBJECTIVES_NEW),
$this->getErrorMessages(self::SECTION_OBJECTIVES_NEW)
);
// Step 2
// course material
$done = $this->getMaterialsStatus(true);
$this->ctrl->setParameterByClass('ilobjcoursegui','cmd','enableAdministrationPanel');
$list->addEntry($this->lng->txt('crs_objective_status_materials'),
$this->ctrl->getLinkTargetByClass('ilobjcoursegui',''),
$done
($this->section == self::SECTION_MATERIALS),
$this->getErrorMessages(self::SECTION_MATERIALS)
);
// Step 3
// course itest
if(ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->worksWithInitialTest())
{
$done = $this->getInitialTestStatus();
$this->ctrl->setParameter($this->getCmdClass(),'tt', 1);
$list->addEntry($this->lng->txt('crs_objective_status_itest'),
$this->ctrl->getLinkTarget($this->getCmdClass(),'testOverview'),
$done
($this->section == self::SECTION_ITES),
$this->getErrorMessages(self::SECTION_ITES)
);
}
// Step 4
// course qtest
$done = $this->getQualifiedTestStatus();
$this->ctrl->setParameter($this->getCmdClass(),'tt', 2);
$list->addEntry($this->lng->txt('crs_objective_status_qtest'),
$this->ctrl->getLinkTarget($this->getCmdClass(),'testOverview'),
$done
($this->section == self::SECTION_QTEST),
$this->getErrorMessages(self::SECTION_QTEST)
);
$this->ctrl->setParameter($this->getCmdClass(),'tt', $_GET["tt"]);
// Step 5
// course qtest
$done = $this->getObjectivesStatus();
$list->addEntry($this->lng->txt('crs_objective_status_objectives'),
$this->ctrl->getLinkTarget($this->getCmdClass(),'listObjectives'),
$done
($this->section == self::SECTION_OBJECTIVES),
$this->getErrorMessages(self::SECTION_OBJECTIVES)
);
return $list->getHTML();
}

+ Here is the call graph for this function:

ilLOEditorStatus::getInitialTestStatus (   $a_set_errors = true)
protected

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

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

Referenced by getFirstFailedStep(), and getHTML().

{
$tst_ref = $this->getSettings()->getInitialTest();
if(!$GLOBALS['tree']->isInTree($tst_ref))
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_ITES, 'crs_loc_err_stat_no_it');
}
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLOEditorStatus::getInstance ( ilObject  $a_parent)
static

Get instance.

Parameters
ilObject$a_parent

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

References $instance.

Referenced by ilLOEditorGUI\executeCommand().

{
if(self::$instance)
{
}
return self::$instance = new self($a_parent);
}

+ Here is the caller graph for this function:

ilLOEditorStatus::getMaterialsStatus (   $a_set_errors = true)
protected

Get status of materials.

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

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

Referenced by getHTML().

{
$childs = $GLOBALS['tree']->getChilds($this->getParentObject()->getRefId());
foreach((array) $childs as $tnode)
{
if($tnode['type'] == 'rolf')
{
continue;
}
if($tnode['child'] == $this->getSettings()->getInitialTest())
{
continue;
}
if($tnode['child'] == $this->getSettings()->getQualifiedTest())
{
continue;
}
return true;
}
if($a_set_errors)
{
$this->appendFailure(self::SECTION_MATERIALS, 'crs_loc_err_stat_no_materials');
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

ilLOEditorStatus::getObjectivesAvailableStatus ( )
protected

Get objectives.

Returns
type

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

References getObjectives().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getObjectivesStatus (   $a_set_errors = true)
protected

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

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

Referenced by getFirstFailedStep(), and getHTML().

{
if(!$this->getObjectivesAvailableStatus($a_set_errors))
{
return false;
}
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$num_active = ilCourseObjective::_getCountObjectives($this->getParentObject()->getId(),true);
if(!$num_active)
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_lo');
}
return false;
}
foreach(ilCourseObjective::_getObjectiveIds($this->getParentObject()->getId(),true) as $objective_id)
{
include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
$obj = new ilCourseObjectiveMaterials($objective_id);
if(!count($obj->getMaterials()))
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_mat');
}
return false;
}
}
// check for assigned initial test questions
if($this->getSettings()->worksWithInitialTest())
{
// check for assigned questions
if(!$this->lookupQuestionsAssigned($this->getSettings()->getInitialTest()))
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
}
return false;
}
}
// check for assigned questions
if(!$this->lookupQuestionsAssigned($this->getSettings()->getQualifiedTest()))
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_no_active_qst');
}
return false;
}
if(!$this->checkNumberOfTries())
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_OBJECTIVES, 'crs_loc_err_nr_tries_exceeded');
}
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getParentObject ( )

Get parent object.

Returns
ilObject

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

References $parent_obj.

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

{
}

+ Here is the caller graph for this function:

ilLOEditorStatus::getQualifiedTestStatus (   $a_set_errors = true)
protected

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

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

Referenced by getFirstFailedStep(), and getHTML().

{
$tst_ref = $this->getSettings()->getQualifiedTest();
if(!$GLOBALS['tree']->isInTree($tst_ref))
{
if($a_set_errors)
{
$this->appendFailure(self::SECTION_QTEST, 'crs_loc_err_stat_no_qt');
}
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getSection ( )

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

References $section.

{
}
ilLOEditorStatus::getSettings ( )

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

References $settings.

Referenced by checkNumberOfTries(), getFirstFailedStep(), getInitialTestStatus(), getMaterialsStatus(), getObjectivesStatus(), getQualifiedTestStatus(), and getSettingsStatus().

{
}

+ Here is the caller graph for this function:

ilLOEditorStatus::getSettingsStatus ( )
protected

Check if course is lo confgured.

Returns
type

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

References getSettings().

Referenced by getFirstFailedStep(), and getHTML().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::getStartStatus ( )
protected

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

{
return true;
}
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.

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

Referenced by getObjectivesStatus().

{
include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
{
foreach($this->getObjectives() as $objective_id)
{
include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
$this->parent_obj->getId(),
$objective_id,
ilObject::_lookupObjId($a_test_ref_id)
);
if(!$seq)
{
return false;
}
}
}
else
{
foreach($this->getObjectives() as $objective_id)
{
include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
if(!count($qsts))
{
return false;
}
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOEditorStatus::setCmdClass (   $a_cmd_class)

Command class.

Parameters
type$a_cmd_class

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

{
$this->cmd_class = $a_cmd_class;
}
ilLOEditorStatus::setSection (   $a_section)

Set current section.

Parameters
type$a_section

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

{
$this->section = $a_section;
}

Field Documentation

ilLOEditorStatus::$cmd_class = NULL
protected

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

Referenced by getCmdClass().

ilLOEditorStatus::$ctrl = NULL
protected

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

ilLOEditorStatus::$failures_by_section = array()
protected

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

ilLOEditorStatus::$html = ''
protected

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

ilLOEditorStatus::$instance = NULL
staticprotected

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

Referenced by getInstance().

ilLOEditorStatus::$lng = NULL
protected

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

ilLOEditorStatus::$objectives = array()
protected

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

Referenced by getObjectives().

ilLOEditorStatus::$parent_obj = NULL
protected

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

Referenced by getParentObject().

ilLOEditorStatus::$section = NULL
protected

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

Referenced by getSection().

ilLOEditorStatus::$settings = NULL
protected

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

Referenced by getSettings().

ilLOEditorStatus::$tpl = NULL
protected

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

const ilLOEditorStatus::SECTION_ITES = 3
const ilLOEditorStatus::SECTION_MATERIALS = 2

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

Referenced by getHTML(), and ilLOEditorGUI\materials().

const ilLOEditorStatus::SECTION_OBJECTIVES = 5
const ilLOEditorStatus::SECTION_OBJECTIVES_NEW = 6

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

Referenced by getHTML(), and ilLOEditorGUI\showObjectiveCreation().

const ilLOEditorStatus::SECTION_QTEST = 4
const ilLOEditorStatus::SECTION_SETTINGS = 1

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

Referenced by getHTML(), and ilLOEditorGUI\settings().


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