19 declare(strict_types=0);
36 bool $a_call_by_reference,
41 $this->error = $DIC[
'ilErr'];
46 $this->
lng->loadLanguageModule(
'trac');
51 $next_class = $this->
ctrl->getNextClass();
52 $this->
ctrl->setReturn($this,
"show");
55 switch ($next_class) {
56 case 'ilpermissiongui':
58 $this->
ctrl->forwardCommand($perm_gui);
61 case 'illpobjectstatisticsgui':
62 $this->tabs_gui->activateTab(
'statistics');
66 $this->
ctrl->forwardCommand($os_gui);
69 case 'ilsessionstatisticsgui':
70 $this->tabs_gui->setTabActive(
'session_statistics');
72 $this->
ctrl->forwardCommand($sess_gui);
76 $cmd = $this->
ctrl->getCmd();
77 if ($cmd ==
"view" || $cmd ==
"") {
93 $this->
ctrl->setParameter($this,
"ref_id", $this->ref_id);
95 $this->tabs_gui->addTarget(
97 $this->
ctrl->getLinkTarget($this,
"settings"),
102 if ($this->rbac_system->checkAccess(
"visible,read", $this->ref_id)) {
104 $this->tabs_gui->addTarget(
106 $this->
ctrl->getLinkTargetByClass(
107 "illpobjectstatisticsgui",
111 "illpobjectstatisticsgui" 117 $this->tabs_gui->addTarget(
118 "session_statistics",
119 $this->
ctrl->getLinkTargetByClass(
120 "ilsessionstatisticsgui",
124 "ilsessionstatisticsgui" 130 $this->tabs_gui->addTarget(
132 $this->
ctrl->getLinkTargetByClass(
133 array(get_class($this),
'ilpermissiongui'),
136 array(
"perm",
"info",
"owner"),
144 if (!$this->rbac_system->checkAccess(
146 $this->object->getRefId()
148 $this->error->raiseError(
149 $this->
lng->txt(
"no_permission"),
150 $this->error->WARNING
154 $this->tabs_gui->addSubTab(
156 $this->
lng->txt(
'settings'),
157 $this->
ctrl->getLinkTarget($this,
'settings')
161 $this->tabs_gui->addSubTab(
163 $this->
lng->txt(
'trac_defaults'),
164 $this->
ctrl->getLinkTarget($this,
'editLPDefaults')
168 $this->tabs_gui->setTabActive(
'settings');
169 $this->tabs_gui->setSubTabActive(
'lp_settings');
175 $this->tpl->setContent($a_form->getHTML());
181 $form->setFormAction($this->
ctrl->getFormAction($this));
182 $form->setTitle($this->
lng->txt(
'tracking_settings'));
185 $this->
lng->txt(
'activate_tracking')
187 $form->addItem($activate);
191 $this->
lng->txt(
'trac_learning_progress'),
192 'learning_progress_tracking' 194 if ($this->
object->enabledLearningProgress()) {
195 $lp->setChecked(
true);
197 $activate->addSubItem($lp);
202 $this->
lng->txt(
'trac_lp_learner_access'),
205 $learner->setInfo($this->
lng->txt(
'trac_lp_learner_access_info'));
206 $learner->setChecked($this->
object->hasLearningProgressLearner());
207 $lp->addSubItem($learner);
212 $this->
lng->txt(
'trac_learning_progress_settings_info'),
217 $this->
lng->txt(
'trac_first_and_last_access'),
226 $this->
lng->txt(
'trac_spent_seconds'),
230 $lp->addSubItem($extdata);
232 $ext_value = array();
233 if ($this->
object->hasExtendedData(
236 $ext_value[] =
'lp_access';
238 if ($this->
object->hasExtendedData(
241 $ext_value[] =
'lp_count';
243 if ($this->
object->hasExtendedData(
246 $ext_value[] =
'lp_spent';
248 $extdata->setValue($ext_value);
251 $this->
lng->txt(
'trac_lp_list_gui'),
254 $listgui->setInfo($this->
lng->txt(
'trac_lp_list_gui_info'));
255 $listgui->setChecked($this->
object->hasLearningProgressListGUI());
256 $lp->addSubItem($listgui);
260 $this->
lng->txt(
'trac_object_statistics'),
263 if ($this->
object->enabledObjectStatistics()) {
264 $objstat->setChecked(
true);
266 $activate->addSubItem($objstat);
270 $this->
lng->txt(
'session_statistics'),
273 if ($this->
object->enabledSessionStatistics()) {
274 $sessstat->setChecked(
true);
276 $activate->addSubItem($sessstat);
280 $this->
lng->txt(
'trac_anonymized'),
283 $user->setInfo($this->
lng->txt(
'trac_anonymized_info'));
284 $user->setChecked(!$this->
object->enabledUserRelatedData());
285 $form->addItem(
$user);
289 $this->
lng->txt(
'trac_valid_request'),
294 $valid->setSuffix($this->
lng->txt(
'seconds'));
295 $valid->setInfo($this->
lng->txt(
'info_valid_request'));
296 $valid->setValue((
string) $this->
object->getValidTimeSpan());
298 $valid->setMaxValue(9999);
299 $valid->setRequired(
true);
310 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
312 $lp->setDisabled(
true);
313 $learner->setDisabled(
true);
314 $extdata->setDisabled(
true);
315 $listgui->setDisabled(
true);
316 $objstat->setDisabled(
true);
317 $user->setDisabled(
true);
318 $valid->setDisabled(
true);
329 if ($form->checkInput()) {
330 $lp_active = $form->getInput(
'learning_progress_tracking');
332 $this->
object->enableLearningProgress((
bool) $lp_active);
335 $ext_data = (array) $form->getInput(
"lp_extdata");
337 if (in_array(
'lp_access', $ext_data)) {
340 if (in_array(
'lp_count', $ext_data)) {
343 if (in_array(
'lp_spent', $ext_data)) {
346 $this->
object->setExtendedData($code);
349 $this->
object->enableChangeEventTracking(
350 (
bool) $form->getInput(
'change_event_tracking')
352 $this->
object->enableObjectStatistics(
353 (
bool) $form->getInput(
'object_statistics')
355 $this->
object->enableUserRelatedData(
356 !$form->getInput(
'user_related')
358 $this->
object->setValidTimeSpan(
359 (
int) $form->getInput(
'valid_request')
362 $this->
object->setLearningProgressLearner(
363 (
bool) $form->getInput(
'lp_learner')
365 $this->
object->enableSessionStatistics(
366 (
bool) $form->getInput(
'session_statistics')
368 $this->
object->setLearningProgressListGUI(
369 (
bool) $form->getInput(
'lp_list')
371 $this->
object->updateSettings();
373 $this->tpl->setOnScreenMessage(
375 $this->
lng->txt(
"msg_obj_modified"),
378 $this->
ctrl->redirect($this,
"settings");
380 $form->setValuesByPost();
389 $this->tabs_gui->addSubTab(
391 $this->
lng->txt(
'settings'),
392 $this->
ctrl->getLinkTarget($this,
'settings')
395 $this->tabs_gui->addSubTab(
397 $this->
lng->txt(
'trac_defaults'),
398 $this->
ctrl->getLinkTarget($this,
'editLPDefaults')
401 $this->tabs_gui->setTabActive(
'settings');
402 $this->tabs_gui->setSubTabActive(
'lpdef');
408 $this->tpl->setContent($a_form->getHTML());
414 $form->setFormAction($this->
ctrl->getFormAction($this));
415 $form->setTitle($this->
lng->txt(
'trac_defaults'));
416 $form->setDescription($this->
lng->txt(
'trac_defaults_info'));
421 $types[
$type] = array(
423 "caption" => $this->
lng->txt(
"obj_" .
$type)
428 foreach ($types as $item) {
430 $modes = $class::getDefaultModes(
433 if (
sizeof($modes) > 1) {
436 "def_" . $item[
"type"]
438 $form->addItem($def_type);
440 $def_type->setRequired(
true);
444 foreach ($modes as $mode) {
446 ? $this->
lng->txt(
"trac_defaults_inactive")
448 $options[$mode] = $caption;
450 $def_type->setOptions($options);
455 $form->addCommandButton(
'saveLPDefaults', $this->
lng->txt(
'save'));
457 foreach ($types as $item) {
458 $form->getItemByPostVar(
"def_" . $item[
"type"])->setDisabled(
471 if ($form->checkInput()) {
476 $mode = $form->getInput(
"def_" .
$type);
484 $this->tpl->setOnScreenMessage(
486 $this->
lng->txt(
"msg_obj_modified"),
489 $this->
ctrl->redirect($this,
"editLPDefaults");
492 $form->setValuesByPost();
498 switch ($a_form_id) {
501 return array(
'obj_trac' => array(
'editLPDefaults', $fields));
const EXTENDED_DATA_LAST_ACCESS
This class represents an option in a checkbox group.
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)