ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
class.ilContainerBlockPropertiesStorageGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)