4require_once 
'./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php';
 
    5require_once 
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
 
   39                parent::__construct($a_title, $a_postvar);
 
   40                $this->
setSuffixes(array(
"jpg", 
"jpeg", 
"png", 
"gif"));
 
   42                $this->text_name = 
$lng->txt(
'answer_text');
 
   43                $this->image_name = 
$lng->txt(
'answer_image');
 
   53                $this->suffixes = $a_suffixes;
 
   73                $this->hideImages = $a_hide;
 
   83                $this->values = $a_values;
 
   98                $this->text_name = $a_value;
 
  103                $this->image_name = $a_value;
 
  113                $this->qstObject =& $a_value;
 
  133                $this->allowMove = $a_allow_move;
 
  153                $this->values = array();
 
  154                if (is_array($a_value))
 
  156                        if (is_array($a_value[
'answer']))
 
  158                                foreach ($a_value[
'answer'] as $index => 
$value)
 
  160                                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
  162                                        array_push($this->values, $answer);
 
  176                include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  182                if (is_array($foundvalues))
 
  185                        if (is_array($foundvalues[
'answer']))
 
  187                                foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
 
  189                                        if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0))
 
  191                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  196                        if (!$this->hideImages)
 
  198                                if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image']))
 
  200                                        foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index => $error)
 
  207                                                                case UPLOAD_ERR_INI_SIZE:
 
  208                                                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  212                                                                case UPLOAD_ERR_FORM_SIZE:
 
  213                                                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  217                                                                case UPLOAD_ERR_PARTIAL:
 
  218                                                                        $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  222                                                                case UPLOAD_ERR_NO_FILE:
 
  225                                                                                if ((!strlen($foundvalues[
'imagename'][$index])) && (!strlen($foundvalues[
'answer'][$index])))
 
  227                                                                                        $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  233                                                                case UPLOAD_ERR_NO_TMP_DIR:
 
  234                                                                        $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  238                                                                case UPLOAD_ERR_CANT_WRITE:
 
  239                                                                        $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  243                                                                case UPLOAD_ERR_EXTENSION:
 
  244                                                                        $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  252                                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
 
  254                                        foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
 
  258                                                $suffix = $filename_arr[
"extension"];
 
  261                                                if (strlen($tmpname) && is_array($this->
getSuffixes()))
 
  264                                                        if ($vir[0] == 
false)
 
  266                                                                $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
 
  272                                                                $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  292                $tpl = 
new ilTemplate(
"tpl.prop_matchingwizardinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  294                foreach ($this->values as 
$value)
 
  296                        if (!$this->hideImages)
 
  298                                if (strlen(
$value->picture))
 
  300                                        $imagename = $this->qstObject->getImagePathWeb() . 
$value->picture;
 
  301                                        if ($this->qstObject->getThumbSize())
 
  303                                                if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . 
$value->picture))
 
  305                                                        $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . 
$value->picture;
 
  308                                        $tpl->setCurrentBlock(
'image');
 
  309                                        $tpl->setVariable(
'SRC_IMAGE', $imagename);
 
  310                                        $tpl->setVariable(
'IMAGE_NAME', 
$value->picture);
 
  312                                        $tpl->setVariable(
"TXT_DELETE_EXISTING", 
$lng->txt(
"delete_existing_file"));
 
  313                                        $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  315                                        $tpl->parseCurrentBlock();
 
  317                                $tpl->setCurrentBlock(
'addimage');
 
  318                                $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() . 
"[image][$i]");
 
  319                                $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
 
  320                                $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  322                                $tpl->parseCurrentBlock();
 
  327                                $tpl->setCurrentBlock(
"prop_text_propval");
 
  329                                $tpl->parseCurrentBlock();
 
  334                        $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  335                        $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
 
  340                                $tpl->setVariable(
"DISABLED_SINGLELINE", 
" disabled=\"disabled\"");
 
  342                        $tpl->parseCurrentBlock();
 
  345                                $tpl->setCurrentBlock(
"move");
 
  346                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  347                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  351                                $tpl->parseCurrentBlock();
 
  353                        $tpl->setCurrentBlock(
"row");
 
  355                        $tpl->setVariable(
"ROW_NUMBER", $i+1);
 
  356                        $tpl->setVariable(
"ROW_IDENTIFIER", 
$value->identifier);
 
  358                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  359                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  362                        $tpl->parseCurrentBlock();
 
  366                if (!$this->hideImages)
 
  370                                $suff_str = $delim = 
"";
 
  373                                        $suff_str.= $delim.
".".
$suffix;
 
  376                                $tpl->setCurrentBlock(
'allowed_image_suffixes');
 
  377                                $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", 
$lng->txt(
"file_allowed_suffixes").
" ".$suff_str);
 
  378                                $tpl->parseCurrentBlock();
 
  380                        $tpl->setCurrentBlock(
"image_heading");
 
  381                        $tpl->setVariable(
"ANSWER_IMAGE", $this->image_name);
 
  383                        $tpl->parseCurrentBlock();
 
  387                $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
 
  388                $tpl->setVariable(
"TEXT_NO", 
$lng->txt(
'no'));
 
  389                $tpl->setVariable(
"DELETE_IMAGE_HEADER", 
$lng->txt(
'delete_image_header'));
 
  390                $tpl->setVariable(
"DELETE_IMAGE_QUESTION", 
$lng->txt(
'delete_image_question'));
 
  391                $tpl->setVariable(
"ANSWER_TEXT", $this->text_name);
 
  392                $tpl->setVariable(
"NUMBER_TEXT", 
$lng->txt(
'row'));
 
  393                $tpl->setVariable(
"COMMANDS_TEXT", 
$lng->txt(
'actions'));
 
  395                $a_tpl->setCurrentBlock(
"prop_generic");
 
  396                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  397                $a_tpl->parseCurrentBlock();
 
Class for matching question terms.
static get($a_glyph, $a_text="")
Get glyph html.
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
getMaxLength()
Get Max Length.
setSize($a_size)
Set Size.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public