18 declare(strict_types=1);
69 $this->usr_id = $a_usr_id;
70 $this->ref_id = $a_ref_id;
76 $this->ui_factory = $DIC->ui()->factory();
77 $this->ui_renderer = $DIC->ui()->renderer();
78 $this->request = $DIC->http()->request();
79 $this->
lng = $DIC->language();
80 $this->
lng->loadLanguageModule(
'ecs');
81 $this->
ctrl = $DIC->ctrl();
82 $this->objDefinition = $DIC[
'objDefinition'];
86 $this->obj_id = $this->remote_object->getId();
91 return $this->consents->hasConsented($this->server_id, $this->mid);
96 $this->mid = $this->remote_object->getMID();
102 return $this->remote_object->getOrganization();
107 return $this->remote_object->isLocalObject();
120 return $this->ui_renderer->render($components);
140 $button = $this->ui_factory
143 $this->
lng->txt($this->remote_object->getType() .
'_call'),
144 $this->
ctrl->getLinkTarget($this->remote_gui,
'call')
152 foreach ($components as $component) {
161 foreach ($components as $component) {
162 if ($component === null) {
165 $this->
toolbar->addComponent($component);
168 $image = $image->withOnClick($component->getShowSignal());
171 ->withTitleAction($component->getShowSignal());
177 int $a_trigger_type = self::TRIGGER_TYPE_STANDARD
180 $form_id =
'form_' . $form->getId();
181 $agree = $this->ui_factory->button()
182 ->primary(
'Agree and Proceed',
'#')
184 function (
$id) use ($form_id) {
185 return "$('#$id').click(function() { $('#$form_id').submit(); return false; });";
189 $submitted = (string) ($this->request->getParsedBody()[
'cmd'] ??
'');
192 if (strcmp($submitted,
'submit') === 0) {
194 $form->setValuesByPost();
195 $error = $this->ui_factory->messageBox()->failure(
196 $this->
lng->txt(
'ecs_consent_required')
198 $error_html = $this->ui_renderer->render([$error]);
203 $modal = $this->ui_factory->modal()->roundtrip(
204 $this->
lng->txt(
'ecs_consent_modal_title'),
205 $this->ui_factory->legacy(
209 )->withActionButtons([$agree]);
211 $modal = $modal->withOnLoad($modal->getShowSignal());
215 if ($a_trigger_type === self::TRIGGER_TYPE_STANDARD) {
216 $button = $this->ui_factory->button()->standard(
217 $this->
lng->txt($this->remote_object->getType() .
'_call'),
220 $modal->getShowSignal()
222 } elseif ($a_trigger_type === self::TRIGGER_TYPE_SHY) {
223 $button = $this->ui_factory->button()->shy(
224 $this->remote_object->getTitle(),
227 $modal->getShowSignal()
230 return [$button, $modal];
235 $consented = (bool) ($this->request->getParsedBody()[
'consent'] ?? 0);
236 $ref_id_hidden = (
int) ($this->request->getParsedBody()[
'consented_ref_id'] ?? 0);
237 $ref_type_hidden = (string) ($this->request->getParsedBody()[
'consented_type'] ??
'');
239 $this->consents->add($this->server_id, $this->mid);
240 $this->
ctrl->setParameterByClass(
245 $this->
ctrl->redirectToURL(
246 $this->
ctrl->getLinkTargetByClass(
248 ilRepositoryGUI::class,
262 $form->setId(uniqid(
'form',
false));
263 $form->setFormAction(
'#');
266 $ref_id_hidden->setValue((
string) $this->ref_id);
267 $form->addItem($ref_id_hidden);
270 $form->addItem($ref_type_hidden);
272 $this->
lng->txt(
'title'),
278 $form->addItem($title);
281 $this->
lng->txt(
'ecs_form_target_platform'),
285 $form->addItem($target);
291 $this->
lng->txt(
'organization'),
294 $provider->setValue($organisation->getName());
299 $this->
lng->txt(
'ecs_form_consent'),
303 $consent->setChecked($this->consents->hasConsented($this->server_id, $this->mid));
304 $consent->setRequired(
true);
305 $form->addItem($consent);
307 $user_data_fields = [];
314 $user_data_fields[] = $this->
lng->txt(
'ecs_' . $field);
316 $listing = $this->ui_factory->listing()->unordered($user_data_fields);
317 $listing_html = $this->ui_renderer->render([$listing]);
318 $consent->setOptionTitle(
320 'ecs_form_consent_option_title' 321 ) .
'<br />' . $listing_html
324 $submit->setValue(
'submit');
325 $form->addItem($submit);
331 $server_id = $this->importManager->lookupServerId($this->obj_id);
332 if (0 === $server_id) {
339 $part = $community_reader->getParticipantByMID($this->mid);
341 return $part->getOrganisation();
351 return get_class($this->remote_gui);
363 'Invalid ref_id given: ' . $this->ref_id
addConsentModalToCard(RepositoryObject $card)
ilRemoteObjectBase $remote_object
static getInstance()
Get the singelton instance of this ilECSExportManager.
__construct(int $a_usr_id, int $a_ref_id, ilRemoteObjectBaseGUI $remote_gui=null)
Manage the ECS imported contents.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilECSImportManager $importManager
getImage()
Get the image of the card.
parses the objects.xml it handles the xml-description of all ilias objects
static getInstance()
Get the singleton instance of this ilECSImportManager.
static _lookupTitle(int $obj_id)
addConsentModalToToolbar(ilToolbarGUI $toolbar)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
const TRIGGER_TYPE_STANDARD
static getInstanceByUserId(int $a_usr_id)
ilECSUserConsents $consents
addLinkToToolbar(ilToolbarGUI $toolbar)
Remote object app base class.
ilECSExportManager $exportManager
RequestInterface $request
saveConsent(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withImage(Image $image)
Set the image of the card.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ilObjectDefinition $objDefinition
addRemoteLinkToToolbar(ilToolbarGUI $toolbar)
Manage the ECS exported contents.
getConsentModalComponents(int $a_trigger_type=self::TRIGGER_TYPE_STANDARD)
ilRemoteObjectBaseGUI $remote_gui