4 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
5 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
6 require_once
'Services/Object/classes/class.ilObject2GUI.php';
7 require_once
'Services/PDFGeneration/classes/class.ilPDFGeneratorUtils.php';
8 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
43 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
47 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
48 $this->lng->loadLanguageModule(
'pdfgen');
49 $this->toolbar = $DIC[
'ilToolbar'];
50 $this->ctrl = $DIC[
'ilCtrl'];
51 $this->tabs = $DIC[
'ilTabs'];
75 $next_class = $this->ctrl->getNextClass();
76 $cmd = $this->ctrl->getCmd();
79 switch ($next_class) {
80 case 'ilpermissiongui':
81 $this->tabs_gui->setTabActive(
'perm_settings');
83 $this->ctrl->forwardCommand($perm_gui);
87 if ($cmd ==
'' || $cmd ==
'view') {
90 if (substr($cmd, 0, 21) ==
'saveandconf_selected_') {
91 $this->handleSaveAndConf(substr($cmd, 21));
102 $form->setFormAction($this->ctrl->getFormAction($this,
'view'));
106 foreach ($purpose_map as
$service => $purposes) {
107 foreach ($purposes as $purpose) {
112 $preferred =
new ilTextInputGUI($this->lng->txt(
'preferred_renderer'));
114 $preferred->setDisabled(
true);
115 $form->addItem($preferred);
119 $selected_renderer = $selection_map[
$service][$purpose][
'selected'];
121 foreach ($renderers[
$service][$purpose] as
$key => $value) {
122 if ($value == $selected_renderer) {
123 $selected_index =
$key;
126 $selected->setValue($selected_index);
127 $form->addItem($selected);
130 $s_button->setCaption(
'configure');
131 $s_button->setCommand(
'saveandconf_selected_' .
$service .
'::' . $purpose);
133 $s_button->setDisabled(
true);
136 $input_selected->
setHtml($s_button->getToolbarHTML());
137 $form->addItem($input_selected);
142 $form->addCommandButton(
"saveSettings", $this->lng->txt(
"save"));
148 $clean_btn->setCaption(
'cleanup');
149 $clean_btn->setUrl($this->ctrl->getLinkTarget($this,
'doCleanUp'));
150 $this->toolbar->addButtonInstance($clean_btn);
152 $this->tpl->setContent(
$form->getHTML());
167 foreach ($purpose_map as
$service => $purposes) {
168 foreach ($purposes as $purpose) {
170 $selected_renderer = $selection_map[
$service][$purpose][
'selected'];
171 if ($posted_renderer != $selected_renderer) {
176 $form->setTitle($this->lng->txt(
'pdf_config'));
178 if ($redirect_after) {
180 $this->ctrl->redirect($this,
"view");
184 $this->ctrl->redirect($this,
"view");
191 protected function handleSaveAndConf($command)
196 $parts = explode(
'::', $command);
198 $purpose = $parts[1];
205 $form->setFormAction($this->ctrl->getFormAction($this,
'view'));
207 $form->setTitle($this->lng->txt(
'settings') .
' ' . $posted_renderer .
' / ' .
$service .
' / ' . $purpose);
209 $service_hidden->setValue(
$service);
210 $form->addItem($service_hidden);
213 $purpose_hidden->setValue($purpose);
214 $form->addItem($purpose_hidden);
217 $renderer_hidden->setValue($posted_renderer);
218 $form->addItem($renderer_hidden);
221 $renderer = ilPDFGeneratorUtils::getRendererInstance($posted_renderer);
222 $config = ilPDFGeneratorUtils::getRendererConfig(
$service, $purpose, $posted_renderer);
225 $renderer->addConfigElementsToForm(
$form,
$service, $purpose);
228 $form->addCommandButton(
"saveConfig", $this->lng->txt(
"save"));
229 $form->addCommandButton(
"view", $this->lng->txt(
"cancel"));
230 $form->addCommandButton(
"resetSettings", $this->lng->txt(
"reset_to_default"));
231 $this->tpl->setContent(
$form->getHTML());
235 $this->ctrl->redirect($this,
"view");
246 $this->ctrl->redirect($this,
"view");
249 protected function saveConfig()
253 $renderer =
$_POST[
'renderer'];
255 $purpose =
$_POST[
'purpose'];
258 $renderer_obj = ilPDFGeneratorUtils::getRendererInstance($renderer);
259 $renderer_obj->addConfigElementsToForm(
$form,
$service, $purpose);
261 $form->setValuesByPost();
262 if ($renderer_obj->validateConfigInForm(
$form,
$service, $purpose)) {
264 ilPDFGeneratorUtils::saveRendererPurposeConfig(
$service, $purpose, $renderer,
$config);
266 $this->ctrl->redirect($this,
"view");
269 $this->ctrl->redirect($this,
"view");
277 $this->ctrl->redirect($this,
"view");
285 if (strpos($this->ctrl->getCmd(),
'saveandconf') !== 0) {
287 $this->tabs->addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'view'),
array(), __CLASS__);
291 $this->tabs->addTarget(
293 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
'perm'),
299 $this->tabs->setBackTarget(
300 $this->lng->txt(
"back"),
301 $this->ctrl->getLinkTargetByClass(
"ilobjpdfgenerationgui",
"view")
311 $this->tabs->setTabActive(
$tab ==
'' ? $this->active_tab :
$tab);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
saveSettings($redirect_after=true)
static updateRendererSelection($service, $purpose, $renderer)
This class represents a text property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
Class ilObjPDFGenerationGUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static removeRendererConfig($service, $purpose, $renderer)
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
prepareOutput($a_show_subobjects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
setValue($a_value)
Set Value.
static checkForMultipleServiceAndPurposeCombination()