19 declare(strict_types=1);
29 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
33 $this->
lng->loadLanguageModule(
'pdfgen');
49 $next_class = $this->
ctrl->getNextClass();
50 $cmd = $this->
ctrl->getCmd();
53 switch (strtolower($next_class)) {
54 case strtolower(ilPermissionGUI::class):
55 $this->tabs_gui->setTabActive(
'perm_settings');
57 $this->
ctrl->forwardCommand($perm_gui);
61 if ($cmd === null || $cmd ===
'' || $cmd ===
'view') {
65 if (strpos($cmd,
'saveandconf_selected_') === 0) {
77 $form->setFormAction($this->
ctrl->getFormAction($this,
'view'));
81 foreach ($purpose_map as
$service => $purposes) {
82 foreach ($purposes as $purpose) {
84 $section->setTitle(ucfirst(
$service) .
' / ' . ucfirst($purpose));
85 $form->addItem($section);
88 $preferred->setValue($selection_map[
$service][$purpose][
'preferred']);
89 $preferred->setDisabled(
true);
90 $form->addItem($preferred);
93 $selected->setOptions($renderers[
$service][$purpose]);
94 $selected_renderer = $selection_map[
$service][$purpose][
'selected'];
96 foreach ($renderers[
$service][$purpose] as
$key => $value) {
97 if ($value === $selected_renderer) {
98 $selected_index =
$key;
101 $selected->setValue($selected_index);
102 $form->addItem($selected);
105 $s_button->setCaption(
'configure');
106 $s_button->setCommand(
'saveandconf_selected_' .
$service .
'::' . $purpose);
108 $s_button->setDisabled(
true);
111 $input_selected->
setHtml($s_button->getToolbarHTML());
112 $form->addItem($input_selected);
117 $form->addCommandButton(
"saveSettings", $this->
lng->txt(
"save"));
121 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'problem_with_purposes'));
123 $clean_btn->setCaption(
'cleanup');
124 $clean_btn->setUrl($this->
ctrl->getLinkTarget($this,
'doCleanUp'));
125 $this->
toolbar->addButtonInstance($clean_btn);
127 $this->tpl->setContent($form->getHTML());
134 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
135 $this->
ctrl->redirect($this,
"view");
142 foreach ($purpose_map as
$service => $purposes) {
143 foreach ($purposes as $purpose) {
144 $selected = $this->pdfRequest->securedString(
'selected_' .
$service .
'::' . $purpose);
145 $posted_renderer = $renderers[
$service][$purpose][$selected] ?? null;
146 if ($posted_renderer === null) {
150 $selected_renderer = $selection_map[
$service][$purpose][
'selected'];
151 if ($posted_renderer !== $selected_renderer) {
157 if ($redirect_after) {
158 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'config_saved'),
true);
159 $this->
ctrl->redirect($this,
"view");
166 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
167 $this->
ctrl->redirect($this,
"view");
173 $this->tpl->setContent($form->getHTML());
179 $renderer = $this->pdfRequest->securedString(
'renderer');
180 $service = $this->pdfRequest->securedString(
'service');
181 $purpose = $this->pdfRequest->securedString(
'purpose');
184 $this->
ctrl->redirect($this,
"view");
189 $parts = explode(
'::', $command);
195 $selected = $this->pdfRequest->securedString(
'selected_' .
$service .
'::' . $purpose);
196 $posted_renderer = $renderers[
$service][$purpose][$selected];
199 $form->setFormAction($this->
ctrl->getFormAction($this,
'view'));
201 $form->setTitle($this->
lng->txt(
'settings') .
' ' . $posted_renderer .
' / ' .
$service .
' / ' . $purpose);
203 $service_hidden->setValue(
$service);
204 $form->addItem($service_hidden);
207 $purpose_hidden->setValue($purpose);
208 $form->addItem($purpose_hidden);
211 $renderer_hidden->setValue($posted_renderer);
212 $form->addItem($renderer_hidden);
217 $renderer_hidden->setValue($selected);
218 $form->addItem($renderer_hidden);
222 $renderer->addConfigElementsToForm($form,
$service, $purpose);
226 $renderer->populateConfigElementsInForm($form,
$service, $purpose,
$config);
229 $form->addCommandButton(
'saveConfig', $this->
lng->txt(
'save'));
230 $form->addCommandButton(
'view', $this->
lng->txt(
'cancel'));
231 $form->addCommandButton(
'resetSettings', $this->
lng->txt(
'reset_to_default'));
238 $renderer = $this->pdfRequest->securedString(
'renderer');
239 $service = $this->pdfRequest->securedString(
'service');
240 $purpose = $this->pdfRequest->securedString(
'purpose');
246 $valid_renderer_config =
false;
247 if ($form->checkInput() &&
248 ($valid_renderer_config = $renderer_obj->validateConfigInForm($form,
$service, $purpose))) {
251 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'config_saved'),
true);
252 $this->
ctrl->redirect($this,
'view');
255 if (!$valid_renderer_config) {
256 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
259 $form->setValuesByPost();
261 $this->tpl->setContent($form->getHTML());
268 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'config_saved'),
true);
269 $this->
ctrl->redirect($this,
"view");
277 if (strpos($this->
ctrl->getCmd(),
'saveandconf') !== 0) {
279 $this->tabs_gui->addTarget(
'settings', $this->
ctrl->getLinkTarget($this,
'view'), [], __CLASS__);
283 $this->tabs_gui->addTarget(
285 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
'perm'),
291 $this->tabs_gui->setBackTarget(
292 $this->
lng->txt(
"back"),
293 $this->
ctrl->getLinkTargetByClass(
"ilobjpdfgenerationgui",
"view")
300 $this->tabs_gui->setTabActive($tab ===
'' ? $this->active_tab : $tab);
ilPDFGenerationRequest $pdfRequest
New implementation of ilObjectGUI.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
static saveRendererPurposeConfig(string $service, string $purpose, string $renderer, array $config)
static getRendererConfig(string $service, string $purpose, string $renderer)
static getRendererInstance(string $renderer)
prepareOutput(bool $show_sub_objects=true)
buildConfigForm(string $command, bool $populate=true)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
saveSettings(bool $redirect_after=true)
static removeRendererConfig(string $service, string $purpose, string $renderer)
setActiveTab(string $tab='')
__construct(Container $dic, ilPlugin $plugin)
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static updateRendererSelection(string $service, string $purpose, string $renderer)
static checkForMultipleServiceAndPurposeCombination()
handleSaveAndConf(string $command)