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)
 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
 
 $dic
 
 $lng
 
 $rbacsystem
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

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

References $DIC, and initObject().

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
+ 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 628 of file class.ilDidacticTemplateSettingsGUI.php.

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

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  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

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

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

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  }
$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.
$DIC
Definition: xapitoken.php:46
+ 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.

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

Referenced by importTemplate(), and showImportForm().

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 property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46
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 660 of file class.ilDidacticTemplateSettingsGUI.php.

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

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  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ 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 596 of file class.ilDidacticTemplateSettingsGUI.php.

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

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  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ editImport()

ilDidacticTemplateSettingsGUI::editImport (   $a_settings)

ilCtrl $ilCtrl

Parameters
ilDidacticTemplateSetting$a_settings

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

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

Referenced by importTemplate().

760  {
761  global $DIC;
762 
763  $ilCtrl = $DIC['ilCtrl'];
764  $tplid = $_REQUEST['tplid'];
765 
766  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
767  ilDidacticTemplateObjSettings::transferAutoGenerateStatus($tplid, $a_settings->getId());
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 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.
$DIC
Definition: xapitoken.php:46
+ 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.

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

Referenced by importTemplate(), and showEditImportForm().

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  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46
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 271 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by updateTemplate().

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  }
This class represents a property form user interface.
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
global $ilCtrl
Definition: ilias.php:18
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ 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.

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

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.
$ilErr
Definition: raiseError.php:18
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ importTemplate()

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Import template.

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

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

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  }
showImportForm(ilPropertyFormGUI $form=null)
Show template import form.
global $ilCtrl
Definition: ilias.php:18
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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.
$DIC
Definition: xapitoken.php:46
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 362 of file class.ilDidacticTemplateSettingsGUI.php.

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(), ilObjectPlugin\lookupTxtById(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), and ilTextAreaInputGUI\setValue().

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

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  }
isEnabled()
Check if template is enabled.
static lookupTxtById($plugin_id, $lang_var)
This class represents a property form user interface.
$type
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(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This class represents a text area property in a property form.
$DIC
Definition: xapitoken.php:46
getInfo()
Get installation info text.
static getLogger($a_component_id)
Get component logger.
getTranslations()
get all translations from this object
+ 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.

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

Referenced by __construct().

62  {
63  return $this->object = new ilDidacticTemplateSetting($a_id);
64  }
+ 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 124 of file class.ilDidacticTemplateSettingsGUI.php.

References $GLOBALS.

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.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( )

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

References $GLOBALS, and editImportForm().

Referenced by importTemplate().

725  {
726  $this->setEditTabs("import");
727 
728  $form = $this->editImportForm();
729 
730  $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
731  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ 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 146 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by importTemplate().

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  }
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$DIC
Definition: xapitoken.php:46
+ 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.

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

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  }
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
global $ilCtrl
Definition: ilias.php:18
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$lang
Definition: xapiexit.php:8
$DIC
Definition: xapitoken.php:46
+ 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: