ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilMemberViewGUI.php
Go to the documentation of this file.
1 <?php
2 
23 {
24  public static function showMemberViewSwitch(int $a_ref_id): bool
25  {
26  global $DIC;
27 
28  $ilAccess = $DIC->access();
29  $ilCtrl = $DIC->ctrl();
30 
32  if (!$settings->isEnabled()) {
33  return false;
34  }
35  $tree = $DIC->repositoryTree();
36  $lng = $DIC->language();
37  $ilToolbar = $DIC->toolbar();
38  $ui = $DIC->ui();
39  $ilTab = $DIC->tabs();
40 
41  // No course or group in path => aborting
42  if (!$tree->checkForParentType($a_ref_id, 'crs') &&
43  !$tree->checkForParentType($a_ref_id, 'grp')) {
44  return false;
45  }
46 
47  // TODO: check edit_permission
48 
50 
51  $isCourseOrGroupContentTab =
52  (
53  $ilCtrl->getCmd() === 'view' &&
54  ($type === 'crs' || $type === 'grp')
55  ) || (
56  $ilCtrl->getCmd() === '' &&
57  $type === 'crs' &&
58  strtolower($ilCtrl->getCmdClass()) === 'ilobjcoursegui'
59  ) || (
60  $ilCtrl->getCmd() === '' &&
61  $type === 'grp' &&
62  strtolower($ilCtrl->getCmdClass()) === 'ilobjgroupgui'
63  );
64 
65  if (
66  $isCourseOrGroupContentTab &&
67  $ilAccess->checkAccess('write', '', $a_ref_id)
68  ) {
69  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_ref_id);
70  $ilCtrl->setParameterByClass("ilrepositorygui", "mv", "1");
71  $ilCtrl->setParameterByClass("ilrepositorygui", "set_mode", "flat");
72  $ilToolbar->addComponent(
73  $ui->factory()->button()->standard(
74  $lng->txt('mem_view_activate'),
75  $ilCtrl->getLinkTargetByClass("ilrepositorygui", "")
76  )
77  );
78  $ilCtrl->clearParametersByClass("ilrepositorygui");
79  return true;
80  }
81  return true;
82  }
83 }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
$lng
static showMemberViewSwitch(int $a_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)