ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTBasedObjectGUI Class Reference

ADT based-object GUI base class. More...

+ Inheritance diagram for ilADTBasedObjectGUI:
+ Collaboration diagram for ilADTBasedObjectGUI:

Public Member Functions

 __construct (ilObjectGUI $a_parent_gui)
 Constructor.
 editAction (ilADTGroupFormBridge $a_form=null)
 Edit object ADT properties.
 updateAction ()
 Parse incoming values and update if valid.

Protected Member Functions

 initObject ()
 Init ADT-based object.
 prepareFormElements (ilADTGroupFormBridge $a_adt_form)
 Prepare/customize form elements.
 initForm ()
 Init ADT-based form.

Protected Attributes

 $object

Detailed Description

ADT based-object GUI base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 11 of file class.ilADTBasedObjectGUI.php.

Constructor & Destructor Documentation

ilADTBasedObjectGUI::__construct ( ilObjectGUI  $a_parent_gui)

Constructor.

Parent GUI is just needed for testing (ilCtrl)

Parameters
ilObjectGUI$a_parent_gui
Returns
self

Definition at line 23 of file class.ilADTBasedObjectGUI.php.

References initObject().

{
$this->gui = $a_parent_gui;
$this->object = $this->initObject();
}

+ Here is the call graph for this function:

Member Function Documentation

ilADTBasedObjectGUI::editAction ( ilADTGroupFormBridge  $a_form = null)

Edit object ADT properties.

Parameters
ilADTGroupFormBridge$a_form

Definition at line 44 of file class.ilADTBasedObjectGUI.php.

References $tpl, and initForm().

Referenced by updateAction().

{
global $tpl;
if(!$a_form)
{
$a_form = $this->initForm();
}
$tpl->setContent($a_form->getForm()->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTBasedObjectGUI::initForm ( )
protected

Init ADT-based form.

Returns
ilADTGroupFormBridge $a_form

Definition at line 68 of file class.ilADTBasedObjectGUI.php.

References $ilCtrl, $lng, $tpl, ilADTFactory\getInstance(), and prepareFormElements().

Referenced by editAction(), and updateAction().

{
global $tpl, $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this->gui, "updateAction"));
$adt_form = ilADTFactory::getInstance()->getFormBridgeForInstance($this->object->getProperties());
// has to be done BEFORE prepareFormElements() ...
$adt_form->setForm($form);
$this->prepareFormElements($adt_form);
$adt_form->addToForm();
$adt_form->addJS($tpl);
// :TODO:
$form->addCommandButton("updateAction", $lng->txt("save"));
return $adt_form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTBasedObjectGUI::initObject ( )
abstractprotected

Init ADT-based object.

Reimplemented in ilADTTestGUI.

Referenced by __construct().

+ Here is the caller graph for this function:

ilADTBasedObjectGUI::prepareFormElements ( ilADTGroupFormBridge  $a_adt_form)
abstractprotected

Prepare/customize form elements.

Parameters
ilADTGroupFormBridge$a_adt_form

Reimplemented in ilADTTestGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilADTBasedObjectGUI::updateAction ( )

Parse incoming values and update if valid.

Definition at line 95 of file class.ilADTBasedObjectGUI.php.

References $changed, $ilCtrl, $lng, $valid, editAction(), initForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $lng, $ilCtrl;
$adt_form = $this->initForm();
$valid = $adt_form->getForm()->checkInput(); // :TODO: return value is obsolete
$old_chksum = $this->object->getProperties()->getCheckSum();
$adt_form->importFromPost();
$valid = $adt_form->validate();
$changed = ($old_chksum != $this->object->getProperties()->getCheckSum());
// validation errors have top priority
if(!$valid)
{
ilUtil::sendFailure($lng->txt("form_input_not_valid"));
return $this->editAction($adt_form);
}
// :TODO: experimental, update only if necessary
{
if($this->object->update())
{
ilUtil::sendSuccess($lng->txt("settings_saved"), true);
}
else
{
// error occured in db-layer (primary/unique)
foreach($this->object->getDBErrors() as $element_id => $codes)
{
$element = $adt_form->getElement($element_id);
if($element)
{
$element->setExternalErrors($this->object->translateDBErrorCodes($codes));
}
}
ilUtil::sendFailure($lng->txt("form_input_not_valid"));
return $this->editAction($adt_form);
}
}
$ilCtrl->redirect($this->gui, "edit");
}

+ Here is the call graph for this function:

Field Documentation

ilADTBasedObjectGUI::$object
protected

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


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