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)) {
 
   46            if (is_array($a_value[
'answer'])) {
 
   48                    include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
 
   50                    array_push($this->values, $answer);
 
   63        $this->suffixes = $a_suffixes;
 
   73        $this->hideImages = $a_hide;
 
   88        $this->showPoints = $a_value;
 
  103        $this->values = $a_values;
 
  123        $this->singleline = $a_value;
 
  143        $this->qstObject =&$a_value;
 
  163        $this->allowMove = $a_allow_move;
 
  185        include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  191        if (is_array($foundvalues)) {
 
  193            if (is_array($foundvalues[
'answer'])) {
 
  194                foreach ($foundvalues[
'answer'] as $aidx => $answervalue) {
 
  195                    if (((strlen($answervalue)) == 0) && (strlen($foundvalues[
'imagename'][$aidx]) == 0)) {
 
  196                        $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  203            if (is_array($foundvalues[
'points'])) {
 
  204                foreach ($foundvalues[
'points'] as $points) {
 
  205                    if ($points > $max) {
 
  208                    if (((strlen($points)) == 0) || (!is_numeric($points))) {
 
  209                        $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
 
  215                $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
 
  219            if (is_array($_FILES) && count($_FILES) && $this->
getSingleline() && (!$this->hideImages)) {
 
  220                if (is_array($_FILES[$this->
getPostVar()][
'error'][
'image'])) {
 
  225                                case UPLOAD_ERR_INI_SIZE:
 
  226                                    $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  230                                case UPLOAD_ERR_FORM_SIZE:
 
  231                                    $this->
setAlert($lng->txt(
"form_msg_file_size_exceeds"));
 
  235                                case UPLOAD_ERR_PARTIAL:
 
  236                                    $this->
setAlert($lng->txt(
"form_msg_file_partially_uploaded"));
 
  240                                case UPLOAD_ERR_NO_FILE:
 
  242                                        if ((!strlen($foundvalues[
'imagename'][
$index])) && (!strlen($foundvalues[
'answer'][
$index]))) {
 
  243                                            $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  249                                case UPLOAD_ERR_NO_TMP_DIR:
 
  250                                    $this->
setAlert($lng->txt(
"form_msg_file_missing_tmp_dir"));
 
  254                                case UPLOAD_ERR_CANT_WRITE:
 
  255                                    $this->
setAlert($lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
  259                                case UPLOAD_ERR_EXTENSION:
 
  260                                    $this->
setAlert($lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  268                        $this->
setAlert($lng->txt(
"form_msg_file_no_upload"));
 
  273                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
 
  274                    foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as 
$index => $tmpname) {
 
  277                        $suffix = $filename_arr[
"extension"];
 
  281                        if (strlen($tmpname) && is_array($this->
getSuffixes())) {
 
  283                                $this->
setAlert($lng->txt(
"form_msg_file_wrong_file_type"));
 
  290                if (is_array($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'])) {
 
  291                    foreach ($_FILES[$this->
getPostVar()][
'tmp_name'][
'image'] as 
$index => $tmpname) {
 
  294                        $suffix = $filename_arr[
"extension"];
 
  298                        if (strlen($tmpname)) {
 
  300                            if ($vir[0] == 
false) {
 
  301                                $this->
setAlert($lng->txt(
"form_msg_file_virus_found") . 
"<br />" . $vir[1]);
 
  309            $this->
setAlert($lng->txt(
"msg_input_is_required"));
 
  323        $tpl = 
new ilTemplate(
"tpl.prop_singlechoicewizardinput.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  325        foreach ($this->values as 
$value) {
 
  327                if (!$this->hideImages) {
 
  328                    if (strlen(
$value->getImage())) {
 
  329                        $imagename = $this->qstObject->getImagePathWeb() . 
$value->getImage();
 
  330                        if (($this->
getSingleline()) && ($this->qstObject->getThumbSize())) {
 
  331                            if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . 
$value->getImage())) {
 
  332                                $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . 
$value->getImage();
 
  335                        $tpl->setCurrentBlock(
'image');
 
  336                        $tpl->setVariable(
'SRC_IMAGE', $imagename);
 
  337                        $tpl->setVariable(
'IMAGE_NAME', 
$value->getImage());
 
  339                        $tpl->setVariable(
"TXT_DELETE_EXISTING", 
$lng->txt(
"delete_existing_file"));
 
  340                        $tpl->setVariable(
"IMAGE_ROW_NUMBER", 
$i);
 
  342                        $tpl->parseCurrentBlock();
 
  344                    $tpl->setCurrentBlock(
'addimage');
 
  345                    $tpl->setVariable(
"IMAGE_BROWSE", $lng->txt(
'select_file'));
 
  346                    $tpl->setVariable(
"IMAGE_ID", $this->
getPostVar() . 
"[image][$i]");
 
  347                    $tpl->setVariable(
"IMAGE_SUBMIT", $lng->txt(
"upload"));
 
  348                    $tpl->setVariable(
"IMAGE_ROW_NUMBER", 
$i);
 
  350                    $tpl->parseCurrentBlock();
 
  354                    $tpl->setCurrentBlock(
"prop_text_propval");
 
  356                    $tpl->parseCurrentBlock();
 
  358                        $tpl->setCurrentBlock(
"prop_points_propval");
 
  360                        $tpl->parseCurrentBlock();
 
  363                $tpl->setCurrentBlock(
'singleline');
 
  365                $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  366                $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", 
$i);
 
  370                    $tpl->setVariable(
"DISABLED_SINGLELINE", 
" disabled=\"disabled\"");
 
  372                $tpl->parseCurrentBlock();
 
  376                        $tpl->setCurrentBlock(
"prop_points_propval");
 
  378                        $tpl->parseCurrentBlock();
 
  381                $tpl->setCurrentBlock(
'multiline');
 
  383                $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() . 
"[answer][$i]");
 
  384                $tpl->setVariable(
"MULTILINE_ROW_NUMBER", 
$i);
 
  387                    $tpl->setVariable(
"DISABLED_MULTILINE", 
" disabled=\"disabled\"");
 
  389                $tpl->parseCurrentBlock();
 
  392                $tpl->setCurrentBlock(
"move");
 
  393                $tpl->setVariable(
"CMD_UP", 
"cmd[up" . $this->
getFieldId() . 
"][$i]");
 
  394                $tpl->setVariable(
"CMD_DOWN", 
"cmd[down" . $this->
getFieldId() . 
"][$i]");
 
  398                $tpl->parseCurrentBlock();
 
  401                $tpl->setCurrentBlock(
"points");
 
  402                $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() . 
"[points][$i]");
 
  404                $tpl->setVariable(
"POINTS_ROW_NUMBER", 
$i);
 
  405                $tpl->parseCurrentBlock();
 
  407            $tpl->setCurrentBlock(
"row");
 
  409            $tpl->setVariable(
"ROW_NUMBER", 
$i);
 
  411            $tpl->setVariable(
"CMD_ADD", 
"cmd[add" . $this->
getFieldId() . 
"][$i]");
 
  412            $tpl->setVariable(
"CMD_REMOVE", 
"cmd[remove" . $this->
getFieldId() . 
"][$i]");
 
  414                $tpl->setVariable(
"DISABLED_POINTS", 
" disabled=\"disabled\"");
 
  418            $tpl->parseCurrentBlock();
 
  423            if (!$this->hideImages) {
 
  425                    $suff_str = $delim = 
"";
 
  427                        $suff_str.= $delim . 
"." . 
$suffix;
 
  430                    $tpl->setCurrentBlock(
'allowed_image_suffixes');
 
  431                    $tpl->setVariable(
"TXT_ALLOWED_SUFFIXES", 
$lng->txt(
"file_allowed_suffixes") . 
" " . $suff_str);
 
  432                    $tpl->parseCurrentBlock();
 
  434                $tpl->setCurrentBlock(
"image_heading");
 
  435                $tpl->setVariable(
"ANSWER_IMAGE", 
$lng->txt(
'answer_image'));
 
  437                $tpl->parseCurrentBlock();
 
  442            $tpl->setCurrentBlock(
"points_heading");
 
  443            $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
 
  444            $tpl->parseCurrentBlock();
 
  448        $tpl->setVariable(
"TEXT_YES", $lng->txt(
'yes'));
 
  449        $tpl->setVariable(
"TEXT_NO", 
$lng->txt(
'no'));
 
  450        $tpl->setVariable(
"DELETE_IMAGE_HEADER", 
$lng->txt(
'delete_image_header'));
 
  451        $tpl->setVariable(
"DELETE_IMAGE_QUESTION", 
$lng->txt(
'delete_image_question'));
 
  452        $tpl->setVariable(
"ANSWER_TEXT", 
$lng->txt(
'answer_text'));
 
  453        $tpl->setVariable(
"COMMANDS_TEXT", 
$lng->txt(
'actions'));
 
  455        $a_tpl->setCurrentBlock(
"prop_generic");
 
  456        $a_tpl->setVariable(
"PROP_GENERIC", 
$tpl->get());
 
  457        $a_tpl->parseCurrentBlock();
 
  460        $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
 
  461        $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/singlechoicewizard.js");
 
Class for answers with a binary state indicator.
An exception for terminatinating execution or to throw for unit testing.
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