ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCategoryWizardInputGUI Class Reference

This class represents a survey question category wizard property in a property form. More...

+ Inheritance diagram for ilCategoryWizardInputGUI:
+ Collaboration diagram for ilCategoryWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 getUseOtherAnswer ()
 setUseOtherAnswer ($a_value)
 getCategoryCount ()
 setShowNeutralCategory ($a_value)
 getShowNeutralCategory ()
 setNeutralCategoryTitle ($a_title)
 getNeutralCategoryTitle ()
 setValue ($a_value)
 Set Value.
 setValues ($a_values)
 Set Values.
 getValues ()
 Get Values.
 setAllowMove ($a_allow_move)
 Set allow move.
 getAllowMove ()
 Get allow move.
 setShowWizard ($a_value)
 getShowWizard ()
 setCategoryText ($a_text)
 getCategoryText ()
 setShowSavePhrase ($a_value)
 getShowSavePhrase ()
 getDisabledScale ()
 setDisabledScale ($a_value)
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilTextInputGUI
 getValue ()
 Get Value.
 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, $a_delimiter=null)
 set datasource link for js autocomplete
 setMultiValues (array $a_values)
 Set multi values.
 render ($a_mode="")
 Render item.
 getTableFilterHTML ()
 Get HTML for table filter.
 getToolbarHTML ()
 Get HTML for toolbar.
 setDisableHtmlAutoComplete ($autocomplete)
 isHtmlAutoCompleteDisabled ()
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively
 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, $a_sortable=false, $a_addremove=true)
 Set Multi.
 getMulti ()
 Get Multi.
 getMultiValues ()
 Get multi values.
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g.

Protected Member Functions

 calcNeutralCategoryScale ()

Protected Attributes

 $values = array()
 $allowMove = false
 $disabled_scale = true
 $show_wizard = false
 $show_save_phrase = false
 $categorytext
 $show_neutral_category = false
 $neutral_category_title
 $use_other_answer
- Protected Attributes inherited from ilTextInputGUI
 $value
 $maxlength = 200
 $size = 40
 $validationRegexp
 $validationFailureMessage = ''
 $suffix
 $style_css
 $css_class
 $ajax_datasource
 $ajax_datasource_delimiter
 $submit_form_on_enter = false
 $autocomplete_disabled = 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 = false
 $multi_sortable = false
 $multi_addremove = true
 $multi_values

Detailed Description

This class represents a survey question category wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
Id:
class.ilCategoryWizardInputGUI.php 43773 2013-07-30 15:04:06Z jluetzen

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

Definition at line 49 of file class.ilCategoryWizardInputGUI.php.

References $lng.

{
parent::__construct($a_title, $a_postvar);
global $lng;
$this->show_wizard = false;
$this->show_save_phrase = false;
$this->categorytext = $lng->txt('answer');
$this->use_other_answer = false;
}

Member Function Documentation

ilCategoryWizardInputGUI::calcNeutralCategoryScale ( )
protected

Definition at line 75 of file class.ilCategoryWizardInputGUI.php.

{
if (is_object($this->values))
{
$scale = 0;
for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
{
$cat = $this->values->getCategory($i);
if ($cat->neutral == 0) $scale += 1;
}
return $scale+1;
}
else
{
return 99;
}
}
ilCategoryWizardInputGUI::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 223 of file class.ilCategoryWizardInputGUI.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['answer']))
{
foreach ($foundvalues['answer'] as $idx => $answervalue)
{
if (((strlen($answervalue)) == 0) && ($this->getRequired() && (!$foundvalues['other'][$idx])))
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
}
// check neutral column
if (array_key_exists('neutral', $foundvalues))
{
if ((strlen($foundvalues['neutral']) == 0) && ($this->getRequired))
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
}
// check scales
if (is_array($foundvalues['scale']))
{
foreach ($foundvalues['scale'] as $scale)
{
if ((strlen($scale)) == 0)
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
}
}
// check scales
if (is_array($foundvalues['scale']))
{
if (count(array_unique($foundvalues['scale'])) != count($foundvalues['scale']))
{
$this->setAlert($lng->txt("msg_duplicate_scale"));
return FALSE;
}
}
// check neutral column scale
if (strlen($_POST[$this->postvar . '_neutral_scale']))
{
if (is_array($foundvalues['scale']))
{
if (in_array($_POST[$this->postvar . '_neutral_scale'], $foundvalues['scale']))
{
$this->setAlert($lng->txt("msg_duplicate_scale"));
return FALSE;
}
}
}
}
else
{
$this->setAlert($lng->txt("msg_input_is_required"));
return FALSE;
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilCategoryWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 173 of file class.ilCategoryWizardInputGUI.php.

References $allowMove.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getCategoryCount ( )

Definition at line 69 of file class.ilCategoryWizardInputGUI.php.

{
if (!is_object($this->values)) return 0;
return $this->values->getCategoryCount();
}
ilCategoryWizardInputGUI::getCategoryText ( )

Definition at line 193 of file class.ilCategoryWizardInputGUI.php.

References $categorytext.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getDisabledScale ( )

Definition at line 208 of file class.ilCategoryWizardInputGUI.php.

References $disabled_scale.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getNeutralCategoryTitle ( )

Definition at line 108 of file class.ilCategoryWizardInputGUI.php.

References $neutral_category_title.

Referenced by insert().

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getShowNeutralCategory ( )

Definition at line 98 of file class.ilCategoryWizardInputGUI.php.

References $show_neutral_category.

Referenced by insert().

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getShowSavePhrase ( )

Definition at line 203 of file class.ilCategoryWizardInputGUI.php.

References $show_save_phrase.

Referenced by insert().

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getShowWizard ( )

Definition at line 183 of file class.ilCategoryWizardInputGUI.php.

References $show_wizard.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getUseOtherAnswer ( )

Definition at line 59 of file class.ilCategoryWizardInputGUI.php.

References $use_other_answer.

Referenced by insert().

+ Here is the caller graph for this function:

ilCategoryWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 153 of file class.ilCategoryWizardInputGUI.php.

References $values.

{
return $this->values;
}
ilCategoryWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

Definition at line 298 of file class.ilCategoryWizardInputGUI.php.

References $lng, $tpl, getAllowMove(), getCategoryText(), ilFormPropertyGUI\getDisabled(), getDisabledScale(), ilFormPropertyGUI\getFieldId(), ilUtil\getImagePath(), ilTextInputGUI\getMaxLength(), getNeutralCategoryTitle(), ilFormPropertyGUI\getPostVar(), getShowNeutralCategory(), getShowSavePhrase(), getShowWizard(), ilTextInputGUI\getSize(), getUseOtherAnswer(), ilYuiUtil\initDomEvent(), and ilUtil\prepareFormOutput().

{
global $lng;
$neutral_category = null;
$tpl = new ilTemplate("tpl.prop_categorywizardinput.html", true, true, "Modules/SurveyQuestionPool");
$i = 0;
if (is_object($this->values))
{
for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
{
$cat = $this->values->getCategory($i);
if (!$cat->neutral)
{
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($cat->title));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_scale_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->values->getScale($i)));
$tpl->parseCurrentBlock();
if ($this->getUseOtherAnswer())
{
$tpl->setCurrentBlock("other_answer_checkbox");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("OTHER_ID", $this->getPostVar() . "[other][$i]");
$tpl->setVariable("ROW_NUMBER", $i);
if ($cat->other)
{
$tpl->setVariable("CHECKED_OTHER", ' checked="checked"');
}
$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 == $this->values->getCategoryCount()-1) $class .= " last";
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
$tpl->setVariable("SCALE_ID", $this->getPostVar() . "[scale][$i]");
if ($this->getDisabledScale())
{
$tpl->setVariable("DISABLED_SCALE", " disabled=\"disabled\"");
}
$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->parseCurrentBlock();
}
else
{
$neutral_category = $cat;
}
}
}
if ($this->getShowWizard())
{
$tpl->setCurrentBlock("wizard");
$tpl->setVariable("CMD_WIZARD", 'cmd[addPhrase]');
$tpl->setVariable("WIZARD_BUTTON", ilUtil::getImagePath('wizard.png'));
$tpl->setVariable("WIZARD_TEXT", $lng->txt('add_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getShowSavePhrase())
{
$tpl->setCurrentBlock('savephrase');
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("VALUE_SAVE_PHRASE", $lng->txt('save_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getShowNeutralCategory())
{
if (is_object($neutral_category) && strlen($neutral_category->title))
{
$tpl->setCurrentBlock("prop_text_neutral_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($neutral_category->title));
$tpl->parseCurrentBlock();
}
if (strlen($this->getNeutralCategoryTitle()))
{
$tpl->setCurrentBlock("neutral_category_title");
$tpl->setVariable("CATEGORY_TITLE", ilUtil::prepareFormOutput($this->getNeutralCategoryTitle()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("prop_scale_neutral_propval");
$scale = ($neutral_category->scale > 0) ? $neutral_category->scale : $this->values->getNewScale();
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($scale));
$tpl->parseCurrentBlock();
if ($this->getUseOtherAnswer())
{
$tpl->touchBlock('other_answer_neutral');
}
$tpl->setCurrentBlock('neutral_row');
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ID", $this->getPostVar() . "_neutral");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled())
{
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
$tpl->setVariable("SCALE_ID", $this->getPostVar() . "_neutral_scale");
if ($this->getDisabledScale())
{
$tpl->setVariable("DISABLED_SCALE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
if ($this->getUseOtherAnswer())
{
$tpl->setCurrentBlock('other_answer_title');
$tpl->setVariable("OTHER_TEXT", $lng->txt('use_other_answer'));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("ANSWER_TEXT", $this->getCategoryText());
$tpl->setVariable("SCALE_TEXT", $lng->txt('scale'));
$tpl->setVariable("ACTIONS_TEXT", $lng->txt('actions'));
$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/SurveyQuestionPool/templates/default/categorywizard.js");
}

+ Here is the call graph for this function:

ilCategoryWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 163 of file class.ilCategoryWizardInputGUI.php.

{
$this->allowMove = $a_allow_move;
}
ilCategoryWizardInputGUI::setCategoryText (   $a_text)

Definition at line 188 of file class.ilCategoryWizardInputGUI.php.

{
$this->categorytext = $a_text;
}
ilCategoryWizardInputGUI::setDisabledScale (   $a_value)

Definition at line 213 of file class.ilCategoryWizardInputGUI.php.

{
$this->disabled_scale = $a_value;
}
ilCategoryWizardInputGUI::setNeutralCategoryTitle (   $a_title)

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

{
$this->neutral_category_title = $a_title;
}
ilCategoryWizardInputGUI::setShowNeutralCategory (   $a_value)

Definition at line 93 of file class.ilCategoryWizardInputGUI.php.

{
$this->show_neutral_category = $a_value;
}
ilCategoryWizardInputGUI::setShowSavePhrase (   $a_value)

Definition at line 198 of file class.ilCategoryWizardInputGUI.php.

{
$this->show_save_phrase = $a_value;
}
ilCategoryWizardInputGUI::setShowWizard (   $a_value)

Definition at line 178 of file class.ilCategoryWizardInputGUI.php.

{
$this->show_wizard = $a_value;
}
ilCategoryWizardInputGUI::setUseOtherAnswer (   $a_value)

Definition at line 64 of file class.ilCategoryWizardInputGUI.php.

{
$this->use_other_answer = ($a_value) ? true : false;
}
ilCategoryWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

Definition at line 118 of file class.ilCategoryWizardInputGUI.php.

References $_POST, and ilTextInputGUI\$value.

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
$this->values = new SurveyCategories();
if (is_array($a_value))
{
if (is_array($a_value['answer']))
{
foreach ($a_value['answer'] as $index => $value)
{
$this->values->addCategory($value, $a_value['other'][$index], null, null, $a_value['scale'][$index]);
}
}
}
if (array_key_exists('neutral', $a_value))
{
$this->values->addCategory($a_value['neutral'], 0, 1, null, $_POST[$this->postvar . '_neutral_scale']);
}
}
ilCategoryWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 143 of file class.ilCategoryWizardInputGUI.php.

{
$this->values = $a_values;
}

Field Documentation

ilCategoryWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

ilCategoryWizardInputGUI::$categorytext
protected

Definition at line 38 of file class.ilCategoryWizardInputGUI.php.

Referenced by getCategoryText().

ilCategoryWizardInputGUI::$disabled_scale = true
protected

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

Referenced by getDisabledScale().

ilCategoryWizardInputGUI::$neutral_category_title
protected

Definition at line 40 of file class.ilCategoryWizardInputGUI.php.

Referenced by getNeutralCategoryTitle().

ilCategoryWizardInputGUI::$show_neutral_category = false
protected

Definition at line 39 of file class.ilCategoryWizardInputGUI.php.

Referenced by getShowNeutralCategory().

ilCategoryWizardInputGUI::$show_save_phrase = false
protected

Definition at line 37 of file class.ilCategoryWizardInputGUI.php.

Referenced by getShowSavePhrase().

ilCategoryWizardInputGUI::$show_wizard = false
protected

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

Referenced by getShowWizard().

ilCategoryWizardInputGUI::$use_other_answer
protected

Definition at line 41 of file class.ilCategoryWizardInputGUI.php.

Referenced by getUseOtherAnswer().

ilCategoryWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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