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