ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilContainerBlockPropertiesStorageGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
32 {
33  protected ilCtrl $ctrl;
34  protected ilObjUser $user;
37 
38  public function __construct()
39  {
41  global $DIC;
42 
43  $this->ctrl = $DIC->ctrl();
44  $this->user = $DIC->user();
45 
46  $this->request =
47  $DIC->container()->internal()->gui()->standardRequest();
48  $this->block_repo =
49  $DIC->container()->internal()->repo()->content()->block();
50  }
51 
52  public function executeCommand(): void
53  {
54  $ilCtrl = $this->ctrl;
55 
56  $cmd = $ilCtrl->getCmd();
57  if (in_array($cmd, ["store"], true)) {
58  $this->$cmd();
59  }
60  }
61 
62  public function store(): void
63  {
64  $ilUser = $this->user;
65 
66  switch ($this->request->getBlockAction()) {
67  case "expand":
68  $this->block_repo->setProperty(
69  $this->request->getBlockId(),
70  $ilUser->getId(),
71  "opened",
72  "1"
73  );
74  break;
75 
76  case "collapse":
77  $this->block_repo->setProperty(
78  $this->request->getBlockId(),
79  $ilUser->getId(),
80  "opened",
81  "0"
82  );
83  break;
84  }
85  }
86 }
getCmd(string $fallback_command=null)
Save container block property Mainly used for item group expand/collapse.
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)