ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPropertyFormGUI Class Reference

This class represents a property form user interface. More...

+ Inheritance diagram for ilPropertyFormGUI:
+ Collaboration diagram for ilPropertyFormGUI:

Public Member Functions

 ilPropertyFormGUI ()
 Constructor.
executeCommand ()
 Execute command.
 setTableWidth ($a_width)
 Set table width.
 getTableWidth ()
 get table width
 setMode ($a_mode)
 Set Mode ('std', 'subform').
 getMode ()
 Get Mode ('std', 'subform').
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setTitleIcon ($a_titleicon)
 Set TitleIcon.
 getTitleIcon ()
 Get TitleIcon.
 setDescription ($a_val)
 Set description.
 getDescription ()
 Get description.
 setTopAnchor ($a_val)
 Set top anchor.
 getTopAnchor ()
 Get top anchor.
 addItem ($a_item)
 Add Item (Property, SectionHeader).
 removeItemByPostVar ($a_post_var)
 Remove Item.
 getItemByPostVar ($a_post_var)
 Get Item by POST variable.
 setItems ($a_items)
 Set Items.
 getItems ()
 Get Items.
 setDisableStandardMessage ($a_val)
 Set disable standard message.
 getDisableStandardMessage ()
 Get disable standard message.
 setValuesByArray ($a_values)
 Set form values from an array.
 setValuesByPost ()
 Set form values from POST values.
 checkInput ()
 Check Post Input.
 getInput ($a_post_var)
 addCustomProperty ($a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property.
 addCommandButton ($a_cmd, $a_text)
 Add Command button.
 clearCommandButtons ()
 Remove all command buttons.
 getContent ()
 Get Content.
 insertItem ($item, $a_sub_item=false)
- Public Member Functions inherited from ilFormGUI
 ilFormGUI ()
 Constructor.
 setFormAction ($a_formaction)
 Set FormAction.
 getFormAction ()
 Get FormAction.
 setTarget ($a_target)
 Set Target.
 getTarget ()
 Get Target.
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false.
 getMultipart ()
 Get Enctype Multipart/Formdata true/false.
 setId ($a_id)
 Set Id.
 getId ()
 Get Id.
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open.
 getKeepOpen ()
 Get Keep Form Tag Open.
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag.
 getOpenTag ()
 Get Open Form Tag Enabled.
 setCloseTag ($a_val)
 Set close tag.
 getCloseTag ()
 Get close tag.
 getHTML ()
 Get HTML.

Protected Attributes

 $mode = "std"
 $check_input_called = false
 $disable_standard_message = false
 $top_anchor = "il_form_top"
- Protected Attributes inherited from ilFormGUI
 $formaction
 $multipart = false
 $keepopen = false
 $opentag = true

Private Attributes

 $buttons = array()
 $items = array()

Detailed Description

This class represents a property form user interface.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ ilPropertyFormGUI: ilFormPropertyDispatchGUI

Definition at line 48 of file class.ilPropertyFormGUI.php.

Member Function Documentation

ilPropertyFormGUI::addCommandButton (   $a_cmd,
  $a_text 
)

Add Command button.

Parameters
stringCommand
stringText

Definition at line 401 of file class.ilPropertyFormGUI.php.

{
$this->buttons[] = array("cmd" => $a_cmd, "text" => $a_text);
}
ilPropertyFormGUI::addCustomProperty (   $a_title,
  $a_html,
  $a_info = "",
  $a_alert = "",
  $a_required = false 
)

Add a custom property.

Parameters
stringTitle
stringHTML.
stringInfo text.
stringAlert text.
booleanRequired field. (Default false)

Definition at line 386 of file class.ilPropertyFormGUI.php.

{
$this->properties[] = array ("type" => "custom",
"title" => $a_title,
"html" => $a_html,
"info" => $a_info);
}
ilPropertyFormGUI::addItem (   $a_item)

Add Item (Property, SectionHeader).

Parameters
object$a_propertyItem object

Definition at line 222 of file class.ilPropertyFormGUI.php.

{
$a_item->setParentForm($this);
return $this->items[] = $a_item;
}
ilPropertyFormGUI::checkInput ( )

Check Post Input.

This method also strips slashes and html from input and sets the alert texts for the items, if the input was not ok.

Returns
boolean ok true/false

Definition at line 338 of file class.ilPropertyFormGUI.php.

References $lng, $ok, getDisableStandardMessage(), and ilUtil\sendFailure().

{
global $lng;
if ($this->check_input_called)
{
die ("Error: ilPropertyFormGUI->checkInput() called twice.");
}
$ok = true;
foreach($this->items as $item)
{
$item_ok = $item->checkInput();
if(!$item_ok)
{
$ok = false;
}
}
$this->check_input_called = true;
if (!$ok && !$this->getDisableStandardMessage())
{
ilUtil::sendFailure($lng->txt("form_input_not_valid"));
}
return $ok;
}

+ Here is the call graph for this function:

ilPropertyFormGUI::clearCommandButtons ( )

Remove all command buttons.

Definition at line 409 of file class.ilPropertyFormGUI.php.

{
$this->buttons = array();
}
& ilPropertyFormGUI::executeCommand ( )

Execute command.

Definition at line 73 of file class.ilPropertyFormGUI.php.

References $_GET, $cmd, $ilCtrl, and getItemByPostVar().

{
global $ilCtrl;
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
case 'ilformpropertydispatchgui':
include_once './Services/Form/classes/class.ilFormPropertyDispatchGUI.php';
$form_prop_dispatch = new ilFormPropertyDispatchGUI();
$item = $this->getItemByPostVar($_GET["postvar"]);
$form_prop_dispatch->setItem($item);
return $ilCtrl->forwardCommand($form_prop_dispatch);
break;
}
return false;
}

+ Here is the call graph for this function:

ilPropertyFormGUI::getContent ( )

Get Content.

Reimplemented from ilFormGUI.

Definition at line 417 of file class.ilPropertyFormGUI.php.

References $lng, $tpl, getDescription(), getMode(), getTableWidth(), getTitle(), getTitleIcon(), getTopAnchor(), ilYuiUtil\initAnimation(), ilYuiUtil\initDom(), ilYuiUtil\initEvent(), and insertItem().

{
global $lng, $tpl;
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
$tpl->addJavaScript("Services/JavaScript/js/Basic.js");
$tpl->addJavaScript("Services/Form/js/ServiceForm.js");
$this->tpl = new ilTemplate("tpl.property_form.html", true, true, "Services/Form");
// title icon
if ($this->getTitleIcon() != "" && @is_file($this->getTitleIcon()))
{
$this->tpl->setCurrentBlock("title_icon");
$this->tpl->setVariable("IMG_ICON", $this->getTitleIcon());
$this->tpl->parseCurrentBlock();
}
// title
if ($this->getTitle() != "")
{
$this->tpl->setCurrentBlock("header");
$this->tpl->setVariable("TXT_TITLE", $this->getTitle());
$this->tpl->setVariable("LABEL", $this->getTopAnchor());
$this->tpl->setVariable("TXT_DESCRIPTION", $this->getDescription());
$this->tpl->parseCurrentBlock();
}
$this->tpl->touchBlock("item");
// properties
$this->required_text = false;
foreach($this->items as $item)
{
if ($item->getType() != "hidden")
{
$this->insertItem($item);
}
}
// required
if ($this->required_text)
{
$this->tpl->setCurrentBlock("required_text");
$this->tpl->setVariable("TXT_REQUIRED", $lng->txt("required_field"));
$this->tpl->parseCurrentBlock();
}
// command buttons
foreach($this->buttons as $button)
{
$this->tpl->setCurrentBlock("cmd");
$this->tpl->setVariable("CMD", $button["cmd"]);
$this->tpl->setVariable("CMD_TXT", $button["text"]);
$this->tpl->parseCurrentBlock();
}
// hidden properties
$hidden_fields = false;
foreach($this->items as $item)
{
if ($item->getType() == "hidden")
{
$item->insert($this->tpl);
$hidden_fields = true;
}
}
if ($required_text || count($this->buttons) > 0 || $hidden_fields)
{
$this->tpl->setCurrentBlock("commands");
$this->tpl->parseCurrentBlock();
}
if ($this->getMode() == "subform")
{
$this->tpl->touchBlock("sub_table");
}
else
{
$this->tpl->touchBlock("std_table");
$this->tpl->setVariable('STD_TABLE_WIDTH',$this->getTableWidth());
}
return $this->tpl->get();
}

+ Here is the call graph for this function:

ilPropertyFormGUI::getDescription ( )

Get description.

Returns
string description

Definition at line 192 of file class.ilPropertyFormGUI.php.

Referenced by getContent().

{
return $this->description;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getDisableStandardMessage ( )

Get disable standard message.

Returns
boolean disable standard message

Definition at line 302 of file class.ilPropertyFormGUI.php.

References $disable_standard_message.

Referenced by checkInput().

+ Here is the caller graph for this function:

ilPropertyFormGUI::getInput (   $a_post_var)

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

References $_POST.

{
// this check ensures, that checkInput has been called (incl. stripSlashes())
if (!$this->check_input_called)
{
die ("Error: ilPropertyFormGUI->getInput() called without calling checkInput() first.");
}
return $_POST[$a_post_var];
}
ilPropertyFormGUI::getItemByPostVar (   $a_post_var)

Get Item by POST variable.

Parameters
string$a_postvarPost Var

Definition at line 249 of file class.ilPropertyFormGUI.php.

References $key, and $ret.

Referenced by executeCommand().

{
foreach ($this->items as $key => $item)
{
if ($item->getType() != "section_header")
{
//if ($item->getPostVar() == $a_post_var)
$ret = $item->getItemByPostVar($a_post_var);
if (is_object($ret))
{
return $ret;
}
}
}
return false;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getItems ( )

Get Items.

Returns
array array of item objects

Definition at line 282 of file class.ilPropertyFormGUI.php.

References $items.

{
return $this->items;
}
ilPropertyFormGUI::getMode ( )

Get Mode ('std', 'subform').

Returns
string Mode ('std', 'subform')

Definition at line 132 of file class.ilPropertyFormGUI.php.

References $mode.

Referenced by getContent(), and insertItem().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getTableWidth ( )
final

get table width

public

Definition at line 112 of file class.ilPropertyFormGUI.php.

Referenced by getContent().

{
return $this->tbl_width;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getTitle ( )

Get Title.

Returns
string Title

Definition at line 152 of file class.ilPropertyFormGUI.php.

References $title.

Referenced by getContent().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getTitleIcon ( )

Get TitleIcon.

Returns
string TitleIcon

Definition at line 172 of file class.ilPropertyFormGUI.php.

Referenced by getContent().

{
return $this->titleicon;
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::getTopAnchor ( )

Get top anchor.

Returns
string top anchor

Definition at line 212 of file class.ilPropertyFormGUI.php.

References $top_anchor.

Referenced by getContent().

{
}

+ Here is the caller graph for this function:

ilPropertyFormGUI::ilPropertyFormGUI ( )

Constructor.

Parameters

Definition at line 62 of file class.ilPropertyFormGUI.php.

References $lng, and ilFormGUI\ilFormGUI().

{
global $lng;
$lng->loadLanguageModule("form");
}

+ Here is the call graph for this function:

ilPropertyFormGUI::insertItem (   $item,
  $a_sub_item = false 
)

Definition at line 507 of file class.ilPropertyFormGUI.php.

References $lng, $tpl, ilUtil\getImagePath(), getMode(), and ilFormGUI\setMultipart().

Referenced by getContent().

{
global $tpl, $lng;
$item->insert($this->tpl);
if ($item->getType() == "file" || $item->getType() == "image_file")
{
$this->setMultipart(true);
}
if ($item->getType() != "section_header")
{
// info text
if ($item->getInfo() != "")
{
$this->tpl->setCurrentBlock("description");
//$this->tpl->setVariable("IMG_INFO",
// ilUtil::getImagePath("icon_info_s.gif"));
//$this->tpl->setVariable("ALT_INFO",
// $lng->txt("info_short"));
$this->tpl->setVariable("PROPERTY_DESCRIPTION",
$item->getInfo());
$this->tpl->parseCurrentBlock();
}
if ($this->getMode() == "subform")
{
// required
if ($item->getType() != "non_editable_value")
{
if ($item->getRequired())
{
$this->tpl->touchBlock("sub_required");
$this->required_text = true;
}
}
// hidden title (for accessibility, e.g. file upload)
if ($item->getHiddenTitle() != "")
{
$this->tpl->setCurrentBlock("sub_hid_title");
$this->tpl->setVariable("SPHID_TITLE",
$item->getHiddenTitle());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("sub_prop_start");
$this->tpl->setVariable("PROPERTY_TITLE", $item->getTitle());
if ($item->getType() != "non_editable_value")
{
$this->tpl->setVariable("LAB_ID", $item->getFieldId());
}
$this->tpl->parseCurrentBlock();
}
else
{
// required
if ($item->getType() != "non_editable_value")
{
if ($item->getRequired())
{
$this->tpl->touchBlock("required");
$this->required_text = true;
}
}
// hidden title (for accessibility, e.g. file upload)
if ($item->getHiddenTitle() != "")
{
$this->tpl->setCurrentBlock("std_hid_title");
$this->tpl->setVariable("PHID_TITLE",
$item->getHiddenTitle());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("std_prop_start");
$this->tpl->setVariable("PROPERTY_TITLE", $item->getTitle());
if ($item->getType() != "non_editable_value")
{
$this->tpl->setVariable("LAB_ID", $item->getFieldId());
}
$this->tpl->parseCurrentBlock();
}
// alert
if ($item->getType() != "non_editable_value" && $item->getAlert() != "")
{
$this->tpl->setCurrentBlock("alert");
$this->tpl->setVariable("IMG_ALERT",
ilUtil::getImagePath("icon_alert_s.gif"));
$this->tpl->setVariable("ALT_ALERT",
$lng->txt("alert"));
$this->tpl->setVariable("TXT_ALERT",
$item->getAlert());
$this->tpl->parseCurrentBlock();
}
// subitems
$sf = null;
if ($item->getType() != "non_editable_value" or 1)
{
$sf = $item->getSubForm();
if ($item->hideSubForm() && is_object($sf))
{
$this->tpl->setCurrentBlock("sub_form_hide");
$this->tpl->setVariable("DSFID", $item->getFieldId());
$this->tpl->parseCurrentBlock();
}
}
$sf_content = "";
if (is_object($sf))
{
$sf_content = $sf->getContent();
if ($sf->getMultipart())
{
$this->setMultipart(true);
}
$this->tpl->setCurrentBlock("sub_form");
$this->tpl->setVariable("PROP_SUB_FORM", $sf_content);
$this->tpl->setVariable("SFID", $item->getFieldId());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("prop");
$this->tpl->parseCurrentBlock();
}
$this->tpl->touchBlock("item");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPropertyFormGUI::removeItemByPostVar (   $a_post_var)

Remove Item.

Parameters
string$a_postvarPost Var

Definition at line 233 of file class.ilPropertyFormGUI.php.

References $key.

{
foreach ($this->items as $key => $item)
{
if ($item->getPostVar() == $a_post_var)
{
unset($this->items[$key]);
}
}
}
ilPropertyFormGUI::setDescription (   $a_val)

Set description.

Parameters
stringdescription

Definition at line 182 of file class.ilPropertyFormGUI.php.

{
$this->description = $a_val;
}
ilPropertyFormGUI::setDisableStandardMessage (   $a_val)

Set disable standard message.

Parameters
booleandisable standard message

Definition at line 292 of file class.ilPropertyFormGUI.php.

{
$this->disable_standard_message = $a_val;
}
ilPropertyFormGUI::setItems (   $a_items)

Set Items.

Parameters
array$a_itemsarray of item objects

Definition at line 272 of file class.ilPropertyFormGUI.php.

{
$this->items = $a_items;
}
ilPropertyFormGUI::setMode (   $a_mode)

Set Mode ('std', 'subform').

Parameters
string$a_modeMode ('std', 'subform')

Definition at line 122 of file class.ilPropertyFormGUI.php.

{
$this->mode = $a_mode;
}
ilPropertyFormGUI::setTableWidth (   $a_width)
final

Set table width.

public

Parameters
stringtable width

Definition at line 101 of file class.ilPropertyFormGUI.php.

{
$this->tbl_width = $a_width;
}
ilPropertyFormGUI::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

Definition at line 142 of file class.ilPropertyFormGUI.php.

{
$this->title = $a_title;
}
ilPropertyFormGUI::setTitleIcon (   $a_titleicon)

Set TitleIcon.

Parameters
string$a_titleiconTitleIcon

Definition at line 162 of file class.ilPropertyFormGUI.php.

{
$this->titleicon = $a_titleicon;
}
ilPropertyFormGUI::setTopAnchor (   $a_val)

Set top anchor.

Parameters
stringtop anchor

Definition at line 202 of file class.ilPropertyFormGUI.php.

{
$this->top_anchor = $a_val;
}
ilPropertyFormGUI::setValuesByArray (   $a_values)

Set form values from an array.

Parameters
array$a_valuesValue array (key is post variable name, value is value)

Definition at line 312 of file class.ilPropertyFormGUI.php.

{
foreach($this->items as $item)
{
$item->setValueByArray($a_values);
}
}
ilPropertyFormGUI::setValuesByPost ( )

Set form values from POST values.

Definition at line 324 of file class.ilPropertyFormGUI.php.

References $_POST.

{
foreach($this->items as $item)
{
$item->setValueByArray($_POST);
}
}

Field Documentation

ilPropertyFormGUI::$buttons = array()
private

Definition at line 50 of file class.ilPropertyFormGUI.php.

ilPropertyFormGUI::$check_input_called = false
protected

Definition at line 53 of file class.ilPropertyFormGUI.php.

ilPropertyFormGUI::$disable_standard_message = false
protected

Definition at line 54 of file class.ilPropertyFormGUI.php.

Referenced by getDisableStandardMessage().

ilPropertyFormGUI::$items = array()
private

Definition at line 51 of file class.ilPropertyFormGUI.php.

Referenced by getItems().

ilPropertyFormGUI::$mode = "std"
protected

Definition at line 52 of file class.ilPropertyFormGUI.php.

Referenced by getMode().

ilPropertyFormGUI::$top_anchor = "il_form_top"
protected

Definition at line 55 of file class.ilPropertyFormGUI.php.

Referenced by getTopAnchor().


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