4require_once 
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
 
   31                parent::__construct($a_title, $a_postvar);
 
   32                $this->
setSuffixes(array(
"jpg", 
"jpeg", 
"png", 
"gif"));
 
   34                $this->validationRegexp = 
"";
 
   44                $this->values = array();
 
   45                if (is_array($a_value))
 
   47                        if (is_array($a_value[
'answer']))
 
   49                                foreach ($a_value[
'answer'] as $index => 
$value)
 
   51                                        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
 
   53                                        array_push($this->values, $answer);
 
   66                $this->suffixes = $a_suffixes;
 
   76                $this->hideImages = $a_hide;
 
   91                $this->showPoints = $a_value;
 
  106                $this->values = $a_values;
 
  126                $this->singleline = $a_value;
 
  146                $this->qstObject =& $a_value;
 
  166                $this->allowMove = $a_allow_move;
 
  188                include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  192                if (is_array($foundvalues))
 
  195                        if (is_array($foundvalues[
'answer']))
 
  197                                foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
 
  199                                        if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0))
 
  201                                                $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  208                        if (is_array($foundvalues[
'points']))
 
  210                                foreach ($foundvalues[
'points'] as $points)
 
  212                                        if ($points > $max) $max = $points;
 
  213                                        if (((strlen($points)) == 0) || (!is_numeric($points))) 
 
  215                                                $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
 
  222                                $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
 
  226                        if (is_array($_FILES) && count($_FILES) && $this->
getSingleline() && (!$this->hideImages))
 
  228                                if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image']))
 
  230                                        foreach ($_FILES[$this->
getPostVar()][
'error'][
'image'] as $index => $error)
 
  237                                                                case UPLOAD_ERR_INI_SIZE:
 
  238                                                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  242                                                                case UPLOAD_ERR_FORM_SIZE:
 
  243                                                                        $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  247                                                                case UPLOAD_ERR_PARTIAL:
 
  248                                                                        $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  252                                                                case UPLOAD_ERR_NO_FILE:
 
  255                                                                                if ((!strlen($foundvalues[
'imagename'][$index])) && (!strlen($foundvalues[
'answer'][$index])))
 
  257                                                                                        $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  263                                                                case UPLOAD_ERR_NO_TMP_DIR:
 
  264                                                                        $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  268                                                                case UPLOAD_ERR_CANT_WRITE:
 
  269                                                                        $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  273                                                                case UPLOAD_ERR_EXTENSION:
 
  274                                                                        $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  285                                                $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  290                                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
 
  292                                        foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
 
  296                                                $suffix = $filename_arr[
"extension"];
 
  297                                                $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
 
  298                                                $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
 
  300                                                if (strlen($tmpname) && is_array($this->
getSuffixes()))
 
  304                                                                $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  311                                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image']))
 
  313                                        foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as $index => $tmpname)
 
  317                                                $suffix = $filename_arr[
"extension"];
 
  318                                                $mimetype = $_FILES[$this->
getPostVar()][
'type'][
'image'][$index];
 
  319                                                $size_bytes = $_FILES[$this->
getPostVar()][
'size'][
'image'][$index];
 
  321                                                if (strlen($tmpname))
 
  324                                                        if ($vir[0] == 
false)
 
  326                                                                $this->
setAlert($lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1]);
 
  336                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  352                $tpl = 
new ilTemplate(
"tpl.prop_singlechoicewizardinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  354                foreach ($this->values as 
$value)
 
  358                                if (!$this->hideImages)
 
  360                                        if (strlen(
$value->getImage()))
 
  362                                                $imagename = $this->qstObject->getImagePathWeb() . 
$value->getImage();
 
  363                                                if (($this->
getSingleline()) && ($this->qstObject->getThumbSize()))
 
  365                                                        if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . 
$value->getImage()))
 
  367                                                                $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . 
$value->getImage();
 
  370                                                $tpl->setCurrentBlock(
'image');
 
  371                                                $tpl->setVariable(
'SRC_IMAGE', $imagename);
 
  372                                                $tpl->setVariable(
'IMAGE_NAME', 
$value->getImage());
 
  374                                                $tpl->setVariable(
"TXT_DELETE_EXISTING", 
$lng->txt(
"delete_existing_file"));
 
  375                                                $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  377                                                $tpl->parseCurrentBlock();
 
  379                                        $tpl->setCurrentBlock(
'addimage');
 
  380                                        $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() . 
"[image][$i]");
 
  381                                        $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
 
  382                                        $tpl->setVariable(
"IMAGE_ROW_NUMBER", $i);
 
  384                                        $tpl->parseCurrentBlock();
 
  389                                        $tpl->setCurrentBlock(
"prop_text_propval");
 
  391                                        $tpl->parseCurrentBlock();
 
  393                                                $tpl->setCurrentBlock(
"prop_points_propval");
 
  395                                                $tpl->parseCurrentBlock();
 
  398                                $tpl->setCurrentBlock(
'singleline');
 
  400                                $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  401                                $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
 
  406                                        $tpl->setVariable(
"DISABLED_SINGLELINE", 
" disabled=\"disabled\"");
 
  408                                $tpl->parseCurrentBlock();
 
  416                                                $tpl->setCurrentBlock(
"prop_points_propval");
 
  418                                                $tpl->parseCurrentBlock();
 
  421                                $tpl->setCurrentBlock(
'multiline');
 
  423                                $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  424                                $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
 
  428                                        $tpl->setVariable(
"DISABLED_MULTILINE", 
" disabled=\"disabled\"");
 
  430                                $tpl->parseCurrentBlock();
 
  434                                $tpl->setCurrentBlock(
"move");
 
  435                                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  436                                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  440                                $tpl->parseCurrentBlock();
 
  444                                $tpl->setCurrentBlock(
"points");
 
  445                                $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() . 
"[points][$i]");
 
  447                                $tpl->setVariable(
"POINTS_ROW_NUMBER", $i);
 
  448                                $tpl->parseCurrentBlock();
 
  450                        $tpl->setCurrentBlock(
"row");
 
  452                        $tpl->setVariable(
"ROW_NUMBER", $i);
 
  454                        $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  455                        $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  458                                $tpl->setVariable(
"DISABLED_POINTS", 
" disabled=\"disabled\"");
 
  462                        $tpl->parseCurrentBlock();
 
  468                        if (!$this->hideImages)
 
  472                                        $suff_str = $delim = 
"";
 
  475                                                $suff_str.= $delim.
".".
$suffix;
 
  478                                        $tpl->setCurrentBlock(
'allowed_image_suffixes');
 
  479                                        $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", 
$lng->txt(
"file_allowed_suffixes").
" ".$suff_str);
 
  480                                        $tpl->parseCurrentBlock();
 
  482                                $tpl->setCurrentBlock(
"image_heading");
 
  483                                $tpl->setVariable(
"ANSWER_IMAGE", 
$lng->txt(
'answer_image'));
 
  485                                $tpl->parseCurrentBlock();
 
  491                        $tpl->setCurrentBlock(
"points_heading");
 
  492                        $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
 
  493                        $tpl->parseCurrentBlock();
 
  497                $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
 
  498                $tpl->setVariable(
"TEXT_NO", 
$lng->txt(
'no'));
 
  499                $tpl->setVariable(
"DELETE_IMAGE_HEADER", 
$lng->txt(
'delete_image_header'));
 
  500                $tpl->setVariable(
"DELETE_IMAGE_QUESTION", 
$lng->txt(
'delete_image_question'));
 
  501                $tpl->setVariable(
"ANSWER_TEXT", 
$lng->txt(
'answer_text'));
 
  502                $tpl->setVariable(
"COMMANDS_TEXT", 
$lng->txt(
'actions'));
 
  504                $a_tpl->setCurrentBlock(
"prop_generic");
 
  505                $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  506                $a_tpl->parseCurrentBlock();
 
  509                $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  510                $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/singlechoicewizard.js");
 
Class for answers with a binary state indicator.
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