4 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
32 $this->parent_object = $a_parent_obj;
35 if (isset($_REQUEST[
"tplid"])) {
53 public function executeCommand()
60 $next_class = $ilCtrl->getNextClass($this);
61 $cmd = $ilCtrl->getCmd();
63 switch ($next_class) {
64 case "ilpropertyformgui":
67 $ilCtrl->forwardCommand(
$form);
69 case 'ilmultilingualismgui':
70 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"]) ||
71 !isset($this->
object) ||
72 $this->
object->isAutoGenerated()) {
73 $ilCtrl->redirect($this,
"overview");
76 $this->setEditTabs(
"settings_trans");
77 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualismGUI.php");
79 $defaultl = $this->
object->getTranslationObject()->getDefaultLanguage();
81 $transgui->setStartValues(
82 $this->
object->getPresentationTitle($defaultl),
83 $this->
object->getPresentationDescription($defaultl)
86 $ilCtrl->forwardCommand($transgui);
108 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
109 $ilToolbar->addButton(
110 $lng->txt(
'didactic_import_btn'),
111 $ilCtrl->getLinkTarget($this,
'showImportForm')
116 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
133 if (isset($_REQUEST[
"tplid"])) {
134 $this->setEditTabs(
'import');
136 $ilTabs->clearTargets();
137 $ilTabs->setBackTarget(
138 $this->lng->txt(
'didactic_back_to_overview'),
139 $ilCtrl->getLinkTarget($this,
'overview')
157 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
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'));
167 $file->setRequired(
true);
182 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
183 $ilCtrl->redirect($this,
"overview");
186 $edit = isset($_REQUEST[
'tplid']);
195 if (!
$form->checkInput()) {
197 $form->setValuesByPost();
207 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
215 ilUtil::moveUploadedFile(
220 $import->setInputFile($tmp);
223 $settings = $import->import();
236 $ilCtrl->redirect($this,
'editTemplate');
238 $ilCtrl->redirect($this,
'overview');
250 $this->setEditTabs(
"edit");
252 if (!$_REQUEST[
'tplid']) {
254 $ilCtrl->redirect($this,
'overview');
264 $ilCtrl->saveParameter($this,
'tplid');
279 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
280 $this->ctrl->redirect($this,
"overview");
286 if (
$form->checkInput()) {
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();
294 if (!$temp->isAutoGenerated()) {
295 $temp->setTitle(
$form->getInput(
'title'));
296 $temp->setDescription(
$form->getInput(
'description'));
299 $temp->setInfo(
$form->getInput(
'info'));
300 $temp->enable(
$form->getInput(
'enable'));
302 if (!$temp->isAutoGenerated()) {
303 $temp->setAssignments(
array(
$form->getInput(
'type')));
306 if (
$form->getInput(
'local_template') && count(
$form->getInput(
'effective_from')) > 0) {
307 $temp->setEffectiveFrom(
$form->getInput(
'effective_from'));
309 $temp->setEffectiveFrom(
array());
312 $temp->setExclusive((
bool)
$form->getInput(
'exclusive_template'));
317 $ilCtrl->redirect($this,
'overview');
321 $form->setValuesByPost();
335 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
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'));
347 $title->setRequired(
true);
355 if (
sizeof($trans) > 1) {
356 include_once(
'Services/MetaData/classes/class.ilMDLanguageItem.php');
358 $title->setInfo($this->lng->txt(
"language") .
": " . $languages[
$def[
"lang_code"]] .
359 ' <a href="' . $ilCtrl->getLinkTargetByClass(
"ilmultilingualismgui",
"listTranslations") .
360 '">» ' . $this->lng->txt(
"more_translations") .
'</a>');
378 $desc->setValue(
$def[
"description"]);
382 $form->addItem($desc);
393 $enable->setRequired(
true);
394 $form->addItem($enable);
399 $type->setRequired(
true);
400 $type->setInfo($this->lng->txt(
'dtpl_obj_type_info'));
402 $type->setValue(isset($assigned[0]) ? $assigned[0] :
'');
403 $subs = $objDefinition->getSubObjectsRecursively(
'root',
false);
405 foreach (array_merge($subs,
array(
'fold' => 1)) as $obj => $null) {
407 if ($objDefinition->isPlugin($obj)) {
409 } elseif ($objDefinition->isAllowedInRepository($obj)) {
410 $options[$obj] = $this->lng->txt(
'obj_' . $obj);
418 $lokal_templates =
new ilCheckboxInputGUI($this->lng->txt(
"activate_local_didactic_template"),
"local_template");
420 $lokal_templates->setInfo($this->lng->txt(
"activate_local_didactic_template_info"));
423 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
426 $definition =
$GLOBALS[
'objDefinition'];
428 foreach ($definition->getAllRepositoryTypes() as
$type) {
429 if ($definition->isContainer(
$type)) {
430 $white_list[] =
$type;
433 $effrom->getExplorerGUI()->setTypeWhiteList($white_list);
436 $lokal_templates->addSubItem($effrom);
437 $form->addItem($lokal_templates);
439 $excl =
new ilCheckboxInputGUI($this->lng->txt(
"activate_exclusive_template"),
"exclusive_template");
440 $excl->
setInfo($this->lng->txt(
"activate_exclusive_template_info"));
443 $form->addItem($excl);
458 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
459 $this->ctrl->redirect($this,
"overview");
462 if (!$_REQUEST[
'tplid']) {
464 return $ilCtrl->redirect($this,
'overview');
467 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
473 $ilCtrl->redirect($this,
'overview');
483 if (!$_REQUEST[
'tplid']) {
485 return $ilCtrl->redirect($this,
'overview');
488 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
493 $writer->xmlDumpMem(
true),
494 $writer->getSetting()->getTitle() .
'.xml',
504 protected function confirmDelete()
511 if (!$_REQUEST[
'tpls']) {
513 return $ilCtrl->redirect($this,
'overview');
516 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
519 $confirm->setFormAction($ilCtrl->getFormAction($this));
520 $confirm->setConfirm($this->lng->txt(
'delete'),
'deleteTemplates');
521 $confirm->setCancel($this->lng->txt(
'cancel'),
'overview');
523 $forbidden =
array();
525 foreach ((
array) $_REQUEST[
'tpls'] as $tplid) {
528 if (!
$tpl->isAutoGenerated()) {
529 $confirm->addItem(
'tpls[]',
$tpl->getId(),
$tpl->getPresentationTitle());
531 $forbidden[] =
$tpl->getId();
535 if (count($forbidden) > 0 && count($_REQUEST[
'tpls']) == 1) {
537 $ilCtrl->redirect($this,
"overview");
538 } elseif (count($forbidden) > 0 && count($_REQUEST[
'tpls']) > 1) {
539 ilUtil::sendInfo($this->lng->txt(
'didactic_cannot_delete_auto_generated_confirmation'));
543 $GLOBALS[
'tpl']->setContent($confirm->getHTML());
556 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
557 $this->ctrl->redirect($this,
"overview");
560 if (!$_REQUEST[
'tpls']) {
562 return $ilCtrl->redirect($this,
'overview');
565 foreach ((
array) $_REQUEST[
'tpls'] as $tplid) {
571 $ilCtrl->redirect($this,
'overview');
584 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
585 $this->ctrl->redirect($this,
"overview");
587 if (!$_REQUEST[
'tpls']) {
589 return $ilCtrl->redirect($this,
'overview');
592 foreach ($_REQUEST[
'tpls'] as $tplid) {
599 $ilCtrl->redirect($this,
'overview');
612 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
613 $this->ctrl->redirect($this,
"overview");
616 if (!$_REQUEST[
'tpls']) {
618 $ilCtrl->redirect($this,
'overview');
621 foreach ($_REQUEST[
'tpls'] as $tplid) {
628 $ilCtrl->redirect($this,
'overview');
634 protected function setEditTabs($a_tab_active =
"edit")
643 $ilTabs->clearTargets();
644 $ilTabs->setBackTarget(
645 $this->lng->txt(
'didactic_back_to_overview'),
646 $ilCtrl->getLinkTarget($this,
'overview')
648 $ilCtrl->saveParameter($this,
"tplid");
650 if (!$this->
object->isAutoGenerated()) {
651 $ilTabs->addTab(
'edit', $this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
652 $ilTabs->addTab(
'import', $this->lng->txt(
'import'), $ilCtrl->getLinkTarget($this,
'showEditImportForm'));
654 if (in_array($a_tab_active,
array(
'edit',
'settings_trans'))) {
655 $ilTabs->addSubTab(
'edit', $this->lng->txt(
'settings'), $ilCtrl->getLinkTarget($this,
'editTemplate'));
656 $ilTabs->addSubTab(
'settings_trans', $this->lng->txt(
"obj_multilinguality"), $ilCtrl->getLinkTargetByClass(
array(
"ilmultilingualismgui"),
'listTranslations'));
657 $ilTabs->setTabActive(
'edit');
658 $ilTabs->setSubTabActive($a_tab_active);
660 $ilTabs->setTabActive($a_tab_active);
667 $this->setEditTabs(
"import");
678 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
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'));
688 $file->setInfo($this->lng->txt(
'didactic_template_update_import_info'));
701 $tplid = $_REQUEST[
'tplid'];
703 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
708 $this->
object->delete();
710 foreach ($assignments as $obj) {
714 $ilCtrl->setParameter($this,
"tplid", $a_settings->getId());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
Create styles array
The data for the language used.
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)
Create a temporary file in an ILIAS writable directory.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
getInfo()
Get installation info text.
Settings for a single didactic template.
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.
overview()
Show didactic template administration.