53                parent::__construct($a_title, $a_postvar);
 
   55                $this->show_wizard = 
false;
 
   56                $this->show_save_phrase = 
false;
 
   57                $this->categorytext = 
$lng->txt(
'answer');
 
   58                $this->use_other_answer = 
false;
 
   70                $this->use_other_answer = ($a_value) ? 
true : 
false;
 
   75                if (!is_object($this->values)) 
return 0;
 
   76                return $this->values->getCategoryCount();
 
   81                if (is_object($this->values))
 
   84                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
   86                                $cat = $this->values->getCategory($i);
 
   87                                if ($cat->neutral == 0) $scale += 1;
 
   99                $this->show_neutral_category = $a_value;
 
  109                $this->neutral_category_title = $a_title;
 
  124                include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  126                if (is_array($a_value))
 
  128                        if (is_array($a_value[
'answer']))
 
  130                                foreach ($a_value[
'answer'] as $index => 
$value)
 
  132                                        $this->values->addCategory(
$value, $a_value[
'other'][$index], 
null, 
null, $a_value[
'scale'][$index]);
 
  136                if (array_key_exists(
'neutral', $a_value))
 
  138                        $this->values->addCategory($a_value[
'neutral'], 0, 1, 
null, 
$_POST[$this->postvar . 
'_neutral_scale']);
 
  149                $this->values = $a_values;
 
  169                $this->allowMove = $a_allow_move;
 
  184                $this->show_wizard = $a_value;
 
  194                $this->categorytext = $a_text;
 
  204                $this->show_save_phrase = $a_value;
 
  219                $this->disabled_scale = $a_value;
 
  232                if (is_array($foundvalues))
 
  235                        if (is_array($foundvalues[
'answer']))
 
  237                                foreach ($foundvalues[
'answer'] as $idx => $answervalue)
 
  239                                        if (((strlen($answervalue)) == 0) && ($this->
getRequired() && (!$foundvalues[
'other'][$idx])))
 
  241                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  247                        if (array_key_exists(
'neutral', $foundvalues))
 
  249                                if ((strlen($foundvalues[
'neutral']) == 0) && ($this->
getRequired))
 
  251                                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  256                        if (is_array($foundvalues[
'scale']))
 
  258                                foreach ($foundvalues[
'scale'] as $scale)
 
  261                                        if ((strlen($scale)) == 0) 
 
  263                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  267                    if (!ctype_digit($scale) || $scale <= 0)
 
  269                        $this->
setAlert($lng->txt(
"msg_input_only_positive_numbers"));
 
  274                if (count(array_unique($foundvalues[
'scale'])) != count($foundvalues[
'scale']))
 
  276                    $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  282                        if (strlen(
$_POST[$this->postvar . 
'_neutral_scale']))
 
  284                                if (is_array($foundvalues[
'scale']))
 
  286                                        if (in_array(
$_POST[$this->postvar . 
'_neutral_scale'], $foundvalues[
'scale']))
 
  288                                                $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  296                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  311                $neutral_category = 
null;
 
  312                $tpl = 
new ilTemplate(
"tpl.prop_categorywizardinput.html", 
true, 
true, 
"Modules/SurveyQuestionPool");
 
  314                if (is_object($this->values))
 
  316                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
  318                                $cat = $this->values->getCategory($i);
 
  321                                        $tpl->setCurrentBlock(
"prop_text_propval");
 
  323                                        $tpl->parseCurrentBlock();
 
  324                                        $tpl->setCurrentBlock(
"prop_scale_propval");
 
  326                                        $tpl->parseCurrentBlock();
 
  330                                                $tpl->setCurrentBlock(
"other_answer_checkbox");
 
  332                                                $tpl->setVariable(
"OTHER_ID", $this->
getPostVar() . 
"[other][$i]");
 
  333                                                $tpl->setVariable(
"ROW_NUMBER", $i);
 
  336                                                        $tpl->setVariable(
"CHECKED_OTHER", 
' checked="checked"');
 
  338                                                $tpl->parseCurrentBlock();
 
  343                                                $tpl->setCurrentBlock(
"move");
 
  344                                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  345                                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  347                                                include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  350                                                $tpl->parseCurrentBlock();
 
  353                                        $tpl->setCurrentBlock(
"row");                                                                           
 
  355                                        $tpl->setVariable(
"ROW_NUMBER", $i);
 
  361                                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  364                                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"[scale][$i]");
 
  367                                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  370                                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  371                                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");                                                                                                                  
 
  372                                        include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  375                                        $tpl->parseCurrentBlock();
 
  379                                        $neutral_category = $cat;
 
  386                        $tpl->setCurrentBlock(
"wizard");
 
  387                        $tpl->setVariable(
"CMD_WIZARD", 
'cmd[addPhrase]');
 
  389                        $tpl->setVariable(
"WIZARD_TEXT", $lng->txt(
'add_phrase'));
 
  390                        $tpl->parseCurrentBlock();
 
  395                        $tpl->setCurrentBlock(
'savephrase');
 
  397                        $tpl->setVariable(
"VALUE_SAVE_PHRASE", $lng->txt(
'save_phrase'));
 
  398                        $tpl->parseCurrentBlock();
 
  403                        if (is_object($neutral_category) && strlen($neutral_category->title))
 
  405                                $tpl->setCurrentBlock(
"prop_text_neutral_propval");
 
  407                                $tpl->parseCurrentBlock();
 
  411                                $tpl->setCurrentBlock(
"neutral_category_title");
 
  414                                $tpl->parseCurrentBlock();
 
  416                        $tpl->setCurrentBlock(
"prop_scale_neutral_propval");
 
  417                        $scale = ($neutral_category->scale > 0) ? $neutral_category->scale : $this->values->getNewScale();
 
  419                        $tpl->parseCurrentBlock();
 
  423                                $tpl->touchBlock(
'other_answer_neutral');
 
  426                        $tpl->setCurrentBlock(
'neutral_row');                   
 
  433                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  435                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"_neutral_scale");
 
  438                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  440                        $tpl->parseCurrentBlock();
 
  445                        $tpl->setCurrentBlock(
'other_answer_title');
 
  446                        $tpl->setVariable(
"OTHER_TEXT", $lng->txt(
'use_other_answer'));
 
  447                        $tpl->parseCurrentBlock();
 
  452                $tpl->setVariable(
"SCALE_TEXT", $lng->txt(
'scale'));
 
  453                $tpl->setVariable(
"ACTIONS_TEXT", 
$lng->txt(
'actions'));
 
  455                $a_tpl->setCurrentBlock(
"prop_generic");
 
  456                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  457                $a_tpl->parseCurrentBlock();
 
  460                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  461                $tpl->addJavascript(
"./Modules/SurveyQuestionPool/templates/default/categorywizard.js");
 
An exception for terminatinating execution or to throw for unit testing.
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.
setMaxLength($a_maxlength)
Set Max Length.
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