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)) {
 
  155            if (is_array($a_value[
'answer'])) {
 
  157                    include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
  159                    array_push($this->values, $answer);
 
  173        include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  178        if (is_array($foundvalues)) {
 
  180            if (is_array($foundvalues[
'answer'])) {
 
  181                foreach ($foundvalues[
'answer'] as $aidx => $answervalue) {
 
  182                    if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0)) {
 
  183                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  188            if (!$this->hideImages) {
 
  189                if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image'])) {
 
  194                                case UPLOAD_ERR_INI_SIZE:
 
  195                                    $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  199                                case UPLOAD_ERR_FORM_SIZE:
 
  200                                    $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  204                                case UPLOAD_ERR_PARTIAL:
 
  205                                    $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  209                                case UPLOAD_ERR_NO_FILE:
 
  211                                        if ((!strlen($foundvalues[
'imagename'][
$index])) && (!strlen($foundvalues[
'answer'][
$index]))) {
 
  212                                            $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  218                                case UPLOAD_ERR_NO_TMP_DIR:
 
  219                                    $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  223                                case UPLOAD_ERR_CANT_WRITE:
 
  224                                    $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  228                                case UPLOAD_ERR_EXTENSION:
 
  229                                    $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  237                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
 
  238                    foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as 
$index => $tmpname) {
 
  241                        $suffix = $filename_arr[
"extension"];
 
  244                        if (strlen($tmpname) && is_array($this->
getSuffixes())) {
 
  246                            if ($vir[0] == 
false) {
 
  247                                $this->
setAlert($lng->txt(
"form_msg_file_virus_found") . 
"<br />" . $vir[1]);
 
  252                                $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  272        $tpl = 
new ilTemplate(
"tpl.prop_matchingwizardinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  274        foreach ($this->values as 
$value) {
 
  275            if (!$this->hideImages) {
 
  276                if (strlen(
$value->picture)) {
 
  277                    $imagename = $this->qstObject->getImagePathWeb() . 
$value->picture;
 
  278                    if ($this->qstObject->getThumbSize()) {
 
  279                        if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . 
$value->picture)) {
 
  280                            $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . 
$value->picture;
 
  283                    $tpl->setCurrentBlock(
'image');
 
  284                    $tpl->setVariable(
'SRC_IMAGE', $imagename);
 
  285                    $tpl->setVariable(
'IMAGE_NAME', 
$value->picture);
 
  287                    $tpl->setVariable(
"TXT_DELETE_EXISTING", 
$lng->txt(
"delete_existing_file"));
 
  288                    $tpl->setVariable(
"IMAGE_ROW_NUMBER", 
$i);
 
  290                    $tpl->parseCurrentBlock();
 
  292                $tpl->setCurrentBlock(
'addimage');
 
  293                $tpl->setVariable(
"IMAGE_BROWSE", $lng->txt(
'select_file'));
 
  294                $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() . 
"[image][$i]");
 
  295                $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
 
  296                $tpl->setVariable(
"IMAGE_ROW_NUMBER", 
$i);
 
  298                $tpl->parseCurrentBlock();
 
  302                $tpl->setCurrentBlock(
"prop_text_propval");
 
  304                $tpl->parseCurrentBlock();
 
  309            $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  310            $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", 
$i);
 
  314                $tpl->setVariable(
"DISABLED_SINGLELINE", 
" disabled=\"disabled\"");
 
  316            $tpl->parseCurrentBlock();
 
  318                $tpl->setCurrentBlock(
"move");
 
  319                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  320                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  324                $tpl->parseCurrentBlock();
 
  326            $tpl->setCurrentBlock(
"row");
 
  328            $tpl->setVariable(
"ROW_NUMBER", 
$i+1);
 
  329            $tpl->setVariable(
"ROW_IDENTIFIER", $value->identifier);
 
  331            $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  332            $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  335            $tpl->parseCurrentBlock();
 
  339        if (!$this->hideImages) {
 
  341                $suff_str = $delim = 
"";
 
  343                    $suff_str.= $delim . 
"." . 
$suffix;
 
  346                $tpl->setCurrentBlock(
'allowed_image_suffixes');
 
  347                $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", 
$lng->txt(
"file_allowed_suffixes") . 
" " . $suff_str);
 
  348                $tpl->parseCurrentBlock();
 
  350            $tpl->setCurrentBlock(
"image_heading");
 
  351            $tpl->setVariable(
"ANSWER_IMAGE", $this->image_name);
 
  353            $tpl->parseCurrentBlock();
 
  357        $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
 
  358        $tpl->setVariable(
"TEXT_NO", 
$lng->txt(
'no'));
 
  359        $tpl->setVariable(
"DELETE_IMAGE_HEADER", 
$lng->txt(
'delete_image_header'));
 
  360        $tpl->setVariable(
"DELETE_IMAGE_QUESTION", 
$lng->txt(
'delete_image_question'));
 
  361        $tpl->setVariable(
"ANSWER_TEXT", $this->text_name);
 
  362        $tpl->setVariable(
"NUMBER_TEXT", 
$lng->txt(
'row'));
 
  363        $tpl->setVariable(
"COMMANDS_TEXT", 
$lng->txt(
'actions'));
 
  365        $a_tpl->setCurrentBlock(
"prop_generic");
 
  366        $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  367        $a_tpl->parseCurrentBlock();
 
An exception for terminatinating execution or to throw for unit testing.
Class for matching question terms.
static get($a_glyph, $a_text="")
Get glyph html.
static _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