ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilDidacticTemplateSettingsGUI Class Reference

Settings for a single didactic template. More...

+ Collaboration diagram for ilDidacticTemplateSettingsGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor. More...
 
 showEditImportForm ()
 
 editImportForm ()
 
 editImport ($a_settings)
 @global ilCtrl $ilCtrl More...
 

Protected Member Functions

 initObject ($a_id)
 
 overview ()
 Show didactic template administration. More...
 
 showImportForm (ilPropertyFormGUI $form=null)
 Show template import form. More...
 
 createImportForm ()
 Create template import form. More...
 
 importTemplate ()
 Import template. More...
 
 editTemplate (ilPropertyFormGUI $form=null)
 Edit template. More...
 
 updateTemplate ()
 Update template. More...
 
 initEditTemplate (ilDidacticTemplateSetting $set)
 Init edit template form. More...
 
 copyTemplate ()
 Copy on template. More...
 
 exportTemplate ()
 Export one template. More...
 
 deleteTemplates ()
 Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 activateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 deactivateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 

Private Attributes

 $parent_object
 
 $object = null
 
 $dic
 
 $lng
 
 $rbacsystem
 
 $ctrl
 

Detailed Description

Settings for a single didactic template.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@ilCtrl_IsCalledBy ilDidacticTemplateSettingsGUI: ilObjRoleFolderGUI @ilCtrl_Calls ilDidacticTemplateSettingsGUI: ilMultilingualismGUI, ilPropertyFormGUI

Definition at line 14 of file class.ilDidacticTemplateSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

Definition at line 42 of file class.ilDidacticTemplateSettingsGUI.php.

43 {
44 global $DIC;
45
46 $this->parent_object = $a_parent_obj;
47 $this->dic = $DIC;
48 $this->lng = $this->dic->language();
49 $this->rbacsystem = $this->dic->rbac()->system();
50 $this->ctrl = $this->dic->ctrl();
51
52 if (isset($_REQUEST["tplid"])) {
53 $this->initObject($_REQUEST["tplid"]);
54 }
55 }
$DIC
Definition: xapitoken.php:46

References $DIC, and initObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateTemplates()

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 628 of file class.ilDidacticTemplateSettingsGUI.php.

629 {
630 global $DIC;
631
632 $ilErr = $DIC['ilErr'];
633 $ilCtrl = $DIC['ilCtrl'];
634 $ilAccess = $DIC['ilAccess'];
635
636 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
637 $this->ctrl->redirect($this, "overview");
638 }
639 if (!$_REQUEST['tpls']) {
640 ilUtil::sendFailure($this->lng->txt('select_one'));
641 return $ilCtrl->redirect($this, 'overview');
642 }
643
644 foreach ($_REQUEST['tpls'] as $tplid) {
645 $tpl = new ilDidacticTemplateSetting($tplid);
646 $tpl->enable(true);
647 $tpl->update();
648 }
649
650 ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'), true);
651 $ilCtrl->redirect($this, 'overview');
652 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$ilErr
Definition: raiseError.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $DIC, $ilCtrl, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

Definition at line 488 of file class.ilDidacticTemplateSettingsGUI.php.

489 {
490 global $DIC;
491
492 $ilErr = $DIC['ilErr'];
493 $ilCtrl = $DIC['ilCtrl'];
494 $ilAccess = $DIC['ilAccess'];
495
496 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
497 $this->ctrl->redirect($this, "overview");
498 }
499
500 if (!$_REQUEST['tplid']) {
501 ilUtil::sendFailure($this->lng->txt('select_one'));
502 return $ilCtrl->redirect($this, 'overview');
503 }
504
505 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
506
507 $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
508 $copier->start();
509
510 ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
511 $ilCtrl->redirect($this, 'overview');
512 }
Copy a didactic template and all subitems.

References $DIC, $ilCtrl, $ilErr, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ createImportForm()

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Create template import form.

Returns
ilPropertyFormGUI $form

Definition at line 173 of file class.ilDidacticTemplateSettingsGUI.php.

174 {
175 global $DIC;
176
177 $ilCtrl = $DIC['ilCtrl'];
178
179 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
180 $form = new ilPropertyFormGUI();
181 $form->setShowTopButtons(false);
182 $form->setFormAction($ilCtrl->getFormAction($this));
183 $form->setTitle($this->lng->txt('didactic_import_table_title'));
184 $form->addCommandButton('importTemplate', $this->lng->txt('import'));
185 $form->addCommandButton('overview', $this->lng->txt('cancel'));
186
187 $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
188 $file->setSuffixes(array('xml'));
189 $file->setRequired(true);
190 $form->addItem($file);
191
192 $created = true;
193
194 return $form;
195 }
This class represents a file property in a property form.
This class represents a property form user interface.

References $DIC, and $ilCtrl.

Referenced by importTemplate(), and showImportForm().

+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 660 of file class.ilDidacticTemplateSettingsGUI.php.

661 {
662 global $DIC;
663
664 $ilErr = $DIC['ilErr'];
665 $ilCtrl = $DIC['ilCtrl'];
666 $ilAccess = $DIC['ilAccess'];
667
668 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
669 $this->ctrl->redirect($this, "overview");
670 }
671
672 if (!$_REQUEST['tpls']) {
673 ilUtil::sendFailure($this->lng->txt('select_one'));
674 $ilCtrl->redirect($this, 'overview');
675 }
676
677 foreach ($_REQUEST['tpls'] as $tplid) {
678 $tpl = new ilDidacticTemplateSetting($tplid);
679 $tpl->enable(false);
680 $tpl->update();
681 }
682
683 ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'), true);
684 $ilCtrl->redirect($this, 'overview');
685 }

References $DIC, $ilCtrl, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteTemplates()

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 596 of file class.ilDidacticTemplateSettingsGUI.php.

597 {
598 global $DIC;
599
600 $ilErr = $DIC['ilErr'];
601 $ilCtrl = $DIC['ilCtrl'];
602 $ilAccess = $DIC['ilAccess'];
603
604 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
605 $this->ctrl->redirect($this, "overview");
606 }
607
608 if (!$_REQUEST['tpls']) {
609 ilUtil::sendFailure($this->lng->txt('select_one'));
610 return $ilCtrl->redirect($this, 'overview');
611 }
612
613 foreach ((array) $_REQUEST['tpls'] as $tplid) {
614 $tpl = new ilDidacticTemplateSetting($tplid);
615 $tpl->delete();
616 }
617
618 ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'), true);
619 $ilCtrl->redirect($this, 'overview');
620 }

References $DIC, $ilCtrl, $ilErr, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ editImport()

ilDidacticTemplateSettingsGUI::editImport (   $a_settings)

@global ilCtrl $ilCtrl

Parameters
ilDidacticTemplateSetting$a_settings

Definition at line 759 of file class.ilDidacticTemplateSettingsGUI.php.

760 {
761 global $DIC;
762
763 $ilCtrl = $DIC['ilCtrl'];
764 $tplid = $_REQUEST['tplid'];
765
766 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
768
770
771 $this->object->delete();
772
773 foreach ($assignments as $obj) {
774 ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"], $obj["obj_id"], $a_settings->getId());
775 }
776
777 $ilCtrl->setParameter($this, "tplid", $a_settings->getId());
778 }
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object @global ilDB $ilDB.
static getAssignmentsByTemplateID($a_tpl_id)
Lookup template id @global ilDB $ilDB.
static transferAutoGenerateStatus($a_src, $a_dest)
transfer auto generated flag if source is auto generated

References $DIC, $ilCtrl, ilDidacticTemplateObjSettings\assignTemplate(), ilDidacticTemplateObjSettings\getAssignmentsByTemplateID(), and ilDidacticTemplateObjSettings\transferAutoGenerateStatus().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editImportForm()

ilDidacticTemplateSettingsGUI::editImportForm ( )

Definition at line 733 of file class.ilDidacticTemplateSettingsGUI.php.

734 {
735 global $DIC;
736
737 $ilCtrl = $DIC['ilCtrl'];
738
739 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
740 $form = new ilPropertyFormGUI();
741 $form->setShowTopButtons(false);
742 $form->setFormAction($ilCtrl->getFormAction($this));
743 $form->setTitle($this->lng->txt('didactic_import_table_title'));
744 $form->addCommandButton('importTemplate', $this->lng->txt('import'));
745 $form->addCommandButton('overview', $this->lng->txt('cancel'));
746
747 $file = new ilFileInputGUI($this->lng->txt('didactic_template_update_import'), 'file');
748 $file->setSuffixes(array('xml'));
749 $file->setInfo($this->lng->txt('didactic_template_update_import_info'));
750 $form->addItem($file);
751
752 return $form;
753 }

References $DIC, and $ilCtrl.

Referenced by importTemplate(), and showEditImportForm().

+ Here is the caller graph for this function:

◆ editTemplate()

ilDidacticTemplateSettingsGUI::editTemplate ( ilPropertyFormGUI  $form = null)
protected

Edit template.

Returns
void

Definition at line 271 of file class.ilDidacticTemplateSettingsGUI.php.

272 {
273 global $DIC;
274
275 $ilCtrl = $DIC['ilCtrl'];
276 $ilTabs = $DIC['ilTabs'];
277
278 $this->setEditTabs("edit");
279
280 if (!$_REQUEST['tplid']) {
281 ilUtil::sendFailure($this->lng->txt('select_one'), true);
282 $ilCtrl->redirect($this, 'overview');
283 }
284
285 //$ilTabs->clearTargets();
286 //$ilTabs->setBackTarget(
287 // $this->lng->txt('didactic_back_to_overview'),
288 // $ilCtrl->getLinkTarget($this,'overview')
289 //);
290
291
292 $ilCtrl->saveParameter($this, 'tplid');
293
294 if (!$form instanceof ilPropertyFormGUI) {
295 $form = $this->initEditTemplate($this->object);
296 }
297 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
298 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.

References $DIC, $GLOBALS, $ilCtrl, initEditTemplate(), and ilUtil\sendFailure().

Referenced by updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportTemplate()

ilDidacticTemplateSettingsGUI::exportTemplate ( )
protected

Export one template.

Definition at line 517 of file class.ilDidacticTemplateSettingsGUI.php.

518 {
519 global $DIC;
520
521 $ilErr = $DIC['ilErr'];
522 $ilCtrl = $DIC['ilCtrl'];
523
524 if (!$_REQUEST['tplid']) {
525 ilUtil::sendFailure($this->lng->txt('select_one'));
526 return $ilCtrl->redirect($this, 'overview');
527 }
528
529 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
530 $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
531 $writer->write();
532
534 $writer->xmlDumpMem(true),
535 $writer->getSetting()->getTitle() . '.xml',
536 'application/xml'
537 );
538 }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $DIC, $ilCtrl, $ilErr, ilUtil\deliverData(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ importTemplate()

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Import template.

Definition at line 200 of file class.ilDidacticTemplateSettingsGUI.php.

201 {
202 global $DIC;
203
204 $ilCtrl = $DIC['ilCtrl'];
205 $ilAccess = $DIC['ilAccess'];
206
207 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
208 $ilCtrl->redirect($this, "overview");
209 }
210
211 $edit = isset($_REQUEST['tplid']);
212
213 if ($edit) {
214 $form = $this->createImportForm();
215 } else {
216 $form = $this->editImportForm();
217 }
218
219
220 if (!$form->checkInput()) {
221 ilUtil::sendFailure($this->lng->txt('err_check_input'));
222 $form->setValuesByPost();
223
224 if ($edit) {
225 $this->showEditImportForm();
226 } else {
227 $this->showImportForm($form);
228 }
229 }
230
231 // Do import
232 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
233
235
236 $file = $form->getInput('file');
237 $tmp = ilUtil::ilTempnam() . '.xml';
238
239 // move uploaded file
241 $file['tmp_name'],
242 $file['name'],
243 $tmp
244 );
245 $import->setInputFile($tmp);
246
247 try {
248 $settings = $import->import();
249
250 if ($edit) {
251 $this->editImport($settings);
252 }
254 ilLoggerFactory::getLogger('otpl')->error('Import failed with message: ' . $e->getMessage());
255 ilUtil::sendFailure($this->lng->txt('didactic_import_failed') . ': ' . $e->getMessage());
256 }
257
258 ilUtil::sendSuccess($this->lng->txt('didactic_import_success'), true);
259
260 if ($edit) {
261 $ilCtrl->redirect($this, 'editTemplate');
262 } else {
263 $ilCtrl->redirect($this, 'overview');
264 }
265 }
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
editImport($a_settings)
@global ilCtrl $ilCtrl
showImportForm(ilPropertyFormGUI $form=null)
Show template import form.
static getLogger($a_component_id)
Get component logger.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.

References $DIC, Vendor\Package\$e, $ilCtrl, createImportForm(), editImport(), editImportForm(), ilLoggerFactory\getLogger(), ilUtil\ilTempnam(), ilDidacticTemplateImport\IMPORT_FILE, ilUtil\moveUploadedFile(), ilUtil\sendFailure(), showEditImportForm(), and showImportForm().

+ Here is the call graph for this function:

◆ initEditTemplate()

ilDidacticTemplateSettingsGUI::initEditTemplate ( ilDidacticTemplateSetting  $set)
protected

Init edit template form.

Parameters
ilDidacticTemplateSetting$set
Returns
ilPropertyFormGUI

Definition at line 362 of file class.ilDidacticTemplateSettingsGUI.php.

363 {
364 global $DIC;
365
366 $ilCtrl = $DIC['ilCtrl'];
367 $objDefinition = $DIC['objDefinition'];
368
369 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
370 $form = new ilPropertyFormGUI();
371 $form->setShowTopButtons(false);
372 $form->setFormAction($ilCtrl->getFormAction($this, 'updateTemplate'));
373 $form->setTitle($this->lng->txt('didactic_edit_tpl'));
374 $form->addCommandButton('updateTemplate', $this->lng->txt('save'));
375 $form->addCommandButton('overview', $this->lng->txt('cancel'));
376
377 // title
378 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
379 $title->setSize(40);
380 $title->setMaxLength(64);
381 $title->setRequired(true);
382 //use presentation title if autogenerated is set
383 $title->setDisabled($set->isAutoGenerated());
384
385 if (!$set->isAutoGenerated()) {
386 $trans = $set->getTranslations();
387 $def = $trans[0]; // default
388
389 if (sizeof($trans) > 1) {
390 include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
391 $languages = ilMDLanguageItem::_getLanguages();
392 $title->setInfo($this->lng->txt("language") . ": " . $languages[$def["lang_code"]] .
393 ' <a href="' . $ilCtrl->getLinkTargetByClass("ilmultilingualismgui", "listTranslations") .
394 '">&raquo; ' . $this->lng->txt("more_translations") . '</a>');
395 }
396 }
397
398 if ($set->isAutoGenerated()) {
399 $title->setValue($set->getPresentationTitle());
400 } else {
401 $title->setValue($def["title"]);
402 }
403
404 $form->addItem($title);
405
406 // desc
407 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
408 //use presentation title if autogenerated is set
409 if ($set->isAutoGenerated()) {
410 $desc->setValue($set->getPresentationDescription());
411 } else {
412 $desc->setValue($def["description"]);
413 }
414 $desc->setRows(3);
415 $desc->setDisabled($set->isAutoGenerated());
416 $form->addItem($desc);
417
418 // info
419 $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
420 $info->setValue($set->getInfo());
421 $info->setRows(6);
422 $form->addItem($info);
423
424 //activate
425 $enable = new ilCheckboxInputGUI($this->lng->txt('active'), 'enable');
426 $enable->setChecked($set->isEnabled());
427 $enable->setRequired(true);
428 $form->addItem($enable);
429
430 // object type
431 if (!$set->isAutoGenerated()) {
432 $type = new ilSelectInputGUI($this->lng->txt('obj_type'), 'type');
433 $type->setRequired(true);
434 $type->setInfo($this->lng->txt('dtpl_obj_type_info'));
435 $assigned = $set->getAssignments();
436 $type->setValue(isset($assigned[0]) ? $assigned[0] : '');
437 $subs = $objDefinition->getSubObjectsRecursively('root', false);
438 $options = array();
439 foreach (array_merge($subs, array('fold' => 1)) as $obj => $null) {
440 ilLoggerFactory::getLogger('root')->dump($null);
441 if ($objDefinition->isPlugin($obj)) {
442 $options[$obj] = ilObjectPlugin::lookupTxtById($obj, "obj_" . $obj);
443 } elseif ($objDefinition->isAllowedInRepository($obj)) {
444 $options[$obj] = $this->lng->txt('obj_' . $obj);
445 }
446 }
447 asort($options);
448
449 $type->setOptions($options);
450 $form->addItem($type);
451
452 $lokal_templates = new ilCheckboxInputGUI($this->lng->txt("activate_local_didactic_template"), "local_template");
453 $lokal_templates->setChecked(count($set->getEffectiveFrom()) > 0);
454 $lokal_templates->setInfo($this->lng->txt("activate_local_didactic_template_info"));
455
456 //effective from (multinode)
457 include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
458 $effrom = new ilRepositorySelector2InputGUI($this->lng->txt("effective_form"), "effective_from", true);
459 //$effrom->setMulti(true);
460 $definition = $GLOBALS['DIC']['objDefinition'];
461 $white_list = [];
462 foreach ($definition->getAllRepositoryTypes() as $type) {
463 if ($definition->isContainer($type)) {
464 $white_list[] = $type;
465 }
466 }
467 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
468 $effrom->setValue($set->getEffectiveFrom());
469
470 $lokal_templates->addSubItem($effrom);
471 $form->addItem($lokal_templates);
472
473 $excl = new ilCheckboxInputGUI($this->lng->txt("activate_exclusive_template"), "exclusive_template");
474 $excl->setInfo($this->lng->txt("activate_exclusive_template_info"));
475 $excl->setChecked($set->isExclusive());
476
477 $form->addItem($excl);
478 }
479
480
481
482 return $form;
483 }
This class represents a checkbox property in a property form.
getTranslations()
get all translations from this object
getInfo()
Get installation info text.
isEnabled()
Check if template is enabled.
static lookupTxtById($plugin_id, $lang_var)
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$type

References $DIC, $GLOBALS, $ilCtrl, $type, ilMDLanguageItem\_getLanguages(), ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), ilDidacticTemplateSetting\getInfo(), ilLoggerFactory\getLogger(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\getTranslations(), ilDidacticTemplateSetting\isAutoGenerated(), ilDidacticTemplateSetting\isEnabled(), ilDidacticTemplateSetting\isExclusive(), and ilObjectPlugin\lookupTxtById().

Referenced by editTemplate(), and updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initObject()

ilDidacticTemplateSettingsGUI::initObject (   $a_id)
protected
Parameters
int$a_id
Returns
ilDidacticTemplateSetting

Definition at line 61 of file class.ilDidacticTemplateSettingsGUI.php.

62 {
63 return $this->object = new ilDidacticTemplateSetting($a_id);
64 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ overview()

ilDidacticTemplateSettingsGUI::overview ( )
protected

Show didactic template administration.

@global ilToolbarGUI $ilToolbar

Definition at line 124 of file class.ilDidacticTemplateSettingsGUI.php.

125 {
126 if ($this->rbacsystem->checkAccess('write', $_REQUEST["ref_id"])) {
127 $this->dic->toolbar()->addButton(
128 $this->lng->txt('didactic_import_btn'),
129 $this->ctrl->getLinkTarget($this, 'showImportForm')
130 );
131 }
132
133 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
134 $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview');
135 $table->init();
136 $table->parse();
137
138 $GLOBALS['DIC']['tpl']->setContent($table->getHTML());
139 }
Description of ilDidacticTemplateSettingsTableGUI.

References $GLOBALS.

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( )

Definition at line 724 of file class.ilDidacticTemplateSettingsGUI.php.

725 {
726 $this->setEditTabs("import");
727
728 $form = $this->editImportForm();
729
730 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
731 }

References $GLOBALS, and editImportForm().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showImportForm()

ilDidacticTemplateSettingsGUI::showImportForm ( ilPropertyFormGUI  $form = null)
protected

Show template import form.

@global ilTabsGUI $ilTabs

Definition at line 146 of file class.ilDidacticTemplateSettingsGUI.php.

147 {
148 global $DIC;
149
150 $ilTabs = $DIC['ilTabs'];
151 $ilCtrl = $DIC['ilCtrl'];
152
153 if (isset($_REQUEST["tplid"])) {
154 $this->setEditTabs('import');
155 } else {
156 $ilTabs->clearTargets();
157 $ilTabs->setBackTarget(
158 $this->lng->txt('didactic_back_to_overview'),
159 $ilCtrl->getLinkTarget($this, 'overview')
160 );
161 }
162
163 if (!$form instanceof ilPropertyFormGUI) {
164 $form = $this->createImportForm();
165 }
166 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
167 }

References $DIC, $GLOBALS, $ilCtrl, and createImportForm().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTemplate()

ilDidacticTemplateSettingsGUI::updateTemplate ( )
protected

Update template.

Definition at line 303 of file class.ilDidacticTemplateSettingsGUI.php.

304 {
305 global $DIC;
306
307 $ilCtrl = $DIC['ilCtrl'];
308 $ilAccess = $DIC['ilAccess'];
309
310 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
311 $this->ctrl->redirect($this, "overview");
312 }
313
314 $temp = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
315 $form = $this->initEditTemplate($temp);
316
317 if ($form->checkInput()) {
318 //change default entrys if translation is active
319 if (count($lang = $temp->getTranslationObject()->getLanguages())) {
320 $temp->getTranslationObject()->setDefaultTitle($form->getInput('title'));
321 $temp->getTranslationObject()->setDefaultDescription($form->getInput('description'));
322 $temp->getTranslationObject()->save();
323 }
324
325 if (!$temp->isAutoGenerated()) {
326 $temp->setTitle($form->getInput('title'));
327 $temp->setDescription($form->getInput('description'));
328 }
329
330 $temp->setInfo($form->getInput('info'));
331 $temp->enable($form->getInput('enable'));
332
333 if (!$temp->isAutoGenerated()) {
334 $temp->setAssignments(array($form->getInput('type')));
335 }
336
337 if ($form->getInput('local_template') && count($form->getInput('effective_from')) > 0) {
338 $temp->setEffectiveFrom($form->getInput('effective_from'));
339 } else {
340 $temp->setEffectiveFrom(array());
341 }
342
343 $temp->setExclusive((bool) $form->getInput('exclusive_template'));
344
345 $temp->update();
346
347 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
348 $ilCtrl->redirect($this, 'overview');
349 }
350
351 ilUtil::sendFailure($this->lng->txt('err_check_input'));
352 $form->setValuesByPost();
353 $this->editTemplate($form);
354 }
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
$lang
Definition: xapiexit.php:8

References $DIC, $ilCtrl, $lang, editTemplate(), initEditTemplate(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDidacticTemplateSettingsGUI::$ctrl
private

Definition at line 37 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $dic

ilDidacticTemplateSettingsGUI::$dic
private

Definition at line 25 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $lng

ilDidacticTemplateSettingsGUI::$lng
private

Definition at line 29 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $object

ilDidacticTemplateSettingsGUI::$object = null
private

Definition at line 21 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $parent_object

ilDidacticTemplateSettingsGUI::$parent_object
private

Definition at line 16 of file class.ilDidacticTemplateSettingsGUI.php.

◆ $rbacsystem

ilDidacticTemplateSettingsGUI::$rbacsystem
private

Definition at line 33 of file class.ilDidacticTemplateSettingsGUI.php.


The documentation for this class was generated from the following file: