3 declare(strict_types=0);
22 bool $a_call_by_reference,
27 $this->error = $DIC[
'ilErr'];
32 $this->
lng->loadLanguageModule(
'trac');
37 $next_class = $this->
ctrl->getNextClass();
38 $this->
ctrl->setReturn($this,
"show");
41 switch ($next_class) {
42 case 'ilpermissiongui':
44 $this->
ctrl->forwardCommand($perm_gui);
47 case 'illpobjectstatisticsgui':
48 $this->tabs_gui->activateTab(
'statistics');
52 $this->
ctrl->forwardCommand($os_gui);
55 case 'ilsessionstatisticsgui':
56 $this->tabs_gui->setTabActive(
'session_statistics');
58 $this->
ctrl->forwardCommand($sess_gui);
62 $cmd = $this->
ctrl->getCmd();
63 if ($cmd ==
"view" || $cmd ==
"") {
79 $this->
ctrl->setParameter($this,
"ref_id", $this->ref_id);
81 $this->tabs_gui->addTarget(
83 $this->
ctrl->getLinkTarget($this,
"settings"),
88 if ($this->rbac_system->checkAccess(
"visible,read", $this->ref_id)) {
90 $this->tabs_gui->addTarget(
92 $this->
ctrl->getLinkTargetByClass(
93 "illpobjectstatisticsgui",
97 "illpobjectstatisticsgui" 103 $this->tabs_gui->addTarget(
104 "session_statistics",
105 $this->
ctrl->getLinkTargetByClass(
106 "ilsessionstatisticsgui",
110 "ilsessionstatisticsgui" 116 $this->tabs_gui->addTarget(
118 $this->
ctrl->getLinkTargetByClass(
119 array(get_class($this),
'ilpermissiongui'),
122 array(
"perm",
"info",
"owner"),
130 if (!$this->rbac_system->checkAccess(
132 $this->object->getRefId()
134 $this->error->raiseError(
135 $this->
lng->txt(
"no_permission"),
136 $this->error->WARNING
140 $this->tabs_gui->addSubTab(
142 $this->
lng->txt(
'settings'),
143 $this->
ctrl->getLinkTarget($this,
'settings')
147 $this->tabs_gui->addSubTab(
149 $this->
lng->txt(
'trac_defaults'),
150 $this->
ctrl->getLinkTarget($this,
'editLPDefaults')
154 $this->tabs_gui->setTabActive(
'settings');
155 $this->tabs_gui->setSubTabActive(
'lp_settings');
161 $this->tpl->setContent($a_form->getHTML());
167 $form->setFormAction($this->
ctrl->getFormAction($this));
168 $form->setTitle($this->
lng->txt(
'tracking_settings'));
171 $this->
lng->txt(
'activate_tracking')
173 $form->addItem($activate);
177 $this->
lng->txt(
'trac_learning_progress'),
178 'learning_progress_tracking' 180 if ($this->
object->enabledLearningProgress()) {
181 $lp->setChecked(
true);
183 $activate->addSubItem($lp);
188 $this->
lng->txt(
'trac_lp_learner_access'),
191 $learner->setInfo($this->
lng->txt(
'trac_lp_learner_access_info'));
192 $learner->setChecked($this->
object->hasLearningProgressLearner());
193 $lp->addSubItem($learner);
198 $this->
lng->txt(
'trac_learning_progress_settings_info'),
203 $this->
lng->txt(
'trac_first_and_last_access'),
212 $this->
lng->txt(
'trac_spent_seconds'),
216 $lp->addSubItem($extdata);
218 $ext_value = array();
219 if ($this->
object->hasExtendedData(
222 $ext_value[] =
'lp_access';
224 if ($this->
object->hasExtendedData(
227 $ext_value[] =
'lp_count';
229 if ($this->
object->hasExtendedData(
232 $ext_value[] =
'lp_spent';
234 $extdata->setValue($ext_value);
237 $this->
lng->txt(
'trac_lp_list_gui'),
240 $listgui->setInfo($this->
lng->txt(
'trac_lp_list_gui_info'));
241 $listgui->setChecked($this->
object->hasLearningProgressListGUI());
242 $lp->addSubItem($listgui);
246 $this->
lng->txt(
'trac_object_statistics'),
249 if ($this->
object->enabledObjectStatistics()) {
250 $objstat->setChecked(
true);
252 $activate->addSubItem($objstat);
256 $this->
lng->txt(
'session_statistics'),
259 if ($this->
object->enabledSessionStatistics()) {
260 $sessstat->setChecked(
true);
262 $activate->addSubItem($sessstat);
266 $this->
lng->txt(
'trac_anonymized'),
269 $user->setInfo($this->
lng->txt(
'trac_anonymized_info'));
270 $user->setChecked(!$this->
object->enabledUserRelatedData());
271 $form->addItem(
$user);
275 $this->
lng->txt(
'trac_valid_request'),
280 $valid->setSuffix($this->
lng->txt(
'seconds'));
281 $valid->setInfo($this->
lng->txt(
'info_valid_request'));
282 $valid->setValue((
string) $this->
object->getValidTimeSpan());
284 $valid->setMaxValue(9999);
285 $valid->setRequired(
true);
296 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
298 $lp->setDisabled(
true);
299 $learner->setDisabled(
true);
300 $extdata->setDisabled(
true);
301 $listgui->setDisabled(
true);
302 $objstat->setDisabled(
true);
303 $user->setDisabled(
true);
304 $valid->setDisabled(
true);
315 if ($form->checkInput()) {
316 $lp_active = $form->getInput(
'learning_progress_tracking');
318 $this->
object->enableLearningProgress((
bool) $lp_active);
321 $ext_data = (array) $form->getInput(
"lp_extdata");
323 if (in_array(
'lp_access', $ext_data)) {
326 if (in_array(
'lp_count', $ext_data)) {
329 if (in_array(
'lp_spent', $ext_data)) {
332 $this->
object->setExtendedData($code);
335 $this->
object->enableChangeEventTracking(
336 (
bool) $form->getInput(
'change_event_tracking')
338 $this->
object->enableObjectStatistics(
339 (
bool) $form->getInput(
'object_statistics')
341 $this->
object->enableUserRelatedData(
342 !$form->getInput(
'user_related')
344 $this->
object->setValidTimeSpan(
345 (
int) $form->getInput(
'valid_request')
348 $this->
object->setLearningProgressLearner(
349 (
bool) $form->getInput(
'lp_learner')
351 $this->
object->enableSessionStatistics(
352 (
bool) $form->getInput(
'session_statistics')
354 $this->
object->setLearningProgressListGUI(
355 (
bool) $form->getInput(
'lp_list')
357 $this->
object->updateSettings();
359 $this->tpl->setOnScreenMessage(
361 $this->
lng->txt(
"msg_obj_modified"),
364 $this->
ctrl->redirect($this,
"settings");
366 $form->setValuesByPost();
375 $this->tabs_gui->addSubTab(
377 $this->
lng->txt(
'settings'),
378 $this->
ctrl->getLinkTarget($this,
'settings')
381 $this->tabs_gui->addSubTab(
383 $this->
lng->txt(
'trac_defaults'),
384 $this->
ctrl->getLinkTarget($this,
'editLPDefaults')
387 $this->tabs_gui->setTabActive(
'settings');
388 $this->tabs_gui->setSubTabActive(
'lpdef');
394 $this->tpl->setContent($a_form->getHTML());
400 $form->setFormAction($this->
ctrl->getFormAction($this));
401 $form->setTitle($this->
lng->txt(
'trac_defaults'));
402 $form->setDescription($this->
lng->txt(
'trac_defaults_info'));
407 $types[
$type] = array(
409 "caption" => $this->
lng->txt(
"obj_" .
$type)
414 foreach ($types as $item) {
416 $modes = $class::getDefaultModes(
419 if (
sizeof($modes) > 1) {
422 "def_" . $item[
"type"]
424 $form->addItem($def_type);
426 $def_type->setRequired(
true);
430 foreach ($modes as $mode) {
432 ? $this->
lng->txt(
"trac_defaults_inactive")
434 $options[$mode] = $caption;
436 $def_type->setOptions($options);
441 $form->addCommandButton(
'saveLPDefaults', $this->
lng->txt(
'save'));
443 foreach ($types as $item) {
444 $form->getItemByPostVar(
"def_" . $item[
"type"])->setDisabled(
457 if ($form->checkInput()) {
462 $mode = $form->getInput(
"def_" .
$type);
470 $this->tpl->setOnScreenMessage(
472 $this->
lng->txt(
"msg_obj_modified"),
475 $this->
ctrl->redirect($this,
"editLPDefaults");
478 $form->setValuesByPost();
484 switch ($a_form_id) {
487 return array(
'obj_trac' => array(
'editLPDefaults', $fields));
const EXTENDED_DATA_LAST_ACCESS
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _enabledObjectStatistics()
static isSupportedObjectType(string $type)
prepareOutput(bool $show_sub_objects=true)
static getTypeDefault(string $type)
const EXTENDED_DATA_READ_COUNT
static saveTypeDefaults(array $data)
const LP_CONTEXT_ADMINISTRATION
static _enabledLearningProgress()
settingsObject(?ilPropertyFormGUI $a_form=null)
ilObjectDefinition $objectDefinition
Class ilObjectGUI Basic methods of all Output classes.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
const EXTENDED_DATA_SPENT_SECONDS
const LP_MODE_DEACTIVATED
editLPDefaultsObject(?ilPropertyFormGUI $a_form=null)
__construct(Container $dic, ilPlugin $plugin)
static _enabledSessionStatistics()
static getTypeClass(string $type)
addToExternalSettingsForm(int $a_form_id)
__construct( $a_data, int $a_id, bool $a_call_by_reference, bool $prepare_output)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _mode2Text(int $a_mode)