Example #1
0
 /**
  * Set the question display method
  * @param string $value
  */
 public function set_display_method($value)
 {
     if ($value == $this->_answer_negative) {
         $value = '';
     }
     parent::set_display_method($value);
 }
Example #2
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_score_methods = array($this->_lang_strings['markperquestion'], $this->_lang_strings['markperoption'], $this->_lang_strings['allowpartial'], $this->_lang_strings['bonusmark']);
     $this->_fields_unified = array('marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect'], 'marks_partial' => $this->_lang_strings['markspartial']);
     // 'correct' is not a unified field for Rank questions
     $this->_fields_editable[] = 'correct';
 }
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_fields_unified = array('marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect']);
     $this->_display_methods = array('vertical' => $this->_lang_strings['vertical'], 'horizontal' => $this->_lang_strings['horizontal'], 'dropdown' => $this->_lang_strings['dropdownlist']);
     // 'correct' is not a unified field for True/False questions
     $this->_fields_editable[] = 'correct';
 }
 /**
  * Persist the object to the database
  * @return boolean Success or failure of the save operation
  * @throws ValidationException
  */
 public function save($clear_checkout = true)
 {
     // Make sure 'correct' value is set for option
     if ((!isset($this->correct) or $this->correct = '') and $this->points1 != '' and count($this->options) > 0) {
         $this->set_points1($this->points1);
     }
     return parent::save($clear_checkout);
 }
Example #5
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_fields_unified = array('text' => $this->_lang_strings['questionstem'], 'marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect']);
     $this->_display_methods = array('dropdown' => $this->_lang_strings['dropdownlists'], 'textboxes' => $this->_lang_strings['textboxes']);
     // 'correct' is not a unified field for Dichotomous questions
     $this->_fields_editable[] = 'correct';
 }
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_fields_unified = array('marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect']);
     $this->_display_methods = array('TF_NegativeAbstain' => $this->_lang_strings['tfnegativeabstain'], 'TF_Positive' => $this->_lang_strings['tfpositive'], 'YN_NegativeAbstain' => $this->_lang_strings['ynnegativeabstain'], 'YN_Positive' => $this->_lang_strings['ynpositive']);
     // 'correct' is not a unified field for Dichotomous questions
     $this->_fields_editable[] = 'correct';
 }
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_score_methods = array($this->_lang_strings['allowpartial']);
     $this->_fields_unified = array('correct' => $this->_lang_strings['correctanswer'], 'marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect'], 'marks_partial' => $this->_lang_strings['markspartial']);
     // Convert the max number of options into a list of variables
     $this->_variables = range('A', chr(64 + $this->max_options));
     $this->option_order = 'display order';
 }
Example #8
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->sct_types = array(array($this->_lang_strings['hypothesis'], $this->_lang_strings['veryunlikely'], $this->_lang_strings['unlikely'], $this->_lang_strings['neithernorlikely'], $this->_lang_strings['morelikely'], $this->_lang_strings['verylikely']), array($this->_lang_strings['investigation'], $this->_lang_strings['useless'], $this->_lang_strings['lessuseful'], $this->_lang_strings['neithernoruseful'], $this->_lang_strings['moreuseful'], $this->_lang_strings['veryuseful']), array($this->_lang_strings['prescription'], $this->_lang_strings['contraindicatedtotally'], $this->_lang_strings['detrimental'], $this->_lang_strings['neithernoruseful'], $this->_lang_strings['useful'], $this->_lang_strings['necessary']), array($this->_lang_strings['intervention'], $this->_lang_strings['contraindicated'], $this->_lang_strings['lessindicated'], $this->_lang_strings['neithernorindicated'], $this->_lang_strings['indicated'], $this->_lang_strings['stronglyindicated']), array($this->_lang_strings['treatment'], $this->_lang_strings['contraindicated'], $this->_lang_strings['lessindicated'], $this->_lang_strings['neithernorindicated'], $this->_lang_strings['indicated'], $this->_lang_strings['stronglyindicated']));
     $i = 1;
     foreach ($this->sct_types as $type) {
         $this->_display_methods[$i] = $this->_lang_strings['this'] . ' ' . strtolower($type[0]) . ' ' . $this->_lang_strings['becomes'];
         $i++;
     }
     // 'correct' is not a unified field for SCT questions
     $this->_fields_unified = array();
     $this->_fields_editable[] = 'correct';
 }
 /**
  * Persist the object to the database
  * @return boolean Success or failure of the save operation
  * @throws ValidationException
  */
 public function save($clear_checkout = true)
 {
     // Extract options into arrays for JSON encoding
     $this->extract_answers();
     $this->extract_vars();
     $this->extract_marks();
     try {
         $status = parent::save($clear_checkout);
     } catch (ValidationException $ex) {
         $this->unserialize_settings();
         throw new ValidationException($ex->getMessage());
     }
     return $status;
 }
Example #10
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
 }
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     // 'correct' is not a unified field for Extmatch because it is compound
     $this->_fields_unified = array('marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect']);
 }
Example #12
0
 /**
  * Restore a previously deleted question
  * @param int $id
  * @return bool True or false depending on success or failure of the restore operation
  */
 public static function restore($id)
 {
     $success = false;
     return QuestionEdit::update_deletion_status($id, null, $mysqli);
 }
Example #13
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_fields_unified = array('marks_correct' => $this->_lang_strings['markscorrect'], 'marks_incorrect' => $this->_lang_strings['marksincorrect']);
 }
Example #14
0
        $critical_error = sprintf($string['typeinvalid'], htmlentities($_GET['type']));
    } else {
        try {
            $question = QuestionEdit::question_factory($mysqli, $userObject, $string, $_GET['type']);
            $question->set_type($_GET['type']);
            $question->set_owner_id($userObject->get_user_ID());
            $question->set_teams(Paper_utils::get_modules($paper_id, $mysqli));
        } catch (ClassNotFoundException $ex) {
            $critical_error = $ex->getMessage();
        }
    }
} else {
    // We're editing an existing question
    $mode = $string['edit'];
    try {
        $question = QuestionEdit::question_factory($mysqli, $userObject, $string, $_REQUEST['q_id']);
    } catch (Exception $ex) {
        $critical_error = $ex->getMessage();
    }
}
// Handle upload of files for question types that require it
if ($critical_error == '' and $question->requires_media() and (isset($_POST['submit_media']) or isset($_POST['q_media']))) {
    if (isset($_POST['q_media']) and $_POST['q_media'] != '') {
        $new_media['filename'] = $_POST['q_media'];
        $new_media['width'] = (isset($_POST['q_media_width']) and $_POST['q_media_width'] != '') ? $_POST['q_media_width'] : 0;
        $new_media['height'] = (isset($_POST['q_media_height']) and $_POST['q_media_height'] != '') ? $_POST['q_media_height'] : 0;
    } else {
        $new_media = uploadFile('q_media');
    }
    if ($new_media !== false) {
        $question->set_media($new_media);
Example #15
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_scale_types = array($this->_lang_strings['oscescales'] => array('0|1' => '0, 1', '0|1|2' => '0, 1, 2', $this->_lang_strings['failpass3'] => $this->_lang_strings['failpass']), '3 ' . $this->_lang_strings['pointscales'] => array($this->_lang_strings['lowhigh3'] => $this->_lang_strings['lowhigh'], $this->_lang_strings['neveralways3'] => $this->_lang_strings['neveralways'], $this->_lang_strings['disagre3'] => $this->_lang_strings['disagre3point']), '4 ' . $this->_lang_strings['pointscales'] => array($this->_lang_strings['lowhigh4'] => $this->_lang_strings['lowhigh'], $this->_lang_strings['neveralways4'] => $this->_lang_strings['neveralways'], $this->_lang_strings['disagre4'] => $this->_lang_strings['disagre4point']), '5 ' . $this->_lang_strings['pointscales'] => array($this->_lang_strings['lowhigh5'] => $this->_lang_strings['lowhigh'], $this->_lang_strings['neveralways5'] => $this->_lang_strings['neveralways'], $this->_lang_strings['disagre5a'] => $this->_lang_strings['disagre5pointneither'], $this->_lang_strings['disagre5b'] => $this->_lang_strings['disagre5pointuncertain'], $this->_lang_strings['disagre5c'] => $this->_lang_strings['disagre5pointneutral']));
     $this->get_all_custom_scales();
 }
Example #16
0
 function __construct($mysqli, $userObj, $lang_strings, $data = null)
 {
     parent::__construct($mysqli, $userObj, $lang_strings, $data);
     $this->_display_methods = array('vertical' => $this->_lang_strings['vertical'], 'vertical_other' => $this->_lang_strings['verticalother'], 'horizontal' => $this->_lang_strings['horizontal'], 'dropdown' => $this->_lang_strings['dropdownlist']);
 }