ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilEmployeeTalkMyStaffUserGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 {
31  private int $usr_id;
32 
33  public function __construct()
34  {
35  global $DIC;
36 
38 
39  if ($DIC->http()->wrapper()->query()->has('usr_id')) {
40  $this->usr_id = $DIC->http()->wrapper()->query()->retrieve(
41  'usr_id',
42  $DIC->refinery()->kindlyTo()->int()
43  );
44  $this->ctrl->setParameter($this, 'usr_id', $this->usr_id);
45  }
46  }
47 
48  protected function hasCurrentUserAccess(): bool
49  {
50  if (!$this->usr_id) {
51  return false;
52  }
53 
54  if (
55  !$this->access->hasCurrentUserAccessToTalks() ||
56  !$this->access->hasCurrentUserAccessToUser($this->usr_id)
57  ) {
58  return false;
59  }
60 
61  return true;
62  }
63 
64  public function getClassPath(): array
65  {
66  return [
67  strtolower(ilDashboardGUI::class),
68  strtolower(ilMyStaffGUI::class),
69  strtolower(ilMStShowUserGUI::class),
70  strtolower(ilEmployeeTalkMyStaffUserGUI::class)
71  ];
72  }
73 
74  protected function loadHeader(): void
75  {
76  // header is set by MyStaff
77  }
78 
79  protected function loadTabs(): void
80  {
81  // tabs are set by MyStaff
82  }
83 
84  protected function loadTalkData(): array
85  {
86  $talks = [];
87  if ($this->talk_access->hasPermissionToReadUnownedTalksOfUser($this->usr_id)) {
88  $talks = $this->repository->findByEmployee($this->usr_id);
89  } else {
90  $talks = $this->repository->findTalksBetweenEmployeeAndOwner(
91  $this->usr_id,
92  $this->current_user->getId()
93  );
94  }
95  return $talks;
96  }
97 }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)