58        $this->lng = 
$DIC->language();
 
   59        $this->tpl = 
$DIC[
"tpl"];
 
   62        parent::__construct($a_title, $a_postvar);
 
   64        $this->show_wizard = 
false;
 
   65        $this->show_save_phrase = 
false;
 
   66        $this->categorytext = 
$lng->txt(
'answer');
 
   67        $this->use_other_answer = 
false;
 
   79        $this->use_other_answer = ($a_value) ? 
true : 
false;
 
   84        if (!is_object($this->values)) {
 
   87        return $this->values->getCategoryCount();
 
   92        if (is_object($this->values)) {
 
   94            for (
$i = 0; 
$i < $this->values->getCategoryCount(); 
$i++) {
 
   95                $cat = $this->values->getCategory(
$i);
 
   96                if ($cat->neutral == 0) {
 
  108        $this->show_neutral_category = $a_value;
 
  118        $this->neutral_category_title = $a_title;
 
  133        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  135        if (is_array($a_value)) {
 
  136            if (is_array($a_value[
'answer'])) {
 
  138                    $this->values->addCategory(
$value, $a_value[
'other'][
$index], 
null, 
null, $a_value[
'scale'][
$index]);
 
  142        if (array_key_exists(
'neutral', $a_value)) {
 
  143            $this->values->addCategory($a_value[
'neutral'], 0, 1, 
null, 
$_POST[$this->postvar . 
'_neutral_scale']);
 
  154        $this->values = $a_values;
 
  174        $this->allowMove = $a_allow_move;
 
  189        $this->show_wizard = $a_value;
 
  199        $this->categorytext = $a_text;
 
  209        $this->show_save_phrase = $a_value;
 
  224        $this->disabled_scale = $a_value;
 
  239        if (is_array($foundvalues)) {
 
  241            if (is_array($foundvalues[
'answer'])) {
 
  242                foreach ($foundvalues[
'answer'] as $idx => $answervalue) {
 
  243                    if (((strlen($answervalue)) == 0) && ($this->
getRequired() && (!$foundvalues[
'other'][$idx]))) {
 
  250            if (array_key_exists(
'neutral', $foundvalues)) {
 
  251                if ((strlen($foundvalues[
'neutral']) == 0) && ($this->
getRequired)) {
 
  257            if (is_array($foundvalues[
'scale'])) {
 
  258                foreach ($foundvalues[
'scale'] as $scale) {
 
  260                    if ((strlen($scale)) == 0) {
 
  265                    if (!ctype_digit($scale) || $scale <= 0) {
 
  266                        $this->
setAlert(
$lng->txt(
"msg_input_only_positive_numbers"));
 
  271                if (count(array_unique($foundvalues[
'scale'])) != count($foundvalues[
'scale'])) {
 
  278            if (strlen(
$_POST[$this->postvar . 
'_neutral_scale'])) {
 
  279                if (is_array($foundvalues[
'scale'])) {
 
  280                    if (in_array(
$_POST[$this->postvar . 
'_neutral_scale'], $foundvalues[
'scale'])) {
 
  302        $neutral_category = 
null;
 
  303        $tpl = 
new ilTemplate(
"tpl.prop_categorywizardinput.html", 
true, 
true, 
"Modules/SurveyQuestionPool");
 
  305        if (is_object($this->values)) {
 
  306            for (
$i = 0; 
$i < $this->values->getCategoryCount(); 
$i++) {
 
  307                $cat = $this->values->getCategory(
$i);
 
  308                if (!$cat->neutral) {
 
  309                    $tpl->setCurrentBlock(
"prop_text_propval");
 
  311                    $tpl->parseCurrentBlock();
 
  312                    $tpl->setCurrentBlock(
"prop_scale_propval");
 
  314                    $tpl->parseCurrentBlock();
 
  317                        $tpl->setCurrentBlock(
"other_answer_checkbox");
 
  319                        $tpl->setVariable(
"OTHER_ID", $this->
getPostVar() . 
"[other][$i]");
 
  320                        $tpl->setVariable(
"ROW_NUMBER", 
$i);
 
  322                            $tpl->setVariable(
"CHECKED_OTHER", 
' checked="checked"');
 
  324                        $tpl->parseCurrentBlock();
 
  328                        $tpl->setCurrentBlock(
"move");
 
  329                        $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  330                        $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  332                        include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  335                        $tpl->parseCurrentBlock();
 
  338                    $tpl->setCurrentBlock(
"row");
 
  340                    $tpl->setVariable(
"ROW_NUMBER", 
$i);
 
  345                        $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  348                    $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"[scale][$i]");
 
  350                        $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  353                    $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  354                    $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  355                    include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  358                    $tpl->parseCurrentBlock();
 
  360                    $neutral_category = $cat;
 
  366            $tpl->setCurrentBlock(
"wizard");
 
  367            $tpl->setVariable(
"CMD_WIZARD", 
'cmd[addPhrase]');
 
  369            $tpl->setVariable(
"WIZARD_TEXT", 
$lng->txt(
'add_phrase'));
 
  370            $tpl->parseCurrentBlock();
 
  374            $tpl->setCurrentBlock(
'savephrase');
 
  376            $tpl->setVariable(
"VALUE_SAVE_PHRASE", 
$lng->txt(
'save_phrase'));
 
  377            $tpl->parseCurrentBlock();
 
  381            if (is_object($neutral_category) && strlen($neutral_category->title)) {
 
  382                $tpl->setCurrentBlock(
"prop_text_neutral_propval");
 
  384                $tpl->parseCurrentBlock();
 
  387                $tpl->setCurrentBlock(
"neutral_category_title");
 
  390                $tpl->parseCurrentBlock();
 
  392            $tpl->setCurrentBlock(
"prop_scale_neutral_propval");
 
  393            $scale = ($neutral_category->scale > 0) ? $neutral_category->scale : $this->values->getNewScale();
 
  395            $tpl->parseCurrentBlock();
 
  398                $tpl->touchBlock(
'other_answer_neutral');
 
  401            $tpl->setCurrentBlock(
'neutral_row');
 
  407                $tpl->setVariable(
"DISABLED", 
" disabled=\"disabled\"");
 
  409            $tpl->setVariable(
"SCALE_ID", $this->
getPostVar() . 
"_neutral_scale");
 
  411                $tpl->setVariable(
"DISABLED_SCALE", 
" disabled=\"disabled\"");
 
  413            $tpl->parseCurrentBlock();
 
  417            $tpl->setCurrentBlock(
'other_answer_title');
 
  418            $tpl->setVariable(
"OTHER_TEXT", 
$lng->txt(
'use_other_answer'));
 
  419            $tpl->parseCurrentBlock();
 
  424        $tpl->setVariable(
"SCALE_TEXT", 
$lng->txt(
'scale'));
 
  425        $tpl->setVariable(
"ACTIONS_TEXT", 
$lng->txt(
'actions'));
 
  427        $a_tpl->setCurrentBlock(
"prop_generic");
 
  428        $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  429        $a_tpl->parseCurrentBlock();
 
  432        $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  433        $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