4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6 require_once
'Modules/Test/classes/class.ilObjTest.php';
7 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
26 public function __construct($a_data, $a_id = 0, $a_call_by_reference =
true, $a_prepare_output =
true)
29 $rbacsystem = $DIC[
'rbacsystem'];
32 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
34 if (!$rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
35 $this->
ilias->raiseError($this->lng->txt(
"msg_no_perm_read_assf"), $this->
ilias->error_obj->WARNING);
38 $this->lng->loadLanguageModule(
'assessment');
48 $rbacsystem = $DIC[
'rbacsystem'];
49 $ilTabs = $DIC[
'ilTabs'];
51 $next_class = $this->ctrl->getNextClass($this);
52 $cmd = $this->ctrl->getCmd();
55 switch ($next_class) {
56 case 'ilpermissiongui':
57 $ilTabs->activateTab(
'perm_settings');
58 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
60 $ret = &$this->ctrl->forwardCommand($perm_gui);
63 case 'ilsettingstemplategui':
67 case 'ilglobalunitconfigurationgui':
68 if (!$rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
69 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->WARNING);
72 $ilTabs->setTabActive(
'units');
74 require_once
'Modules/TestQuestionPool/classes/class.ilGlobalUnitConfigurationGUI.php';
75 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
79 $this->ctrl->forwardCommand($gui);
83 if ($cmd ==
"" || $cmd ==
"view") {
102 $rbacadmin = $DIC[
'rbacadmin'];
105 $newObj = parent::saveObject();
110 ilUtil::sendSuccess($this->lng->txt(
"object_added"),
true);
112 $this->ctrl->redirect($this);
122 $ilTabs = $DIC[
'ilTabs'];
124 $ilTabs->setTabActive(
'settings');
126 if (
$form === null) {
127 $form = $this->buildSettingsForm();
130 $this->tpl->setVariable(
"ADM_CONTENT",
$form->getHTML());
133 private function buildSettingsForm()
139 $ilAccess = $DIC[
'ilAccess'];
141 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
142 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
144 $form->setFormAction($this->ctrl->getFormAction($this));
145 $form->setTableWidth(
"100%");
146 $form->setId(
"settings");
149 $header->setTitle($this->lng->txt(
'settings'));
153 $chb =
new ilCheckboxInputGUI($this->lng->txt(
'ass_process_lock'),
'ass_process_lock');
155 $chb->setInfo($this->lng->txt(
'ass_process_lock_desc'));
156 $form->addItem($chb);
157 $rg =
new ilRadioGroupInputGUI($this->lng->txt(
'ass_process_lock_mode'),
'ass_process_lock_mode');
160 $opt->
setInfo($this->lng->txt(
'ass_process_lock_mode_file_desc'));
161 $rg->addOption($opt);
163 $opt->
setInfo($this->lng->txt(
'ass_process_lock_mode_db_desc'));
164 $rg->addOption($opt);
166 $rg->setValue($this->object->getAssessmentProcessLockMode());
168 $chb->addSubItem($rg);
170 $assessmentSetting =
new ilSetting(
'assessment');
171 $imap_line_color = array_key_exists(
'imap_line_color',
$_GET) ?
$_GET[
'imap_line_color'] : $assessmentSetting->get(
'imap_line_color');
172 if (strlen($imap_line_color) == 0) {
173 $imap_line_color =
'FF0000';
176 $linepicker =
new ilColorPickerInputGUI($this->lng->txt(
'assessment_imap_line_color'),
'imap_line_color');
177 $linepicker->
setValue($imap_line_color);
178 $form->addItem($linepicker);
180 $user_criteria = array_key_exists(
'user_criteria',
$_GET) ?
$_GET[
'user_criteria'] : $assessmentSetting->get(
'user_criteria');
181 $userCriteria =
new ilSelectInputGUI($this->lng->txt(
'user_criteria'),
'user_criteria');
182 $userCriteria->
setInfo($this->lng->txt(
'user_criteria_desc'));
183 $userCriteria->setRequired(
true);
185 $fields = array(
'usr_id',
'login',
'email',
'matriculation',
'ext_account');
186 $usr_fields = array();
187 foreach ($fields as $field) {
188 $usr_fields[$field] = $field;
190 $userCriteria->setOptions($usr_fields);
191 $userCriteria->setValue($user_criteria);
192 $form->addItem($userCriteria);
195 $this->lng->txt(
'tst_skill_triggerings_num_req_answers'),
198 $numRequiredAnswers->
setInfo($this->lng->txt(
'tst_skill_triggerings_num_req_answers_desc'));
199 $numRequiredAnswers->setSize(4);
200 $numRequiredAnswers->allowDecimals(
false);
201 $numRequiredAnswers->setMinValue(1);
202 $numRequiredAnswers->setMinvalueShouldBeGreater(
false);
203 $numRequiredAnswers->setValue($this->object->getSkillTriggeringNumAnswersBarrier());
204 $form->addItem($numRequiredAnswers);
206 $ceeqwh =
new ilCheckboxInputGUI($this->lng->txt(
'export_essay_qst_with_html'),
'export_essay_qst_with_html');
207 $ceeqwh->
setChecked($this->object->getExportEssayQuestionsWithHtml());
208 $ceeqwh->setInfo($this->lng->txt(
'export_essay_qst_with_html_desc'));
209 $form->addItem($ceeqwh);
213 $header->setTitle($this->lng->txt(
"assf_questiontypes"));
217 $allowed =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assf_allowed_questiontypes'),
"chb_allowed_questiontypes");
220 $allowedtypes = array();
221 foreach ($questiontypes as $qt) {
222 if (!in_array($qt[
'question_type_id'], $forbidden_types)) {
223 array_push($allowedtypes, $qt[
'question_type_id']);
226 $allowed->setValue($allowedtypes);
227 foreach ($questiontypes as $type_name => $qtype) {
228 $allowed->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
230 $allowed->setInfo($this->lng->txt(
'assf_allowed_questiontypes_desc'));
231 $form->addItem($allowed);
234 $manual =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_manual_scoring_activate'),
"chb_manual_scoring");
236 $manual->setValue($manscoring);
237 foreach ($questiontypes as $type_name => $qtype) {
238 $manual->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
240 $manual->setInfo($this->lng->txt(
'assessment_log_manual_scoring_desc'));
241 $form->addItem($manual);
244 $scoring_activation =
new ilCheckboxInputGUI($this->lng->txt(
'assessment_scoring_adjust'),
'chb_scoring_adjust');
245 $scoring_activation->
setChecked($this->object->getScoringAdjustmentEnabled());
246 $scoring_activation->setInfo($this->lng->txt(
'assessment_scoring_adjust_desc'));
247 $form->addItem($scoring_activation);
250 $scoring =
new ilCheckboxGroupInputGUI($this->lng->txt(
'assessment_log_scoring_adjustment_activate'),
"chb_scoring_adjustment");
251 $scoring_active = $this->
object->getScoringAdjustableQuestions();
252 $scoring->
setValue($scoring_active);
253 foreach ($this->object->fetchScoringAdjustableTypes($questiontypes) as $type_name => $qtype) {
254 $scoring->addOption(
new ilCheckboxOption($type_name, $qtype[
"question_type_id"]));
256 $scoring->setInfo($this->lng->txt(
'assessment_log_scoring_adjustment_desc'));
257 $form->addItem($scoring);
259 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
260 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
272 $ilAccess = $DIC[
'ilAccess'];
273 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
274 $this->ctrl->redirect($this,
'settings');
277 $form = $this->buildSettingsForm();
278 if (!
$form->checkInput()) {
279 $form->setValuesByPost();
283 $this->
object->setSkillTriggeringNumAnswersBarrier((
int)
$_POST[
'num_req_answers']);
284 $this->
object->setExportEssayQuestionsWithHtml((
int) $_POST[
"export_essay_qst_with_html"] == 1);
285 $this->
object->_setManualScoring($_POST[
"chb_manual_scoring"]);
286 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
288 $forbidden_types = array();
289 foreach ($questiontypes as
$name =>
$row) {
290 if (!in_array(
$row[
"question_type_id"], $_POST[
"chb_allowed_questiontypes"])) {
291 array_push($forbidden_types,
$row[
"question_type_id"]);
294 $this->
object->_setForbiddenQuestionTypes($forbidden_types);
296 $this->
object->setScoringAdjustmentEnabled($_POST[
'chb_scoring_adjust']);
297 $scoring_types = array();
298 foreach ($questiontypes as
$name =>
$row) {
299 if (in_array(
$row[
"question_type_id"], (array) $_POST[
"chb_scoring_adjustment"])) {
300 array_push($scoring_types,
$row[
"question_type_id"]);
303 $this->
object->setScoringAdjustableQuestions($scoring_types);
305 if (!$_POST[
'ass_process_lock']) {
308 $this->
object->setAssessmentProcessLockMode($_POST[
'ass_process_lock_mode']);
311 $assessmentSetting =
new ilSetting(
'assessment');
312 $assessmentSetting->set(
'use_javascript',
'1');
313 if (strlen($_POST[
'imap_line_color']) == 6) {
318 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
320 $this->ctrl->redirect($this,
'settings');
331 $form->setValuesByPost();
332 $this->logsObject(
$form);
341 if (!
$form->checkInput()) {
342 $form->setValuesByPost();
343 $this->logsObject(
$form);
354 $this->lng->txt(
"assessment_log_datetime"),
355 $this->lng->txt(
"user"),
356 $this->lng->txt(
"assessment_log_text"),
357 $this->lng->txt(
"question")
359 include_once
"./Modules/Test/classes/class.ilObjTest.php";
360 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
365 foreach ($log_output as
$key =>
$log) {
366 if (!array_key_exists(
$log[
"user_fi"],
$users)) {
370 if (
$log[
"question_fi"] ||
$log[
"original_fi"]) {
372 if (strlen(
$title) == 0) {
375 $title = $this->lng->txt(
"assessment_log_question") .
": " .
$title;
380 array_push($csvrow, trim(
$users[
$log[
"user_fi"]][
"title"] .
" " .
$users[
$log[
"user_fi"]][
"firstname"] .
" " .
$users[
$log[
"user_fi"]][
"lastname"]));
381 array_push($csvrow, trim($log[
"logtext"]));
382 array_push($csvrow,
$title);
386 foreach ($csv as
$row) {
387 $csvoutput .= join($separator, $row) .
"\n";
397 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
399 $form->setPreventDoubleSubmission(
false);
400 $form->setFormAction($this->ctrl->getFormAction($this));
401 $form->setTableWidth(
"100%");
402 $form->setId(
"logs");
405 $header->setTitle($this->lng->txt(
"assessment_log"));
410 $from->setShowTime(
true);
411 $from->setRequired(
true);
417 $until->setRequired(
true);
418 $form->addItem($until);
420 require_once
'Modules/Test/classes/class.ilObjTest.php';
421 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
425 $fortest =
new ilSelectInputGUI($this->lng->txt(
'assessment_log_for_test'),
"sel_test");
427 $sorted_options = array();
428 foreach ($available_tests as
$key => $value) {
429 $sorted_options[] = array(
430 'title' =>
ilUtil::prepareFormOutput($value) .
" [" . $this->object->getNrOfLogEntries(
$key) .
" " . $this->lng->txt(
"assessment_log_log_entries") .
"]",
435 $options = array(
'' => $this->lng->txt(
'please_choose'));
436 foreach ($sorted_options as $option) {
437 $options[$option[
'key']] = $option[
'title'];
440 $form->addItem($fortest);
442 $form->addCommandButton(
'showLog', $this->lng->txt(
'show'));
443 $form->addCommandButton(
'exportLog', $this->lng->txt(
'export'));
457 $ilTabs = $DIC[
'ilTabs'];
459 $ilTabs->activateTab(
'logs');
471 if (isset(
$_GET[
'sel_test'])) {
472 $p_test =
$values[
'sel_test'] = (int)
$_GET[
'sel_test'];
475 if (isset(
$_GET[
'log_from'])) {
476 $fromdate = (int)
$_GET[
'log_from'];
478 $fromdate = mktime(0, 0, 0, 1, 1, date(
'Y'));
481 if (isset(
$_GET[
'log_until'])) {
482 $untildate = (int)
$_GET[
'log_until'];
492 $fromdate_input =
$form->getItemByPostVar(
'log_from')->getDate();
493 $untildate_input =
$form->getItemByPostVar(
'log_until')->getDate();
495 $p_test =
$form->getInput(
'sel_test');
502 $this->ctrl->setParameter($this,
'sel_test', (
int) $p_test);
503 $this->ctrl->setParameter($this,
'log_until', (
int) $untildate);
504 $this->ctrl->setParameter($this,
'log_from', (
int) $fromdate);
509 require_once
"Services/Link/classes/class.ilLink.php";
510 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogTableGUI.php";
515 array_walk($log_output,
function (&
$row) use ($self) {
516 if (is_numeric(
$row[
'ref_id']) &&
$row[
'ref_id'] > 0) {
518 $row[
'location_txt'] = $self->lng->txt(
"perma_link");
522 $table_gui->setData($log_output);
523 $template->setVariable(
'LOG', $table_gui->getHTML());
525 $this->tpl->setVariable(
"ADM_CONTENT",
$template->get());
533 if (is_array(
$_POST[
"chb_test"]) && (count(
$_POST[
"chb_test"]))) {
534 $this->
object->deleteLogEntries(
$_POST[
"chb_test"]);
535 ilUtil::sendSuccess($this->lng->txt(
"ass_log_deleted"));
548 $ilAccess = $DIC[
'ilAccess'];
549 $ilTabs = $DIC[
'ilTabs'];
551 $ilTabs->activateTab(
'logs');
553 $a_write_access = ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) ? true :
false;
555 include_once
"./Modules/Test/classes/tables/class.ilAssessmentFolderLogAdministrationTableGUI.php";
557 include_once
"./Modules/Test/classes/class.ilObjTest.php";
558 require_once
"./Services/Link/classes/class.ilLink.php";
563 array_push(
$data, array(
565 "nr" => $this->object->getNrOfLogEntries(
$obj_id),
568 "location_txt" => $this->lng->txt(
"perma_link")
571 $table_gui->setData(
$data);
572 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
583 $ilTabs = $DIC[
'ilTabs'];
586 $ilTabs->addSubTabTarget(
588 $this->ctrl->getLinkTarget($this,
"showLogSettings"),
589 array(
"saveLogSettings",
"showLogSettings"),
594 $ilTabs->addSubTabTarget(
596 $this->ctrl->getLinkTarget($this,
"logs"),
597 array(
"logs",
"showLog",
"exportLog"),
602 $ilTabs->addSubTabTarget(
604 $this->ctrl->getLinkTarget($this,
"logAdmin"),
605 array(
"logAdmin",
"deleteLog"),
619 $rbacsystem = $DIC[
'rbacsystem'];
622 switch ($this->ctrl->getCmd()) {
623 case "saveLogSettings":
624 case "showLogSettings":
634 if ($rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
635 $this->tabs_gui->addTarget(
637 $this->ctrl->getLinkTarget($this,
"settings"),
638 array(
"settings",
"",
"view"),
643 $this->tabs_gui->addTarget(
645 $this->ctrl->getLinkTarget($this,
"showLogSettings"),
646 array(
'saveLogSettings',
'showLogSettings',
"logs",
"showLog",
"exportLog",
"logAdmin",
"deleteLog"),
651 $this->tabs_gui->addTab(
653 $lng->txt(
"adm_settings_templates"),
654 $this->ctrl->getLinkTargetByClass(
"ilsettingstemplategui",
"")
658 if ($rbacsystem->checkAccess(
"write", $this->object->getRefId())) {
659 $this->tabs_gui->addTarget(
'units', $this->ctrl->getLinkTargetByClass(
'ilGlobalUnitConfigurationGUI',
''),
'',
'ilglobalunitconfigurationgui');
662 if ($rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
663 $this->tabs_gui->addTarget(
665 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
666 array(
"perm",
"info",
"owner"),
677 $this->tabs_gui->activateTab(
'logs');
680 $form = $this->getLogSettingsForm();
681 $form->setValuesByArray(array(
687 $this->tpl->setContent(
$form->getHTML());
693 protected function saveLogSettingsObject()
699 $ilAccess = $DIC[
'ilAccess'];
701 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
702 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"), $this->
ilias->error_obj->WARNING);
705 $form = $this->getLogSettingsForm();
706 if (
$form->checkInput()) {
707 $this->
object->_enableAssessmentLogging((
int)
$form->getInput(
'chb_assessment_logging'));
708 $this->
object->_setLogLanguage(
$form->getInput(
'reporting_language'));
709 $this->
object->update();
710 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
713 $form->setValuesByPost();
720 protected function getLogSettingsForm()
726 $ilAccess = $DIC[
'ilAccess'];
728 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
730 $form->setFormAction($this->ctrl->getFormAction($this,
'saveLogSettings'));
731 $form->setTitle($this->lng->txt(
'assessment_log_logging'));
734 $logging->setValue(1);
735 $logging->setOptionTitle($this->lng->txt(
'activate_assessment_logging'));
736 $form->addItem($logging);
738 $reporting =
new ilSelectInputGUI($this->lng->txt(
'assessment_settings_reporting_language'),
'reporting_language');
739 $languages = $this->lng->getInstalledLanguages();
740 $this->lng->loadLanguageModule(
'meta');
742 foreach ($languages as
$lang) {
746 $form->addItem($reporting);
748 if ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
749 $form->addCommandButton(
'saveLogSettings', $this->lng->txt(
'save'));
758 $ilTabs = $DIC[
'ilTabs'];
760 $ilTabs->setTabActive(
'templates');
762 require_once
'Services/Administration/classes/class.ilSettingsTemplateGUI.php';
765 $this->ctrl->forwardCommand($gui);
776 require_once
'Modules/Test/classes/class.ilTestSettingsTemplateConfig.php';
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupName($a_user_id)
lookup user name
static getSettingsTemplateConfig()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
This class represents an option in a checkbox group.
saveObject()
save object public
settingsObject(ilPropertyFormGUI $form=null)
display assessment folder settings form
const ASS_PROC_LOCK_MODE_DB
Class ilObjAssessmentFolderGUI.
static getLog($ts_from, $ts_to, $test_id, $test_only=false)
Retrieve assessment log datasets from the database.
Class ilGlobalUnitConfigurationGUI.
Class ilUnitConfigurationRepository.
static getValidAssessmentProcessLockModes()
setInfo($a_info)
Set Info.
const ASS_PROC_LOCK_MODE_NONE
static _lookupObjectId($a_ref_id)
lookup object id
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
logAdminObject()
Administration output for assessment log files.
static _getLogLanguage()
retrieve the log language for assessment logging
const ASS_PROC_LOCK_MODE_FILE
prepareOutput($a_show_subobjects=true)
prepare output
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
if(isset($_POST['submit'])) $form
saveSettingsObject()
Save Assessment settings.
Class ilObjectGUI Basic methods of all Output classes.
special template class to simplify handling of ITX/PEAR
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
redirection script todo: (a better solution should control the processing via a xml file) ...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
showLogSettingsObject(ilPropertyFormGUI $form=null)
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor.
static _getManualScoring()
Retrieve the manual scoring settings.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
forwardToSettingsTemplateGUI()
showLogObject()
Called when the a log should be shown.
exportLogObject()
Called when the a log should be exported.
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
executeCommand()
execute command
deleteLogObject()
Deletes the log entries for one or more tests.
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)