ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMarkSchemaGUI Class Reference
+ Collaboration diagram for ilMarkSchemaGUI:

Public Member Functions

 executeCommand ()
 Controller method.

Protected Member Functions

 ensureMarkSchemaCanBeEdited ()
 addMarkStep ()
 Add a new mark step to the tests marks.
 saveMarkSchemaFormData ()
 Save the mark schema POST data when the form was submitted.
 addSimpleMarkSchema ()
 Add a simple mark schema to the tests marks.
 deleteMarkSteps ()
 Delete selected mark steps.
 saveMarks ()
 Save the mark schema.
 showMarkSchema (ilPropertyFormGUI $ects_form=null)
 Display mark schema.
 populateEctsForm (ilPropertyFormGUI $form)
 getEctsForm ()
 saveEctsForm ()

Protected Attributes

 $object
 $lng
 $ctrl
 $tpl
 $toolbar

Private Member Functions

 objectSupportsEctsGrades ()

Detailed Description

Definition at line 9 of file class.ilMarkSchemaGUI.php.

Member Function Documentation

ilMarkSchemaGUI::addMarkStep ( )
protected

Add a new mark step to the tests marks.

Definition at line 81 of file class.ilMarkSchemaGUI.php.

References ensureMarkSchemaCanBeEdited(), saveMarkSchemaFormData(), and showMarkSchema().

{
$this->object->getMarkSchema()->addMarkStep();
$this->showMarkSchema();
}

+ Here is the call graph for this function:

ilMarkSchemaGUI::addSimpleMarkSchema ( )
protected

Add a simple mark schema to the tests marks.

Definition at line 113 of file class.ilMarkSchemaGUI.php.

References ensureMarkSchemaCanBeEdited(), and showMarkSchema().

{
$this->object->getMarkSchema()->createSimpleSchema(
$this->lng->txt('failed_short'), $this->lng->txt('failed_official'),
0, 0,
$this->lng->txt('passed_short'), $this->lng->txt('passed_official'),
50, 1
);
$this->showMarkSchema();
}

+ Here is the call graph for this function:

ilMarkSchemaGUI::deleteMarkSteps ( )
protected

Delete selected mark steps.

Definition at line 129 of file class.ilMarkSchemaGUI.php.

References $_POST, ensureMarkSchemaCanBeEdited(), saveMarkSchemaFormData(), ilUtil\sendInfo(), and showMarkSchema().

{
if(!isset($_POST['marks']) || !is_array($_POST['marks']))
{
$this->showMarkSchema();
return;
}
$delete_mark_steps = array();
foreach($_POST['marks'] as $mark_step_id)
{
$delete_mark_steps[] = $mark_step_id;
}
if(count($delete_mark_steps))
{
$this->object->getMarkSchema()->deleteMarkSteps($delete_mark_steps);
}
else
{
ilUtil::sendInfo($this->lng->txt('tst_delete_missing_mark'));
}
$this->showMarkSchema();
}

+ Here is the call graph for this function:

ilMarkSchemaGUI::ensureMarkSchemaCanBeEdited ( )
protected

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

References ilUtil\sendFailure().

Referenced by addMarkStep(), addSimpleMarkSchema(), deleteMarkSteps(), and saveMarks().

{
if(!$this->object->canEditMarks())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirect($this, 'showMarkSchema');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMarkSchemaGUI::executeCommand ( )

Controller method.

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

References $cmd.

{
$cmd = $this->ctrl->getCmd('showMarkSchema');
$this->$cmd();
}
ilMarkSchemaGUI::getEctsForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 262 of file class.ilMarkSchemaGUI.php.

References ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), and ilNumberInputGUI\setSize().

Referenced by saveEctsForm(), and showMarkSchema().

{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'saveEctsForm'));
$form->addCommandButton('saveEctsForm', $this->lng->txt('save'));
$form->setTitle($this->lng->txt('ects_output_of_ects_grades'));
$allow_ects_marks = new ilCheckboxInputGUI($this->lng->txt('ects_allow_ects_grades'), 'ectcs_status');
for($i = ord('a'); $i <= ord('e'); $i++)
{
$mark = chr($i);
$mark_step = new ilNumberInputGUI(chr($i - 32) . ' - ' . $this->lng->txt('ects_grade_' . $mark . '_short'), 'ects_grade_' . $mark);
$mark_step->setSize(5);
$mark_step->allowDecimals(true);
$mark_step->setMinValue(0, true);
$mark_step->setMaxValue(100, true);
$mark_step->setSuffix($this->lng->txt('percentile'));
$mark_step->setRequired(true);
$allow_ects_marks->addSubItem($mark_step);
}
$use_ects_fx = new ilCheckboxInputGUI($this->lng->txt('use_ects_fx'), 'use_ects_fx');
$threshold = new ilNumberInputGUI($this->lng->txt('ects_fx_threshold'), 'ects_fx_threshold');
$threshold->setInfo($this->lng->txt('ects_fx_threshold_info'));
$threshold->setSuffix($this->lng->txt('percentile'));
$threshold->allowDecimals(true);
$threshold->setSize(5);
$threshold->setRequired(true);
$use_ects_fx->addSubItem($threshold);
$allow_ects_marks->addSubItem($use_ects_fx);
$form->addItem($allow_ects_marks);
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMarkSchemaGUI::objectSupportsEctsGrades ( )
private
Returns
boolean

Definition at line 192 of file class.ilMarkSchemaGUI.php.

Referenced by saveEctsForm(), and showMarkSchema().

{
require_once 'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
return $this->object instanceof ilEctsGradesEnabled;
}

+ Here is the caller graph for this function:

ilMarkSchemaGUI::populateEctsForm ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form

Definition at line 241 of file class.ilMarkSchemaGUI.php.

References ilPropertyFormGUI\setValuesByArray().

Referenced by showMarkSchema().

{
$data = array();
$data['ectcs_status'] = $this->object->getECTSOutput();
$data['use_ects_fx'] = preg_match('/\d+/', $this->object->getECTSFX());
$data['ects_fx_threshold'] = $this->object->getECTSFX();
$ects_grades = $this->object->getECTSGrades();
for($i = ord('a'); $i <= ord('e'); $i++)
{
$mark = chr($i);
$data['ects_grade_' . $mark] = $ects_grades[chr($i - 32)];
}
$form->setValuesByArray($data);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMarkSchemaGUI::saveEctsForm ( )
protected

Definition at line 304 of file class.ilMarkSchemaGUI.php.

References getEctsForm(), objectSupportsEctsGrades(), ilUtil\sendSuccess(), and showMarkSchema().

{
if(!$this->objectSupportsEctsGrades() && $this->object->canEditEctsGrades())
{
$this->showMarkSchema();
return;
}
$ects_form = $this->getEctsForm();
if(!$ects_form->checkInput())
{
$ects_form->setValuesByPost();
$this->showMarkSchema($ects_form);
return;
}
$grades = array();
for($i = ord('a'); $i <= ord('e'); $i++)
{
$mark = chr($i);
$grades[chr($i - 32)] = $ects_form->getInput('ects_grade_' . $mark);
}
$this->object->setECTSGrades($grades);
$this->object->setECTSOutput((int)$ects_form->getInput('ectcs_status'));
$this->object->setECTSFX(
$ects_form->getInput('use_ects_fx') && preg_match('/\d+/', $ects_form->getInput('ects_fx_threshold')) ?
$ects_form->getInput('ects_fx_threshold'):
NULL
);
$this->object->saveECTSStatus();
ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
$ects_form->setValuesByPost();
$this->showMarkSchema($ects_form);
}

+ Here is the call graph for this function:

ilMarkSchemaGUI::saveMarks ( )
protected

Save the mark schema.

Definition at line 161 of file class.ilMarkSchemaGUI.php.

References $result, ensureMarkSchemaCanBeEdited(), saveMarkSchemaFormData(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
try
{
$result = $this->object->checkMarks();
}
catch(Exception $e)
{
$result = $this->lng->txt('mark_schema_invalid');
}
if(is_string($result))
{
ilUtil::sendFailure($this->lng->txt($result), true);
}
else
{
$this->object->getMarkSchema()->saveToDb($this->object->getMarkSchemaForeignId());
$this->object->onMarkSchemaSaved();
ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
}
$this->ctrl->redirect($this);
}

+ Here is the call graph for this function:

ilMarkSchemaGUI::saveMarkSchemaFormData ( )
protected

Save the mark schema POST data when the form was submitted.

Definition at line 93 of file class.ilMarkSchemaGUI.php.

References $_POST, and ilUtil\stripSlashes().

Referenced by addMarkStep(), deleteMarkSteps(), and saveMarks().

{
$this->object->getMarkSchema()->flush();
foreach($_POST as $key => $value)
{
if(preg_match('/mark_short_(\d+)/', $key, $matches))
{
$this->object->getMarkSchema()->addMarkStep(
ilUtil::stripSlashes($_POST["mark_short_$matches[1]"]),
ilUtil::stripSlashes($_POST["mark_official_$matches[1]"]),
ilUtil::stripSlashes($_POST["mark_percentage_$matches[1]"]),
ilUtil::stripSlashes($_POST["passed_$matches[1]"])
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMarkSchemaGUI::showMarkSchema ( ilPropertyFormGUI  $ects_form = null)
protected

Display mark schema.

Parameters
ilPropertyFormGUI$ects_form

Definition at line 202 of file class.ilMarkSchemaGUI.php.

References getEctsForm(), ilSubmitButton\getInstance(), objectSupportsEctsGrades(), populateEctsForm(), and ilUtil\sendInfo().

Referenced by addMarkStep(), addSimpleMarkSchema(), deleteMarkSteps(), and saveEctsForm().

{
if(!$this->object->canEditMarks())
{
ilUtil::sendInfo($this->lng->txt('cannot_edit_marks'));
}
$this->toolbar->setFormAction($this->ctrl->getFormAction($this, 'showMarkSchema'));
if($this->object->canEditMarks())
{
require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
$create_simple_mark_schema_button = ilSubmitButton::getInstance();
$create_simple_mark_schema_button->setCaption($this->lng->txt('tst_mark_create_simple_mark_schema'), false);
$create_simple_mark_schema_button->setCommand('addSimpleMarkSchema');
$this->toolbar->addButtonInstance($create_simple_mark_schema_button);
}
require_once 'Modules/Test/classes/tables/class.ilMarkSchemaTableGUI.php';
$mark_schema_table = new ilMarkSchemaTableGUI($this, 'showMarkSchema', '', $this->object);
$content_parts = array($mark_schema_table->getHTML());
if($this->objectSupportsEctsGrades() && $this->object->canEditEctsGrades())
{
if(!($ects_form instanceof ilPropertyFormGUI))
{
$ects_form = $this->getEctsForm();
$this->populateEctsForm($ects_form);
}
$content_parts[] = $ects_form->getHTML();
}
$this->tpl->setContent(implode('<br />', $content_parts));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMarkSchemaGUI::$ctrl
protected

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

ilMarkSchemaGUI::$lng
protected

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

ilMarkSchemaGUI::$object
protected

Definition at line 14 of file class.ilMarkSchemaGUI.php.

ilMarkSchemaGUI::$toolbar
protected

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

ilMarkSchemaGUI::$tpl
protected

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


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