19 declare(strict_types=1);
70 $this->usr_id = $a_usr_id;
71 $this->ref_id = $a_ref_id;
77 $this->ui_factory = $DIC->ui()->factory();
78 $this->ui_renderer = $DIC->ui()->renderer();
79 $this->request = $DIC->http()->request();
80 $this->
lng = $DIC->language();
81 $this->
lng->loadLanguageModule(
'ecs');
82 $this->
ctrl = $DIC->ctrl();
83 $this->objDefinition = $DIC[
'objDefinition'];
85 $this->
toolbar = $DIC->toolbar();
88 $this->obj_id = $this->remote_object->getId();
93 return $this->consents->hasConsented($this->server_id, $this->mid);
98 $this->mid = $this->remote_object->getMID();
104 return $this->remote_object->getOrganization();
109 return $this->remote_object->isLocalObject();
142 $button = $this->ui_factory
145 $this->
lng->txt($this->remote_object->getType() .
'_call'),
146 $this->
ctrl->getLinkTarget($this->remote_gui,
'call')
164 if ($component ===
null) {
167 $this->
toolbar->addComponent($component);
170 $image = $image->withOnClick($component->getShowSignal());
173 ->withTitleAction($component->getShowSignal());
179 int $a_trigger_type = self::TRIGGER_TYPE_STANDARD
182 $form_id =
'form_' . $form->getId();
183 $agree = $this->ui_factory->button()
184 ->primary($this->
lng->txt(
'ecs_consent_modal_btn_accept'),
'#')
186 function (
$id) use ($form_id) {
187 return "$('#$id').click(function() { $('#$form_id').submit(); return false; });";
191 $submitted = (string) ($this->request->getParsedBody()[
'cmd'] ??
'');
194 if (strcmp($submitted,
'submit') === 0) {
196 $form->setValuesByPost();
197 $error = $this->ui_factory->messageBox()->failure(
198 $this->
lng->txt(
'ecs_consent_required')
200 $error_html = $this->ui_renderer->render([$error]);
205 $modal = $this->ui_factory->modal()->roundtrip(
206 $this->
lng->txt(
'ecs_consent_modal_title'),
207 $this->ui_factory->legacy()->content(
211 )->withActionButtons([$agree]);
213 $modal = $modal->withOnLoad($modal->getShowSignal());
217 if ($a_trigger_type === self::TRIGGER_TYPE_STANDARD) {
218 $button = $this->ui_factory->button()->standard(
219 $this->
lng->txt($this->remote_object->getType() .
'_call'),
222 $modal->getShowSignal()
224 } elseif ($a_trigger_type === self::TRIGGER_TYPE_SHY) {
225 $button = $this->ui_factory->button()->shy(
226 $this->remote_object->getTitle(),
229 $modal->getShowSignal()
232 return [$button, $modal];
237 $consented = (bool) ($this->request->getParsedBody()[
'consent'] ?? 0);
238 $ref_id_hidden = (
int) ($this->request->getParsedBody()[
'consented_ref_id'] ?? 0);
239 $ref_type_hidden = (string) ($this->request->getParsedBody()[
'consented_type'] ??
'');
241 $this->consents->add($this->server_id, $this->mid);
242 $this->
ctrl->setParameterByClass(
247 $this->
ctrl->redirectToURL(
248 $this->
ctrl->getLinkTargetByClass(
250 ilRepositoryGUI::class,
264 $form->setId(uniqid(
'form',
false));
265 $form->setFormAction(
'#');
268 $ref_id_hidden->setValue((
string) $this->ref_id);
269 $form->addItem($ref_id_hidden);
272 $form->addItem($ref_type_hidden);
274 $this->
lng->txt(
'title'),
280 $form->addItem($title);
283 $this->
lng->txt(
'ecs_form_target_platform'),
287 $form->addItem($target);
293 $this->
lng->txt(
'organization'),
296 $provider->setValue($organisation->getName());
301 $this->
lng->txt(
'ecs_form_consent'),
304 $consent->setValue(
"1");
305 $consent->setChecked($this->consents->hasConsented($this->server_id, $this->mid));
306 $consent->setRequired(
true);
307 $form->addItem($consent);
309 $user_data_fields = [];
316 $user_data_fields[] = $this->
lng->txt(
'ecs_' . $field);
318 $listing = $this->ui_factory->listing()->unordered($user_data_fields);
319 $listing_html = $this->ui_renderer->render([$listing]);
320 $consent->setOptionTitle(
322 'ecs_form_consent_option_title' 323 ) .
'<br />' . $listing_html
326 $submit->setValue(
'submit');
327 $form->addItem($submit);
333 $server_id = $this->importManager->lookupServerId($this->obj_id);
334 if (0 === $server_id) {
341 $part = $community_reader->getParticipantByMID($this->mid);
343 return $part->getOrganisation();
353 return get_class($this->remote_gui);
365 'Invalid ref_id given: ' . $this->ref_id
addConsentModalToCard(RepositoryObject $card)
ilRemoteObjectBase $remote_object
static getInstance()
Get the singelton instance of this ilECSExportManager.
Manage the ECS imported contents.
withOnLoadCode(Closure $binder)
ilECSImportManager $importManager
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getImage()
Get the image of the card.
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)
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.
__construct(int $a_usr_id, int $a_ref_id, ?ilRemoteObjectBaseGUI $remote_gui=null)
getConsentModalComponents(int $a_trigger_type=self::TRIGGER_TYPE_STANDARD)
ilRemoteObjectBaseGUI $remote_gui