ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->initObject($_REQUEST["tplid"]);
37  }
38  }
+ 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 580 of file class.ilDidacticTemplateSettingsGUI.php.

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

581  {
582  global $ilErr, $ilCtrl, $ilAccess;
583 
584  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
585  $this->ctrl->redirect($this, "overview");
586  }
587  if (!$_REQUEST['tpls']) {
588  ilUtil::sendFailure($this->lng->txt('select_one'));
589  return $ilCtrl->redirect($this, 'overview');
590  }
591 
592  foreach ($_REQUEST['tpls'] as $tplid) {
593  $tpl = new ilDidacticTemplateSetting($tplid);
594  $tpl->enable(true);
595  $tpl->update();
596  }
597 
598  ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'), true);
599  $ilCtrl->redirect($this, 'overview');
600  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
$tpl
Definition: ilias.php:10
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 454 of file class.ilDidacticTemplateSettingsGUI.php.

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

455  {
456  global $ilErr, $ilCtrl, $ilAccess;
457 
458  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
459  $this->ctrl->redirect($this, "overview");
460  }
461 
462  if (!$_REQUEST['tplid']) {
463  ilUtil::sendFailure($this->lng->txt('select_one'));
464  return $ilCtrl->redirect($this, 'overview');
465  }
466 
467  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
468 
469  $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
470  $copier->start();
471 
472  ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
473  $ilCtrl->redirect($this, 'overview');
474  }
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 153 of file class.ilDidacticTemplateSettingsGUI.php.

References $file, $form, $ilCtrl, and array.

Referenced by importTemplate(), and showImportForm().

154  {
155  global $ilCtrl;
156 
157  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
158  $form = new ilPropertyFormGUI();
159  $form->setShowTopButtons(false);
160  $form->setFormAction($ilCtrl->getFormAction($this));
161  $form->setTitle($this->lng->txt('didactic_import_table_title'));
162  $form->addCommandButton('importTemplate', $this->lng->txt('import'));
163  $form->addCommandButton('overview', $this->lng->txt('cancel'));
164 
165  $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
166  $file->setSuffixes(array('xml'));
167  $file->setRequired(true);
168  $form->addItem($file);
169 
170  $created = true;
171 
172  return $form;
173  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
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 608 of file class.ilDidacticTemplateSettingsGUI.php.

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

609  {
610  global $ilErr, $ilCtrl, $ilAccess;
611 
612  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
613  $this->ctrl->redirect($this, "overview");
614  }
615 
616  if (!$_REQUEST['tpls']) {
617  ilUtil::sendFailure($this->lng->txt('select_one'));
618  $ilCtrl->redirect($this, 'overview');
619  }
620 
621  foreach ($_REQUEST['tpls'] as $tplid) {
622  $tpl = new ilDidacticTemplateSetting($tplid);
623  $tpl->enable(false);
624  $tpl->update();
625  }
626 
627  ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'), true);
628  $ilCtrl->redirect($this, 'overview');
629  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
$tpl
Definition: ilias.php:10
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 552 of file class.ilDidacticTemplateSettingsGUI.php.

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

553  {
554  global $ilErr, $ilCtrl, $ilAccess;
555 
556  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
557  $this->ctrl->redirect($this, "overview");
558  }
559 
560  if (!$_REQUEST['tpls']) {
561  ilUtil::sendFailure($this->lng->txt('select_one'));
562  return $ilCtrl->redirect($this, 'overview');
563  }
564 
565  foreach ((array) $_REQUEST['tpls'] as $tplid) {
566  $tpl = new ilDidacticTemplateSetting($tplid);
567  $tpl->delete();
568  }
569 
570  ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'), true);
571  $ilCtrl->redirect($this, 'overview');
572  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
$tpl
Definition: ilias.php:10
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 698 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by importTemplate().

699  {
700  global $ilCtrl;
701  $tplid = $_REQUEST['tplid'];
702 
703  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
704  ilDidacticTemplateObjSettings::transferAutoGenerateStatus($tplid, $a_settings->getId());
705 
707 
708  $this->object->delete();
709 
710  foreach ($assignments as $obj) {
711  ilDidacticTemplateObjSettings::assignTemplate($obj["ref_id"], $obj["obj_id"], $a_settings->getId());
712  }
713 
714  $ilCtrl->setParameter($this, "tplid", $a_settings->getId());
715  }
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 674 of file class.ilDidacticTemplateSettingsGUI.php.

References $file, $form, $ilCtrl, and array.

Referenced by importTemplate(), and showEditImportForm().

675  {
676  global $ilCtrl;
677 
678  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
679  $form = new ilPropertyFormGUI();
680  $form->setShowTopButtons(false);
681  $form->setFormAction($ilCtrl->getFormAction($this));
682  $form->setTitle($this->lng->txt('didactic_import_table_title'));
683  $form->addCommandButton('importTemplate', $this->lng->txt('import'));
684  $form->addCommandButton('overview', $this->lng->txt('cancel'));
685 
686  $file = new ilFileInputGUI($this->lng->txt('didactic_template_update_import'), 'file');
687  $file->setSuffixes(array('xml'));
688  $file->setInfo($this->lng->txt('didactic_template_update_import_info'));
689  $form->addItem($file);
690 
691  return $form;
692  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
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 246 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by updateTemplate().

247  {
248  global $ilCtrl,$ilTabs;
249 
250  $this->setEditTabs("edit");
251 
252  if (!$_REQUEST['tplid']) {
253  ilUtil::sendFailure($this->lng->txt('select_one'), true);
254  $ilCtrl->redirect($this, 'overview');
255  }
256 
257  //$ilTabs->clearTargets();
258  //$ilTabs->setBackTarget(
259  // $this->lng->txt('didactic_back_to_overview'),
260  // $ilCtrl->getLinkTarget($this,'overview')
261  //);
262 
263 
264  $ilCtrl->saveParameter($this, 'tplid');
265 
266  if (!$form instanceof ilPropertyFormGUI) {
267  $form = $this->initEditTemplate($this->object);
268  }
269  $GLOBALS['tpl']->setContent($form->getHTML());
270  }
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 479 of file class.ilDidacticTemplateSettingsGUI.php.

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

480  {
481  global $ilErr, $ilCtrl;
482 
483  if (!$_REQUEST['tplid']) {
484  ilUtil::sendFailure($this->lng->txt('select_one'));
485  return $ilCtrl->redirect($this, 'overview');
486  }
487 
488  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
489  $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
490  $writer->write();
491 
493  $writer->xmlDumpMem(true),
494  $writer->getSetting()->getTitle() . '.xml',
495  'application/xml'
496  );
497  }
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 178 of file class.ilDidacticTemplateSettingsGUI.php.

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

179  {
180  global $ilCtrl, $ilAccess;
181 
182  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
183  $ilCtrl->redirect($this, "overview");
184  }
185 
186  $edit = isset($_REQUEST['tplid']);
187 
188  if ($edit) {
189  $form = $this->createImportForm();
190  } else {
191  $form = $this->editImportForm();
192  }
193 
194 
195  if (!$form->checkInput()) {
196  ilUtil::sendFailure($this->lng->txt('err_check_input'));
197  $form->setValuesByPost();
198 
199  if ($edit) {
200  $this->showEditImportForm();
201  } else {
202  $this->showImportForm($form);
203  }
204  }
205 
206  // Do import
207  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
208 
210 
211  $file = $form->getInput('file');
212  $tmp = ilUtil::ilTempnam() . '.xml';
213 
214  // move uploaded file
215  ilUtil::moveUploadedFile(
216  $file['tmp_name'],
217  $file['name'],
218  $tmp
219  );
220  $import->setInputFile($tmp);
221 
222  try {
223  $settings = $import->import();
224 
225  if ($edit) {
226  $this->editImport($settings);
227  }
228  } catch (ilDidacticTemplateImportException $e) {
229  ilLoggerFactory::getLogger('otpl')->error('Import failed with message: ' . $e->getMessage());
230  ilUtil::sendFailure($this->lng->txt('didactic_import_failed') . ': ' . $e->getMessage());
231  }
232 
233  ilUtil::sendSuccess($this->lng->txt('didactic_import_success'), true);
234 
235  if ($edit) {
236  $ilCtrl->redirect($this, 'editTemplate');
237  } else {
238  $ilCtrl->redirect($this, 'overview');
239  }
240  }
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
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)
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 331 of file class.ilDidacticTemplateSettingsGUI.php.

References $def, $form, $GLOBALS, $ilCtrl, $info, $options, $title, $type, ilMDLanguageItem\_getLanguages(), array, 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().

332  {
333  global $ilCtrl,$objDefinition;
334 
335  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
336  $form = new ilPropertyFormGUI();
337  $form->setShowTopButtons(false);
338  $form->setFormAction($ilCtrl->getFormAction($this, 'updateTemplate'));
339  $form->setTitle($this->lng->txt('didactic_edit_tpl'));
340  $form->addCommandButton('updateTemplate', $this->lng->txt('save'));
341  $form->addCommandButton('overview', $this->lng->txt('cancel'));
342 
343  // title
344  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
345  $title->setSize(40);
346  $title->setMaxLength(64);
347  $title->setRequired(true);
348  //use presentation title if autogenerated is set
349  $title->setDisabled($set->isAutoGenerated());
350 
351  if (!$set->isAutoGenerated()) {
352  $trans = $set->getTranslations();
353  $def = $trans[0]; // default
354 
355  if (sizeof($trans) > 1) {
356  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
357  $languages = ilMDLanguageItem::_getLanguages();
358  $title->setInfo($this->lng->txt("language") . ": " . $languages[$def["lang_code"]] .
359  ' <a href="' . $ilCtrl->getLinkTargetByClass("ilmultilingualismgui", "listTranslations") .
360  '">&raquo; ' . $this->lng->txt("more_translations") . '</a>');
361  }
362  }
363 
364  if ($set->isAutoGenerated()) {
365  $title->setValue($set->getPresentationTitle());
366  } else {
367  $title->setValue($def["title"]);
368  }
369 
370  $form->addItem($title);
371 
372  // desc
373  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
374  //use presentation title if autogenerated is set
375  if ($set->isAutoGenerated()) {
376  $desc->setValue($set->getPresentationDescription());
377  } else {
378  $desc->setValue($def["description"]);
379  }
380  $desc->setRows(3);
381  $desc->setDisabled($set->isAutoGenerated());
382  $form->addItem($desc);
383 
384  // info
385  $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
386  $info->setValue($set->getInfo());
387  $info->setRows(6);
388  $form->addItem($info);
389 
390  //activate
391  $enable = new ilCheckboxInputGUI($this->lng->txt('active'), 'enable');
392  $enable->setChecked($set->isEnabled());
393  $enable->setRequired(true);
394  $form->addItem($enable);
395 
396  // object type
397  if (!$set->isAutoGenerated()) {
398  $type = new ilSelectInputGUI($this->lng->txt('obj_type'), 'type');
399  $type->setRequired(true);
400  $type->setInfo($this->lng->txt('dtpl_obj_type_info'));
401  $assigned = $set->getAssignments();
402  $type->setValue(isset($assigned[0]) ? $assigned[0] : '');
403  $subs = $objDefinition->getSubObjectsRecursively('root', false);
404  $options = array();
405  foreach (array_merge($subs, array('fold' => 1)) as $obj => $null) {
406  ilLoggerFactory::getLogger('root')->dump($null);
407  if ($objDefinition->isPlugin($obj)) {
408  $options[$obj] = ilObjectPlugin::lookupTxtById($obj, "obj_" . $obj);
409  } elseif ($objDefinition->isAllowedInRepository($obj)) {
410  $options[$obj] = $this->lng->txt('obj_' . $obj);
411  }
412  }
413  asort($options);
414 
415  $type->setOptions($options);
416  $form->addItem($type);
417 
418  $lokal_templates = new ilCheckboxInputGUI($this->lng->txt("activate_local_didactic_template"), "local_template");
419  $lokal_templates->setChecked(count($set->getEffectiveFrom()) > 0);
420  $lokal_templates->setInfo($this->lng->txt("activate_local_didactic_template_info"));
421 
422  //effective from (multinode)
423  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
424  $effrom = new ilRepositorySelector2InputGUI($this->lng->txt("effective_form"), "effective_from", true);
425  //$effrom->setMulti(true);
426  $definition = $GLOBALS['objDefinition'];
427  $white_list = [];
428  foreach ($definition->getAllRepositoryTypes() as $type) {
429  if ($definition->isContainer($type)) {
430  $white_list[] = $type;
431  }
432  }
433  $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
434  $effrom->setValue($set->getEffectiveFrom());
435 
436  $lokal_templates->addSubItem($effrom);
437  $form->addItem($lokal_templates);
438 
439  $excl = new ilCheckboxInputGUI($this->lng->txt("activate_exclusive_template"), "exclusive_template");
440  $excl->setInfo($this->lng->txt("activate_exclusive_template_info"));
441  $excl->setChecked($set->isExclusive());
442 
443  $form->addItem($excl);
444  }
445 
446 
447 
448  return $form;
449  }
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
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.
$def
Definition: croninfo.php:21
static getLogger($a_component_id)
Get component logger.
$info
Definition: index.php:5
getTranslations()
get all translations from this object
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 44 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by __construct().

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

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

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

◆ showEditImportForm()

ilDidacticTemplateSettingsGUI::showEditImportForm ( )

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

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

Referenced by importTemplate().

666  {
667  $this->setEditTabs("import");
668 
669  $form = $this->editImportForm();
670 
671  $GLOBALS['tpl']->setContent($form->getHTML());
672  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(isset($_POST['submit'])) $form
+ 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 129 of file class.ilDidacticTemplateSettingsGUI.php.

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

Referenced by importTemplate().

130  {
131  global $ilTabs, $ilCtrl;
132 
133  if (isset($_REQUEST["tplid"])) {
134  $this->setEditTabs('import');
135  } else {
136  $ilTabs->clearTargets();
137  $ilTabs->setBackTarget(
138  $this->lng->txt('didactic_back_to_overview'),
139  $ilCtrl->getLinkTarget($this, 'overview')
140  );
141  }
142 
143  if (!$form instanceof ilPropertyFormGUI) {
144  $form = $this->createImportForm();
145  }
146  $GLOBALS['tpl']->setContent($form->getHTML());
147  }
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 275 of file class.ilDidacticTemplateSettingsGUI.php.

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

276  {
277  global $ilCtrl, $ilAccess;
278 
279  if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
280  $this->ctrl->redirect($this, "overview");
281  }
282 
283  $temp = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
284  $form = $this->initEditTemplate($temp);
285 
286  if ($form->checkInput()) {
287  //change default entrys if translation is active
288  if (count($lang = $temp->getTranslationObject()->getLanguages())) {
289  $temp->getTranslationObject()->setDefaultTitle($form->getInput('title'));
290  $temp->getTranslationObject()->setDefaultDescription($form->getInput('description'));
291  $temp->getTranslationObject()->save();
292  }
293 
294  if (!$temp->isAutoGenerated()) {
295  $temp->setTitle($form->getInput('title'));
296  $temp->setDescription($form->getInput('description'));
297  }
298 
299  $temp->setInfo($form->getInput('info'));
300  $temp->enable($form->getInput('enable'));
301 
302  if (!$temp->isAutoGenerated()) {
303  $temp->setAssignments(array($form->getInput('type')));
304  }
305 
306  if ($form->getInput('local_template') && count($form->getInput('effective_from')) > 0) {
307  $temp->setEffectiveFrom($form->getInput('effective_from'));
308  } else {
309  $temp->setEffectiveFrom(array());
310  }
311 
312  $temp->setExclusive((bool) $form->getInput('exclusive_template'));
313 
314  $temp->update();
315 
316  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
317  $ilCtrl->redirect($this, 'overview');
318  }
319 
320  ilUtil::sendFailure($this->lng->txt('err_check_input'));
321  $form->setValuesByPost();
322  $this->editTemplate($form);
323  }
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.
if(isset($_POST['submit'])) $form
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:

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: