4 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
34 $this->parent_object = $a_parent_obj;
37 if (isset($_REQUEST[
"tplid"])) {
55 public function executeCommand()
63 $ilAccess = $DIC[
'ilAccess'];
65 $next_class =
$ilCtrl->getNextClass($this);
68 switch ($next_class) {
69 case "ilpropertyformgui":
74 case 'ilmultilingualismgui':
75 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"]) ||
76 !isset($this->
object) ||
77 $this->
object->isAutoGenerated()) {
78 $ilCtrl->redirect($this,
"overview");
81 $this->setEditTabs(
"settings_trans");
82 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualismGUI.php");
84 $defaultl = $this->
object->getTranslationObject()->getDefaultLanguage();
86 $transgui->setStartValues(
87 $this->object->getPresentationTitle($defaultl),
88 $this->
object->getPresentationDescription($defaultl)
91 $ilCtrl->forwardCommand($transgui);
113 $ilToolbar = $DIC[
'ilToolbar'];
116 $ilAccess = $DIC[
'ilAccess'];
118 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
119 $ilToolbar->addButton(
120 $lng->txt(
'didactic_import_btn'),
121 $ilCtrl->getLinkTarget($this,
'showImportForm')
126 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
143 $ilTabs = $DIC[
'ilTabs'];
146 if (isset($_REQUEST[
"tplid"])) {
147 $this->setEditTabs(
'import');
149 $ilTabs->clearTargets();
150 $ilTabs->setBackTarget(
151 $this->lng->txt(
'didactic_back_to_overview'),
152 $ilCtrl->getLinkTarget($this,
'overview')
172 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
174 $form->setShowTopButtons(
false);
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'));
180 $file =
new ilFileInputGUI($this->lng->txt(
'import_file'),
'file');
182 $file->setRequired(
true);
183 $form->addItem($file);
198 $ilAccess = $DIC[
'ilAccess'];
200 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
201 $ilCtrl->redirect($this,
"overview");
204 $edit = isset($_REQUEST[
'tplid']);
213 if (!
$form->checkInput()) {
215 $form->setValuesByPost();
225 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
229 $file =
$form->getInput(
'file');
233 ilUtil::moveUploadedFile(
238 $import->setInputFile($tmp);
241 $settings = $import->import();
251 ilUtil::sendSuccess($this->lng->txt(
'didactic_import_success'),
true);
254 $ilCtrl->redirect($this,
'editTemplate');
256 $ilCtrl->redirect($this,
'overview');
269 $ilTabs = $DIC[
'ilTabs'];
271 $this->setEditTabs(
"edit");
273 if (!$_REQUEST[
'tplid']) {
275 $ilCtrl->redirect($this,
'overview');
285 $ilCtrl->saveParameter($this,
'tplid');
301 $ilAccess = $DIC[
'ilAccess'];
303 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
304 $this->ctrl->redirect($this,
"overview");
310 if (
$form->checkInput()) {
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();
318 if (!$temp->isAutoGenerated()) {
319 $temp->setTitle(
$form->getInput(
'title'));
320 $temp->setDescription(
$form->getInput(
'description'));
323 $temp->setInfo(
$form->getInput(
'info'));
324 $temp->enable(
$form->getInput(
'enable'));
326 if (!$temp->isAutoGenerated()) {
327 $temp->setAssignments(array(
$form->getInput(
'type')));
330 if (
$form->getInput(
'local_template') && count(
$form->getInput(
'effective_from')) > 0) {
331 $temp->setEffectiveFrom(
$form->getInput(
'effective_from'));
333 $temp->setEffectiveFrom(array());
336 $temp->setExclusive((
bool)
$form->getInput(
'exclusive_template'));
340 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
341 $ilCtrl->redirect($this,
'overview');
345 $form->setValuesByPost();
360 $objDefinition = $DIC[
'objDefinition'];
362 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
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'));
374 $title->setRequired(
true);
382 if (
sizeof($trans) > 1) {
383 include_once(
'Services/MetaData/classes/class.ilMDLanguageItem.php');
386 ' <a href="' .
$ilCtrl->getLinkTargetByClass(
"ilmultilingualismgui",
"listTranslations") .
387 '">» ' . $this->lng->txt(
"more_translations") .
'</a>');
405 $desc->setValue(
$def[
"description"]);
409 $form->addItem($desc);
420 $enable->setRequired(
true);
421 $form->addItem($enable);
426 $type->setRequired(
true);
427 $type->setInfo($this->lng->txt(
'dtpl_obj_type_info'));
429 $type->setValue(isset($assigned[0]) ? $assigned[0] :
'');
430 $subs = $objDefinition->getSubObjectsRecursively(
'root',
false);
432 foreach (array_merge($subs, array(
'fold' => 1)) as $obj => $null) {
434 if ($objDefinition->isPlugin($obj)) {
436 } elseif ($objDefinition->isAllowedInRepository($obj)) {
437 $options[$obj] = $this->lng->txt(
'obj_' . $obj);
445 $lokal_templates =
new ilCheckboxInputGUI($this->lng->txt(
"activate_local_didactic_template"),
"local_template");
447 $lokal_templates->setInfo($this->lng->txt(
"activate_local_didactic_template_info"));
450 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
453 $definition =
$GLOBALS[
'DIC'][
'objDefinition'];
455 foreach ($definition->getAllRepositoryTypes() as
$type) {
456 if ($definition->isContainer(
$type)) {
457 $white_list[] =
$type;
460 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
463 $lokal_templates->addSubItem($effrom);
464 $form->addItem($lokal_templates);
466 $excl =
new ilCheckboxInputGUI($this->lng->txt(
"activate_exclusive_template"),
"exclusive_template");
467 $excl->
setInfo($this->lng->txt(
"activate_exclusive_template_info"));
470 $form->addItem($excl);
487 $ilAccess = $DIC[
'ilAccess'];
489 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
490 $this->ctrl->redirect($this,
"overview");
493 if (!$_REQUEST[
'tplid']) {
495 return $ilCtrl->redirect($this,
'overview');
498 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
503 ilUtil::sendSuccess($this->lng->txt(
'didactic_copy_suc_message'),
true);
504 $ilCtrl->redirect($this,
'overview');
517 if (!$_REQUEST[
'tplid']) {
519 return $ilCtrl->redirect($this,
'overview');
522 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
527 $writer->xmlDumpMem(
true),
528 $writer->getSetting()->getTitle() .
'.xml',
538 protected function confirmDelete()
548 if (!$_REQUEST[
'tpls']) {
550 return $ilCtrl->redirect($this,
'overview');
553 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
556 $confirm->setFormAction(
$ilCtrl->getFormAction($this));
557 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteTemplates');
558 $confirm->setCancel($this->lng->txt(
'cancel'),
'overview');
560 $forbidden = array();
562 foreach ((array) $_REQUEST[
'tpls'] as $tplid) {
565 if (!
$tpl->isAutoGenerated()) {
566 $confirm->addItem(
'tpls[]',
$tpl->getId(),
$tpl->getPresentationTitle());
568 $forbidden[] =
$tpl->getId();
572 if (count($forbidden) > 0 && count($_REQUEST[
'tpls']) == 1) {
574 $ilCtrl->redirect($this,
"overview");
575 } elseif (count($forbidden) > 0 && count($_REQUEST[
'tpls']) > 1) {
576 ilUtil::sendInfo($this->lng->txt(
'didactic_cannot_delete_auto_generated_confirmation'));
580 $GLOBALS[
'DIC'][
'tpl']->setContent($confirm->getHTML());
595 $ilAccess = $DIC[
'ilAccess'];
597 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
598 $this->ctrl->redirect($this,
"overview");
601 if (!$_REQUEST[
'tpls']) {
603 return $ilCtrl->redirect($this,
'overview');
606 foreach ((array) $_REQUEST[
'tpls'] as $tplid) {
611 ilUtil::sendSuccess($this->lng->txt(
'didactic_delete_msg'),
true);
612 $ilCtrl->redirect($this,
'overview');
627 $ilAccess = $DIC[
'ilAccess'];
629 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
630 $this->ctrl->redirect($this,
"overview");
632 if (!$_REQUEST[
'tpls']) {
634 return $ilCtrl->redirect($this,
'overview');
637 foreach ($_REQUEST[
'tpls'] as $tplid) {
643 ilUtil::sendSuccess($this->lng->txt(
'didactic_activated_msg'),
true);
644 $ilCtrl->redirect($this,
'overview');
659 $ilAccess = $DIC[
'ilAccess'];
661 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
662 $this->ctrl->redirect($this,
"overview");
665 if (!$_REQUEST[
'tpls']) {
667 $ilCtrl->redirect($this,
'overview');
670 foreach ($_REQUEST[
'tpls'] as $tplid) {
676 ilUtil::sendSuccess($this->lng->txt(
'didactic_deactivated_msg'),
true);
677 $ilCtrl->redirect($this,
'overview');
683 protected function setEditTabs($a_tab_active =
"edit")
692 $ilTabs = $DIC[
'ilTabs'];
695 $ilTabs->clearTargets();
696 $ilTabs->setBackTarget(
697 $this->lng->txt(
'didactic_back_to_overview'),
698 $ilCtrl->getLinkTarget($this,
'overview')
700 $ilCtrl->saveParameter($this,
"tplid");
702 if (!$this->object->isAutoGenerated()) {
703 $ilTabs->addTab(
'edit', $this->lng->txt(
'settings'),
$ilCtrl->getLinkTarget($this,
'editTemplate'));
704 $ilTabs->addTab(
'import', $this->lng->txt(
'import'),
$ilCtrl->getLinkTarget($this,
'showEditImportForm'));
706 if (in_array($a_tab_active, array(
'edit',
'settings_trans'))) {
707 $ilTabs->addSubTab(
'edit', $this->lng->txt(
'settings'),
$ilCtrl->getLinkTarget($this,
'editTemplate'));
708 $ilTabs->addSubTab(
'settings_trans', $this->lng->txt(
"obj_multilinguality"),
$ilCtrl->getLinkTargetByClass(array(
"ilmultilingualismgui"),
'listTranslations'));
709 $ilTabs->setTabActive(
'edit');
710 $ilTabs->setSubTabActive($a_tab_active);
712 $ilTabs->setTabActive($a_tab_active);
719 $this->setEditTabs(
"import");
732 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
734 $form->setShowTopButtons(
false);
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'));
740 $file =
new ilFileInputGUI($this->lng->txt(
'didactic_template_update_import'),
'file');
742 $file->setInfo($this->lng->txt(
'didactic_template_update_import_info'));
743 $form->addItem($file);
757 $tplid = $_REQUEST[
'tplid'];
759 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
764 $this->
object->delete();
766 foreach ($assignments as $obj) {
770 $ilCtrl->setParameter($this,
"tplid", $a_settings->getId());
GUI class for object translation handling.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
isEnabled()
Check if template is enabled.
Description of ilDidacticTemplateSettingsTableGUI.
exportTemplate()
Export one template.
static lookupTxtById($plugin_id, $lang_var)
deleteTemplates()
Delete chosen didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
deactivateTemplates()
Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
getAssignments()
Get object assignemnts.
createImportForm()
Create template import form.
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.
setValue($a_value)
Set Value.
__construct($a_parent_obj)
Constructor.
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.
showImportForm(ilPropertyFormGUI $form=null)
Show template import form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object ilDB $ilDB.
editTemplate(ilPropertyFormGUI $form=null)
Edit template.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
getPresentationDescription($a_lng="")
getPresentationTitle($a_lng="")
Description of ilDidacticTemplateImportException.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
Description of ilDidacticTemplateImport.
Copy a didactic template and all subitems.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
copyTemplate()
Copy on template.
updateTemplate()
Update template.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
This class represents a text area property in a property form.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
getInfo()
Get installation info text.
Settings for a single didactic template.
static getLogger($a_component_id)
Get component logger.
if(empty($password)) $table
editImport($a_settings)
ilCtrl $ilCtrl
importTemplate()
Import template.
getTranslations()
get all translations from this object
activateTemplates()
Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Confirmation screen class.
overview()
Show didactic template administration.