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

This class represents a key value pair wizard property in a property form. More...

+ Inheritance diagram for ilMatchingPairWizardInputGUI:
+ Collaboration diagram for ilMatchingPairWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValue ($a_value)
 Set Value.
 setTerms ($a_terms)
 Set terms.
 setDefinitions ($a_definitions)
 Set definitions.
 setPairs ($a_pairs)
 Set pairs.
 setAllowMove ($a_allow_move)
 Set allow move.
 getAllowMove ()
 Get allow move.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilTextInputGUI
 getValue ()
 Get Value.
 setMulti ($a_multi, $a_sortable=false)
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure.
 getValidationFailureMessage ()
 setValidationRegexp ($a_value)
 Set validation regexp.
 getValidationRegexp ()
 Get validation regexp.
 setMaxLength ($a_maxlength)
 Set Max Length.
 getMaxLength ()
 Get Max Length.
 setSize ($a_size)
 Set Size.
 setInlineStyle ($a_style)
 Set inline style.
 getInlineStyle ()
 Get inline style.
 setCssClass ($a_class)
 getCssClass ()
 setValueByArray ($a_values)
 Set value by array.
 getSize ()
 Get Size.
 setSuffix ($a_value)
 Set suffix.
 getSuffix ()
 Get suffix.
 setInputType ($a_type)
 set input type
 getInputType ()
 get input type
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter.
 getSubmitFormOnEnter ()
 Get submit form on enter.
 getDataSource ()
 get datasource link for js autocomplete
 setDataSource ($href)
 set datasource link for js autocomplete
 setMultiValues (array $a_values)
 Set multi values.
 getTableFilterHTML ()
 Get HTML for table filter.
 getToolbarHTML ()
 Get HTML for toolbar.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
executeCommand ()
 Execute command.
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.
 setParentForm ($a_parentform)
 Set Parent Form.
 getParentForm ()
 Get Parent Form.
 setParent ($a_val)
 Set Parent GUI object.
 getParent ()
 Get Parent GUI object.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
 writeToSession ()
 Write to session.
 clearFromSession ()
 Clear session value.
 readFromSession ()
 Read from session.
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties)
 setMulti ($a_multi)
 Set Multi.
 getMulti ()
 Get Multi.
 getMultiValues ()
 Get multi values.

Protected Attributes

 $pairs = array()
 $allowMove = false
 $terms = array()
 $definitions = array()
- Protected Attributes inherited from ilTextInputGUI
 $value
 $maxlength = 200
 $size = 40
 $validationRegexp
 $validationFailureMessage = ''
 $suffix
 $style_css
 $css_class
 $ajax_datasource
 $submit_form_on_enter = false
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform
 $hidden_title = ""
 $multi
 $multi_values

Additional Inherited Members

- Protected Member Functions inherited from ilTextInputGUI
 render ($a_mode="")
 Render item.

Detailed Description

This class represents a key value pair wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 31 of file class.ilMatchingPairWizardInputGUI.php.

Constructor & Destructor Documentation

ilMatchingPairWizardInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

{
parent::__construct($a_title, $a_postvar);
}

Member Function Documentation

ilMatchingPairWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilTextInputGUI.

Definition at line 139 of file class.ilMatchingPairWizardInputGUI.php.

References $_POST, $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

{
global $lng;
if (is_array($_POST[$this->getPostVar()])) $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
$foundvalues = $_POST[$this->getPostVar()];
if (is_array($foundvalues))
{
// check answers
if (is_array($foundvalues['term']))
{
foreach ($foundvalues['term'] as $val)
{
if ($this->getRequired() && $val < 1)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
foreach ($foundvalues['definition'] as $val)
{
if ($this->getRequired() && $val < 1)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
$max = 0;
foreach ($foundvalues['points'] as $val)
{
if ($val > 0) $max += $val;
if ($this->getRequired() && (strlen($val)) == 0)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
if ($max <= 0)
{
$this->setAlert($lng->txt("enter_enough_positive_points"));
return FALSE;
}
}
else
{
if ($this->getRequired())
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
}
else
{
if ($this->getRequired())
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilMatchingPairWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 129 of file class.ilMatchingPairWizardInputGUI.php.

References $allowMove.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilMatchingPairWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

Definition at line 207 of file class.ilMatchingPairWizardInputGUI.php.

References $lng, $tpl, getAllowMove(), ilFormPropertyGUI\getFieldId(), ilUtil\getImagePath(), ilFormPropertyGUI\getPostVar(), ilYuiUtil\initDomEvent(), and ilUtil\prepareFormOutput().

{
global $lng;
$tpl = new ilTemplate("tpl.prop_matchingpairinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->pairs as $pair)
{
$counter = 1;
$tpl->setCurrentBlock("option_term");
$tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
$tpl->setVariable("VALUE_OPTION", 0);
$tpl->parseCurrentBlock();
foreach ($this->terms as $term)
{
$tpl->setCurrentBlock("option_term");
$tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($term->identifier));
$tpl->setVariable("TEXT_OPTION", $lng->txt('term') . " " . $counter);
if ($pair->term->identifier == $term->identifier) $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
$tpl->parseCurrentBlock();
$counter++;
}
$counter = 1;
$tpl->setCurrentBlock("option_definition");
$tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
$tpl->setVariable("VALUE_OPTION", 0);
$tpl->parseCurrentBlock();
foreach ($this->definitions as $definition)
{
$tpl->setCurrentBlock("option_definition");
$tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($definition->identifier));
$tpl->setVariable("TEXT_OPTION", $lng->txt('definition') . " " . $counter);
if ($pair->definition->identifier == $definition->identifier) $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
$tpl->parseCurrentBlock();
$counter++;
}
if (strlen($pair->points))
{
$tpl->setCurrentBlock('points_value');
$tpl->setVariable('POINTS_VALUE', $pair->points);
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove())
{
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
$tpl->setVariable("ID", $this->getPostVar() . "[$i]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = ($i % 2 == 0) ? "even" : "odd";
if ($i == 0) $class .= " first";
if ($i == count($this->values)-1) $class .= " last";
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[$i]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setCurrentBlock('term_ids');
$ids = array();
foreach ($this->terms as $term)
{
array_push($ids, $term->identifier);
}
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("TERM_IDS", join($ids, ","));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock('definition_ids');
$ids = array();
foreach ($this->definitions as $definition)
{
array_push($ids, $definition->identifier);
}
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("DEFINITION_IDS", join($ids, ","));
$tpl->parseCurrentBlock();
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_POINTS", $lng->txt('points'));
$tpl->setVariable("TEXT_DEFINITION", $lng->txt('definition'));
$tpl->setVariable("TEXT_TERM", $lng->txt('term'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
}

+ Here is the call graph for this function:

ilMatchingPairWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 119 of file class.ilMatchingPairWizardInputGUI.php.

{
$this->allowMove = $a_allow_move;
}
ilMatchingPairWizardInputGUI::setDefinitions (   $a_definitions)

Set definitions.

Parameters
array$a_definitionsDefinitions

Definition at line 99 of file class.ilMatchingPairWizardInputGUI.php.

{
$this->definitions = $a_definitions;
}
ilMatchingPairWizardInputGUI::setPairs (   $a_pairs)

Set pairs.

Parameters
array$a_pairsPairs

Definition at line 109 of file class.ilMatchingPairWizardInputGUI.php.

{
$this->pairs = $a_pairs;
}
ilMatchingPairWizardInputGUI::setTerms (   $a_terms)

Set terms.

Parameters
array$a_termsTerms

Definition at line 89 of file class.ilMatchingPairWizardInputGUI.php.

{
$this->terms = $a_terms;
}
ilMatchingPairWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

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

{
$this->pairs = array();
$this->terms = array();
$this->definitions = array();
if (is_array($a_value))
{
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
if (is_array($a_value['term']))
{
foreach ($a_value['term'] as $idx => $term)
{
array_push($this->pairs, new assAnswerMatchingPair(new assAnswerMatchingTerm('', '', $term), new assAnswerMatchingDefinition('', '', $a_value['definition'][$idx]), $a_value['points'][$idx]));
}
}
$term_ids = split(",", $a_value['term_id']);
foreach ($term_ids as $id)
{
array_push($this->terms, new assAnswerMatchingTerm('', '', $id));
}
$definition_ids = split(",", $a_value['definition_id']);
foreach ($definition_ids as $id)
{
array_push($this->definitions, new assAnswerMatchingDefinition('', '', $id));
}
}
}

Field Documentation

ilMatchingPairWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

ilMatchingPairWizardInputGUI::$definitions = array()
protected

Definition at line 36 of file class.ilMatchingPairWizardInputGUI.php.

ilMatchingPairWizardInputGUI::$pairs = array()
protected

Definition at line 33 of file class.ilMatchingPairWizardInputGUI.php.

ilMatchingPairWizardInputGUI::$terms = array()
protected

Definition at line 35 of file class.ilMatchingPairWizardInputGUI.php.


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