51                parent::__construct($a_title, $a_postvar);
 
   53                $this->show_wizard = 
false;
 
   54                $this->show_save_phrase = 
false;
 
   55                $this->categorytext = 
$lng->txt(
'answer');
 
   56                $this->use_other_answer = 
false;
 
   66                $this->use_other_answer = ($a_value) ? 
true : 
false;
 
   71                if (!is_object($this->values)) 
return 0;
 
   72                return $this->values->getCategoryCount();
 
   77                if (is_object($this->values))
 
   80                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
   82                                $cat = $this->values->getCategory($i);
 
   83                                if ($cat->neutral == 0) $scale += 1;
 
   95                $this->show_neutral_category = $a_value;
 
  105                $this->neutral_category_title = $a_title;
 
  120                include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  122                if (is_array($a_value))
 
  124                        if (is_array($a_value[
'answer']))
 
  126                                foreach ($a_value[
'answer'] as $index => 
$value)
 
  128                                        $this->values->addCategory(
$value, $a_value[
'other'][$index], 
null, 
null, $a_value[
'scale'][$index]);
 
  132                if (array_key_exists(
'neutral', $a_value))
 
  134                        $this->values->addCategory($a_value[
'neutral'], 0, 1, 
null, 
$_POST[$this->postvar . 
'_neutral_scale']);
 
  145                $this->values = $a_values;
 
  165                $this->allowMove = $a_allow_move;
 
  180                $this->show_wizard = $a_value;
 
  190                $this->categorytext = $a_text;
 
  200                $this->show_save_phrase = $a_value;
 
  215                $this->disabled_scale = $a_value;
 
  228                if (is_array($foundvalues))
 
  231                        if (is_array($foundvalues[
'answer']))
 
  233                                foreach ($foundvalues[
'answer'] as $idx => $answervalue)
 
  235                                        if (((strlen($answervalue)) == 0) && ($this->
getRequired() && (!$foundvalues[
'other'][$idx])))
 
  237                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  243                        if (array_key_exists(
'neutral', $foundvalues))
 
  245                                if ((strlen($foundvalues[
'neutral']) == 0) && ($this->
getRequired))
 
  247                                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  252                        if (is_array($foundvalues[
'scale']))
 
  254                                foreach ($foundvalues[
'scale'] as $scale)
 
  256                                        if ((strlen($scale)) == 0) 
 
  258                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  264                        if (is_array($foundvalues[
'scale']))
 
  266                                if (count(array_unique($foundvalues[
'scale'])) != count($foundvalues[
'scale']))
 
  268                                        $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  273                        if (strlen(
$_POST[$this->postvar . 
'_neutral_scale']))
 
  275                                if (is_array($foundvalues[
'scale']))
 
  277                                        if (in_array(
$_POST[$this->postvar . 
'_neutral_scale'], $foundvalues[
'scale']))
 
  279                                                $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  287                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  302                $neutral_category = 
null;
 
  303                $tpl = 
new ilTemplate(
"tpl.prop_categorywizardinput.html", 
true, 
true, 
"Modules/SurveyQuestionPool");
 
  305                if (is_object($this->values))
 
  307                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
  309                                $cat = $this->values->getCategory($i);
 
  312                                        $tpl->setCurrentBlock(
"prop_text_propval");
 
  314                                        $tpl->parseCurrentBlock();
 
  315                                        $tpl->setCurrentBlock(
"prop_scale_propval");
 
  317                                        $tpl->parseCurrentBlock();
 
  321                                                $tpl->setCurrentBlock(
"other_answer_checkbox");
 
  323                                                $tpl->setVariable(
"OTHER_ID", $this->
getPostVar() . 
"[other][$i]");
 
  324                                                $tpl->setVariable(
"ROW_NUMBER", $i);
 
  327                                                        $tpl->setVariable(
"CHECKED_OTHER", 
' checked="checked"');
 
  329                                                $tpl->parseCurrentBlock();
 
  334                                                $tpl->setCurrentBlock(
"move");
 
  335                                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  336                                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  338                                                include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  341                                                $tpl->parseCurrentBlock();
 
  344                                        $tpl->setCurrentBlock(
"row");                                                                           
 
  346                                        $tpl->setVariable(
"ROW_NUMBER", $i);
 
  352                                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  355                                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"[scale][$i]");
 
  358                                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  361                                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  362                                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");                                                                                                                  
 
  363                                        include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  366                                        $tpl->parseCurrentBlock();
 
  370                                        $neutral_category = $cat;
 
  377                        $tpl->setCurrentBlock(
"wizard");
 
  378                        $tpl->setVariable(
"CMD_WIZARD", 
'cmd[addPhrase]');
 
  380                        $tpl->setVariable(
"WIZARD_TEXT", $lng->txt(
'add_phrase'));
 
  381                        $tpl->parseCurrentBlock();
 
  386                        $tpl->setCurrentBlock(
'savephrase');
 
  388                        $tpl->setVariable(
"VALUE_SAVE_PHRASE", $lng->txt(
'save_phrase'));
 
  389                        $tpl->parseCurrentBlock();
 
  394                        if (is_object($neutral_category) && strlen($neutral_category->title))
 
  396                                $tpl->setCurrentBlock(
"prop_text_neutral_propval");
 
  398                                $tpl->parseCurrentBlock();
 
  402                                $tpl->setCurrentBlock(
"neutral_category_title");
 
  405                                $tpl->parseCurrentBlock();
 
  407                        $tpl->setCurrentBlock(
"prop_scale_neutral_propval");
 
  408                        $scale = ($neutral_category->scale > 0) ? $neutral_category->scale : $this->values->getNewScale();
 
  410                        $tpl->parseCurrentBlock();
 
  414                                $tpl->touchBlock(
'other_answer_neutral');
 
  417                        $tpl->setCurrentBlock(
'neutral_row');                   
 
  424                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  426                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"_neutral_scale");
 
  429                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  431                        $tpl->parseCurrentBlock();
 
  436                        $tpl->setCurrentBlock(
'other_answer_title');
 
  437                        $tpl->setVariable(
"OTHER_TEXT", $lng->txt(
'use_other_answer'));
 
  438                        $tpl->parseCurrentBlock();
 
  443                $tpl->setVariable(
"SCALE_TEXT", $lng->txt(
'scale'));
 
  444                $tpl->setVariable(
"ACTIONS_TEXT", 
$lng->txt(
'actions'));
 
  446                $a_tpl->setCurrentBlock(
"prop_generic");
 
  447                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  448                $a_tpl->parseCurrentBlock();
 
  451                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  452                $tpl->addJavascript(
"./Modules/SurveyQuestionPool/templates/default/categorywizard.js");
 
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
getMaxLength()
Get Max Length.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public