24 include_once 
"./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
 
   42                 $this->values = array();
 
   43                 if (is_array($a_value))
 
   45                         if (is_array($a_value[
'answer']))
 
   47                                 foreach ($a_value[
'answer'] as $index => 
$value)
 
   49                                         include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
 
   51                                         array_push($this->values, $answer);
 
   66                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
   69                 if (is_array($foundvalues))
 
   72                         if (is_array($foundvalues[
'answer']))
 
   74                                 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
 
   76                                         if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0))
 
   78                                                 $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
   85                         if (is_array($foundvalues[
'points']))
 
   87                                 foreach ($foundvalues[
'points'] as $points)
 
   89                                         if ($points > $max) $max = $points;
 
   90                                         if (((strlen($points)) == 0) || (!is_numeric($points))) 
 
   92                                                 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
 
   96                                 foreach ($foundvalues[
'points_unchecked'] as $points)
 
   98                                         if ($points > $max) $max = $points;
 
   99                                         if (((strlen($points)) == 0) || (!is_numeric($points))) 
 
  101                                                 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
 
  108                                 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
 
  112                         if (is_array($_FILES) && count($_FILES) && $this->
getSingleline())
 
  114                                 if (!$this->hideImages)
 
  116                                         if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image']))
 
  118                                                 foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index => $error)
 
  125                                                                         case UPLOAD_ERR_INI_SIZE:
 
  126                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  130                                                                         case UPLOAD_ERR_FORM_SIZE:
 
  131                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  135                                                                         case UPLOAD_ERR_PARTIAL:
 
  136                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  140                                                                         case UPLOAD_ERR_NO_FILE:
 
  143                                                                                         if ((!strlen($foundvalues[
'imagename'][$index])) && (!strlen($foundvalues[
'answer'][$index])))
 
  145                                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  151                                                                         case UPLOAD_ERR_NO_TMP_DIR:
 
  152                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  156                                                                         case UPLOAD_ERR_CANT_WRITE:
 
  157                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  161                                                                         case UPLOAD_ERR_EXTENSION:
 
  162                                                                                 $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  173                                                         $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  178                                         if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
 
  180                                                 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
 
  184                                                         $suffix = $filename_arr[
"extension"];
 
  185                                                         $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
 
  186                                                         $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
 
  188                                                         if (strlen($tmpname) && is_array($this->
getSuffixes()))
 
  192                                                                         $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  199                                         if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
 
  201                                                 foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
 
  205                                                         $suffix = $filename_arr[
"extension"];
 
  206                                                         $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
 
  207                                                         $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
 
  209                                                         if (strlen($tmpname))
 
  212                                                                 if ($vir[0] == 
false)
 
  214                                                                         $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
 
  225                         $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  241                 $tpl = 
new ilTemplate(
"tpl.prop_multiplechoicewizardinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  243                 foreach ($this->values as 
$value)
 
  247                                 if (!$this->hideImages)
 
  249                                         if (strlen($value->getImage()))
 
  251                                                 $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
 
  252                                                 if (($this->
getSingleline()) && ($this->qstObject->getThumbSize()))
 
  254                                                         if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage()))
 
  256                                                                 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
 
  259                                                 $tpl->setCurrentBlock(
'image');
 
  260                                                 $tpl->setVariable(
'SRC_IMAGE', $imagename);
 
  261                                                 $tpl->setVariable(
'IMAGE_NAME', $value->getImage());
 
  263                                                 $tpl->setVariable(
"TXT_DELETE_EXISTING", $lng->txt(
"delete_existing_file"));
 
  264                                                 $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  266                                                 $tpl->parseCurrentBlock();
 
  268                                         $tpl->setCurrentBlock(
'addimage');
 
  269                                         $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() . 
"[image][$i]");
 
  270                                         $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
 
  271                                         $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  273                                         $tpl->parseCurrentBlock();
 
  276                                 if (is_object($value))
 
  278                                         $tpl->setCurrentBlock(
"prop_text_propval");
 
  280                                         $tpl->parseCurrentBlock();
 
  281                                         $tpl->setCurrentBlock(
"prop_points_propval");
 
  283                                         $tpl->parseCurrentBlock();
 
  284                                         $tpl->setCurrentBlock(
"prop_points_unchecked_propval");
 
  286                                         $tpl->parseCurrentBlock();
 
  288                                 $tpl->setCurrentBlock(
'singleline');
 
  290                                 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  291                                 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
 
  296                                         $tpl->setVariable(
"DISABLED_SINGLELINE", 
" disabled=\"disabled\"");
 
  298                                 $tpl->parseCurrentBlock();
 
  302                                 if (is_object($value))
 
  304                                         $tpl->setCurrentBlock(
"prop_points_propval");
 
  306                                         $tpl->parseCurrentBlock();
 
  307                                         $tpl->setCurrentBlock(
"prop_points_unchecked_propval");
 
  309                                         $tpl->parseCurrentBlock();
 
  311                                 $tpl->setCurrentBlock(
'multiline');
 
  313                                 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  314                                 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
 
  318                                         $tpl->setVariable(
"DISABLED_MULTILINE", 
" disabled=\"disabled\"");
 
  320                                 $tpl->parseCurrentBlock();
 
  324                                 $tpl->setCurrentBlock(
"move");
 
  325                                 $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  326                                 $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  330                                 $tpl->parseCurrentBlock();
 
  332                         $tpl->setCurrentBlock(
"row");
 
  333                         $class = ($i % 2 == 0) ? 
"even" : 
"odd";
 
  334                         if ($i == 0) $class .= 
" first";
 
  335                         if ($i == count($this->values)-1) $class .= 
" last";
 
  336                         $tpl->setVariable(
"ROW_CLASS", $class);
 
  338                         $tpl->setVariable(
"ROW_NUMBER", $i);
 
  340                         $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() . 
"[points][$i]");
 
  341                         $tpl->setVariable(
"POINTS_UNCHECKED_ID", $this->
getPostVar() . 
"[points_unchecked][$i]");
 
  342                         $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  343                         $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  346                                 $tpl->setVariable(
"DISABLED_POINTS", 
" disabled=\"disabled\"");
 
  350                         $tpl->parseCurrentBlock();
 
  356                         if (!$this->hideImages)
 
  360                                         $suff_str = $delim = 
"";
 
  363                                                 $suff_str.= $delim.
".".
$suffix;
 
  366                                         $tpl->setCurrentBlock(
'allowed_image_suffixes');
 
  367                                         $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", $lng->txt(
"file_allowed_suffixes").
" ".$suff_str);
 
  368                                         $tpl->parseCurrentBlock();
 
  371                                 $tpl->setCurrentBlock(
"image_heading");
 
  372                                 $tpl->setVariable(
"ANSWER_IMAGE", $lng->txt(
'answer_image'));
 
  374                                 $tpl->parseCurrentBlock();
 
  379                 $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
 
  380                 $tpl->setVariable(
"TEXT_NO", $lng->txt(
'no'));
 
  381                 $tpl->setVariable(
"DELETE_IMAGE_HEADER", $lng->txt(
'delete_image_header'));
 
  382                 $tpl->setVariable(
"DELETE_IMAGE_QUESTION", $lng->txt(
'delete_image_question'));
 
  383                 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
 
  384                 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
 
  385                 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
 
  386                 $tpl->setVariable(
"POINTS_CHECKED_TEXT", $lng->txt(
'checkbox_checked'));
 
  387                 $tpl->setVariable(
"POINTS_UNCHECKED_TEXT", $lng->txt(
'checkbox_unchecked'));
 
  389                 $a_tpl->setCurrentBlock(
"prop_generic");
 
  390                 $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  391                 $a_tpl->parseCurrentBlock();
 
  394                 include_once 
"./Services/YUI/classes/class.ilYuiUtil.php";
 
  396                 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/multiplechoicewizard.js");