<?php
global $CFG;
require_once($CFG->dirroot . '/lib/moodlelib.php');
require_once($CFG->dirroot . '/wiris-quizzes/lib/functions.php');

$string['addingmatchwiris'] = wrsqz_get_string('addingmatchwiris','match');
$string['editingmatchwiris'] = wrsqz_get_string('editingmatchwiris','match');
$string['matchwiris'] = wrsqz_get_string('matchwiris','match');

?>
/**
 * This page is a popup launched when a user is editing a question and clicks
 * the button 'Initial content' of CAS field.
 * **/
  require_once('../../config.php');
  global $CFG;
  require_once($CFG->dirroot.'/wiris-quizzes/lib/functions.php');
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?php echo wrsqz_get_string('wrsqz_initialcontent'); ?></title>
        <script type="text/javascript"  src="<?php echo $CFG->wwwroot; ?>/lib/yui/yahoo/yahoo-min.js"></script>
        <script type="text/javascript"  src="<?php echo $CFG->wwwroot; ?>/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
        <script type="text/javascript" src="<?php echo $CFG->wwwroot; ?>/wiris-quizzes/js/constants.js"></script>
        <script type="text/javascript" src="<?php echo $CFG->wwwroot; ?>/wiris-quizzes/js/wiris-quizzes-edit.js"></script>
    </head>
    <body>
<?php
//applet
  $wirisCASContent = '';
  $applet = wrsqz_wirisCASAppletHTML('initial', $wirisCASContent, FALSE, "100%", "92%");
  echo $applet;
?>
         <div id="buttons" style="text-align: right; margin: 4px">
         <button id="initialCASOk"><?php echo wrsqz_get_string('wrsqz_ok'); ?></button>
         <button id="initialCASCancel"><?php echo wrsqz_get_string('wrsqz_cancel'); ?></button>
      </div>
    </body>
</html>
<?php
global $CFG;
require_once($CFG->dirroot . '/lib/moodlelib.php');
require_once($CFG->dirroot . '/wiris-quizzes/lib/functions.php');

$string['addingshortanswerwiris'] = wrsqz_get_string('addingshortanswerwiris','shortanswer');
$string['editingshortanswerwiris'] = wrsqz_get_string('editingshortanswerwiris','shortanswer');
$string['shortanswerwiris'] = wrsqz_get_string('shortanswerwiris','shortanswer');

?>
/**

@param $prefix String a name prefix. Usually $question->name_prefix. It is used
       in order to distinguish between applets.
@param $wirisCASContent String the MathML content of WIRIS CAS.
@param $printString if true, prints a string telling user that can do auxiliar
       computations.
@return an html with a tag <applet> that includes the WIRS CAS applet.

**/
function wrsqz_wirisCASAppletHTML($prefix, $wirisCASContent='', $printString = TRUE, $width = 500, $height = 265){
  global $CFG;
$casLang = empty($wirisCASContent) ? wrsqz_currentCASLanguage() : wrsqz_CASLanguageFromSession($wirisCASContent);
  $html = '<div class="wirisCASApplet">';
  if($printString){
    $html .= wrsqz_get_string('wrsqz_candocomputations')."\n";
    $html .= '<br />'."\n";
  }
  $html .= '<applet'."\n";
  $html .= 'id="'.$prefix.'wirisCAS"'."\n";
  $html .= 'width="'.$width.'" height="'.$height.'"'."\n";
  $html .= 'name="'.$prefix.'wirisCAS"'."\n";
  $html .= 'codebase="'.$CFG->wiriscascodebase.'"'."\n";
  $html .= 'archive="'.wrsqz_getCASArchive($casLang).'"'."\n";
  $html .= 'code="'.wrsqz_getCASClass($casLang).'"'."\n";
  $html .= '>'."\n";
  if($wirisCASContent){
    $html .= '<param name="command" value="false" />'."\n";
    $html .= '<param name="commands"       value="false" />'."\n";
    $html .= '<param name="interface"      value="false" />'."\n";
    $html .= '<param name="XMLinitialText" value="'.$wirisCASContent.'" />'."\n";
  }
  $html .= '</applet>';
  $html .= '<input type="hidden" id="'.$prefix.'wirisCASHidden" name="'.$prefix.'wirisCASHidden" value=""/>';
  $html .= '</div>'."\n";
  return $html;
}
<?php

global $CFG;
require_once $CFG->dirroot . '/lib/moodlelib.php';
require_once $CFG->dirroot . '/wiris-quizzes/lib/functions.php';
$string['addingtruefalsewiris'] = wrsqz_get_string('addingtruefalsewiris', 'truefalse');
$string['editingtruefalsewiris'] = wrsqz_get_string('editingtruefalsewiris', 'truefalse');
$string['truefalsewiris'] = wrsqz_get_string('truefalsewiris', 'truefalse');
/**
 * Prints the question body. Since standard moodle question functions set up
 * variables and prints html in the same function, we cannot call these functions.
 * So, the most code of this function (specially the type-specific part) is copied
 * from the standard moodle question types.
 * **/
function wrsqz_print_question_formulation_and_controls($questionType, $dbType, &$question, &$state, &$cmoptions, &$options) {
	//COMMON VARIABLES:
  global $CFG, $QTYPES;
  //1. Question text
  $formatoptions = new stdClass;
  $formatoptions->noclean = true;
  $formatoptions->para = false;

  $questiontext = format_text($question->questiontext, $question->questiontextformat,
                              $formatoptions, $cmoptions->course);

  //2. Question image
  $image = get_question_image($question);

  //3. name & strings
  $inputname = $question->name_prefix;
  $stranswer = get_string("answer", "quiz").': ';

  //4. WIRIS CAS applet
  $wirisCASApplet = '';
  $wirisCASForComputationsEnabled = !empty($question->options->wiris->options['wirisCASForComputations']);
  if($wirisCASForComputationsEnabled){
    $wirisCASContent = '';
    if (!empty($state->responses['wirisCASHidden'])) {
      $wirisCASContent = htmlentities(stripslashes_safe($state->responses['wirisCASHidden']), ENT_QUOTES, 'UTF-8');
      unset($state->responses['wirisCASHidden']);
    }else if(!empty($question->options->wiris->options['hiddenInitialCASValue'])){
      $wirisCASContent = htmlentities(stripslashes_safe($question->options->wiris->options['hiddenInitialCASValue']), ENT_QUOTES, 'UTF-8');
    }
    $wirisCASApplet = wrsqz_wirisCASAppletHTML($inputname, $wirisCASContent, false, 630, 300);
    require_js(array('yui_yahoo', 'yui_dom-event'));
    require_js(array($CFG->wwwroot.'/wiris-quizzes/js/wiris-quizzes.js',$CFG->wwwroot.'/wiris-quizzes/js/constants.js.php'));
  }
  
  //ANSWER FIELDS & FEEDBACK: QUESTION-TYPE specific
  if($questionType == 'essay'){
    // Response
    if (isset($state->responses[''])) {
      $value = stripslashes_safe($state->responses['']);
    }else{
      $value = "";
    }
    //answer
    if($wirisCASForComputationsEnabled){
      $wirisCASForComputations = $question->options->wiris->options['wirisCASForComputations'];
    }else{
      $wirisCASForComputations = '0';
    }
    //replace answer by an applet
    if($wirisCASForComputations == '2'){
      $answer = $wirisCASApplet;
      $answer .= '<input type="hidden" name="'.$inputname.'" id="edit-'.$inputname.'"/>';
      $wirisCASApplet = '';
    }else{
      if (empty($options->readonly)) {
        static $htmleditorused = false;
        $usehtmleditor = can_use_html_editor() && !$htmleditorused;
        // the student needs to type in their answer so print out a text editor
        echo '<!-- yes we can: '.$usehtmleditor.'-->';
        $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
      }else{
        //it is read only, so just format the students answer and output it
        $safeformatoptions = new stdClass;
        $safeformatoptions->para = false;
        $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
        $answer = '<div class="answerreview">' . $answer . '</div>';
      }
      if($wirisCASForComputationsEnabled){
        $wirisCASApplet = '<tr><td>'.$wirisCASApplet.'</td></tr>';
      }
    }
    
    // feedback handling
    $feedback = '';
    if ($options->feedback && !empty($answers)) {
      foreach ($answers as $answer) {
        $feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course);
      }
    }
    
  }else if($questionType == 'match'){
    $subquestions   = $state->options->subquestions;
    $correctanswers = $QTYPES[$question->qtype]->get_correct_responses($question, $state);
    $answers        = array(); // Answer choices formatted ready for output.
    $allanswers     = array(); // This and the next used to detect identical answers
    $answerids      = array(); // and adjust ids.
    $responses      = &$state->responses;

    // Prepare a list of answers, removing duplicates.
    foreach ($subquestions as $subquestion) {
      foreach ($subquestion->options->answers as $ans) {
        $allanswers[$ans->id] = $ans->answer;
        if (!in_array($ans->answer, $answers)) {
          $answers[$ans->id] = strip_tags(format_string($ans->answer, false));
          $answerids[$ans->answer] = $ans->id;
        }
      }
    }
    // Fix up the ids of any responses that point the the eliminated duplicates.
    foreach ($responses as $subquestionid => $ignored) {
      if ($responses[$subquestionid]) {
        $responses[$subquestionid] = $answerids[$allanswers[$responses[$subquestionid]]];
      }
    }
    foreach ($correctanswers as $subquestionid => $ignored) {
      $correctanswers[$subquestionid] = $answerids[$allanswers[$correctanswers[$subquestionid]]];
    }
    // Shuffle the answers
    $answers = draw_rand_array($answers, count($answers));
    // Print the input controls
    foreach ($subquestions as $key => $subquestion) {
      if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) {
        // Subquestion text:
        $a = new stdClass;
        $a->text = format_text($subquestion->questiontext,
        $question->questiontextformat, $cmoptions);
        // Drop-down list:
        $menuname = $inputname.$subquestion->id;
        $response = isset($state->responses[$subquestion->id])
                    ? $state->responses[$subquestion->id] : '0';
        $a->class = ' ';
        $a->feedbackimg = ' ';

        if ($options->readonly and $options->correct_responses) {
          if (isset($correctanswers[$subquestion->id])
          and ($correctanswers[$subquestion->id] == $response)) {
            $correctresponse = 1;
          } else {
            $correctresponse = 0;
          }
          if ($options->feedback && $response) {
            $a->class = question_get_feedback_class($correctresponse);
            $a->feedbackimg = question_get_feedback_image($correctresponse);
          }
        }

        $a->control = choose_from_menu($answers, $menuname, $response, 'choose',
                                       '', 0, true, $options->readonly);
        $anss[] = $a;
      }
    }

  }else if($questionType == 'multianswer'){

  }else if($questionType == 'multichoice'){
  
    $answers = &$question->options->answers;
    $correctanswers = $QTYPES['multichoicewiris']->get_correct_responses($question, $state);
    $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
    $answerprompt = ($question->options->single) ? get_string('singleanswer', 'quiz') :
                    get_string('multipleanswers', 'quiz');
    // Print each answer in a separate row
    foreach ($state->options->order as $key => $aid) {
      $answer = &$answers[$aid];
      $checked = '';
      $chosen = false;

      if ($question->options->single) {
        $type = 'type="radio"';
        $name   = "name=\"{$question->name_prefix}\"";
        if (isset($state->responses['']) and $aid == $state->responses['']) {
          $checked = 'checked="checked"';
          $chosen = true;
        }
      } else {
        $type = ' type="checkbox" ';
        $name   = "name=\"{$question->name_prefix}{$aid}\"";
        if (isset($state->responses[$aid])) {
          $checked = 'checked="checked"';
          $chosen = true;
        }
      }

      $a = new stdClass;
      $a->id   = $question->name_prefix . $aid;
      $a->class = '';
      $a->feedbackimg = '';

      // Print the control
      $a->control = "<input $readonly id=\"$a->id\" $name $checked $type value=\"$aid\" />";

      if ($options->correct_responses && $answer->fraction > 0) {
        $a->class = question_get_feedback_class(1);
      }
      if (($options->feedback && $chosen) || $options->correct_responses) {
        if ($type == ' type="checkbox" ') {
          $a->feedbackimg = question_get_feedback_image($answer->fraction > 0 ? 1 : 0, $chosen && $options->feedback);
        } else {
          $a->feedbackimg = question_get_feedback_image($answer->fraction, $chosen && $options->feedback);
        }
      }

      // Print the answer text
      $a->text = $QTYPES['multichoicewiris']->number_in_style($key, $question->options->answernumbering) .
                 format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);

      // Print feedback if feedback is on
      if (($options->feedback || $options->correct_responses) && $checked) {
        $a->feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course);
      } else {
        $a->feedback = '';
      }

      $anss[] = clone($a);
    }

    $feedback = '';
      if ($options->feedback) {
        if ($state->raw_grade >= $question->maxgrade/1.01) {
          $feedback = $question->options->correctfeedback;
        } else if ($state->raw_grade > 0) {
          $feedback = $question->options->partiallycorrectfeedback;
        } else {
          $feedback = $question->options->incorrectfeedback;
        }
        $feedback = format_text($feedback, $question->questiontextformat,
                    $formatoptions, $cmoptions->course);
        }

  

  }else if($questionType == 'shortanswer'){
    $value = '';
    $readonly = (empty($options->readonly)) ? '' : 'readonly="readonly"';
    $feedback = '';
		$class = '';
		$feedbackimg = '';

    if (isset($state->responses['']) && $state->responses[''] != '') {
      $value = s($state->responses[''], true);
    }
    mb_parse_str($question->options->wiris->eqoption, $eqoptionArray);
		$wirisEditorEnabled = (isset($eqoptionArray['editor']) && $eqoptionArray['editor'] == 'true');
		if($wirisCASForComputationsEnabled && $wirisEditorEnabled){
      //copy button
      $wirisCASApplet .= '<input id="'.$inputname.'copy_button" name="'.$inputname.'copy_button" type="button" '.
                         'value="'.wrsqz_get_string('wrsqz_copyresponse')
                         .'" onclick="copyCASSessionToEditor('.$question->id.',\''.$inputname.'\')"/>';
      require_js('yui_connection');
    }
    //$wirisCASForComputationsEnabled = (isset($eqoptionArray['wirisCASForComputations']) && $eqoptionArray['wirisCASForComputations'] == 'true');
		$multipleAnswers = (isset($eqoptionArray['multipleAnswers']) && $eqoptionArray['multipleAnswers'] == 'true');

		if ($multipleAnswers) {
			$formulaGrammar = 'http://' . $CFG->wirisservicehost . ':' . $CFG->wirisserviceport . $CFG->wirisservicepath . '/test/grammars/grammar-assign.txt';
			$formulaGrammarTarget = 'math2';
		}else {
			$formulaGrammar = 'http://' . $CFG->wirisservicehost . ':' . $CFG->wirisserviceport . $CFG->wirisservicepath . '/test/grammars/grammar.txt';
			$formulaGrammarTarget = 'math';
		}
    $wirisEditorApplet = wrsqz_wirisEditorAppletHTML($inputname, $formulaGrammar, $formulaGrammarTarget, $value);
    require_js(array('yui_yahoo', 'yui_dom-event'));
    require_js(array($CFG->wwwroot.'/wiris-quizzes/js/wiris-quizzes.js', $CFG->wwwroot.'/wiris-quizzes/js/constants.js.php'));
    
    // Chose feedback according to current response
		if ($options->feedback) {
			$class = question_get_feedback_class(0);
			$feedbackimg = question_get_feedback_image(0);
			$i = 0;

			foreach ($question->options->answers as $answer) {
				if (wrsqz_testResponse($question, $state, $answer) || (!empty($state->grades) && $state->grades[$i] > 0.0)) {
					$class = question_get_feedback_class($answer->fraction);
					$feedbackimg = question_get_feedback_image($answer->fraction);

					if ($answer->feedback) {
						$feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course);
					}
					break;
				}
				++$i;
			}
		}
  }else if($questionType == 'truefalse'){
    $readonly = $options->readonly ? ' disabled="disabled"' : '';
    $answers = &$question->options->answers;
    $trueanswer = &$answers[$question->options->trueanswer];
    $falseanswer = &$answers[$question->options->falseanswer];
    $correctanswer = ($trueanswer->fraction == 1) ? $trueanswer : $falseanswer;

    $trueclass = '';
    $falseclass = '';
    $truefeedbackimg = '';
    $falsefeedbackimg = '';

    // Work out which radio button to select (if any)
    if (isset($state->responses[''])) {
      $response = $state->responses[''];
    } else {
      $response = '';
    }
    $truechecked = ($response == $trueanswer->id) ? ' checked="checked"' : '';
    $falsechecked = ($response == $falseanswer->id) ? ' checked="checked"' : '';

    // Work out visual feedback for answer correctness.
    if ($options->feedback) {
      if ($truechecked) {
         $trueclass = question_get_feedback_class($trueanswer->fraction);
      } else if ($falsechecked) {
         $falseclass = question_get_feedback_class($falseanswer->fraction);
      }
    }
    if ($options->feedback || $options->correct_responses) {
      if (isset($answers[$response])) {
        $truefeedbackimg = question_get_feedback_image($trueanswer->fraction, !empty($truechecked) && $options->feedback);
        $falsefeedbackimg = question_get_feedback_image($falseanswer->fraction, !empty($falsechecked) && $options->feedback);
      }
    }

    $inputname = ' name="'.$question->name_prefix.'" ';
    $trueid    = $question->name_prefix.'true';
    $falseid   = $question->name_prefix.'false';

    $radiotrue = '<input type="radio"' . $truechecked . $readonly . $inputname
      . 'id="'.$trueid . '" value="' . $trueanswer->id . '" /><label for="'.$trueid . '">'
      . s($trueanswer->answer) . '</label>';
    $radiofalse = '<input type="radio"' . $falsechecked . $readonly . $inputname
      . 'id="'.$falseid . '" value="' . $falseanswer->id . '" /><label for="'.$falseid . '">'
      . s($falseanswer->answer) . '</label>';

    $feedback = '';
    if ($options->feedback and isset($answers[$response])) {
      //choose feedback depending on correctness of response
      if($answers[$response]->fraction == 1){
        $feedback = format_text($trueanswer->feedback, true, $formatoptions, $cmoptions->course);
      }else{
        $feedback = format_text($falseanswer->feedback, true, $formatoptions, $cmoptions->course);
      }
    }
  }
  //print body
  include("$CFG->dirroot/question/type/$question->qtype/display.html");

  //print buttons
  $QTYPES[$question->qtype]->print_question_submit_buttons($question, $state, $cmoptions, $options);
  echo '</div>'; //close <div class="block clearfix">
  if($questionType == 'essay' && empty($options->readonly) && !empty($usehtmleditor)){
    use_html_editor($inputname);
    $htmleditorused = true;
  }else if($questionType == 'truefalse'){
    echo '</div>'; //close <div class = "truefalse"/>
  }
}
<?php

global $CFG;
require_once $CFG->dirroot . '/lib/moodlelib.php';
require_once $CFG->dirroot . '/wiris-quizzes/lib/functions.php';
$string['addingmultichoicewiris'] = wrsqz_get_string('addingmultichoicewiris', 'multichoice');
$string['editingmultichoicewiris'] = wrsqz_get_string('editingmultichoicewiris', 'multichoice');
$string['multichoicewiris'] = wrsqz_get_string('multichoicewiris', 'multichoice');
<?php

global $CFG;
require_once $CFG->dirroot . '/lib/moodlelib.php';
require_once $CFG->dirroot . '/wiris-quizzes/lib/functions.php';
$string['addingessaywiris'] = wrsqz_get_string('addingessaywiris', 'essay');
$string['editingessaywiris'] = wrsqz_get_string('editingessaywiris', 'essay');
$string['essaywiris'] = wrsqz_get_string('essaywiris', 'essay');
function wrsqz_definition_inner($questionType, $dbType, &$mform) {
	global $CFG;
  //add javascript:
  require_js(array('yui_yahoo', 'yui_dom-event'));
  require_js(array($CFG->wwwroot.'/wiris-quizzes/js/wiris-quizzes-edit.js',$CFG->wwwroot.'/wiris-quizzes/js/constants.js.php'));

  $mform->addElement('header', 'moodle_qwiris', wrsqz_get_string('wrsqz_wirisquizzes'));
  $mform->setHelpButton('moodle_qwiris',array($questionType.'_main'),false,'wrsqz_helpbutton');
	if ($questionType == 'shortanswer') {
		
		//set the WIRIS quizzes form elements for each answer.
		foreach($mform->_elementIndex as $elementName => $elementValue){
			if (substr($elementName,0,7)==='answer[' and substr($elementName,-1)===']'){
			
				$i=(int)substr($elementName,7,-1);
				$testFunctionName[$i]  = $mform->createElement('text',"testFunctionName[$i]",wrsqz_get_string('wrsqz_testfunctionname'),'maxlength="254" size="15"');
				$mform->insertElementBefore($testFunctionName[$i], "feedback[$i]");
				$mform->setHelpButton("testFunctionName[$i]", array('shortanswer_testfunction'),false, 'wrsqz_helpbutton');
				$mform->setAdvanced("testFunctionName[$i]");
			
			}
		}
		
		//set the end of page WIRIS quizzes form elements.
		$mform->addElement('checkbox', 'wirisEditor', wrsqz_get_string('wrsqz_formulaeditor'));
    $mform->setHelpButton('wirisEditor',array('shortanswer_wiriseditor'),false,'wrsqz_helpbutton');
		$mform->setAdvanced('wirisEditor');
		
	}
	else if ($questionType == 'truefalse') {
		$mform->addElement('text', 'wirisAnswer', wrsqz_get_string('wrsqz_answer'), array('size' => 54));
    $mform->setHelpButton('wirisAnswer',array('truefalse_wirisanswer'),false,'wrsqz_helpbutton');
		$mform->setAdvanced('wirisAnswer');
	}
	else if ($questionType == 'multichoice') {
		foreach($mform->_elementIndex as $elementName => $elementValue){
			if (substr($elementName,0,9)==='fraction[' and substr($elementName,-1)===']'){
				$i=(int)substr($elementName,9,-1);
				$element[$i]  = $mform->createElement('text',"gradeOverride[$i]", wrsqz_get_string('wrsqz_overridegrade'), 'maxlength="254" size="15"');
				$mform->insertElementBefore($element[$i], "feedback[$i]");
                $mform->setHelpButton("gradeOverride[$i]",array('multichoice_gradeoverride'),false,'wrsqz_helpbutton');
				$mform->setAdvanced("gradeOverride[$i]");
			}
		}
	}else if ($questionType == 'multianswer') {
        //TODO (formulaEditor for cloze): uncoment this two lines
        //$mform->addElement('checkbox', 'wirisEditor', 'Formula editor','Is WIRIS Formula Editor needed for answer introduction?');
		//$mform->setAdvanced('wirisEditor');
		
    }
	
	global $CFG;

	$mform->addElement('static', 'htmlWirisEditor', wrsqz_get_string('wrsqz_wirisprogram'), '');
	$mform->setAdvanced('htmlWirisEditor');
	$mform->addElement('hidden', 'hiddenCASValue');

  $langs = wrsqz_getAvailableCASLangs();
    
  if(count($langs)>1){
    $langsAssociative = array();
    foreach ($langs as $lang){
      $langsAssociative[$lang]=$lang;
    }

        //we use javascript to emulate the submit of form when changing the select
        //option using a hidden submit element.
    $casLangAtts = array(
      'onchange' => 'skipClientValidation = true; ' . SAVE_CAS_VALUE_JS
                  . ' this.form.translateCAS.click();'
      );

    $mform->addElement('select','WIRISCASLang',wrsqz_get_string('wrsqz_wiriscaslang'),$langsAssociative,$casLangAtts);
    $mform->setAdvanced('WIRISCASLang');
    $mform->addElement('submit','translateCAS','translateCAS',array('style'=>'display: none;'));
    $mform->registerNoSubmitButton('translateCAS');
  }

//ADD WIRIS CAS FOR AUXILIAR COMPUTATIONS OPTION
  $casGroup = array();
  if($questionType == 'essay'){
    $options = array(
      '0'=>wrsqz_get_string('wrsqz_casnone'),
      '1'=>wrsqz_get_string('wrsqz_casadd'),
      '2'=>wrsqz_get_string('wrsqz_casreplace'),
    );
    $casGroup[0] = &MoodleQuickForm::createElement('select', 'wirisCASForComputations', wrsqz_get_string('wrsqz_wiriscas'), $options);
    $mform->disabledIf('initialCAS', 'wirisCASForComputations', 'eq', '0');
  }
  if($questionType == 'match' || $questionType == 'multianswer' || $questionType == 'multichoice' || $questionType == 'shortanswer' || $questionType == 'truefalse'){
    $casGroup[0] = & $mform->createElement('checkbox', 'wirisCASForComputations', wrsqz_get_string('wrsqz_wiriscas'));
    $mform->disabledIf('initialCAS', 'wirisCASForComputations');
  }
  $casGroup[1] = & $mform->createElement('button','initialCAS', wrsqz_get_string('wrsqz_initialcontent'));
  $casGroup[2] = & $mform->createElement('hidden', 'hiddenInitialCASValue');
  $mform->addGroup($casGroup,'wirisCASGroup', wrsqz_get_string('wrsqz_wiriscas'), array(' '), false);
  
  

  $mform->setAdvanced('wirisCASGroup');
  $mform->setHelpButton('wirisCASGroup',array('all_wiriscasforcomputations'),false,'wrsqz_helpbutton');
  
  if($questionType =='shortanswer'){
		
    $mform->addElement('checkbox', 'multipleAnswers', wrsqz_get_string('wrsqz_multipleanswers'));
		$mform->setAdvanced('multipleAnswers');
    $mform->disabledIf('multipleAnswers','wirisEditor');
    $mform->setHelpButton('multipleAnswers',array('shortanswer_multipleanswers'),false,'wrsqz_helpbutton');
  }
}
<?php 
global $CFG;
require_once($CFG->dirroot . '/lib/moodlelib.php');
require_once($CFG->dirroot . '/wiris-quizzes/lib/functions.php');

$string['addingmultianswerwiris'] = wrsqz_get_string('addingmultianswerwiris','multianswer');
$string['editingmultianswerwiris'] = wrsqz_get_string('editingmultianswerwiris','multianswer');
$string['multianswerwiris'] = wrsqz_get_string('multianswerwiris','multianswer');

?>