ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 91 of file class.ilMarkSchemaGUI.php.

92 {
94
96 $this->object->getMarkSchema()->addMarkStep();
97 $this->showMarkSchema();
98 }
showMarkSchema(ilPropertyFormGUI $ects_form=null)
Display mark schema.
saveMarkSchemaFormData()
Save the mark schema POST data when the form was submitted.

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

+ Here is the call graph for this function:

◆ addSimpleMarkSchema()

ilMarkSchemaGUI::addSimpleMarkSchema ( )
protected

Add a simple mark schema to the tests marks.

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

122 {
124
125 $this->object->getMarkSchema()->createSimpleSchema(
126 $this->lng->txt('failed_short'),
127 $this->lng->txt('failed_official'),
128 0,
129 0,
130 $this->lng->txt('passed_short'),
131 $this->lng->txt('passed_official'),
132 50,
133 1
134 );
135 $this->showMarkSchema();
136 }

References ensureMarkSchemaCanBeEdited(), and showMarkSchema().

+ 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.

142 {
144
145 if (!isset($_POST['marks']) || !is_array($_POST['marks'])) {
146 $this->showMarkSchema();
147 return;
148 }
149
150 $this->saveMarkSchemaFormData();
151 $delete_mark_steps = array();
152 foreach ($_POST['marks'] as $mark_step_id) {
153 $delete_mark_steps[] = $mark_step_id;
154 }
155
156 if (count($delete_mark_steps)) {
157 $this->object->getMarkSchema()->deleteMarkSteps($delete_mark_steps);
158 } else {
159 ilUtil::sendInfo($this->lng->txt('tst_delete_missing_mark'));
160 }
161
162 $this->showMarkSchema();
163 }
$_POST["username"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ ensureEctsGradesCanBeEdited()

ilMarkSchemaGUI::ensureEctsGradesCanBeEdited ( )
protected

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

81 {
82 if (!$this->object->canEditEctsGrades()) {
83 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
84 $this->ctrl->redirect($this, 'showMarkSchema');
85 }
86 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilUtil\sendFailure().

Referenced by saveEctsForm().

+ 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.

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

References ilUtil\sendFailure().

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

+ 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.

61 {
62 $cmd = $this->ctrl->getCmd('showMarkSchema');
63 $this->$cmd();
64 }

◆ getEctsForm()

ilMarkSchemaGUI::getEctsForm ( )
protected
Returns
ilPropertyFormGUI

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

268 {
269 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
270
271 $disabled = !$this->object->canEditEctsGrades();
272
273 $form = new ilPropertyFormGUI();
274 $form->setFormAction($this->ctrl->getFormAction($this, 'saveEctsForm'));
275 $form->setTitle($this->lng->txt('ects_output_of_ects_grades'));
276
277 $allow_ects_marks = new ilCheckboxInputGUI($this->lng->txt('ects_allow_ects_grades'), 'ectcs_status');
278 $allow_ects_marks->setDisabled($disabled);
279 for ($i = ord('a'); $i <= ord('e'); $i++) {
280 $mark = chr($i);
281
282 $mark_step = new ilNumberInputGUI(chr($i - 32), 'ects_grade_' . $mark);
283 $mark_step->setInfo(
284 $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_' . $mark . '_desc')
285 );
286 $mark_step->setSize(5);
287 $mark_step->allowDecimals(true);
288 $mark_step->setMinValue(0, true);
289 $mark_step->setMaxValue(100, true);
290 $mark_step->setSuffix($this->lng->txt('percentile'));
291 $mark_step->setRequired(true);
292 $mark_step->setDisabled($disabled);
293 $allow_ects_marks->addSubItem($mark_step);
294 }
295
296 $mark_step = new ilNonEditableValueGUI('F', 'ects_grade_f');
297 $mark_step->setInfo(
298 $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_f_desc')
299 );
300 $allow_ects_marks->addSubItem($mark_step);
301
302 $use_ects_fx = new ilCheckboxInputGUI($this->lng->txt('use_ects_fx'), 'use_ects_fx');
303 $use_ects_fx->setDisabled($disabled);
304 $allow_ects_marks->addSubItem($use_ects_fx);
305
306 $mark_step = new ilNonEditableValueGUI('FX', 'ects_grade_fx');
307 $mark_step->setInfo(
308 $this->lng->txt('ects_grade_desc_prefix') . ' ' . $this->lng->txt('ects_grade_fx_desc')
309 );
310 $use_ects_fx->addSubItem($mark_step);
311
312 $threshold = new ilNumberInputGUI($this->lng->txt('ects_fx_threshold'), 'ects_fx_threshold');
313 $threshold->setInfo($this->lng->txt('ects_fx_threshold_info'));
314 $threshold->setSuffix($this->lng->txt('percentile'));
315 $threshold->allowDecimals(true);
316 $threshold->setSize(5);
317 $threshold->setRequired(true);
318 $threshold->setDisabled($disabled);
319 $use_ects_fx->addSubItem($threshold);
320
321
322 $form->addItem($allow_ects_marks);
323
324 if (!$disabled) {
325 $form->addCommandButton('saveEctsForm', $this->lng->txt('save'));
326 }
327
328 return $form;
329 }
This class represents a checkbox property in a property form.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
$i
Definition: disco.tpl.php:19
if(isset($_POST['submit'])) $form

References $form, and $i.

Referenced by saveEctsForm(), and showMarkSchema().

+ Here is the caller graph for this function:

◆ objectSupportsEctsGrades()

ilMarkSchemaGUI::objectSupportsEctsGrades ( )
private
Returns
boolean

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

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

Referenced by showMarkSchema().

+ Here is the caller graph for this function:

◆ populateEctsForm()

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

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

248 {
249 $data = array();
250
251 $data['ectcs_status'] = $this->object->getECTSOutput();
252 $data['use_ects_fx'] = preg_match('/\d+/', $this->object->getECTSFX());
253 $data['ects_fx_threshold'] = $this->object->getECTSFX();
254
255 $ects_grades = $this->object->getECTSGrades();
256 for ($i = ord('a'); $i <= ord('e'); $i++) {
257 $mark = chr($i);
258 $data['ects_grade_' . $mark] = $ects_grades[chr($i - 32)];
259 }
260
261 $form->setValuesByArray($data);
262 }

References $data, $form, and $i.

Referenced by showMarkSchema().

+ Here is the caller graph for this function:

◆ saveEctsForm()

ilMarkSchemaGUI::saveEctsForm ( )
protected

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

335 {
337
338 $ects_form = $this->getEctsForm();
339 if (!$ects_form->checkInput()) {
340 $ects_form->setValuesByPost();
341 $this->showMarkSchema($ects_form);
342 return;
343 }
344
345 $grades = array();
346 for ($i = ord('a'); $i <= ord('e'); $i++) {
347 $mark = chr($i);
348 $grades[chr($i - 32)] = $ects_form->getInput('ects_grade_' . $mark);
349 }
350
351 $this->object->setECTSGrades($grades);
352 $this->object->setECTSOutput((int) $ects_form->getInput('ectcs_status'));
353 $this->object->setECTSFX(
354 $ects_form->getInput('use_ects_fx') && preg_match('/\d+/', $ects_form->getInput('ects_fx_threshold')) ?
355 $ects_form->getInput('ects_fx_threshold'):
356 null
357 );
358
359 $this->object->saveECTSStatus();
360
361 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
362 $ects_form->setValuesByPost();
363 $this->showMarkSchema($ects_form);
364 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ saveMarks()

ilMarkSchemaGUI::saveMarks ( )
protected

Save the mark schema.

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

169 {
171
172 try {
173 $this->saveMarkSchemaFormData();
174 $result = $this->object->checkMarks();
175 } catch (Exception $e) {
176 $result = $this->lng->txt('mark_schema_invalid');
177 }
178
179 if (is_string($result)) {
180 ilUtil::sendFailure($this->lng->txt($result), true);
181 } else {
182 $this->object->getMarkSchema()->saveToDb($this->object->getMarkSchemaForeignId());
183 $this->object->onMarkSchemaSaved();
184 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
185 }
186
187 $this->ctrl->redirect($this);
188 }
$result

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

+ 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 103 of file class.ilMarkSchemaGUI.php.

104 {
105 $this->object->getMarkSchema()->flush();
106 foreach ($_POST as $key => $value) {
107 if (preg_match('/mark_short_(\d+)/', $key, $matches)) {
108 $this->object->getMarkSchema()->addMarkStep(
109 ilUtil::stripSlashes($_POST["mark_short_$matches[1]"]),
110 ilUtil::stripSlashes($_POST["mark_official_$matches[1]"]),
111 ilUtil::stripSlashes($_POST["mark_percentage_$matches[1]"]),
112 ilUtil::stripSlashes($_POST["passed_$matches[1]"])
113 );
114 }
115 }
116 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$key
Definition: croninfo.php:18

References $_POST, $key, and ilUtil\stripSlashes().

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

+ 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 203 of file class.ilMarkSchemaGUI.php.

204 {
205 if (!$this->object->canEditMarks()) {
206 ilUtil::sendInfo($this->lng->txt('cannot_edit_marks'));
207 }
208
209 $this->toolbar->setFormAction($this->ctrl->getFormAction($this, 'showMarkSchema'));
210
211 require_once 'Modules/Test/classes/tables/class.ilMarkSchemaTableGUI.php';
212 $mark_schema_table = new ilMarkSchemaTableGUI($this, 'showMarkSchema', '', $this->object);
213
214 if ($this->object->canEditMarks()) {
215 require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
216 $create_simple_mark_schema_button = ilSubmitButton::getInstance();
217 $create_simple_mark_schema_button->setCaption($this->lng->txt('tst_mark_create_simple_mark_schema'), false);
218 $create_simple_mark_schema_button->setCommand('addSimpleMarkSchema');
219 $this->toolbar->addButtonInstance($create_simple_mark_schema_button);
220
221 require_once 'Services/UIComponent/Button/classes/class.ilButton.php';
222 $create_new_mark_step_button = ilButton::getInstance();
223 $create_new_mark_step_button->setCaption($this->lng->txt('tst_mark_create_new_mark_step'), false);
224 $create_new_mark_step_button->setButtonType(ilButton::BUTTON_TYPE_SUBMIT);
225 $create_new_mark_step_button->setForm('form_' . $mark_schema_table->getId());
226 $create_new_mark_step_button->setName('addMarkStep');
227 $this->toolbar->addButtonInstance($create_new_mark_step_button);
228 }
229
230
231 $content_parts = array($mark_schema_table->getHTML());
232
233 if ($this->objectSupportsEctsGrades() && $this->object->canShowEctsGrades()) {
234 if (!($ects_form instanceof ilPropertyFormGUI)) {
235 $ects_form = $this->getEctsForm();
236 $this->populateEctsForm($ects_form);
237 }
238 $content_parts[] = $ects_form->getHTML();
239 }
240
241 $this->tpl->setContent(implode('<br />', $content_parts));
242 }
const BUTTON_TYPE_SUBMIT
static getInstance()
populateEctsForm(ilPropertyFormGUI $form)
static getInstance()
Factory.

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

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

+ 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: