ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilRemoteObjectBaseListGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
26
27 public function __construct()
28 {
29 global $DIC;
31
32 $this->db = $DIC->database();
33 }
34
38 public function _lookupOrganization(string $table, int $a_obj_id): string
39 {
40 $query = "SELECT organization FROM " . $this->db->quoteIdentifier(
41 $table
42 ) .
43 " WHERE obj_id = " . $this->db->quote($a_obj_id, 'integer') . " ";
44 $res = $this->db->query($query);
45 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
46 return $row->organization ?? '';
47 }
48 return '';
49 }
50
51 public function insertTitle(): void
52 {
53 $this->ctrl->setReturnByClass(
54 $this->getGUIClassname(),
55 'call'
56 );
57 $classname = $this->getGUIClassname();
58 $consent_gui = new ilECSUserConsentModalGUI(
59 $this->user->getId(),
60 $this->ref_id,
61 new $classname()
62 );
63
64 $shy_modal = $consent_gui->getTitleLink();
65 if ($shy_modal === '') {
66 parent::insertTitle();
67 return;
68 }
69
70 $this->tpl->setCurrentBlock("item_title");
71 $this->tpl->setVariable("TXT_TITLE", $consent_gui->getTitleLink());
72 $this->tpl->parseCurrentBlock();
73 }
74
75 public function getAsCard(
76 int $ref_id,
77 int $obj_id,
78 string $type,
79 string $title,
80 string $description
82 $classname = $this->getGUIClassname();
83 $consent_gui = new ilECSUserConsentModalGUI(
84 $this->user->getId(),
85 $ref_id,
86 new $classname()
87 );
88 if ($consent_gui->hasConsented()) {
89 return parent::getAsCard($ref_id, $obj_id, $type, $title, $description);
90 }
91
92 $this->ctrl->setReturnByClass(
93 $this->getGUIClassname(),
94 'call'
95 );
96 $card = parent::getAsCard($ref_id, $obj_id, $type, $title, $description);
97 if ($card instanceof RepositoryObject) {
98 return $consent_gui->addConsentModalToCard($card);
99 }
100 return null;
101 }
102
103 public function createDefaultCommand(array $command): array
104 {
105 $classname = $this->getGUIClassname();
106 $consent_gui = new ilECSUserConsentModalGUI(
107 $this->user->getId(),
108 $this->ref_id,
109 new $classname()
110 );
111 $command = parent::createDefaultCommand($command);
112 if ($consent_gui->hasConsented()) {
113 return $command;
114 }
115 $command['link'] = '';
116 $command['frame'] = '';
117 return $command;
118 }
119
120 protected function getGUIClassname(): string
121 {
122 $classname = $this->obj_definition->getClassName($this->type);
123 return 'ilObj' . $classname . 'GUI';
124 }
125}
createDefaultCommand(array $command)
Get default command link Overwritten for e.g categories,courses => they return a goto link If search ...
getAsCard(int $ref_id, int $obj_id, string $type, string $title, string $description)
Get card object.
_lookupOrganization(string $table, int $a_obj_id)
lookup organization
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26