ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDidacticTemplateSettingsGUI Class Reference

Settings for a single didactic template. More...

+ Collaboration diagram for ilDidacticTemplateSettingsGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor.
 executeCommand ()
 Execute command.

Protected Member Functions

 overview ()
 Show didactic template administration.
 showImportForm (ilPropertyFormGUI $form=NULL)
 Show template import form.
 createImportForm ()
 Create template import form.
 importTemplate ()
 Import template.
 editTemplate (ilPropertyFormGUI $form=null)
 Edit template.
 updateTemplate ()
 Update template.
 initEditTemplate (ilDidacticTemplateSetting $set)
 Init edit template form.
 copyTemplate ()
 Copy on template.
 exportTemplate ()
 Export one template.
 confirmDelete ()
 Show delete confirmation screen.
 deleteTemplates ()
 Delete chosen didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
 activateTemplates ()
 Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.
 deactivateTemplates ()
 Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Private Attributes

 $parent_object
 $lng

Detailed Description

Settings for a single didactic template.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

ilDidacticTemplateSettingsGUI: ilObjRoleFolderGUI

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

Constructor & Destructor Documentation

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

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

References $lng.

{
global $lng;
$this->parent_object = $a_parent_obj;
$this->lng = $lng;
}

Member Function Documentation

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

{
global $ilErr, $ilCtrl;
if(!$_REQUEST['tpls'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
foreach($_REQUEST['tpls'] as $tplid)
{
$tpl->enable(true);
$tpl->update();
}
ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'),true);
$ilCtrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::confirmDelete ( )
protected

Show delete confirmation screen.

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

References $_REQUEST, $GLOBALS, $ilCtrl, $ilErr, $tpl, ilUtil\sendFailure(), and ilUtil\sendQuestion().

{
global $ilErr, $ilCtrl;
if(!$_REQUEST['tpls'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($ilCtrl->getFormAction($this));
$confirm->setConfirm($this->lng->txt('delete'), 'deleteTemplates');
$confirm->setCancel($this->lng->txt('cancel'), 'overview');
foreach((array) $_REQUEST['tpls'] as $tplid)
{
$confirm->addItem('tpls[]', $tpl->getId(), $tpl->getTitle());
}
ilUtil::sendQuestion($this->lng->txt('didactic_confirm_delete_msg'));
$GLOBALS['tpl']->setContent($confirm->getHTML());
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

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

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

{
global $ilErr, $ilCtrl;;
if(!$_REQUEST['tplid'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
$copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
$copier->start();
ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
$ilCtrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Create template import form.

Returns
ilPropertyFormGUI $form

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

References $file, and $ilCtrl.

Referenced by importTemplate(), and showImportForm().

{
global $ilCtrl;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setShowTopButtons(false);
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle($this->lng->txt('didactic_import_table_title'));
$form->addCommandButton('importTemplate', $this->lng->txt('import'));
$form->addCommandButton('overview', $this->lng->txt('cancel'));
$file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
$file->setSuffixes(array('xml'));
$file->setRequired(TRUE);
$form->addItem($file);
$created = true;
return $form;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

{
global $ilErr, $ilCtrl;
if(!$_REQUEST['tpls'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
foreach($_REQUEST['tpls'] as $tplid)
{
$tpl->enable(false);
$tpl->update();
}
ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'),true);
$ilCtrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Delete chosen didactic templates ilErrorHandling $ilErr ilCtrl $ilCtrl.

Returns
void

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

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

{
global $ilErr, $ilCtrl;
if(!$_REQUEST['tpls'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
foreach((array) $_REQUEST['tpls'] as $tplid)
{
$tpl->delete();
}
ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'),true);
$ilCtrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

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

Edit template.

Returns
void

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

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

Referenced by updateTemplate().

{
global $ilCtrl,$ilTabs;
if(!$_REQUEST['tplid'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget(
$this->lng->txt('didactic_back_to_overview'),
$ilCtrl->getLinkTarget($this,'overview')
);
$ilCtrl->saveParameter($this,'tplid');
if(!$form instanceof ilPropertyFormGUI)
{
$settings = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
$form = $this->initEditTemplate($settings);
}
$GLOBALS['tpl']->setContent($form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSettingsGUI::executeCommand ( )

Execute command.

Returns
<type>

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

References $cmd, and $ilCtrl.

{
global $ilCtrl;
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = 'overview';
}
$this->$cmd();
break;
}
return true;
}
ilDidacticTemplateSettingsGUI::exportTemplate ( )
protected

Export one template.

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

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

{
global $ilErr, $ilCtrl;
if(!$_REQUEST['tplid'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $ilCtrl->redirect($this,'overview');
}
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
$writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
$writer->write();
$writer->xmlDumpMem(TRUE),
$writer->getSetting()->getTitle().'.xml',
'application/xml'
);
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Import template.

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

References $file, $GLOBALS, $ilCtrl, createImportForm(), ilUtil\ilTempnam(), ilDidacticTemplateImport\IMPORT_FILE, ilUtil\moveUploadedFile(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showImportForm().

{
global $ilCtrl;
$form = $this->createImportForm();
if(!$form->checkInput())
{
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$form->setValuesByPost();
return $this->showImportForm($form);
}
// Do import
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
$file = $form->getInput('file');
// move uploaded file
$file['tmp_name'],
$file['name'],
$tmp
);
$import->setInputFile($tmp);
$GLOBALS['ilLog']->write(__METHOD__.': Using '.$tmp);
try {
$import->import();
}
{
$GLOBALS['ilLog']->write(__METHOD__.': Import failed with message: '. $e->getMessage());
ilUtil::sendFailure($this->lng->txt('didactic_import_failed').': '.$e->getMessage());
}
ilUtil::sendSuccess($this->lng->txt('didactic_import_success'),TRUE);
$ilCtrl->redirect($this,'overview');
}

+ Here is the call graph for this function:

ilDidacticTemplateSettingsGUI::initEditTemplate ( ilDidacticTemplateSetting  $set)
protected

Init edit template form.

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

References $ilCtrl, $title, ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getDescription(), ilDidacticTemplateSetting\getInfo(), ilDidacticTemplateSetting\getTitle(), ilFormPropertyGUI\setRequired(), and ilTextAreaInputGUI\setValue().

Referenced by editTemplate(), and updateTemplate().

{
global $ilCtrl,$objDefinition;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setShowTopButtons(false);
$form->setFormAction($ilCtrl->getFormAction($this,'updateTemplate'));
$form->setTitle($this->lng->txt('didactic_edit_tpl'));
$form->addCommandButton('updateTemplate', $this->lng->txt('save'));
$form->addCommandButton('overview', $this->lng->txt('cancel'));
// title
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setValue($set->getTitle());
$title->setSize(40);
$title->setMaxLength(64);
$title->setRequired(true);
$form->addItem($title);
// desc
$desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
$desc->setValue($set->getDescription());
$desc->setRows(3);
$form->addItem($desc);
// info
$info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
$info->setValue($set->getInfo());
$info->setRows(6);
$form->addItem($info);
// object type
$type = new ilSelectInputGUI($this->lng->txt('obj_type'),'type');
$type->setRequired(true);
$assigned = $set->getAssignments();
$type->setValue(isset($assigned[0]) ? $assigned[0] : '');
$subs = $objDefinition->getCreatableSubobjects('root', false);
$options = array();
foreach(array_merge($subs,array('fold' => 1)) as $obj => $null)
{
if($objDefinition->isAllowedInRepository($obj))
{
$options[$obj] = $this->lng->txt('obj_'.$obj);
}
}
$type->setOptions($options);
$form->addItem($type);
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSettingsGUI::overview ( )
protected

Show didactic template administration.

ilToolbarGUI $ilToolbar

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

References $GLOBALS, $ilCtrl, and $lng.

{
global $ilToolbar,$lng, $ilCtrl;
$ilToolbar->addButton(
$lng->txt('didactic_import_btn'),
$ilCtrl->getLinkTarget($this,'showImportForm')
);
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
$table = new ilDidacticTemplateSettingsTableGUI($this,'overview');
$table->init();
$table->parse();
$GLOBALS['tpl']->setContent($table->getHTML());
}
ilDidacticTemplateSettingsGUI::showImportForm ( ilPropertyFormGUI  $form = NULL)
protected

Show template import form.

ilTabsGUI $ilTabs

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

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

Referenced by importTemplate().

{
global $ilTabs, $ilCtrl;
$ilTabs->clearTargets();
$ilTabs->setBackTarget(
$this->lng->txt('didactic_back_to_overview'),
$ilCtrl->getLinkTarget($this,'overview')
);
if(!$form instanceof ilPropertyFormGUI)
{
$form = $this->createImportForm();
}
$GLOBALS['tpl']->setContent($form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSettingsGUI::updateTemplate ( )
protected

Update template.

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

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

{
global $ilCtrl;
$temp = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
$form = $this->initEditTemplate($temp);
if($form->checkInput())
{
$temp->setTitle($form->getInput('title'));
$temp->setDescription($form->getInput('description'));
$temp->setInfo($form->getInput('info'));
$temp->setAssignments(array($form->getInput('type')));
$temp->update();
ilUtil::sendSuccess($this->lng->txt('save_settings'));
$ilCtrl->redirect($this,'overview');
}
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$form->setValuesByPost();
$this->editTemplate($form);
}

+ Here is the call graph for this function:

Field Documentation

ilDidacticTemplateSettingsGUI::$lng
private

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

Referenced by __construct(), and overview().

ilDidacticTemplateSettingsGUI::$parent_object
private

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


The documentation for this class was generated from the following file: