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

GUI class for didactic template settings inside repository objects. More...

+ Collaboration diagram for ilDidacticTemplateGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor.
 getParentObject ()
 executeCommand ()
 Execute command.
 appendToolbarSwitch (ilToolbarGUI $toolbar, $a_obj_type, $a_ref_id)

Protected Member Functions

 confirmTemplateSwitch ()
 cancel ()
 Return to parent gui.
 switchTemplate ()
 Switch Template.

Private Attributes

 $parent_object
 $lng

Detailed Description

GUI class for didactic template settings inside repository objects.

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

ilDidacticTemplateGUI: ilPermissionGUI

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

Constructor & Destructor Documentation

ilDidacticTemplateGUI::__construct (   $a_parent_obj)

Constructor.

Definition at line 21 of file class.ilDidacticTemplateGUI.php.

References $lng.

{
global $lng;
$this->parent_object = $a_parent_obj;
$this->lng = $lng;
$this->lng->loadLanguageModule('didactic');
}

Member Function Documentation

ilDidacticTemplateGUI::appendToolbarSwitch ( ilToolbarGUI  $toolbar,
  $a_obj_type,
  $a_ref_id 
)

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

References $tpl, ilToolbarGUI\addFormButton(), ilToolbarGUI\addInputItem(), ilToolbarGUI\addText(), ilDidacticTemplateSettings\getInstanceByObjectType(), getParentObject(), and ilDidacticTemplateObjSettings\lookupTemplateId().

{
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php';
$tpls = ilDidacticTemplateSettings::getInstanceByObjectType($a_obj_type)->getTemplates();
if(!count($tpls))
{
return false;
}
// Add template switch
$toolbar->addText($this->lng->txt('didactic_selected_tpl_option'));
// Show template options
$options = array(0 => $this->lng->txt('didactic_default_type'));
foreach($tpls as $tpl)
{
$options[$tpl->getId()] = $tpl->getTitle();
}
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
$tpl_selection = new ilSelectInputGUI(
'',
'tplid'
);
$tpl_selection->setOptions($options);
$this->getParentObject()->object->getRefId()
));
$toolbar->addInputItem($tpl_selection);
// Apply templates switch
$toolbar->addFormButton($this->lng->txt('change'),'confirmTemplateSwitch');
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateGUI::cancel ( )
protected

Return to parent gui.

Definition at line 160 of file class.ilDidacticTemplateGUI.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}
ilDidacticTemplateGUI::confirmTemplateSwitch ( )
protected

Definition at line 100 of file class.ilDidacticTemplateGUI.php.

References $_REQUEST, $GLOBALS, $ilCtrl, $tpl, getParentObject(), ilDidacticTemplateObjSettings\lookupTemplateId(), and ilUtil\sendInfo().

{
global $ilCtrl, $ilTabs, $tpl;
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
// Check if template is changed
$new_tpl_id = (int) $_REQUEST['tplid'];
if($new_tpl_id == ilDidacticTemplateObjSettings::lookupTemplateId($this->getParentObject()->object->getRefId()))
{
$GLOBALS['ilLog']->write(__METHOD__.': Template id: '.$new_tpl_id);
ilUtil::sendInfo($this->lng->txt('didactic_not_changed'),true);
$ilCtrl->returnToParent($this);
}
$ilTabs->clearTargets();
$ilTabs->clearSubTabs();
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($ilCtrl->getFormAction($this));
$confirm->setHeaderText($this->lng->txt('didactic_confirm_apply_new_template'));
$confirm->setConfirm($this->lng->txt('apply'), 'switchTemplate');
$confirm->setCancel($this->lng->txt('cancel'), 'cancel');
if($new_tpl_id)
{
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
$dtpl = new ilDidacticTemplateSetting($new_tpl_id);
$confirm->addItem(
'tplid',
$new_tpl_id,
$dtpl->getTitle().
'<div class="il_Description">'.
$dtpl->getDescription().' '.
'</div>'
);
}
else
{
$confirm->addItem(
'tplid',
$new_tpl_id,
$this->lng->txt('default').' '.
'<div class="il_Description">'.
sprintf(
$this->lng->txt('didactic_default_type_info'),
$this->lng->txt('objs_'.$this->getParentObject()->object->getType())
).
'</div>'
);
}
$tpl->setContent($confirm->getHTML());
}

+ Here is the call graph for this function:

ilDidacticTemplateGUI::executeCommand ( )

Execute command.

Returns
<type>

Definition at line 39 of file class.ilDidacticTemplateGUI.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;
}
ilDidacticTemplateGUI::getParentObject ( )

Definition at line 30 of file class.ilDidacticTemplateGUI.php.

References $parent_object.

Referenced by appendToolbarSwitch(), confirmTemplateSwitch(), and switchTemplate().

{
}

+ Here is the caller graph for this function:

ilDidacticTemplateGUI::switchTemplate ( )
protected

Switch Template.

Definition at line 170 of file class.ilDidacticTemplateGUI.php.

References $_REQUEST, $ilCtrl, ilDidacticTemplateObjSettings\assignTemplate(), ilDidacticTemplateActionFactory\getActionsByTemplateId(), getParentObject(), ilDidacticTemplateObjSettings\lookupTemplateId(), and ilUtil\sendSuccess().

{
global $ilCtrl;
$new_tpl_id = (int) $_REQUEST['tplid'];
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
$this->getParentObject()->object->getRefId()
);
// Revert current template
if($current_tpl_id)
{
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
foreach(ilDidacticTemplateActionFactory::getActionsByTemplateId($current_tpl_id) as $action)
{
$action->setRefId($this->getParentObject()->object->getRefId());
$action->revert();
}
}
if($new_tpl_id)
{
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
{
$action->setRefId($this->getParentObject()->object->getRefId());
$action->apply();
}
}
// Assign template id to object
$this->getParentObject()->object->getRefId(),
$this->getParentObject()->object->getId(),
$new_tpl_id
);
ilUtil::sendSuccess($this->lng->txt('didactic_template_applied'),true);
$ilCtrl->returnToParent($this);
}

+ Here is the call graph for this function:

Field Documentation

ilDidacticTemplateGUI::$lng
private

Definition at line 16 of file class.ilDidacticTemplateGUI.php.

Referenced by __construct().

ilDidacticTemplateGUI::$parent_object
private

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

Referenced by getParentObject().


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