ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 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 ilErrorHandling $ilErr ilCtrl $ilCtrl. More...
 
 activateTemplates ()
 Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl. More...
 
 deactivateTemplates ()
 Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl. More...
 

Private Attributes

 $parent_object
 
 $object = null
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

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

References $DIC, $lng, and initObject().

29  {
30  global $DIC;
31 
32  $lng = $DIC['lng'];
33 
34  $this->parent_object = $a_parent_obj;
35  $this->lng = $lng;
36 
37  if (isset($_REQUEST["tplid"])) {
38  $this->initObject($_REQUEST["tplid"]);
39  }
40  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ activateTemplates()

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

622  {
623  global $DIC;
624 
625  $ilErr = $DIC['ilErr'];
626  $ilCtrl = $DIC['ilCtrl'];
627  $ilAccess = $DIC['ilAccess'];
628 
629  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
630  $this->ctrl->redirect($this, "overview");
631  }
632  if (!$_REQUEST['tpls']) {
633  ilUtil::sendFailure($this->lng->txt('select_one'));
634  return $ilCtrl->redirect($this, 'overview');
635  }
636 
637  foreach ($_REQUEST['tpls'] as $tplid) {
638  $tpl = new ilDidacticTemplateSetting($tplid);
639  $tpl->enable(true);
640  $tpl->update();
641  }
642 
643  ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'), true);
644  $ilCtrl->redirect($this, 'overview');
645  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

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

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

482  {
483  global $DIC;
484 
485  $ilErr = $DIC['ilErr'];
486  $ilCtrl = $DIC['ilCtrl'];
487  $ilAccess = $DIC['ilAccess'];
488 
489  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
490  $this->ctrl->redirect($this, "overview");
491  }
492 
493  if (!$_REQUEST['tplid']) {
494  ilUtil::sendFailure($this->lng->txt('select_one'));
495  return $ilCtrl->redirect($this, 'overview');
496  }
497 
498  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
499 
500  $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
501  $copier->start();
502 
503  ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
504  $ilCtrl->redirect($this, 'overview');
505  }
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
Copy a didactic template and all subitems.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ createImportForm()

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Create template import form.

Returns
ilPropertyFormGUI $form

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

References $DIC, $form, $ilCtrl, and ilFileInputGUI\setSuffixes().

Referenced by importTemplate(), and showImportForm().

167  {
168  global $DIC;
169 
170  $ilCtrl = $DIC['ilCtrl'];
171 
172  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
173  $form = new ilPropertyFormGUI();
174  $form->setShowTopButtons(false);
175  $form->setFormAction($ilCtrl->getFormAction($this));
176  $form->setTitle($this->lng->txt('didactic_import_table_title'));
177  $form->addCommandButton('importTemplate', $this->lng->txt('import'));
178  $form->addCommandButton('overview', $this->lng->txt('cancel'));
179 
180  $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
181  $file->setSuffixes(array('xml'));
182  $file->setRequired(true);
183  $form->addItem($file);
184 
185  $created = true;
186 
187  return $form;
188  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

654  {
655  global $DIC;
656 
657  $ilErr = $DIC['ilErr'];
658  $ilCtrl = $DIC['ilCtrl'];
659  $ilAccess = $DIC['ilAccess'];
660 
661  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
662  $this->ctrl->redirect($this, "overview");
663  }
664 
665  if (!$_REQUEST['tpls']) {
666  ilUtil::sendFailure($this->lng->txt('select_one'));
667  $ilCtrl->redirect($this, 'overview');
668  }
669 
670  foreach ($_REQUEST['tpls'] as $tplid) {
671  $tpl = new ilDidacticTemplateSetting($tplid);
672  $tpl->enable(false);
673  $tpl->update();
674  }
675 
676  ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'), true);
677  $ilCtrl->redirect($this, 'overview');
678  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ deleteTemplates()

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Delete chosen didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

590  {
591  global $DIC;
592 
593  $ilErr = $DIC['ilErr'];
594  $ilCtrl = $DIC['ilCtrl'];
595  $ilAccess = $DIC['ilAccess'];
596 
597  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
598  $this->ctrl->redirect($this, "overview");
599  }
600 
601  if (!$_REQUEST['tpls']) {
602  ilUtil::sendFailure($this->lng->txt('select_one'));
603  return $ilCtrl->redirect($this, 'overview');
604  }
605 
606  foreach ((array) $_REQUEST['tpls'] as $tplid) {
607  $tpl = new ilDidacticTemplateSetting($tplid);
608  $tpl->delete();
609  }
610 
611  ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'), true);
612  $ilCtrl->redirect($this, 'overview');
613  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ editImport()

ilDidacticTemplateSettingsGUI::editImport (   $a_settings)

ilCtrl $ilCtrl

Parameters
ilDidacticTemplateSetting$a_settings

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

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

Referenced by importTemplate().

753  {
754  global $DIC;
755 
756  $ilCtrl = $DIC['ilCtrl'];
757  $tplid = $_REQUEST['tplid'];
758 
759  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
760  ilDidacticTemplateObjSettings::transferAutoGenerateStatus($tplid, $a_settings->getId());
761 
763 
764  $this->object->delete();
765 
766  foreach ($assignments as $obj) {
767  ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"], $obj["obj_id"], $a_settings->getId());
768  }
769 
770  $ilCtrl->setParameter($this, "tplid", $a_settings->getId());
771  }
global $DIC
Definition: saml.php:7
static transferAutoGenerateStatus($a_src, $a_dest)
transfer auto generated flag if source is auto generated
static getAssignmentsByTemplateID($a_tpl_id)
Lookup template id ilDB $ilDB.
global $ilCtrl
Definition: ilias.php:18
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object ilDB $ilDB.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editImportForm()

ilDidacticTemplateSettingsGUI::editImportForm ( )

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

References $DIC, $form, $ilCtrl, and ilFileInputGUI\setSuffixes().

Referenced by importTemplate(), and showEditImportForm().

727  {
728  global $DIC;
729 
730  $ilCtrl = $DIC['ilCtrl'];
731 
732  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
733  $form = new ilPropertyFormGUI();
734  $form->setShowTopButtons(false);
735  $form->setFormAction($ilCtrl->getFormAction($this));
736  $form->setTitle($this->lng->txt('didactic_import_table_title'));
737  $form->addCommandButton('importTemplate', $this->lng->txt('import'));
738  $form->addCommandButton('overview', $this->lng->txt('cancel'));
739 
740  $file = new ilFileInputGUI($this->lng->txt('didactic_template_update_import'), 'file');
741  $file->setSuffixes(array('xml'));
742  $file->setInfo($this->lng->txt('didactic_template_update_import_info'));
743  $form->addItem($file);
744 
745  return $form;
746  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editTemplate()

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

Edit template.

Returns
void

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

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

Referenced by updateTemplate().

265  {
266  global $DIC;
267 
268  $ilCtrl = $DIC['ilCtrl'];
269  $ilTabs = $DIC['ilTabs'];
270 
271  $this->setEditTabs("edit");
272 
273  if (!$_REQUEST['tplid']) {
274  ilUtil::sendFailure($this->lng->txt('select_one'), true);
275  $ilCtrl->redirect($this, 'overview');
276  }
277 
278  //$ilTabs->clearTargets();
279  //$ilTabs->setBackTarget(
280  // $this->lng->txt('didactic_back_to_overview'),
281  // $ilCtrl->getLinkTarget($this,'overview')
282  //);
283 
284 
285  $ilCtrl->saveParameter($this, 'tplid');
286 
287  if (!$form instanceof ilPropertyFormGUI) {
288  $form = $this->initEditTemplate($this->object);
289  }
290  $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
291  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 510 of file class.ilDidacticTemplateSettingsGUI.php.

References $DIC, $GLOBALS, $ilCtrl, $ilErr, $tpl, ilUtil\deliverData(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendQuestion().

511  {
512  global $DIC;
513 
514  $ilErr = $DIC['ilErr'];
515  $ilCtrl = $DIC['ilCtrl'];
516 
517  if (!$_REQUEST['tplid']) {
518  ilUtil::sendFailure($this->lng->txt('select_one'));
519  return $ilCtrl->redirect($this, 'overview');
520  }
521 
522  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
523  $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
524  $writer->write();
525 
527  $writer->xmlDumpMem(true),
528  $writer->getSetting()->getTitle() . '.xml',
529  'application/xml'
530  );
531  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ importTemplate()

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Import template.

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

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

194  {
195  global $DIC;
196 
197  $ilCtrl = $DIC['ilCtrl'];
198  $ilAccess = $DIC['ilAccess'];
199 
200  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
201  $ilCtrl->redirect($this, "overview");
202  }
203 
204  $edit = isset($_REQUEST['tplid']);
205 
206  if ($edit) {
207  $form = $this->createImportForm();
208  } else {
209  $form = $this->editImportForm();
210  }
211 
212 
213  if (!$form->checkInput()) {
214  ilUtil::sendFailure($this->lng->txt('err_check_input'));
215  $form->setValuesByPost();
216 
217  if ($edit) {
218  $this->showEditImportForm();
219  } else {
220  $this->showImportForm($form);
221  }
222  }
223 
224  // Do import
225  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
226 
228 
229  $file = $form->getInput('file');
230  $tmp = ilUtil::ilTempnam() . '.xml';
231 
232  // move uploaded file
233  ilUtil::moveUploadedFile(
234  $file['tmp_name'],
235  $file['name'],
236  $tmp
237  );
238  $import->setInputFile($tmp);
239 
240  try {
241  $settings = $import->import();
242 
243  if ($edit) {
244  $this->editImport($settings);
245  }
246  } catch (ilDidacticTemplateImportException $e) {
247  ilLoggerFactory::getLogger('otpl')->error('Import failed with message: ' . $e->getMessage());
248  ilUtil::sendFailure($this->lng->txt('didactic_import_failed') . ': ' . $e->getMessage());
249  }
250 
251  ilUtil::sendSuccess($this->lng->txt('didactic_import_success'), true);
252 
253  if ($edit) {
254  $ilCtrl->redirect($this, 'editTemplate');
255  } else {
256  $ilCtrl->redirect($this, 'overview');
257  }
258  }
global $DIC
Definition: saml.php:7
showImportForm(ilPropertyFormGUI $form=null)
Show template import form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static getLogger($a_component_id)
Get component logger.
+ 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 355 of file class.ilDidacticTemplateSettingsGUI.php.

References $def, $DIC, $form, $GLOBALS, $ilCtrl, $info, $languages, PHPMailer\PHPMailer\$options, $title, $type, ilMDLanguageItem\_getLanguages(), ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), ilDidacticTemplateSetting\getInfo(), ilLoggerFactory\getLogger(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\getTranslations(), ilDidacticTemplateSetting\isAutoGenerated(), ilDidacticTemplateSetting\isEnabled(), ilDidacticTemplateSetting\isExclusive(), ilObjectPlugin\lookupTxtById(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), and ilTextAreaInputGUI\setValue().

Referenced by editTemplate(), initObject(), and updateTemplate().

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

References $DIC, $form, $ilCtrl, and initEditTemplate().

Referenced by __construct().

47  {
48  return $this->object = new ilDidacticTemplateSetting($a_id);
49  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ overview()

ilDidacticTemplateSettingsGUI::overview ( )
protected

Show didactic template administration.

ilToolbarGUI $ilToolbar

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

References $DIC, $GLOBALS, $ilCtrl, $lng, and $table.

110  {
111  global $DIC;
112 
113  $ilToolbar = $DIC['ilToolbar'];
114  $lng = $DIC['lng'];
115  $ilCtrl = $DIC['ilCtrl'];
116  $ilAccess = $DIC['ilAccess'];
117 
118  if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
119  $ilToolbar->addButton(
120  $lng->txt('didactic_import_btn'),
121  $ilCtrl->getLinkTarget($this, 'showImportForm')
122  );
123  }
124 
125 
126  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
127  $table = new ilDidacticTemplateSettingsTableGUI($this, 'overview');
128  $table->init();
129  $table->parse();
130 
131  $GLOBALS['DIC']['tpl']->setContent($table->getHTML());
132  }
Description of ilDidacticTemplateSettingsTableGUI.
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
if(empty($password)) $table
Definition: pwgen.php:24
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( )

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

References $form, $GLOBALS, and editImportForm().

Referenced by importTemplate().

718  {
719  $this->setEditTabs("import");
720 
721  $form = $this->editImportForm();
722 
723  $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
724  }
if(isset($_POST['submit'])) $form
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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.

ilTabsGUI $ilTabs

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

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

Referenced by importTemplate().

140  {
141  global $DIC;
142 
143  $ilTabs = $DIC['ilTabs'];
144  $ilCtrl = $DIC['ilCtrl'];
145 
146  if (isset($_REQUEST["tplid"])) {
147  $this->setEditTabs('import');
148  } else {
149  $ilTabs->clearTargets();
150  $ilTabs->setBackTarget(
151  $this->lng->txt('didactic_back_to_overview'),
152  $ilCtrl->getLinkTarget($this, 'overview')
153  );
154  }
155 
156  if (!$form instanceof ilPropertyFormGUI) {
157  $form = $this->createImportForm();
158  }
159  $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
160  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 296 of file class.ilDidacticTemplateSettingsGUI.php.

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

297  {
298  global $DIC;
299 
300  $ilCtrl = $DIC['ilCtrl'];
301  $ilAccess = $DIC['ilAccess'];
302 
303  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
304  $this->ctrl->redirect($this, "overview");
305  }
306 
307  $temp = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
308  $form = $this->initEditTemplate($temp);
309 
310  if ($form->checkInput()) {
311  //change default entrys if translation is active
312  if (count($lang = $temp->getTranslationObject()->getLanguages())) {
313  $temp->getTranslationObject()->setDefaultTitle($form->getInput('title'));
314  $temp->getTranslationObject()->setDefaultDescription($form->getInput('description'));
315  $temp->getTranslationObject()->save();
316  }
317 
318  if (!$temp->isAutoGenerated()) {
319  $temp->setTitle($form->getInput('title'));
320  $temp->setDescription($form->getInput('description'));
321  }
322 
323  $temp->setInfo($form->getInput('info'));
324  $temp->enable($form->getInput('enable'));
325 
326  if (!$temp->isAutoGenerated()) {
327  $temp->setAssignments(array($form->getInput('type')));
328  }
329 
330  if ($form->getInput('local_template') && count($form->getInput('effective_from')) > 0) {
331  $temp->setEffectiveFrom($form->getInput('effective_from'));
332  } else {
333  $temp->setEffectiveFrom(array());
334  }
335 
336  $temp->setExclusive((bool) $form->getInput('exclusive_template'));
337 
338  $temp->update();
339 
340  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
341  $ilCtrl->redirect($this, 'overview');
342  }
343 
344  ilUtil::sendFailure($this->lng->txt('err_check_input'));
345  $form->setValuesByPost();
346  $this->editTemplate($form);
347  }
global $DIC
Definition: saml.php:7
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
global $ilCtrl
Definition: ilias.php:18
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
if(isset($_POST['submit'])) $form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilDidacticTemplateSettingsGUI::$lng
private

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

Referenced by __construct(), and overview().

◆ $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.


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