ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $lng, and initObject().

29  {
30  global $lng;
31 
32  $this->parent_object = $a_parent_obj;
33  $this->lng = $lng;
34 
35  if(isset($_REQUEST["tplid"]))
36  {
37  $this->initObject($_REQUEST["tplid"]);
38  }
39  }
+ 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 625 of file class.ilDidacticTemplateSettingsGUI.php.

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

626  {
627  global $ilErr, $ilCtrl, $ilAccess;
628 
629  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
630  {
631  $this->ctrl->redirect($this, "overview");
632  }
633  if(!$_REQUEST['tpls'])
634  {
635  ilUtil::sendFailure($this->lng->txt('select_one'));
636  return $ilCtrl->redirect($this,'overview');
637  }
638 
639  foreach($_REQUEST['tpls'] as $tplid)
640  {
641  $tpl = new ilDidacticTemplateSetting($tplid);
642  $tpl->enable(true);
643  $tpl->update();
644  }
645 
646  ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'),true);
647  $ilCtrl->redirect($this,'overview');
648  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
global $tpl
Definition: ilias.php:8
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 487 of file class.ilDidacticTemplateSettingsGUI.php.

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

488  {
489  global $ilErr, $ilCtrl, $ilAccess;
490 
491  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
492  {
493  $this->ctrl->redirect($this, "overview");
494  }
495 
496  if(!$_REQUEST['tplid'])
497  {
498  ilUtil::sendFailure($this->lng->txt('select_one'));
499  return $ilCtrl->redirect($this,'overview');
500  }
501 
502  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
503 
504  $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
505  $copier->start();
506 
507  ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
508  $ilCtrl->redirect($this,'overview');
509  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
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 159 of file class.ilDidacticTemplateSettingsGUI.php.

References $file, $ilCtrl, and array.

Referenced by importTemplate(), and showImportForm().

160  {
161  global $ilCtrl;
162 
163  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
164  $form = new ilPropertyFormGUI();
165  $form->setShowTopButtons(false);
166  $form->setFormAction($ilCtrl->getFormAction($this));
167  $form->setTitle($this->lng->txt('didactic_import_table_title'));
168  $form->addCommandButton('importTemplate', $this->lng->txt('import'));
169  $form->addCommandButton('overview', $this->lng->txt('cancel'));
170 
171  $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
172  $file->setSuffixes(array('xml'));
173  $file->setRequired(TRUE);
174  $form->addItem($file);
175 
176  $created = true;
177 
178  return $form;
179  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

References $ilCtrl, $ilErr, $tpl, array, object, ilUtil\sendFailure(), and ilUtil\sendSuccess().

657  {
658  global $ilErr, $ilCtrl, $ilAccess;
659 
660  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
661  {
662  $this->ctrl->redirect($this, "overview");
663  }
664 
665  if(!$_REQUEST['tpls'])
666  {
667  ilUtil::sendFailure($this->lng->txt('select_one'));
668  $ilCtrl->redirect($this,'overview');
669  }
670 
671  foreach($_REQUEST['tpls'] as $tplid)
672  {
673  $tpl = new ilDidacticTemplateSetting($tplid);
674  $tpl->enable(false);
675  $tpl->update();
676  }
677 
678  ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'),true);
679  $ilCtrl->redirect($this,'overview');
680  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
global $tpl
Definition: ilias.php:8
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 594 of file class.ilDidacticTemplateSettingsGUI.php.

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

595  {
596  global $ilErr, $ilCtrl, $ilAccess;
597 
598  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
599  {
600  $this->ctrl->redirect($this, "overview");
601  }
602 
603  if(!$_REQUEST['tpls'])
604  {
605  ilUtil::sendFailure($this->lng->txt('select_one'));
606  return $ilCtrl->redirect($this,'overview');
607  }
608 
609  foreach((array) $_REQUEST['tpls'] as $tplid)
610  {
611  $tpl = new ilDidacticTemplateSetting($tplid);
612  $tpl->delete();
613  }
614 
615  ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'),true);
616  $ilCtrl->redirect($this,'overview');
617  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
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 $ilCtrl, ilDidacticTemplateObjSettings\assignTemplate(), ilDidacticTemplateObjSettings\getAssignmentsByTemplateID(), and ilDidacticTemplateObjSettings\transferAutoGenerateStatus().

Referenced by importTemplate().

753  {
754  global $ilCtrl;
755  $tplid = $_REQUEST['tplid'];
756 
757  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
758  ilDidacticTemplateObjSettings::transferAutoGenerateStatus($tplid, $a_settings->getId());
759 
761 
762  $this->object->delete();
763 
764  foreach($assignments as $obj)
765  {
766  ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"],$obj["obj_id"],$a_settings->getId());
767  }
768 
769  $ilCtrl->setParameter($this, "tplid", $a_settings->getId());
770  }
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 728 of file class.ilDidacticTemplateSettingsGUI.php.

References $file, $ilCtrl, and array.

Referenced by importTemplate(), and showEditImportForm().

729  {
730  global $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.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ editTemplate()

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

Edit template.

Returns
void

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

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

Referenced by updateTemplate().

269  {
270  global $ilCtrl,$ilTabs;
271 
272  $this->setEditTabs("edit");
273 
274  if(!$_REQUEST['tplid'])
275  {
276  ilUtil::sendFailure($this->lng->txt('select_one'),true);
277  $ilCtrl->redirect($this,'overview');
278  }
279 
280  //$ilTabs->clearTargets();
281  //$ilTabs->setBackTarget(
282  // $this->lng->txt('didactic_back_to_overview'),
283  // $ilCtrl->getLinkTarget($this,'overview')
284  //);
285 
286 
287  $ilCtrl->saveParameter($this,'tplid');
288 
289  if(!$form instanceof ilPropertyFormGUI)
290  {
291  $form = $this->initEditTemplate($this->object);
292  }
293  $GLOBALS['tpl']->setContent($form->getHTML());
294  }
This class represents a property form user interface.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
+ 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 514 of file class.ilDidacticTemplateSettingsGUI.php.

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

515  {
516  global $ilErr, $ilCtrl;
517 
518  if(!$_REQUEST['tplid'])
519  {
520  ilUtil::sendFailure($this->lng->txt('select_one'));
521  return $ilCtrl->redirect($this,'overview');
522  }
523 
524  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
525  $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
526  $writer->write();
527 
529  $writer->xmlDumpMem(TRUE),
530  $writer->getSetting()->getTitle().'.xml',
531  'application/xml'
532  );
533  }
global $ilErr
Definition: raiseError.php:16
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
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 184 of file class.ilDidacticTemplateSettingsGUI.php.

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

185  {
186  global $ilCtrl, $ilAccess;
187 
188  if(!$ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
189  {
190  $ilCtrl->redirect($this, "overview");
191  }
192 
193  $edit = isset($_REQUEST['tplid']);
194 
195  if($edit)
196  {
197  $form = $this->createImportForm();
198  }
199  else{
200  $form = $this->editImportForm();
201  }
202 
203 
204  if(!$form->checkInput())
205  {
206  ilUtil::sendFailure($this->lng->txt('err_check_input'));
207  $form->setValuesByPost();
208 
209  if($edit)
210  {
211 
212  $this->showEditImportForm();
213  }
214  else
215  {
216  $this->showImportForm($form);
217  }
218 
219  }
220 
221  // Do import
222  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
223 
225 
226  $file = $form->getInput('file');
227  $tmp = ilUtil::ilTempnam();
228 
229  // move uploaded file
231  $file['tmp_name'],
232  $file['name'],
233  $tmp
234  );
235  $import->setInputFile($tmp);
236 
237  try {
238  $settings = $import->import();
239 
240  if($edit)
241  {
242  $this->editImport($settings);
243  }
244  }
246  {
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  {
255  $ilCtrl->redirect($this,'editTemplate');
256  }
257  else
258  {
259  $ilCtrl->redirect($this,'overview');
260  }
261 
262  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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)
Create a temporary file in an ILIAS writable directory.
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 363 of file class.ilDidacticTemplateSettingsGUI.php.

References $ilCtrl, $info, $languages, $options, $title, ilMDLanguageItem\_getLanguages(), array, ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), ilRepositorySelector2InputGUI\getExplorerGUI(), ilDidacticTemplateSetting\getInfo(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\getTranslations(), ilDidacticTemplateSetting\isAutoGenerated(), ilDidacticTemplateSetting\isEnabled(), ilDidacticTemplateSetting\isExclusive(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), and ilTextAreaInputGUI\setValue().

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

364  {
365  global $ilCtrl,$objDefinition;
366 
367  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
368  $form = new ilPropertyFormGUI();
369  $form->setShowTopButtons(false);
370  $form->setFormAction($ilCtrl->getFormAction($this,'updateTemplate'));
371  $form->setTitle($this->lng->txt('didactic_edit_tpl'));
372  $form->addCommandButton('updateTemplate', $this->lng->txt('save'));
373  $form->addCommandButton('overview', $this->lng->txt('cancel'));
374 
375  // title
376  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
377  $title->setSize(40);
378  $title->setMaxLength(64);
379  $title->setRequired(true);
380  //use presentation title if autogenerated is set
381  $title->setDisabled($set->isAutoGenerated());
382 
383  if(!$set->isAutoGenerated())
384  {
385  $trans = $set->getTranslations();
386  $def = $trans[0]; // default
387 
388  if(sizeof($trans) > 1)
389  {
390  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
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  {
400  $title->setValue($set->getPresentationTitle());
401  }
402  else
403  {
404  $title->setValue($def["title"]);
405  }
406 
407  $form->addItem($title);
408 
409  // desc
410  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
411  //use presentation title if autogenerated is set
412  if ($set->isAutoGenerated())
413  {
414  $desc->setValue($set->getPresentationDescription());
415  }
416  else{
417  $desc->setValue($def["description"]);
418  }
419  $desc->setRows(3);
420  $desc->setDisabled($set->isAutoGenerated());
421  $form->addItem($desc);
422 
423  // info
424  $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
425  $info->setValue($set->getInfo());
426  $info->setRows(6);
427  $form->addItem($info);
428 
429  //activate
430  $enable = new ilCheckboxInputGUI($this->lng->txt('active'), 'enable');
431  $enable->setChecked($set->isEnabled());
432  $enable->setRequired(true);
433  $form->addItem($enable);
434 
435  // object type
436 
437  if(!$set->isAutoGenerated())
438  {
439  $type = new ilSelectInputGUI($this->lng->txt('obj_type'),'type');
440  $type->setRequired(true);
441  $type->setInfo($this->lng->txt('dtpl_obj_type_info'));
442  $assigned = $set->getAssignments();
443  $type->setValue(isset($assigned[0]) ? $assigned[0] : '');
444  $subs = $objDefinition->getCreatableSubobjects('root', false);
445  $options = array();
446  foreach(array_merge($subs,array('fold' => 1)) as $obj => $null)
447  {
448  if($objDefinition->isAllowedInRepository($obj))
449  {
450  $options[$obj] = $this->lng->txt('obj_'.$obj);
451  }
452  }
453  asort($options);
454 
455  $type->setOptions($options);
456  $form->addItem($type);
457 
458  $lokal_templates = new ilCheckboxInputGUI($this->lng->txt("activate_local_didactic_template"), "local_template");
459  $lokal_templates->setChecked(count($set->getEffectiveFrom()) > 0);
460  $lokal_templates->setInfo($this->lng->txt("activate_local_didactic_template_info"));
461 
462  //effective from (multinode)
463  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
464  $effrom = new ilRepositorySelector2InputGUI($this->lng->txt("effective_form"), "effective_from", true);
465  //$effrom->setMulti(true);
466  $effrom->getExplorerGUI()->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs"));
467  $effrom->setValue($set->getEffectiveFrom());
468 
469  $lokal_templates->addSubItem($effrom);
470  $form->addItem($lokal_templates);
471 
472  $excl = new ilCheckboxInputGUI($this->lng->txt("activate_exclusive_template"), "exclusive_template");
473  $excl->setInfo($this->lng->txt("activate_exclusive_template_info"));
474  $excl->setChecked($set->isExclusive());
475 
476  $form->addItem($excl);
477  }
478 
479 
480 
481  return $form;
482  }
isEnabled()
Check if template is enabled.
This class represents a selection list property in a property form.
This class represents a property form user interface.
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.
$info
Definition: example_052.php:80
if(!is_array($argv)) $options
This class represents a text property in a property form.
Create styles array
The data for the language used.
This class represents a text area property in a property form.
getInfo()
Get installation info text.
$languages
Definition: cssgen2.php:34
getTranslations()
get all translations from this object
setRequired($a_required)
Set Required.
+ 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 45 of file class.ilDidacticTemplateSettingsGUI.php.

References $cmd, $ilCtrl, initEditTemplate(), and object.

Referenced by __construct().

46  {
47  return $this->object = new ilDidacticTemplateSetting($a_id);
48  }
+ 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 105 of file class.ilDidacticTemplateSettingsGUI.php.

References $GLOBALS, $ilCtrl, and $lng.

106  {
107  global $ilToolbar,$lng, $ilCtrl, $ilAccess;
108 
109  if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
110  {
111  $ilToolbar->addButton(
112  $lng->txt('didactic_import_btn'),
113  $ilCtrl->getLinkTarget($this,'showImportForm')
114  );
115  }
116 
117 
118  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
119  $table = new ilDidacticTemplateSettingsTableGUI($this,'overview');
120  $table->init();
121  $table->parse();
122 
123  $GLOBALS['tpl']->setContent($table->getHTML());
124  }
Description of ilDidacticTemplateSettingsTableGUI.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( )

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

References $GLOBALS, and editImportForm().

Referenced by importTemplate().

720  {
721  $this->setEditTabs("import");
722 
723  $form = $this->editImportForm();
724 
725  $GLOBALS['tpl']->setContent($form->getHTML());
726  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ 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 131 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by importTemplate().

132  {
133  global $ilTabs, $ilCtrl;
134 
135  if(isset($_REQUEST["tplid"]))
136  {
137  $this->setEditTabs('import');
138  }
139  else{
140  $ilTabs->clearTargets();
141  $ilTabs->setBackTarget(
142  $this->lng->txt('didactic_back_to_overview'),
143  $ilCtrl->getLinkTarget($this,'overview')
144  );
145 
146  }
147 
148  if(!$form instanceof ilPropertyFormGUI)
149  {
150  $form = $this->createImportForm();
151  }
152  $GLOBALS['tpl']->setContent($form->getHTML());
153  }
This class represents a property form user interface.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
+ 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 299 of file class.ilDidacticTemplateSettingsGUI.php.

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

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