ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMarkSchemaGUI Class Reference
+ Collaboration diagram for ilMarkSchemaGUI:

Public Member Functions

 executeCommand ()
 Controller method. More...
 

Protected Member Functions

 ensureMarkSchemaCanBeEdited ()
 
 ensureEctsGradesCanBeEdited ()
 
 addMarkStep ()
 Add a new mark step to the tests marks. More...
 
 saveMarkSchemaFormData ()
 Save the mark schema POST data when the form was submitted. More...
 
 addSimpleMarkSchema ()
 Add a simple mark schema to the tests marks. More...
 
 deleteMarkSteps ()
 Delete selected mark steps. More...
 
 saveMarks ()
 Save the mark schema. More...
 
 showMarkSchema (ilPropertyFormGUI $ects_form=null)
 Display mark schema. More...
 
 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

◆ addMarkStep()

ilMarkSchemaGUI::addMarkStep ( )
protected

Add a new mark step to the tests marks.

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

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

94  {
96 
97  $this->saveMarkSchemaFormData();
98  $this->object->getMarkSchema()->addMarkStep();
99  $this->showMarkSchema();
100  }
saveMarkSchemaFormData()
Save the mark schema POST data when the form was submitted.
showMarkSchema(ilPropertyFormGUI $ects_form=null)
Display mark schema.
+ Here is the call graph for this function:

◆ addSimpleMarkSchema()

ilMarkSchemaGUI::addSimpleMarkSchema ( )
protected

Add a simple mark schema to the tests marks.

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

References ensureMarkSchemaCanBeEdited(), and showMarkSchema().

126  {
128 
129  $this->object->getMarkSchema()->createSimpleSchema(
130  $this->lng->txt('failed_short'), $this->lng->txt('failed_official'),
131  0, 0,
132  $this->lng->txt('passed_short'), $this->lng->txt('passed_official'),
133  50, 1
134  );
135  $this->showMarkSchema();
136  }
showMarkSchema(ilPropertyFormGUI $ects_form=null)
Display mark schema.
+ Here is the call graph for this function:

◆ deleteMarkSteps()

ilMarkSchemaGUI::deleteMarkSteps ( )
protected

Delete selected mark steps.

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

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

142  {
144 
145  if(!isset($_POST['marks']) || !is_array($_POST['marks']))
146  {
147  $this->showMarkSchema();
148  return;
149  }
150 
151  $this->saveMarkSchemaFormData();
152  $delete_mark_steps = array();
153  foreach($_POST['marks'] as $mark_step_id)
154  {
155  $delete_mark_steps[] = $mark_step_id;
156  }
157 
158  if(count($delete_mark_steps))
159  {
160  $this->object->getMarkSchema()->deleteMarkSteps($delete_mark_steps);
161  }
162  else
163  {
164  ilUtil::sendInfo($this->lng->txt('tst_delete_missing_mark'));
165  }
166 
167  $this->showMarkSchema();
168  }
saveMarkSchemaFormData()
Save the mark schema POST data when the form was submitted.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMarkSchema(ilPropertyFormGUI $ects_form=null)
Display mark schema.
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ ensureEctsGradesCanBeEdited()

ilMarkSchemaGUI::ensureEctsGradesCanBeEdited ( )
protected

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

References object, and ilUtil\sendFailure().

Referenced by saveEctsForm().

82  {
83  if(!$this->object->canEditEctsGrades())
84  {
85  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
86  $this->ctrl->redirect($this, 'showMarkSchema');
87  }
88  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureMarkSchemaCanBeEdited()

ilMarkSchemaGUI::ensureMarkSchemaCanBeEdited ( )
protected

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

References object, and ilUtil\sendFailure().

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

70  {
71  if(!$this->object->canEditMarks())
72  {
73  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
74  $this->ctrl->redirect($this, 'showMarkSchema');
75  }
76  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilMarkSchemaGUI::executeCommand ( )

Controller method.

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

References $cmd.

61  {
62  $cmd = $this->ctrl->getCmd('showMarkSchema');
63  $this->$cmd();
64  }
$cmd
Definition: sahs_server.php:35

◆ getEctsForm()

ilMarkSchemaGUI::getEctsForm ( )
protected
Returns
ilPropertyFormGUI

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

References ilFormPropertyGUI\setDisabled(), and ilFormPropertyGUI\setInfo().

Referenced by saveEctsForm(), and showMarkSchema().

284  {
285  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
286 
287  $disabled = !$this->object->canEditEctsGrades();
288 
289  $form = new ilPropertyFormGUI();
290  $form->setFormAction($this->ctrl->getFormAction($this, 'saveEctsForm'));
291  $form->setTitle($this->lng->txt('ects_output_of_ects_grades'));
292 
293  $allow_ects_marks = new ilCheckboxInputGUI($this->lng->txt('ects_allow_ects_grades'), 'ectcs_status');
294  $allow_ects_marks->setDisabled($disabled);
295  for($i = ord('a'); $i <= ord('e'); $i++)
296  {
297  $mark = chr($i);
298 
299  $mark_step = new ilNumberInputGUI(chr($i - 32), 'ects_grade_' . $mark);
300  $mark_step->setInfo(
301  $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_' . $mark . '_desc')
302  );
303  $mark_step->setSize(5);
304  $mark_step->allowDecimals(true);
305  $mark_step->setMinValue(0, true);
306  $mark_step->setMaxValue(100, true);
307  $mark_step->setSuffix($this->lng->txt('percentile'));
308  $mark_step->setRequired(true);
309  $mark_step->setDisabled($disabled);
310  $allow_ects_marks->addSubItem($mark_step);
311  }
312 
313  $mark_step = new ilNonEditableValueGUI('F', 'ects_grade_f');
314  $mark_step->setInfo(
315  $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_f_desc')
316  );
317  $allow_ects_marks->addSubItem($mark_step);
318 
319  $use_ects_fx = new ilCheckboxInputGUI($this->lng->txt('use_ects_fx'), 'use_ects_fx');
320  $use_ects_fx->setDisabled($disabled);
321  $allow_ects_marks->addSubItem($use_ects_fx);
322 
323  $mark_step = new ilNonEditableValueGUI('FX', 'ects_grade_fx');
324  $mark_step->setInfo(
325  $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_fx_desc')
326  );
327  $use_ects_fx->addSubItem($mark_step);
328 
329  $threshold = new ilNumberInputGUI($this->lng->txt('ects_fx_threshold'), 'ects_fx_threshold');
330  $threshold->setInfo($this->lng->txt('ects_fx_threshold_info'));
331  $threshold->setSuffix($this->lng->txt('percentile'));
332  $threshold->allowDecimals(true);
333  $threshold->setSize(5);
334  $threshold->setRequired(true);
335  $threshold->setDisabled($disabled);
336  $use_ects_fx->addSubItem($threshold);
337 
338 
339  $form->addItem($allow_ects_marks);
340 
341  if(!$disabled)
342  {
343  $form->addCommandButton('saveEctsForm', $this->lng->txt('save'));
344  }
345 
346  return $form;
347  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
This class represents a non editable value in a property form.
setDisabled($a_disabled)
Set Disabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ objectSupportsEctsGrades()

ilMarkSchemaGUI::objectSupportsEctsGrades ( )
private
Returns
boolean

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

Referenced by showMarkSchema().

205  {
206  require_once 'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
207  return $this->object instanceof ilEctsGradesEnabled;
208  }
+ Here is the caller graph for this function:

◆ populateEctsForm()

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

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

References $data, array, object, and ilPropertyFormGUI\setValuesByArray().

Referenced by showMarkSchema().

263  {
264  $data = array();
265 
266  $data['ectcs_status'] = $this->object->getECTSOutput();
267  $data['use_ects_fx'] = preg_match('/\d+/', $this->object->getECTSFX());
268  $data['ects_fx_threshold'] = $this->object->getECTSFX();
269 
270  $ects_grades = $this->object->getECTSGrades();
271  for($i = ord('a'); $i <= ord('e'); $i++)
272  {
273  $mark = chr($i);
274  $data['ects_grade_' . $mark] = $ects_grades[chr($i - 32)];
275  }
276 
277  $form->setValuesByArray($data);
278  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveEctsForm()

ilMarkSchemaGUI::saveEctsForm ( )
protected

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

References array, ensureEctsGradesCanBeEdited(), getEctsForm(), ilUtil\sendSuccess(), and showMarkSchema().

353  {
355 
356  $ects_form = $this->getEctsForm();
357  if(!$ects_form->checkInput())
358  {
359  $ects_form->setValuesByPost();
360  $this->showMarkSchema($ects_form);
361  return;
362  }
363 
364  $grades = array();
365  for($i = ord('a'); $i <= ord('e'); $i++)
366  {
367  $mark = chr($i);
368  $grades[chr($i - 32)] = $ects_form->getInput('ects_grade_' . $mark);
369  }
370 
371  $this->object->setECTSGrades($grades);
372  $this->object->setECTSOutput((int)$ects_form->getInput('ectcs_status'));
373  $this->object->setECTSFX(
374  $ects_form->getInput('use_ects_fx') && preg_match('/\d+/', $ects_form->getInput('ects_fx_threshold')) ?
375  $ects_form->getInput('ects_fx_threshold'):
376  NULL
377  );
378 
379  $this->object->saveECTSStatus();
380 
381  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
382  $ects_form->setValuesByPost();
383  $this->showMarkSchema($ects_form);
384  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
showMarkSchema(ilPropertyFormGUI $ects_form=null)
Display mark schema.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ saveMarks()

ilMarkSchemaGUI::saveMarks ( )
protected

Save the mark schema.

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

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

174  {
176 
177  try
178  {
179  $this->saveMarkSchemaFormData();
180  $result = $this->object->checkMarks();
181  }
182  catch(Exception $e)
183  {
184  $result = $this->lng->txt('mark_schema_invalid');
185  }
186 
187  if(is_string($result))
188  {
189  ilUtil::sendFailure($this->lng->txt($result), true);
190  }
191  else
192  {
193  $this->object->getMarkSchema()->saveToDb($this->object->getMarkSchemaForeignId());
194  $this->object->onMarkSchemaSaved();
195  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
196  }
197 
198  $this->ctrl->redirect($this);
199  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$result
saveMarkSchemaFormData()
Save the mark schema POST data when the form was submitted.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ saveMarkSchemaFormData()

ilMarkSchemaGUI::saveMarkSchemaFormData ( )
protected

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

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

References $_POST, and ilUtil\stripSlashes().

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

106  {
107  $this->object->getMarkSchema()->flush();
108  foreach($_POST as $key => $value)
109  {
110  if(preg_match('/mark_short_(\d+)/', $key, $matches))
111  {
112  $this->object->getMarkSchema()->addMarkStep(
113  ilUtil::stripSlashes($_POST["mark_short_$matches[1]"]),
114  ilUtil::stripSlashes($_POST["mark_official_$matches[1]"]),
115  ilUtil::stripSlashes($_POST["mark_percentage_$matches[1]"]),
116  ilUtil::stripSlashes($_POST["passed_$matches[1]"])
117  );
118  }
119  }
120  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMarkSchema()

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

Display mark schema.

Parameters
ilPropertyFormGUI$ects_form

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

References array, ilButton\BUTTON_TYPE_SUBMIT, getEctsForm(), ilSubmitButton\getInstance(), ilButton\getInstance(), object, objectSupportsEctsGrades(), populateEctsForm(), and ilUtil\sendInfo().

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

215  {
216  if(!$this->object->canEditMarks())
217  {
218  ilUtil::sendInfo($this->lng->txt('cannot_edit_marks'));
219  }
220 
221  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, 'showMarkSchema'));
222 
223  require_once 'Modules/Test/classes/tables/class.ilMarkSchemaTableGUI.php';
224  $mark_schema_table = new ilMarkSchemaTableGUI($this, 'showMarkSchema', '', $this->object);
225 
226  if($this->object->canEditMarks())
227  {
228  require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
229  $create_simple_mark_schema_button = ilSubmitButton::getInstance();
230  $create_simple_mark_schema_button->setCaption($this->lng->txt('tst_mark_create_simple_mark_schema'), false);
231  $create_simple_mark_schema_button->setCommand('addSimpleMarkSchema');
232  $this->toolbar->addButtonInstance($create_simple_mark_schema_button);
233 
234  require_once 'Services/UIComponent/Button/classes/class.ilButton.php';
235  $create_new_mark_step_button = ilButton::getInstance();
236  $create_new_mark_step_button->setCaption($this->lng->txt('tst_mark_create_new_mark_step'), false);
237  $create_new_mark_step_button->setButtonType(ilButton::BUTTON_TYPE_SUBMIT);
238  $create_new_mark_step_button->setForm('form_' . $mark_schema_table->getId());
239  $create_new_mark_step_button->setName('addMarkStep');
240  $this->toolbar->addButtonInstance($create_new_mark_step_button);
241  }
242 
243 
244  $content_parts = array($mark_schema_table->getHTML());
245 
246  if($this->objectSupportsEctsGrades() && $this->object->canShowEctsGrades())
247  {
248  if(!($ects_form instanceof ilPropertyFormGUI))
249  {
250  $ects_form = $this->getEctsForm();
251  $this->populateEctsForm($ects_form);
252  }
253  $content_parts[] = $ects_form->getHTML();
254  }
255 
256  $this->tpl->setContent(implode('<br />', $content_parts));
257  }
This class represents a property form user interface.
static getInstance()
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
populateEctsForm(ilPropertyFormGUI $form)
Create new PHPExcel object
obj_idprivate
const BUTTON_TYPE_SUBMIT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilMarkSchemaGUI::$ctrl
protected

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

◆ $lng

ilMarkSchemaGUI::$lng
protected

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

◆ $object

ilMarkSchemaGUI::$object
protected

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

◆ $toolbar

ilMarkSchemaGUI::$toolbar
protected

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

◆ $tpl

ilMarkSchemaGUI::$tpl
protected

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


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