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;
 
   68                $this->use_other_answer = ($a_value) ? 
true : 
false;
 
   73                if (!is_object($this->values)) 
return 0;
 
   74                return $this->values->getCategoryCount();
 
   79                if (is_object($this->values))
 
   82                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
   84                                $cat = $this->values->getCategory($i);
 
   85                                if ($cat->neutral == 0) $scale += 1;
 
   97                $this->show_neutral_category = $a_value;
 
  107                $this->neutral_category_title = $a_title;
 
  122                include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  124                if (is_array($a_value))
 
  126                        if (is_array($a_value[
'answer']))
 
  128                                foreach ($a_value[
'answer'] as $index => 
$value)
 
  130                                        $this->values->addCategory(
$value, $a_value[
'other'][$index], 
null, 
null, $a_value[
'scale'][$index]);
 
  134                if (array_key_exists(
'neutral', $a_value))
 
  136                        $this->values->addCategory($a_value[
'neutral'], 0, 1, 
null, 
$_POST[$this->postvar . 
'_neutral_scale']);
 
  147                $this->values = $a_values;
 
  167                $this->allowMove = $a_allow_move;
 
  182                $this->show_wizard = $a_value;
 
  192                $this->categorytext = $a_text;
 
  202                $this->show_save_phrase = $a_value;
 
  217                $this->disabled_scale = $a_value;
 
  230                if (is_array($foundvalues))
 
  233                        if (is_array($foundvalues[
'answer']))
 
  235                                foreach ($foundvalues[
'answer'] as $idx => $answervalue)
 
  237                                        if (((strlen($answervalue)) == 0) && ($this->
getRequired() && (!$foundvalues[
'other'][$idx])))
 
  239                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  245                        if (array_key_exists(
'neutral', $foundvalues))
 
  247                                if ((strlen($foundvalues[
'neutral']) == 0) && ($this->
getRequired))
 
  249                                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  254                        if (is_array($foundvalues[
'scale']))
 
  256                                foreach ($foundvalues[
'scale'] as $scale)
 
  258                                        if ((strlen($scale)) == 0) 
 
  260                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  266                        if (is_array($foundvalues[
'scale']))
 
  268                                if (count(array_unique($foundvalues[
'scale'])) != count($foundvalues[
'scale']))
 
  270                                        $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  275                        if (strlen(
$_POST[$this->postvar . 
'_neutral_scale']))
 
  277                                if (is_array($foundvalues[
'scale']))
 
  279                                        if (in_array(
$_POST[$this->postvar . 
'_neutral_scale'], $foundvalues[
'scale']))
 
  281                                                $this->
setAlert($lng->txt(
"msg_duplicate_scale"));
 
  289                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  304                $neutral_category = 
null;
 
  305                $tpl = 
new ilTemplate(
"tpl.prop_categorywizardinput.html", 
true, 
true, 
"Modules/SurveyQuestionPool");
 
  307                if (is_object($this->values))
 
  309                        for ($i = 0; $i < $this->values->getCategoryCount(); $i++)
 
  311                                $cat = $this->values->getCategory($i);
 
  314                                        $tpl->setCurrentBlock(
"prop_text_propval");
 
  316                                        $tpl->parseCurrentBlock();
 
  317                                        $tpl->setCurrentBlock(
"prop_scale_propval");
 
  319                                        $tpl->parseCurrentBlock();
 
  323                                                $tpl->setCurrentBlock(
"other_answer_checkbox");
 
  325                                                $tpl->setVariable(
"OTHER_ID", $this->
getPostVar() . 
"[other][$i]");
 
  326                                                $tpl->setVariable(
"ROW_NUMBER", $i);
 
  329                                                        $tpl->setVariable(
"CHECKED_OTHER", 
' checked="checked"');
 
  331                                                $tpl->parseCurrentBlock();
 
  336                                                $tpl->setCurrentBlock(
"move");
 
  337                                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  338                                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  340                                                include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  343                                                $tpl->parseCurrentBlock();
 
  346                                        $tpl->setCurrentBlock(
"row");                                                                           
 
  348                                        $tpl->setVariable(
"ROW_NUMBER", $i);
 
  354                                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  357                                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"[scale][$i]");
 
  360                                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  363                                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  364                                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");                                                                                                                  
 
  365                                        include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  368                                        $tpl->parseCurrentBlock();
 
  372                                        $neutral_category = $cat;
 
  379                        $tpl->setCurrentBlock(
"wizard");
 
  380                        $tpl->setVariable(
"CMD_WIZARD", 
'cmd[addPhrase]');
 
  382                        $tpl->setVariable(
"WIZARD_TEXT", $lng->txt(
'add_phrase'));
 
  383                        $tpl->parseCurrentBlock();
 
  388                        $tpl->setCurrentBlock(
'savephrase');
 
  390                        $tpl->setVariable(
"VALUE_SAVE_PHRASE", $lng->txt(
'save_phrase'));
 
  391                        $tpl->parseCurrentBlock();
 
  396                        if (is_object($neutral_category) && strlen($neutral_category->title))
 
  398                                $tpl->setCurrentBlock(
"prop_text_neutral_propval");
 
  400                                $tpl->parseCurrentBlock();
 
  404                                $tpl->setCurrentBlock(
"neutral_category_title");
 
  407                                $tpl->parseCurrentBlock();
 
  409                        $tpl->setCurrentBlock(
"prop_scale_neutral_propval");
 
  410                        $scale = ($neutral_category->scale > 0) ? $neutral_category->scale : $this->values->getNewScale();
 
  412                        $tpl->parseCurrentBlock();
 
  416                                $tpl->touchBlock(
'other_answer_neutral');
 
  419                        $tpl->setCurrentBlock(
'neutral_row');                   
 
  426                                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  428                        $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"_neutral_scale");
 
  431                                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  433                        $tpl->parseCurrentBlock();
 
  438                        $tpl->setCurrentBlock(
'other_answer_title');
 
  439                        $tpl->setVariable(
"OTHER_TEXT", $lng->txt(
'use_other_answer'));
 
  440                        $tpl->parseCurrentBlock();
 
  445                $tpl->setVariable(
"SCALE_TEXT", $lng->txt(
'scale'));
 
  446                $tpl->setVariable(
"ACTIONS_TEXT", 
$lng->txt(
'actions'));
 
  448                $a_tpl->setCurrentBlock(
"prop_generic");
 
  449                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  450                $a_tpl->parseCurrentBlock();
 
  453                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  454                $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.
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