├── .github └── workflows │ └── ci.yml ├── CHANGES.md ├── LICENSE.txt ├── README.txt ├── amd ├── build │ ├── table_sort.min.js │ └── table_sort.min.js.map └── src │ └── table_sort.js ├── appjs └── uncheckother.js ├── backup ├── moodle1 │ └── lib.php └── moodle2 │ ├── backup_questionnaire_activity_task.class.php │ ├── backup_questionnaire_settingslib.php │ ├── backup_questionnaire_stepslib.php │ ├── restore_questionnaire_activity_task.class.php │ └── restore_questionnaire_stepslib.php ├── classes ├── completion │ └── custom_completion.php ├── db │ └── bulk_sql_config.php ├── edit_question_form.php ├── event │ ├── all_responses_deleted.php │ ├── all_responses_saved_as_text.php │ ├── all_responses_viewed.php │ ├── attempt_resumed.php │ ├── attempt_saved.php │ ├── attempt_submitted.php │ ├── course_module_instance_list_viewed.php │ ├── course_module_viewed.php │ ├── non_respondents_viewed.php │ ├── question_created.php │ ├── question_deleted.php │ ├── questionnaire_previewed.php │ ├── response_deleted.php │ └── response_viewed.php ├── feedback │ ├── section.php │ └── sectionfeedback.php ├── feedback_form.php ├── feedback_section_form.php ├── file_storage.php ├── generator │ ├── question_response.php │ └── question_response_rank.php ├── output │ ├── completepage.php │ ├── fbsectionspage.php │ ├── feedbackpage.php │ ├── mobile.php │ ├── nonrespondentspage.php │ ├── previewpage.php │ ├── qsettingspage.php │ ├── questionspage.php │ ├── renderer.php │ ├── reportpage.php │ ├── reportpagepdf.php │ ├── responsepagepdf.php │ └── viewpage.php ├── privacy │ └── provider.php ├── question │ ├── check.php │ ├── choice.php │ ├── date.php │ ├── drop.php │ ├── essay.php │ ├── numerical.php │ ├── pagebreak.php │ ├── question.php │ ├── radio.php │ ├── rate.php │ ├── sectiontext.php │ ├── slider.php │ ├── text.php │ └── yesno.php ├── questions_form.php ├── responsetype │ ├── answer │ │ └── answer.php │ ├── boolean.php │ ├── date.php │ ├── multiple.php │ ├── numericaltext.php │ ├── rank.php │ ├── response │ │ └── response.php │ ├── responsetype.php │ ├── single.php │ ├── slider.php │ └── text.php ├── search │ ├── activity.php │ └── question.php ├── settings_form.php └── task │ └── cleanup.php ├── complete.php ├── composer.json ├── db ├── access.php ├── install.php ├── install.xml ├── log.php ├── messages.php ├── mobile.php ├── services.php ├── tasks.php └── upgrade.php ├── drawchart.php ├── externallib.php ├── fbsections.php ├── feedback.php ├── grade.php ├── images ├── hbar.gif ├── hbar_l.gif ├── hbar_r.gif ├── hbartransp.gif ├── print.gif ├── thbar.gif ├── thbar_l.gif └── thbar_r.gif ├── index.php ├── javascript ├── RGraph │ ├── RGraph.bar.js │ ├── RGraph.bipolar.js │ ├── RGraph.common.core.js │ ├── RGraph.hbar.js │ ├── RGraph.radar.js │ ├── RGraph.rose.js │ ├── RGraph.vprogress.js │ └── license.txt └── mobile.js ├── lang └── en │ └── questionnaire.php ├── lib.php ├── locallib.php ├── mobiledump.txt ├── mod_form.php ├── module.js ├── myreport.php ├── pix ├── b │ └── pdfdown.svg ├── icon.gif ├── icon.svg ├── monologo.png └── monologo.svg ├── preview.php ├── print.php ├── qsettings.php ├── questionnaire.class.php ├── questions.php ├── report.php ├── savefileformat.php ├── settings.php ├── show_nonrespondents.php ├── styles.css ├── styles_app.css ├── tabs.php ├── templates ├── completepage.mustache ├── dataformat_selector.mustache ├── extrafields.mustache ├── fbsectionspage.mustache ├── local │ └── mobile │ │ ├── ionic5 │ │ ├── boolean_question.mustache │ │ ├── checkbox_question.mustache │ │ ├── date_question.mustache │ │ ├── main_index_page.mustache │ │ ├── numeric_question.mustache │ │ ├── radio_question.mustache │ │ ├── rate_question.mustache │ │ ├── select_question.mustache │ │ ├── slider_question.mustache │ │ ├── text_question.mustache │ │ └── view_activity_page.mustache │ │ └── latest │ │ ├── boolean_question.mustache │ │ ├── checkbox_question.mustache │ │ ├── date_question.mustache │ │ ├── main_index_page.mustache │ │ ├── numeric_question.mustache │ │ ├── radio_question.mustache │ │ ├── rate_question.mustache │ │ ├── select_question.mustache │ │ ├── slider_question.mustache │ │ ├── text_question.mustache │ │ └── view_activity_page.mustache ├── navbaralpha.mustache ├── navbaruser.mustache ├── nonrespondentspage.mustache ├── previewpage.mustache ├── progressbar.mustache ├── qsettingspage.mustache ├── question_check.mustache ├── question_container.mustache ├── question_date.mustache ├── question_drop.mustache ├── question_numeric.mustache ├── question_radio.mustache ├── question_rate.mustache ├── question_sectionfb.mustache ├── question_slider.mustache ├── question_text.mustache ├── question_yesno.mustache ├── questionpdf_container.mustache ├── questionspage.mustache ├── reportpage.mustache ├── reportpagepdf.mustache ├── response_check.mustache ├── response_container.mustache ├── response_date.mustache ├── response_drop.mustache ├── response_numeric.mustache ├── response_radio.mustache ├── response_rate.mustache ├── response_slider.mustache ├── response_text.mustache ├── response_yesno.mustache ├── responselist.mustache ├── responsepagepdf.mustache ├── results_choice.mustache ├── results_date.mustache ├── results_rate.mustache ├── results_text.mustache ├── resultspdf_choice.mustache ├── resultspdf_date.mustache ├── resultspdf_rate.mustache ├── resultspdf_text.mustache └── viewpage.mustache ├── tests ├── behat │ ├── add_feedback.feature │ ├── add_multi_feedback_with_sections.feature │ ├── add_questionnaire.feature │ ├── add_questions.feature │ ├── anonymous_questionnaire.feature │ ├── behat_mod_questionnaire.php │ ├── check_responses.feature │ ├── check_responses_capabilities.feature │ ├── checkbox_min_max_responses.feature │ ├── checkbox_other_responses.feature │ ├── dependency_question.feature │ ├── download_responses.feature │ ├── dropdown_feedback_question_type.feature │ ├── multiple_dependency_question.feature │ ├── no_feedback_question_types.feature │ ├── numeric_question_digits.feature │ ├── numeric_question_thousands.feature │ ├── numeric_question_zero.feature │ ├── progress_bar.feature │ ├── public_questionnaire.feature │ ├── public_questionnaire_teacher.feature │ ├── questionnaire_activity_completion.feature │ ├── radio_feedback_question_type.feature │ ├── radio_question_other.feature │ ├── rate_feedback_question_type.feature │ ├── rate_question_na.feature │ ├── rate_question_named.feature │ ├── rate_question_ranking.feature │ ├── save_and_resume.feature │ ├── slider_feedback_question_type.feature │ ├── slider_question.feature │ ├── table_sort.feature │ ├── text_question_zero.feature │ ├── view_questionnaire.feature │ └── yesno_feedback_question_type.feature ├── csvexport_test.php ├── custom_completion_test.php ├── generator │ └── lib.php ├── generator_test.php ├── lib_test.php ├── privacy_provider_test.php ├── questiontypes_test.php └── responsetypes_test.php ├── thirdpartylibs.xml ├── version.php └── view.php /CHANGES.md: -------------------------------------------------------------------------------- 1 | Release Notes 2 | 3 | Release 4.1.0 (Build - 2023081100) 4 | 5 | Initial release for Moodle 4.1 forward. 6 | 7 | Release 4.1.1 (Build - 2024082900) 8 | 9 | Improvements: 10 | * Compatible with Moodle 4.3 and 4.4. 11 | * Compatible with PHP8.2. 12 | * PR449 - Allow localized answer options to be displayed correctly in conditions. 13 | * PR506 - Accessibility: improved accessibility for essay box type. 14 | * PR495 - Accessibility: The slider values should be associated with the labels and the slider should be programmatically associated with the question 15 | * PR497 - Accessibility: Rate table does not have a programmatically associated caption. 16 | * PR496 - Accessibility: Numeric instructions not programmatically associated with field. 17 | * PR505 - Accessibility: Rate form controls within the table are not accessible. 18 | * PR501 - Accessibility: Check boxes missing group label. 19 | * PR511 - Accessibility: Radio buttons & Yes/No missing group labels. 20 | * PR517 - Mobile: Update sectiontext questions to display on mobile. 21 | * PR520 - Add Slider question type compatibility with Feedback features. 22 | * PR526 - Have additional info text pass through filters everywhere fixes. 23 | * PR534 - Fix namespace issues with externallib.php file. 24 | * PR536 - Support for user identity fields in Download Responses. 25 | * PR577 - Improved headings in report page. 26 | * PR581 - Mobile: Adapt mobile code to ionic 7. 27 | * PR569 - Adopt icon size to 24×24 with a smaller content as other icons. 28 | * PR586, PR579, PR594 - Various deprecations fixed. 29 | * PR593 - Ensure "pdf" extension force. 30 | 31 | Bug Fixes: 32 | * PR508 - General PHP fixes. 33 | * PR523 - Behat activity completion fix. 34 | * PR514 - Section text qtype should not support feedback. 35 | * PR516 - Course description displays properly. 36 | 37 | (see CHANGES.md in release 4.00 for earlier changes.) 38 | 39 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | The questionnaire module allows you to construct questionnaires (surveys) from a 2 | variety of question type. It was originally based on phpESP, and Open Source 3 | survey tool. 4 | 5 | -------------------------------------------------------------------------------- 6 | Developers Note: 7 | 8 | There is no main branch. Questionnaire is maintained in MOODLE_XX_STABLE 9 | branches. Use the latest STABLE branch for development or installation. 10 | The current stable branch is MOODLE_400_STABLE, and supports Moodle 4.0 and up. 11 | Use the MOODLE_311_STABLE branch for Moodle 3.9 through 3.11. 12 | 13 | -------------------------------------------------------------------------------- 14 | To Install: 15 | 16 | 1. Load the questionnaire module directory into your "mod" subdirectory. 17 | 2. Visit your admin page to create all of the necessary data tables. 18 | 19 | -------------------------------------------------------------------------------- 20 | To Upgrade: 21 | 22 | 1. Copy all of the files into your 'mod/questionnaire' directory. 23 | 2. Visit your admin page. The database will be updated. 24 | 25 | -------------------------------------------------------------------------------- 26 | Please read the CHANGES.md file for more info about successive changes 27 | -------------------------------------------------------------------------------- /amd/build/table_sort.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * JavaScript library for questionnaire response table sorting. 3 | * 4 | * @module mod_questionnaire/table_sort 5 | * @copyright 6 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 7 | */ 8 | define("mod_questionnaire/table_sort",["jquery"],(function($){var t={init:function(){M.util.js_pending("mod_questionnaire_tablesort"),$(".qn-handcursor").on("click",t.sortcolumn),M.util.js_complete("mod_questionnaire_tablesort")},sortcolumn:function(e){e.preventDefault();var col=$(this).index(),id=$(this).closest("table").attr("id"),sortOrder=1;$(this).siblings().find('span[class^="icon-container-"]').hide(),$(this).siblings().removeClass("asc desc"),$(this).find('span[class^="icon-container-"]').removeAttr("style"),$(this).is(".asc")?($(this).removeClass("asc").addClass("desc"),sortOrder=-1):$(this).addClass("asc").removeClass("desc");var arrData=$(this).closest("table").find("tbody >tr:has(td.cell)").get();arrData.sort((function(a,b){var val1=$(a).children("td").eq(col).text(),val2=$(b).children("td").eq(col).text(),dateregx=/^\d{2}.*\d{4},/;return dateregx.test(val1)&&dateregx.test(val2)?(val1=new Date(val1))<(val2=new Date(val2))?-sortOrder:val1>val2?sortOrder:0:$.isNumeric(val1)&&$.isNumeric(val2)?1==sortOrder?val1-val2:val2-val1:val1val2?sortOrder:0})),$.each(arrData,(function(index,row){$("#"+id+" tbody").append(row)}))}};return t})); 9 | 10 | //# sourceMappingURL=table_sort.min.js.map -------------------------------------------------------------------------------- /appjs/uncheckother.js: -------------------------------------------------------------------------------- 1 | (function(t) { 2 | t.toggleRatebox = function($event, $fieldkey) { 3 | } 4 | })(this); -------------------------------------------------------------------------------- /backup/moodle2/backup_questionnaire_activity_task.class.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | defined('MOODLE_INTERNAL') || die(); 18 | 19 | // Because it exists (must). 20 | require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/backup_questionnaire_stepslib.php'); 21 | // Because it exists (optional). 22 | require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/backup_questionnaire_settingslib.php'); 23 | 24 | /** 25 | * Questionnaire backup task that provides all the settings and steps to perform one complete backup of the activity. 26 | * @package mod_questionnaire 27 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 28 | * @author Mike Churchward 29 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 30 | */ 31 | class backup_questionnaire_activity_task extends backup_activity_task { 32 | 33 | /** 34 | * Define (add) particular settings this activity can have 35 | */ 36 | protected function define_my_settings() { 37 | // No particular settings for this activity. 38 | } 39 | 40 | /** 41 | * Define (add) particular steps this activity can have 42 | */ 43 | protected function define_my_steps() { 44 | // Choice only has one structure step. 45 | $this->add_step(new backup_questionnaire_activity_structure_step('questionnaire_structure', 'questionnaire.xml')); 46 | } 47 | 48 | /** 49 | * Code the transformations to perform in the activity in 50 | * order to get transportable (encoded) links 51 | * @param string $content 52 | * @return array|string|string[]|null 53 | */ 54 | public static function encode_content_links($content) { 55 | global $CFG; 56 | 57 | $base = preg_quote($CFG->wwwroot, "/"); 58 | 59 | // Link to the list of questionnaires. 60 | $search = "/(".$base."\/mod\/questionnaire\/index.php\?id\=)([0-9]+)/"; 61 | $content = preg_replace($search, '$@QUESTIONNAIREINDEX*$2@$', $content); 62 | 63 | // Link to questionnaire view by moduleid. 64 | $search = "/(".$base."\/mod\/questionnaire\/view.php\?id\=)([0-9]+)/"; 65 | $content = preg_replace($search, '$@QUESTIONNAIREVIEWBYID*$2@$', $content); 66 | 67 | return $content; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /backup/moodle2/backup_questionnaire_settingslib.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The required settingslib file. 19 | * @package mod_questionnaire 20 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 21 | * @author Mike Churchward 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | // This activity has no particular settings but the inherited from the generic 26 | // backup_activity_task so here there isn't any class definition, like the ones 27 | // existing in /backup/moodle2/backup_settingslib.php (activities section). 28 | -------------------------------------------------------------------------------- /classes/completion/custom_completion.php: -------------------------------------------------------------------------------- 1 | . 16 | declare(strict_types=1); 17 | 18 | namespace mod_questionnaire\completion; 19 | 20 | defined('MOODLE_INTERNAL') || die(); 21 | 22 | require_once($CFG->dirroot . '/mod/questionnaire/lib.php'); 23 | 24 | use coding_exception; 25 | use core_completion\activity_custom_completion; 26 | use moodle_exception; 27 | 28 | /** 29 | * Activity custom completion subclass for the data activity. 30 | * 31 | * Class for defining mod_oucontent's custom completion rules and fetching the completion statuses 32 | * of the custom completion rules for a given data instance and a user. 33 | * 34 | * @package mod_questionnaire 35 | * @copyright 2022 The Open University 36 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 | */ 38 | class custom_completion extends activity_custom_completion { 39 | /** 40 | * Fetches the completion state for a given completion rule. 41 | * 42 | * @param string $rule 43 | * @return int 44 | */ 45 | public function get_state(string $rule): int { 46 | $this->validate_rule($rule); 47 | $userid = $this->userid; 48 | $cm = $this->cm; 49 | $status = questionnaire_get_completion_state($cm, $userid, $rule); 50 | return $status ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE; 51 | } 52 | 53 | /** 54 | * Fetch the list of custom completion rules that this module defines. 55 | * 56 | * @return array 57 | */ 58 | public static function get_defined_custom_rules(): array { 59 | return [ 60 | 'completionsubmit' 61 | ]; 62 | } 63 | 64 | /** 65 | * Returns an associative array of the descriptions of custom completion rules. 66 | * 67 | * @return array 68 | */ 69 | public function get_custom_rule_descriptions(): array { 70 | return [ 71 | 'completionsubmit' => get_string('completionsubmit', 'questionnaire') 72 | ]; 73 | } 74 | 75 | /** 76 | * Returns an array of all completion rules, in the order they should be displayed to users. 77 | * 78 | * @return array 79 | */ 80 | public function get_sort_order(): array { 81 | return [ 82 | 'completionsubmit', 83 | ]; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /classes/db/bulk_sql_config.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\db; 18 | 19 | /** 20 | * For bulk sql operations on useresponses. 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2015 Guy Thomas 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class bulk_sql_config { 27 | 28 | /** 29 | * @var string $table 30 | */ 31 | public $table = ''; 32 | 33 | /** 34 | * @var string $tablealias 35 | */ 36 | public $tablealias = ''; 37 | 38 | /** 39 | * @var bool $usechoiceid 40 | */ 41 | protected $usechoiceid = false; 42 | 43 | /** 44 | * @var bool $useresponse 45 | */ 46 | protected $useresponse = false; 47 | 48 | /** 49 | * @var bool $userank 50 | */ 51 | protected $userank = false; 52 | 53 | /** 54 | * The class constructor. 55 | * @param string $table 56 | * @param string $tablealias 57 | * @param bool $usechoiceid 58 | * @param bool $useresponse 59 | * @param bool $userank 60 | */ 61 | public function __construct($table, $tablealias, $usechoiceid = false, $useresponse = false, $userank = false) { 62 | $this->table = $table; 63 | $this->tablealias = $tablealias; 64 | $this->usechoiceid = $usechoiceid; 65 | $this->useresponse = $useresponse; 66 | $this->userank = $userank; 67 | } 68 | 69 | /** 70 | * Fields that need to be included for extra select. 71 | * @return array 72 | */ 73 | public function get_extra_select() { 74 | return [ 75 | 'choice_id' => $this->usechoiceid, 76 | 'response' => $this->useresponse, 77 | 'rankvalue' => $this->userank 78 | ]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /classes/event/all_responses_deleted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire all responses deleted event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire all responses deleted event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class all_responses_deleted extends \core\event\base { 36 | 37 | /** 38 | * Init method. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'd'; 43 | $this->data['edulevel'] = self::LEVEL_TEACHING; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_all_responses_deleted', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' deleted all the responses for the questionnaire 62 | with course module id '$this->contextinstanceid'."; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /classes/event/all_responses_saved_as_text.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire all_responses_saved_as_text event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire all_responses_saved_as_text event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class all_responses_saved_as_text extends \core\event\base { 36 | 37 | /** 38 | * Init method. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'c'; 43 | $this->data['edulevel'] = self::LEVEL_TEACHING; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_all_responses_saved_as_text', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' saved as text the responses 62 | to the questionnaire with course module id '$this->contextinstanceid'."; 63 | } 64 | 65 | /** 66 | * Get URL related to the action. 67 | * 68 | * @return \moodle_url 69 | */ 70 | public function get_url() { 71 | $params = array(); 72 | $params['action'] = 'vall'; 73 | $params['group'] = $this->other['currentgroupid']; 74 | return new \moodle_url("/mod/questionnaire/report.php", $params); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /classes/event/attempt_resumed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire attempt_resumed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire attempt_resumed event. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class attempt_resumed extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'u'; 43 | $this->data['edulevel'] = self::LEVEL_OTHER; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_resumed', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' resumed an attempt for the questionnaire 62 | with course module id '$this->contextinstanceid'."; 63 | } 64 | 65 | /** 66 | * Get URL related to the action. 67 | * 68 | * @return \moodle_url 69 | */ 70 | public function get_url() { 71 | return new \moodle_url("/mod/questionnaire/view.php", array('id' => $this->contextinstanceid)); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /classes/event/attempt_saved.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire attempt_saved event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire attempt_saved event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class attempt_saved extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['crud'] = 'c'; 42 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 43 | } 44 | 45 | /** 46 | * Return localised event name. 47 | * 48 | * @return string 49 | */ 50 | public static function get_name() { 51 | return get_string('event_saved', 'mod_questionnaire'); 52 | } 53 | 54 | /** 55 | * Returns description of what happened. 56 | * 57 | * @return string 58 | */ 59 | public function get_description() { 60 | return "The user with id '$this->userid' saved a response for the questionnaire 61 | with course module id '$this->contextinstanceid'."; 62 | } 63 | 64 | /** 65 | * Get URL related to the action. 66 | * 67 | * @return \moodle_url 68 | */ 69 | public function get_url() { 70 | return new \moodle_url("/mod/questionnaire/view.php", array('id' => $this->contextinstanceid)); 71 | } 72 | 73 | /** 74 | * Custom validation. 75 | * 76 | * @throws \coding_exception 77 | * @return void 78 | */ 79 | protected function validate_data() { 80 | parent::validate_data(); 81 | if (empty($this->other['questionnaireid'])) { 82 | throw new \coding_exception('The \'questionnaireid\' value must be set in other.'); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /classes/event/attempt_submitted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire attempt_submitted event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire attempt_submitted event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class attempt_submitted extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['crud'] = 'c'; 42 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 43 | } 44 | 45 | /** 46 | * Return localised event name. 47 | * 48 | * @return string 49 | */ 50 | public static function get_name() { 51 | return get_string('event_submitted', 'mod_questionnaire'); 52 | } 53 | 54 | /** 55 | * Returns description of what happened. 56 | * 57 | * @return string 58 | */ 59 | public function get_description() { 60 | return "The user with id '$this->userid' submitted a response for the questionnaire 61 | with course module id '$this->contextinstanceid'."; 62 | } 63 | 64 | /** 65 | * Get URL related to the action. 66 | * 67 | * @return \moodle_url 68 | */ 69 | public function get_url() { 70 | return new \moodle_url("/mod/questionnaire/view.php", array('id' => $this->contextinstanceid)); 71 | } 72 | 73 | /** 74 | * Custom validation. 75 | * 76 | * @throws \coding_exception 77 | * @return void 78 | */ 79 | protected function validate_data() { 80 | parent::validate_data(); 81 | if (empty($this->other['questionnaireid'])) { 82 | throw new \coding_exception('The \'questionnaireid\' value must be set in other.'); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /classes/event/course_module_instance_list_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire instance list viewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2013 Ankit Agarwal 22 | * @copyright 2014 Joseph Rézeau 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | namespace mod_questionnaire\event; 27 | 28 | /** 29 | * The mod_questionnaire instance list viewed event class. 30 | * 31 | * @package mod_questionnaire 32 | * @since Moodle 2.7 33 | * @copyright 2013 onwards Ankit Agarwal 34 | * @copyright 2014 Joseph Rézeau 35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 | */ 37 | class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed { 38 | // No code required here as the parent class handles it all. 39 | } 40 | -------------------------------------------------------------------------------- /classes/event/course_module_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire course module viewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_survery course module viewed event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class course_module_viewed extends \core\event\course_module_viewed { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'r'; 43 | $this->data['edulevel'] = self::LEVEL_PARTICIPATING; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /classes/event/non_respondents_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire non_respondents_viewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire non_respondents_viewed event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class non_respondents_viewed extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'r'; 43 | $this->data['edulevel'] = self::LEVEL_OTHER; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_non_respondents_viewed', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' viewed the list of non-respondents to 62 | questionnaire with course module id '$this->contextinstanceid'."; 63 | } 64 | 65 | /** 66 | * Get URL related to the action. 67 | * 68 | * @return \moodle_url 69 | */ 70 | public function get_url() { 71 | $params = array(); 72 | $params['id'] = $this->contextinstanceid; 73 | return new \moodle_url("/mod/questionnaire/show_nonrespondents.php", $params); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /classes/event/question_created.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\event; 18 | 19 | /** 20 | * The mod_questionnaire question_created event class. 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2014 Joseph Rézeau 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class question_created extends \core\event\base { 27 | /** 28 | * Set basic properties for the event. 29 | */ 30 | protected function init() { 31 | $this->data['crud'] = 'c'; 32 | $this->data['edulevel'] = self::LEVEL_TEACHING; 33 | } 34 | 35 | /** 36 | * Return localised event name. 37 | * 38 | * @return string 39 | */ 40 | public static function get_name() { 41 | return get_string('event_question_created', 'mod_questionnaire'); 42 | } 43 | 44 | /** 45 | * Returns description of what happened. 46 | * 47 | * @return string 48 | */ 49 | public function get_description() { 50 | $questiontype = $this->other['questiontype']; 51 | return "The user with id '$this->userid' has created or modified a question of type '$questiontype' for " . 52 | "the questionnaire with course module id '$this->contextinstanceid'."; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /classes/event/question_deleted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\event; 18 | 19 | /** 20 | * The mod_questionnaire question_deleted event class. 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2014 Joseph Rézeau 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class question_deleted extends \core\event\base { 27 | /** 28 | * Set basic properties for the event. 29 | */ 30 | protected function init() { 31 | $this->data['crud'] = 'd'; 32 | $this->data['edulevel'] = self::LEVEL_TEACHING; 33 | } 34 | 35 | /** 36 | * Return localised event name. 37 | * 38 | * @return string 39 | */ 40 | public static function get_name() { 41 | return get_string('event_question_deleted', 'mod_questionnaire'); 42 | } 43 | 44 | /** 45 | * Returns description of what happened. 46 | * 47 | * @return string 48 | */ 49 | public function get_description() { 50 | $questiontype = $this->other['questiontype']; 51 | return "The user with id '$this->userid' has deleted a question of type '$questiontype' for 52 | the questionnaire with course module id '$this->contextinstanceid'."; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /classes/event/questionnaire_previewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire questionnaire_previewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire questionnaire_previewed event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class questionnaire_previewed extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'r'; 43 | $this->data['edulevel'] = self::LEVEL_OTHER; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_previewed', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' previewed the questionnaire with course module id '$this->contextinstanceid'."; 62 | } 63 | 64 | /** 65 | * Get URL related to the action. 66 | * 67 | * @return \moodle_url 68 | */ 69 | public function get_url() { 70 | $params = array(); 71 | $params['id'] = $this->contextinstanceid; 72 | return new \moodle_url("/mod/questionnaire/preview.php", $params); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /classes/event/response_deleted.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire response_deleted viewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire response_deleted event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class response_deleted extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'd'; 43 | $this->data['edulevel'] = self::LEVEL_OTHER; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_response_deleted', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' deleted the response by the user with id '$this->relateduserid' 62 | to the questionnaire with course module id '$this->contextinstanceid'."; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /classes/event/response_viewed.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * The mod_questionnaire response_viewed event. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2014 Joseph Rézeau 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | namespace mod_questionnaire\event; 26 | 27 | /** 28 | * The mod_questionnaire response_viewed event class. 29 | * 30 | * @package mod_questionnaire 31 | * @since Moodle 2.7 32 | * @copyright 2014 Joseph Rézeau 33 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 | */ 35 | class response_viewed extends \core\event\base { 36 | 37 | /** 38 | * Set basic properties for the event. 39 | */ 40 | protected function init() { 41 | $this->data['objecttable'] = 'questionnaire'; 42 | $this->data['crud'] = 'r'; 43 | $this->data['edulevel'] = self::LEVEL_OTHER; 44 | } 45 | 46 | /** 47 | * Return localised event name. 48 | * 49 | * @return string 50 | */ 51 | public static function get_name() { 52 | return get_string('event_individual_responses_viewed', 'mod_questionnaire'); 53 | } 54 | 55 | /** 56 | * Returns description of what happened. 57 | * 58 | * @return string 59 | */ 60 | public function get_description() { 61 | return "The user with id '$this->userid' viewed the individual responses report for user with id '$this->relateduserid' 62 | to the questionnaire with course module id '$this->contextinstanceid'."; 63 | } 64 | 65 | /** 66 | * Get URL related to the action. 67 | * 68 | * @return \moodle_url 69 | */ 70 | public function get_url() { 71 | $params = array(); 72 | $params['action'] = 'vresp'; 73 | $params['individualresponse'] = 1; 74 | $params['rid'] = $this->other['rid']; 75 | $params['group'] = $this->other['currentgroupid']; 76 | return new \moodle_url("/mod/questionnaire/report.php", $params); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /classes/file_storage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire; 18 | 19 | /** 20 | * Defines the file stoeage class for questionnaire. 21 | * @package mod_questionnaire 22 | * @copyright 2020 onwards Mike Churchward (mike.churchward@poetopensource.org) 23 | * @author Mike Churchward 24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 | */ 26 | class file_storage extends \file_storage { 27 | 28 | /** 29 | * Copy all the files in a file area from one context to another. 30 | * 31 | * @param int $oldcontextid the context the files are being moved from. 32 | * @param int $newcontextid the context the files are being moved to. 33 | * @param string $component the plugin that these files belong to. 34 | * @param string $filearea the name of the file area. 35 | * @param int|boolean $olditemid The identifier for the old file area if required. 36 | * @param int|boolean $newitemid The identifier for the new file area if different than old. 37 | * @return int the number of files copied, for information. 38 | * @throws \coding_exception 39 | * @throws \file_exception 40 | * @throws \stored_file_creation_exception 41 | */ 42 | public function copy_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $olditemid = false, 43 | $newitemid = false) { 44 | $count = 0; 45 | 46 | $oldfiles = $this->get_area_files($oldcontextid, $component, $filearea, $olditemid, 'id', false); 47 | foreach ($oldfiles as $oldfile) { 48 | $filerecord = new \stdClass(); 49 | $filerecord->contextid = $newcontextid; 50 | if ($newitemid !== false) { 51 | $filerecord->itemid = $newitemid; 52 | } else { 53 | $filerecord->itemid = $olditemid; 54 | } 55 | $this->create_file_from_storedfile($filerecord, $oldfile); 56 | $count += 1; 57 | } 58 | return $count; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /classes/generator/question_response.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\generator; 18 | 19 | use mod_questionnaire\responsetype\response\response; 20 | 21 | /** 22 | * Question response class 23 | * @author gthomas2 24 | * @copyright 2016 onward Mike Churchward (mike.churchward@poetopensource.org) 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | * @package mod_questionnaire 27 | */ 28 | class question_response { 29 | /** @var int $questionid */ 30 | public $questionid; 31 | /** @var response $response */ 32 | public $response; 33 | 34 | /** 35 | * Class constructor. 36 | * @param int $questionid 37 | * @param response $response 38 | */ 39 | public function __construct($questionid, $response) { 40 | $this->questionid = $questionid; 41 | $this->response = $response; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /classes/generator/question_response_rank.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\generator; 18 | 19 | use mod_questionnaire\question\choice; 20 | 21 | /** 22 | * Question response rank class 23 | * @author gthomas2 24 | * @copyright 2016 onward Mike Churchward (mike.churchward@poetopensource.org) 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | * @package mod_questionnaire 27 | */ 28 | class question_response_rank { 29 | /** @var choice $choice */ 30 | public $choice; 31 | /** @var int $rankvalue */ 32 | public $rankvalue; 33 | 34 | /** 35 | * Class constructor. 36 | * @param choice $choice 37 | * @param int $rank 38 | */ 39 | public function __construct($choice, $rank) { 40 | $this->choice = $choice; 41 | $this->rankvalue = $rank; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /classes/output/completepage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class completepage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | if ($element !== 'questions') { 54 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 55 | } else { 56 | $this->data->{$element}[] = $content; 57 | } 58 | } 59 | 60 | /** 61 | * Export the data for template. 62 | * @param \renderer_base $output 63 | */ 64 | public function export_for_template(\renderer_base $output) { 65 | return $this->data; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /classes/output/fbsectionspage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\fbsectionspage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class fbsectionspage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /classes/output/feedbackpage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\feedback 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class feedbackpage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /classes/output/nonrespondentspage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class nonrespondentspage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /classes/output/previewpage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class previewpage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | if ($element === 'questions') { 54 | $this->data->{$element}[] = $content; 55 | } else { 56 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 57 | } 58 | } 59 | 60 | /** 61 | * Export the data for template. 62 | * @param \renderer_base $output 63 | */ 64 | public function export_for_template(\renderer_base $output) { 65 | return $this->data; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /classes/output/qsettingspage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class qsettingspage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /classes/output/questionspage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class questionspage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /classes/output/reportpage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class reportpage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | if ($element === 'responses') { 54 | $this->data->{$element}[] = $content; 55 | } else { 56 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 57 | } 58 | } 59 | 60 | /** 61 | * Export the data for template. 62 | * @param \renderer_base $output 63 | */ 64 | public function export_for_template(\renderer_base $output) { 65 | return $this->data; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /classes/output/reportpagepdf.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\reportpagepdf 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class reportpagepdf implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | if ($element === 'responses') { 54 | $this->data->{$element}[] = $content; 55 | } else { 56 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 57 | } 58 | } 59 | 60 | /** 61 | * Export the data for template. 62 | * @param \renderer_base $output 63 | */ 64 | public function export_for_template(\renderer_base $output) { 65 | return $this->data; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /classes/output/responsepagepdf.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\responsepagepdf 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class responsepagepdf implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | if ($element === 'responses') { 54 | $this->data->{$element}[] = $content; 55 | } else { 56 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 57 | } 58 | } 59 | 60 | /** 61 | * Export the data for template. 62 | * @param \renderer_base $output 63 | */ 64 | public function export_for_template(\renderer_base $output) { 65 | return $this->data; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /classes/output/viewpage.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\output; 18 | 19 | /** 20 | * Contains class mod_questionnaire\output\viewpage 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2016 Mike Churchward (mike.churchward@poetgroup.org) 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class viewpage implements \renderable, \templatable { 28 | 29 | /** 30 | * The data to be exported. 31 | * @var array 32 | */ 33 | protected $data; 34 | 35 | /** 36 | * Construct the renderable. 37 | * @param object $data The template data for export. 38 | */ 39 | public function __construct($data = null) { 40 | if ($data !== null) { 41 | $this->data = $data; 42 | } else { 43 | $this->data = new \stdClass(); 44 | } 45 | } 46 | 47 | /** 48 | * Add data for export. 49 | * @param string $element The index for the data. 50 | * @param string $content The content for the index. 51 | */ 52 | public function add_to_page($element, $content) { 53 | $this->data->{$element} = empty($this->data->{$element}) ? $content : ($this->data->{$element} . $content); 54 | } 55 | 56 | /** 57 | * Export the data for template. 58 | * @param \renderer_base $output 59 | */ 60 | public function export_for_template(\renderer_base $output) { 61 | return $this->data; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /classes/task/cleanup.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | namespace mod_questionnaire\task; 18 | 19 | /** 20 | * A scheduled task for Questionnaire. 21 | * 22 | * @package mod_questionnaire 23 | * @copyright 2015 The Open University 24 | * @author Mike Churchward 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | class cleanup extends \core\task\scheduled_task { 28 | 29 | /** 30 | * Get a descriptive name for this task (shown to admins). 31 | * 32 | * @return string 33 | */ 34 | public function get_name() { 35 | return get_string('crontask', 'mod_questionnaire'); 36 | } 37 | 38 | /** 39 | * Execute method. 40 | */ 41 | public function execute() { 42 | global $CFG; 43 | require_once($CFG->dirroot . '/mod/questionnaire/locallib.php'); 44 | 45 | questionnaire_cleanup(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "poetos/moodle-mod_questionnaire", 3 | "type": "moodle-mod", 4 | "require": { 5 | "composer/installers": "~1.0" 6 | }, 7 | "extra": { 8 | "installer-name": "questionnaire" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /db/log.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Capability definitions for the quiz module. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2016 Mike Churchward (mike.churchward@poetopensource.org) 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | defined('MOODLE_INTERNAL') || die(); 26 | 27 | $logs = array( 28 | array('module' => 'questionnaire', 'action' => 'view all', 'mtable' => 'questionnaire', 'field' => 'name'), 29 | array('module' => 'questionnaire', 'action' => 'submit', 'mtable' => 'questionnaire_response', 'field' => 'id'), 30 | array('module' => 'questionnaire', 'action' => 'view', 'mtable' => 'questionnaire', 'field' => 'name'), 31 | ); 32 | -------------------------------------------------------------------------------- /db/messages.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Defines message providers (types of messages being sent) 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2010 onwards Aparup Banerjee http://moodle.com 22 | * @author Mike Churchward 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | $messageproviders = [ 29 | // Message to nonrespondents. 30 | 'message' => [], 31 | // Response submissions. 32 | 'notification' => [] 33 | ]; 34 | -------------------------------------------------------------------------------- /db/mobile.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Defines mobile handlers. 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2018 Igor Sazonov 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | defined('MOODLE_INTERNAL') || die(); 26 | 27 | $addons = [ 28 | 'mod_questionnaire' => [ 29 | 'handlers' => [ 30 | 'questionsview' => [ 31 | 'displaydata' => [ 32 | 'icon' => $CFG->wwwroot . '/mod/questionnaire/pix/icon.svg', 33 | 'class' => 'core-course-module-questionnaire-handler', 34 | ], 35 | 'delegate' => 'CoreCourseModuleDelegate', 36 | 'method' => 'mobile_view_activity', 37 | 'styles' => [ 38 | 'url' => $CFG->wwwroot . '/mod/questionnaire/styles_app.css', 39 | 'version' => '1.5' 40 | ] 41 | ] 42 | ], 43 | 'lang' => [ 44 | ['yourresponse', 'questionnaire'], 45 | ['submitted', 'questionnaire'], 46 | ['answerquestions', 'questionnaire'], 47 | ['areyousure', 'moodle'], 48 | ['resumesurvey', 'questionnaire'], 49 | ['success', 'moodle'], 50 | ['savechanges', 'moodle'], 51 | ['nextpage', 'questionnaire'], 52 | ['previouspage', 'questionnaire'], 53 | ['fullname', 'moodle'], 54 | ['required', 'moodle'] 55 | ], 56 | ] 57 | ]; 58 | -------------------------------------------------------------------------------- /db/services.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Questionnaire external functions and service definitions. 19 | * 20 | * @package mod_questionnaire 21 | * @category external 22 | * @copyright 2018 Igor Sazonov 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | * @since Moodle 3.0 25 | */ 26 | 27 | defined('MOODLE_INTERNAL') || die; 28 | 29 | $services = [ 30 | 'mod_questionnaire_ws' => [ 31 | 'functions' => ['mod_questionnaire_submit_questionnaire_response'], 32 | 'requiredcapability' => '', 33 | 'enabled' => 1 34 | ] 35 | ]; 36 | 37 | $functions = [ 38 | 'mod_questionnaire_submit_questionnaire_response' => [ 39 | 'classname' => 'mod_questionnaire\external', 40 | 'methodname' => 'submit_questionnaire_response', 41 | 'classpath' => 'mod/questionnaire/externallib.php', 42 | 'description' => 'Questionnaire submit', 43 | 'type' => 'write', 44 | 'capabilities' => 'mod/questionnaire:submit', 45 | 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE] 46 | ] 47 | ]; 48 | -------------------------------------------------------------------------------- /db/tasks.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Definition of Questionnaire scheduled tasks. 19 | * 20 | * Default is to run once every 12 hours. 21 | * 22 | * @package mod_questionnaire 23 | * @category task 24 | * @copyright 2015 The Open University 25 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 | */ 27 | defined('MOODLE_INTERNAL') || die(); 28 | 29 | /** @var array $tasks */ 30 | $tasks = array( 31 | array( 32 | 'classname' => 'mod_questionnaire\task\cleanup', 33 | 'blocking' => 0, 34 | 'minute' => 'R', 35 | 'hour' => '*/12', 36 | 'day' => '*', 37 | 'month' => '*', 38 | 'dayofweek' => '*' 39 | ) 40 | ); 41 | -------------------------------------------------------------------------------- /grade.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Redirects the user to either a questionnaire or to the questionnaire report 19 | * 20 | * @package mod_questionnaire 21 | * @copyright 2013 onwards Joseph Rézeau email moodle@rezeau.org 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | **/ 24 | 25 | /** 26 | * Require config.php 27 | */ 28 | require_once("../../config.php"); 29 | require_once($CFG->dirroot.'/mod/questionnaire/questionnaire.class.php'); 30 | 31 | $id = required_param('id', PARAM_INT); 32 | $cm = get_coursemodule_from_id('questionnaire', $id, 0, false, MUST_EXIST); 33 | if (! $questionnaire = $DB->get_record("questionnaire", array("id" => $cm->instance))) { 34 | throw new \moodle_exception('invalidcoursemodule', 'mod_questionnaire'); 35 | } 36 | $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 37 | require_login($course, false, $cm); 38 | $PAGE->set_url('/mod/questionnaire/grade.php', array('id' => $cm->id)); 39 | 40 | if (has_capability('mod/questionnaire:readallresponseanytime', context_module::instance($cm->id))) { 41 | redirect('report.php?instance='.$questionnaire->id); 42 | } else { 43 | redirect('view.php?id='.$cm->id); 44 | } 45 | -------------------------------------------------------------------------------- /images/hbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/hbar.gif -------------------------------------------------------------------------------- /images/hbar_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/hbar_l.gif -------------------------------------------------------------------------------- /images/hbar_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/hbar_r.gif -------------------------------------------------------------------------------- /images/hbartransp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/hbartransp.gif -------------------------------------------------------------------------------- /images/print.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/print.gif -------------------------------------------------------------------------------- /images/thbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/thbar.gif -------------------------------------------------------------------------------- /images/thbar_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/thbar_l.gif -------------------------------------------------------------------------------- /images/thbar_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/images/thbar_r.gif -------------------------------------------------------------------------------- /javascript/RGraph/license.txt: -------------------------------------------------------------------------------- 1 | 2 | The RGraph license 3 | ================== 4 | RGraph is free to use under the MIT license. 5 | 6 | Extended support 7 | ================ 8 | Free support is available at the link below. If your needs go beyond the free support though 9 | there is Extended Support available to subscribe to. You can read more about this on 10 | the support page. 11 | 12 | http://www.rgraph.net/support 13 | 14 | 15 | o-----------------------------------------------------------------------------------------o 16 | | Copyright (c) 2013 Richard Heyes http://www.rgraph.net | 17 | | | 18 | | Permission is hereby granted, free of charge, to any person obtaining a copy | 19 | | of this software and associated documentation files (the "Software"), to deal | 20 | | in the Software without restriction, including without limitation the rights | 21 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 22 | | copies of the Software, and to permit persons to whom the Software is | 23 | | furnished to do so, subject to the following conditions: | 24 | | | 25 | | The above copyright notice and this permission notice shall be included in | 26 | | all copies or substantial portions of the Software. | 27 | | | 28 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 29 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 30 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 31 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 32 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 33 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 34 | | THE SOFTWARE. | 35 | o-----------------------------------------------------------------------------------------o -------------------------------------------------------------------------------- /javascript/mobile.js: -------------------------------------------------------------------------------- 1 | // This file is part of Moodle - http://moodle.org/ 2 | // 3 | // Moodle is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // Moodle is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with Moodle. If not, see . 15 | 16 | /** 17 | * Support for Moodle Mobile integration 18 | */ 19 | 20 | 21 | var questionsFormFields = {}; 22 | this.questionsFormErrors = {}; 23 | for (const fieldkey in this.CONTENT_OTHERDATA.fields) { 24 | questionsFormFields[fieldkey] = []; 25 | questionsFormFields[fieldkey][0] = ''; 26 | for (const itemid in 27 | this.CONTENT_OTHERDATA.questions[this.CONTENT_OTHERDATA.pagenum][this.CONTENT_OTHERDATA.fields[fieldkey].id]) { 28 | questionsFormFields[fieldkey][0] = 29 | this.CONTENT_OTHERDATA.questions[this.CONTENT_OTHERDATA.pagenum][this.CONTENT_OTHERDATA.fields[fieldkey].id] 30 | [itemid].value; 31 | } 32 | if (this.CONTENT_OTHERDATA.fields[fieldkey].required === 'y') { 33 | questionsFormFields[fieldkey][1] = this.Validators.required; 34 | this.questionsFormErrors[fieldkey] = this.CONTENT_OTHERDATA.fields[fieldkey].errormessage; 35 | } 36 | } 37 | this.questionsForm = this.FormBuilder.group(questionsFormFields); -------------------------------------------------------------------------------- /mobiledump.txt: -------------------------------------------------------------------------------- 1 | 2 | <%#choices%> 3 | 4 | 5 | 6 | 7 | 8 | checked="true"<%/value%> 9 | value="<%id%>" 10 | <%#completed%> disabled="true"<%/completed%>> 11 | 12 | 13 | 14 | 15 | <%/choices%> 16 | 17 | 18 | 31 | 32 | 33 | 34 | =========== error_log =============== 35 | 36 | [Thu Aug 01 10:17:34.671596 2019] [php7:notice] [pid 67268] [client ::1:61305] stdClass Object 37 | ( 38 | [action] => nextpage 39 | [appcustomurlscheme] => moodlemobile 40 | [appid] => com.moodle.moodlemobile 41 | [appisdesktop] => 1 42 | [appismobile] => 0 43 | [appiswide] => 1 44 | [applang] => en-us 45 | [appplatform] => mac 46 | [appversioncode] => 3700 47 | [appversionname] => 3.7.0 48 | [cmid] => 153 49 | [completeq] => 1 50 | [pagenum] => 2 51 | [rid] => 0 52 | [userid] => 3 53 | ) 54 | 55 | -------------------------------------------------------------------------------- /pix/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/pix/icon.gif -------------------------------------------------------------------------------- /pix/monologo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PoetOS/moodle-mod_questionnaire/4d81469fb2808f5f819418b44a0770b88ad29e9e/pix/monologo.png -------------------------------------------------------------------------------- /pix/monologo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /settings.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Setting page for questionaire module 19 | * 20 | * @package mod_questionnaire 21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 | * @copyright 2016 onward Mike Churchward (mike.churchward@poetgroup.org) 23 | * @author Mike Churchward 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die; 27 | 28 | if ($ADMIN->fulltree) { 29 | $options = array(0 => get_string('no'), 1 => get_string('yes')); 30 | $str = get_string('configusergraphlong', 'questionnaire'); 31 | $settings->add(new admin_setting_configselect('questionnaire/usergraph', 32 | get_string('configusergraph', 'questionnaire'), 33 | $str, 0, $options)); 34 | $settings->add(new admin_setting_configtext('questionnaire/maxsections', 35 | get_string('configmaxsections', 'questionnaire'), 36 | '', 10, PARAM_INT)); 37 | $choices = array( 38 | 'response' => get_string('response', 'questionnaire'), 39 | 'submitted' => get_string('submitted', 'questionnaire'), 40 | 'institution' => get_string('institution'), 41 | 'department' => get_string('department'), 42 | 'course' => get_string('course'), 43 | 'group' => get_string('group'), 44 | 'id' => get_string('id', 'questionnaire'), 45 | 'fullname' => get_string('fullname'), 46 | 'username' => get_string('username'), 47 | 'useridentityfields' => get_string('showuseridentity', 'admin') 48 | ); 49 | 50 | $settings->add(new admin_setting_configmultiselect('questionnaire/downloadoptions', 51 | get_string('textdownloadoptions', 'questionnaire'), '', array_keys($choices), $choices)); 52 | 53 | $settings->add(new admin_setting_configcheckbox('questionnaire/allowemailreporting', 54 | get_string('configemailreporting', 'questionnaire'), get_string('configemailreportinglong', 'questionnaire'), 0)); 55 | } 56 | -------------------------------------------------------------------------------- /styles_app.css: -------------------------------------------------------------------------------- 1 | span.mobileratequestion { 2 | padding-left: 2em; 3 | padding-right: 2em; 4 | } 5 | 6 | .mod_questionnaire_slider .range-has-pin .range-pin { 7 | -webkit-transform: translate3d(0, 0, 0) scale(1); 8 | transform: translate3d(0, 0, 0) scale(1); 9 | } 10 | .mod_questionnaire_slider .range-has-pin::part(pin) { 11 | -webkit-transform: translate3d(0, -24px, 0) scale(1); 12 | transform: translate3d(0, -24px, 0) scale(1); 13 | } 14 | 15 | ion-label.disabled { 16 | opacity: 0.8 !important; 17 | } -------------------------------------------------------------------------------- /templates/extrafields.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/extrafields 19 | 20 | Templates which inserts a couple of extra inputs in the dataformat_selector. 21 | 22 | Example context (json): 23 | { 24 | } 25 | }} 26 |
27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /templates/fbsectionspage.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/fbsectionspage 19 | 20 | Template which defines a questionnaire completion page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * tabsarea - string: HTML of the tabs management area. 30 | * formarea - string: HTML of the management form. 31 | 32 | Example context (json): 33 | { 34 | "tabsarea": "
HTML of the tabs area.
", 35 | "formarea": "
HTML of the form area
" 36 | } 37 | }} 38 |
39 | {{{tabsarea}}} 40 |
41 | {{{notifications}}} 42 | {{{formarea}}} 43 |
44 |
-------------------------------------------------------------------------------- /templates/local/mobile/ionic5/boolean_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_boolean_question 19 | 20 | Template which defines a boolean question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "id": 5432, 32 | "content": "Yes", 33 | "completed": 1, 34 | "value": 1 35 | }, 36 | { 37 | "id": 5432, 38 | "content": "No", 39 | "completed": 1, 40 | "value": 0 41 | } 42 | ] 43 | } 44 | }} 45 | {{=<% %>=}} 46 | 47 | <%#choices%> 48 | 49 | 50 | disabled="true"<%#value%> checked="true"<%/value%><%/completed%> [value]="<%id%>"> 51 | 52 | <%/choices%> 53 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/checkbox_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_checkbox_question 19 | 20 | Template which defines a checkbox question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "choices": [ 29 | { 30 | "fieldkey": 985, 31 | "id": 5432, 32 | "content": "Red", 33 | "completed": 0, 34 | "value": 1 35 | }, 36 | { 37 | "fieldkey": 986 , 38 | "id": 5433, 39 | "content": "Blue", 40 | "completed": 0, 41 | "value": 0 42 | } 43 | ] 44 | } 45 | }} 46 | {{=<% %>=}} 47 | 48 | <%#choices%> 49 | 50 | 51 | checked="true"<%/value%> value="<%id%>" 52 | <%#completed%> disabled="true"<%/completed%> 53 | [(ngModel)]="CONTENT_OTHERDATA.<%choicefieldkey%>"> 54 | 55 | <%#otherchoicekey%> 56 | 57 | disabled="true"<%/completed%>> 59 | 60 | <%/otherchoicekey%> 61 | <%/choices%> 62 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/date_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_date_question 19 | 20 | Template which defines a date question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 41 | <%/completed%> 42 | 43 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/numeric_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_numeric_question 19 | 20 | Template which defines a numeric question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 41 | <%/completed%> 42 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/radio_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_radio_question 19 | 20 | Template which defines a radio question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "id": 5432, 32 | "content": "Red", 33 | "completed": 0, 34 | "value": 1 35 | }, 36 | { 37 | "id": 5433, 38 | "content": "Blue", 39 | "completed": 0, 40 | "value": 0 41 | } 42 | ] 43 | } 44 | }} 45 | {{=<% %>=}} 46 | 47 | <%#choices%> 48 | 49 | 50 | checked="true"<%/value%> 51 | value="<%id%>" 52 | <%#completed%> disabled="true"<%/completed%>> 53 | 54 | <%#otherchoicekey%> 55 | 56 | disabled="true"<%/completed%>> 58 | 59 | <%/otherchoicekey%> 60 | <%/choices%> 61 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/select_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_select_question 19 | 20 | Template which defines a select question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "content": "Red", 32 | "completed": 0, 33 | "value": 1 34 | }, 35 | { 36 | "content": "Blue", 37 | "completed": 0, 38 | "value": 0 39 | } 40 | ] 41 | } 42 | }} 43 | {{=<% %>=}} 44 | 45 | 46 | 47 | <%#choices%> 48 | disabled="true"<%/completed%><%#value%> selected="true"<%/value%> value="<%id%>"><%content%> 49 | <%/choices%> 50 | 51 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/slider_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_slider_question 19 | 20 | Template which defines a slider question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "extradata": { 30 | "minrange" : 1 31 | "maxrange" : 10 32 | "startingvalue" : 5 33 | "stepvalue" : 1 34 | "leftlabel" : "left label" 35 | "rightlabel" : "right label" 36 | "centerlabel": "center label" 37 | }, 38 | "completed": 0 39 | } 40 | 41 | }} 42 | {{=<% %>=}} 43 | <%#extradata%> 44 | 45 | disabled="true"<%/completed%> 47 | min="<%extradata.minrange%>" max="<%extradata.maxrange%>" 48 | pin="true" step="<%extradata.stepvalue%>" 49 | [(ngModel)]="CONTENT_OTHERDATA.<%fieldkey%>"> 50 | <%extradata.leftlabel%> 51 | <%extradata.rightlabel%> 52 | 53 | 54 | class="disabled"<%/completed%>> 55 | 56 | 57 | <%/extradata%> 58 | -------------------------------------------------------------------------------- /templates/local/mobile/ionic5/text_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_text_question 19 | 20 | Template which defines a text question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 42 | <%/completed%> 43 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/boolean_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_boolean_question 19 | 20 | Template which defines a boolean question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "id": 5432, 32 | "content": "Yes", 33 | "completed": 1, 34 | "value": 1 35 | }, 36 | { 37 | "id": 5432, 38 | "content": "No", 39 | "completed": 1, 40 | "value": 0 41 | } 42 | ] 43 | } 44 | }} 45 | {{=<% %>=}} 46 | 47 | <%#choices%> 48 | 49 | disabled="true"<%#value%> checked="true"<%/value%><%/completed%> [value]="<%id%>"> 50 | 51 | 52 | 53 | <%/choices%> 54 | 55 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/checkbox_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_checkbox_question 19 | 20 | Template which defines a checkbox question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "choices": [ 29 | { 30 | "fieldkey": 985, 31 | "id": 5432, 32 | "content": "Red", 33 | "completed": 0, 34 | "value": 1 35 | }, 36 | { 37 | "fieldkey": 986 , 38 | "id": 5433, 39 | "content": "Blue", 40 | "completed": 0, 41 | "value": 0 42 | } 43 | ] 44 | } 45 | }} 46 | {{=<% %>=}} 47 | 48 | <%#choices%> 49 | 50 | checked="true"<%/value%> value="<%id%>" 51 | <%#completed%> disabled="true"<%/completed%> 52 | [(ngModel)]="CONTENT_OTHERDATA.<%choicefieldkey%>"> 53 | 54 | 55 | 56 | <%#otherchoicekey%> 57 | 58 | disabled="true"<%/completed%>> 60 | 61 | <%/otherchoicekey%> 62 | <%/choices%> 63 | 64 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/date_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_date_question 19 | 20 | Template which defines a date question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 41 | 42 | 43 | 45 | {{'core.date' | translate}} 46 | 47 | 48 | 49 | <%/completed%> 50 | 51 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/numeric_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_numeric_question 19 | 20 | Template which defines a numeric question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 41 | <%/completed%> 42 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/radio_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_radio_question 19 | 20 | Template which defines a radio question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "id": 5432, 32 | "content": "Red", 33 | "completed": 0, 34 | "value": 1 35 | }, 36 | { 37 | "id": 5433, 38 | "content": "Blue", 39 | "completed": 0, 40 | "value": 0 41 | } 42 | ] 43 | } 44 | }} 45 | {{=<% %>=}} 46 | 47 | <%#choices%> 48 | 49 | checked="true"<%/value%> 50 | value="<%id%>" 51 | <%#completed%> disabled="true"<%/completed%>> 52 | 53 | 54 | 55 | <%#otherchoicekey%> 56 | 57 | disabled="true"<%/completed%>> 59 | 60 | <%/otherchoicekey%> 61 | <%/choices%> 62 | 63 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/select_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_select_question 19 | 20 | Template which defines a select question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * choices - array of objects: choice_id, content, completed and value of each question choice. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "choices": [ 30 | { 31 | "content": "Red", 32 | "completed": 0, 33 | "value": 1 34 | }, 35 | { 36 | "content": "Blue", 37 | "completed": 0, 38 | "value": 0 39 | } 40 | ] 41 | } 42 | }} 43 | {{=<% %>=}} 44 | 45 | 46 | 47 | <%#choices%> 48 | disabled="true"<%/completed%><%#value%> selected="true"<%/value%> value="<%id%>"><%content%> 49 | <%/choices%> 50 | 51 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/slider_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_slider_question 19 | 20 | Template which defines a slider question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "extradata": { 30 | "minrange" : 1 31 | "maxrange" : 10 32 | "startingvalue" : 5 33 | "stepvalue" : 1 34 | "leftlabel" : "left label" 35 | "rightlabel" : "right label" 36 | "centerlabel": "center label" 37 | }, 38 | "completed": 0 39 | } 40 | 41 | }} 42 | {{=<% %>=}} 43 | <%#extradata%> 44 | 45 | disabled="true"<%/completed%> 47 | min="<%extradata.minrange%>" max="<%extradata.maxrange%>" 48 | pin="true" step="<%extradata.stepvalue%>" 49 | [(ngModel)]="CONTENT_OTHERDATA.<%fieldkey%>"> 50 | <%extradata.leftlabel%> 51 | <%extradata.rightlabel%> 52 | 53 | 54 | 55 | class="disabled"<%/completed%>> 56 | 57 | 58 | 59 | <%/extradata%> 60 | -------------------------------------------------------------------------------- /templates/local/mobile/latest/text_question.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/mobile_text_question 19 | 20 | Template which defines a text question display in the mobile app. 21 | 22 | Context variables required for this template: 23 | * fieldkey - integer: ID of the question. 24 | * completed - boolean: True if question already completed. 25 | 26 | Example context (json): 27 | { 28 | "fieldkey": 985, 29 | "completed": 0 30 | } 31 | }} 32 | {{=<% %>=}} 33 | 34 | 35 | <%#completed%> 36 | 37 | <%/completed%> 38 | 39 | <%^completed%> 40 | 42 | <%/completed%> 43 | -------------------------------------------------------------------------------- /templates/navbaruser.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/navbaruser 19 | 20 | Template which defines a questionnaire user responses navigation bar for the report page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * previous - object: "url" and "title" strings for previous link. 30 | * prevrespnumbers - object: Array of "url"'s, "title"'s and response text ("respnumber") for each previous response link. 31 | * currrespnumber - string: The current response number text. 32 | * nextrespnumbers - object: Array of "url"'s, "title"'s and response text ("respnumber") for each next response link. 33 | * next - object: "url" and "title" strings for "next" link. 34 | 35 | Example context (json): 36 | { 37 | "previous": { 38 | "url": "http://somelink.com", 39 | "title": "Link title" 40 | }, 41 | "prevrespnumbers": { 42 | "url": "http://somelink.com", 43 | "title": "Link title", 44 | "respnumber": "3" 45 | }, 46 | "currrespnumber": "4", 47 | "nextrespnumbers": { 48 | "url": "http://somelink.com", 49 | "title": "Link title", 50 | "respnumber": "5" 51 | }, 52 | "next": { 53 | "url": "http://somelink.com", 54 | "title": "Link title" 55 | } 56 | } 57 | }} 58 |
59 | {{#previous}}{{# str }}previous, moodle{{/ str }} | {{/previous}} 60 | {{#prevrespnumbers}}{{respnumber}} | {{/prevrespnumbers}} 61 | {{#currrespnumber}}{{.}}{{/currrespnumber}} 62 | {{#nextrespnumbers}} | {{respnumber}}{{/nextrespnumbers}} 63 | {{#next}} | {{# str}}next, moodle{{/ str }}{{/next}} 64 |
-------------------------------------------------------------------------------- /templates/nonrespondentspage.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/nonrespondentspage 19 | 20 | Template which defines a questionnaire completion page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * tabsarea - string: HTML of the tabs management area. 30 | * formarea - string: HTML of the management form. 31 | 32 | Example context (json): 33 | { 34 | "tabsarea": "
HTML of the tabs area.
", 35 | "formarea": "
HTML of the form area
" 36 | } 37 | }} 38 |
39 | {{{tabsarea}}} 40 | {{{formarea}}} 41 |
-------------------------------------------------------------------------------- /templates/progressbar.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/completepage 19 | 20 | Template which defines a questionnaire completion page. 21 | 22 | Classes required for JS: 23 | * /questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: (Note sections have been used to allow non-inclusion) 29 | * completepercent - string: progress through the questionnaire as a percentage 30 | * targethelp: object - data for the help tooltip template 31 | 32 | Example context (json): 33 | { 34 | "percent": "90", 35 | "progresshelp": { 36 | "title": "Help with something", 37 | "text": "Help with something", 38 | "url": "http://example.org/help", 39 | "linktext": "", 40 | "icon":{ 41 | "extraclasses": "iconhelp", 42 | "attributes": [ 43 | {"name": "src", "value": "../../../pix/help.svg"}, 44 | {"name": "alt", "value": "Help icon"} 45 | ] 46 | } 47 | } 48 | } 49 | }} 50 |
51 |
52 |
{{#str}} 53 | progressbar_info, mod_questionnaire, {{percent}}% {{/str}}
54 | 60 |
61 |
62 |
63 |
64 |
65 |
-------------------------------------------------------------------------------- /templates/qsettingspage.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/qsettingspage 19 | 20 | Template which defines a questionnaire completion page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * tabsarea - string: HTML of the tabs management area. 30 | * formarea - string: HTML of the management form. 31 | 32 | Example context (json): 33 | { 34 | "tabsarea": "
HTML of the tabs area.
", 35 | "formarea": "
HTML of the form area
" 36 | } 37 | }} 38 |
39 | {{{tabsarea}}} 40 | {{{formarea}}} 41 |
-------------------------------------------------------------------------------- /templates/question_check.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_check 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "qelements": [ 33 | { 34 | "choice": { 35 | "id": "choiceid1", 36 | "value": "1", 37 | "name": "choiceid1", 38 | "checked": "", 39 | "label": "Choice question label" 40 | } 41 | }, 42 | { 43 | "choice": { 44 | "id": "choiceid7", 45 | "value": "7", 46 | "name": "choiceid7", 47 | "checked": "1", 48 | "label": "Choice question label", 49 | "oname": "Other", 50 | "ovalue": "another choice" 51 | } 52 | } 53 | ] 54 | } 55 | }} 56 | 57 | {{#qelements}} 58 | {{#choice}} 59 | 61 | 62 | {{#choice.oname}}{{/choice.oname}} 64 |
65 | {{/choice}} 66 | {{/qelements}} 67 | -------------------------------------------------------------------------------- /templates/question_container.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_container 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "fieldset": { 33 | "id": "7", 34 | "class": "questionclass" 35 | }, 36 | "qnum": "7", 37 | "required": "
*
", 38 | "skippedclass": "skippedclass", 39 | "qcontent": "HTML for the question content", 40 | "qformelement": "
HTML for the question form element
", 41 | "notifications": "
HTML for the notifications area
" 42 | } 43 | }} 44 | 45 |
46 | {{{dependencylist}}} 47 | {{#qnum}} 48 | {{# str }}questionnum, mod_questionnaire{{/ str}}{{{qnum}}} {{qlegend}} 49 |
50 |
51 |

{{{qnum}}}

52 |
53 | {{{required}}} 54 |
55 | {{/qnum}} 56 | {{^qnum}} 57 |
58 | {{{required}}} 59 |
60 | {{/qnum}} 61 |
62 |
63 | {{#label}}{{/label}} 66 |
67 |
68 | {{{qformelement}}} 69 |
70 |
71 |
72 | {{#notifications}}{{{.}}}{{/notifications}} 73 | -------------------------------------------------------------------------------- /templates/question_date.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_date 19 | 20 | Template which defines a date type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "isprint": false, 33 | "qelements": { 34 | "choice": { 35 | "type": "text", 36 | "onkeypress": "dosomething()", 37 | "name": "choiceid1", 38 | "value": "2010-03-04" 39 | } 40 | } 41 | } 42 | }} 43 | 44 | {{#qelements}} 45 | {{#choice}} 46 | {{#isprint}} 47 |
{{# str }}printstrictdateformatting, mod_questionnaire{{/ str}}
48 | 49 | {{/isprint}} 50 | {{^isprint}} 51 |
{{# str }}strictdateformatting, mod_questionnaire{{/ str}}
52 |
53 | 54 | 55 |
56 | {{/isprint}} 57 | {{/choice}} 58 | {{/qelements}} 59 | -------------------------------------------------------------------------------- /templates/question_drop.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_drop 19 | 20 | Template which defines a radio button type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "isprint": false, 33 | "qelements": { 34 | "choice": { 35 | "id": "choiceid1", 36 | "name": "choiceid1", 37 | "class": "classname", 38 | "onchange": "dosomething()", 39 | "options": [ 40 | { 41 | "selected": 1, 42 | "value": "34", 43 | "label": "Option 1" 44 | }, 45 | { 46 | "selected": 0, 47 | "value": "35", 48 | "label": "Option 2" 49 | } 50 | ] 51 | } 52 | } 53 | } 54 | }} 55 | 56 | {{#qelements}} 57 | {{#choice}} 58 | {{#isprint}} 59 |
60 | {{#choice.options}} 61 | 62 | 63 |
64 | {{/choice.options}} 65 |
66 | {{/isprint}} 67 | {{^isprint}} 68 | 73 | {{/isprint}} 74 | {{/choice}} 75 | {{/qelements}} 76 | -------------------------------------------------------------------------------- /templates/question_numeric.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_numeric 19 | 20 | Template which defines a numeric type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "qelements": [ 33 | { 34 | "choice": { 35 | "onkeypress": "dosomething()", 36 | "size": 30, 37 | "name": "choiceid1", 38 | "instruction": "Do not use thousands separators.", 39 | "maxlength": 50, 40 | "value": "473", 41 | "id": "choiceid1" 42 | } 43 | }, 44 | { 45 | "choice": { 46 | "onkeypress": "dosomething()", 47 | "size": 20, 48 | "name": "choiceid2", 49 | "instruction": "Do not use thousands separators.", 50 | "maxlength": 50, 51 | "value": "473", 52 | "id": "choiceid2" 53 | } 54 | } 55 | ] 56 | } 57 | }} 58 | 59 | {{#qelements}} 60 | {{#choice}} 61 | {{#instruction}}{{.}}
{{/instruction}} 62 | 63 | {{/choice}} 64 | {{/qelements}} 65 | -------------------------------------------------------------------------------- /templates/question_sectionfb.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_sectiontext 19 | 20 | Template which defines a sectiontext type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "qelements": { 33 | "choice": { 34 | "fb": "feedback messages" 35 | } 36 | } 37 | } 38 | }} 39 | 40 | {{#qelements}} 41 | {{#choice}} 42 | {{{choice.fb}}} 43 | {{/choice}} 44 | {{/qelements}} 45 | -------------------------------------------------------------------------------- /templates/question_slider.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_slider 19 | 20 | Template which defines a slider type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "isprint": false, 33 | "qelements": { 34 | "extradata": 35 | { 36 | "id": "slider1", 37 | "name": "q1", 38 | "minrange": "1", 39 | "maxrange": "10", 40 | "startingvalue": 5, 41 | "stepvalue": "1", 42 | "leftlabel": "Left label", 43 | "rightlabel": "Right label", 44 | "centerlabel": "Center label" 45 | } 46 | } 47 | } 48 | }} 49 | 50 | {{#qelements}} 51 | {{#extradata}} 52 |
53 |
{{extradata.leftlabel}}
54 |
55 |
56 | 59 | 60 |
61 |
{{extradata.centerlabel}}
62 |
63 |
{{extradata.rightlabel}}
64 |
65 | {{/extradata}} 66 | {{/qelements}} 67 | 68 | -------------------------------------------------------------------------------- /templates/question_text.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_text 19 | 20 | Template which defines a text type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "isprint": false, 33 | "qelements": { 34 | "choice": { 35 | "onkeypress": "dosomething()", 36 | "size": 30, 37 | "name": "choiceid1", 38 | "maxlength": 50, 39 | "value": "Answer text", 40 | "id": "choiceid1" 41 | } 42 | } 43 | } 44 | }} 45 | 46 | {{#qelements}} 47 | {{#choice}} 48 | 49 | {{/choice}} 50 | {{/qelements}} 51 | -------------------------------------------------------------------------------- /templates/question_yesno.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_yesno 19 | 20 | Template which defines a yes/no type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "qelements": { 33 | "choice": [ 34 | { 35 | "id": "choice1", 36 | "value": "y", 37 | "name": "q23", 38 | "checked": 1, 39 | "disabled": "", 40 | "onclick": "dosomething()", 41 | "label": "Yes", 42 | "alabel": "Some question Yes" 43 | }, 44 | { 45 | "id": "choice2", 46 | "value": "n", 47 | "name": "q23", 48 | "checked": 0, 49 | "disabled": "", 50 | "onclick": "dosomething()", 51 | "label": "No", 52 | "alabel": "Some question No" 53 | } 54 | ] 55 | } 56 | } 57 | }} 58 | 59 | {{#qelements}} 60 | {{#choice}} 61 | 64 | 65 | {{/choice}} 66 | {{/qelements}} 67 | -------------------------------------------------------------------------------- /templates/questionpdf_container.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/question_container 19 | 20 | Template which defines a check type question survey display. This template uses a simple level of HTML, suitable for being 21 | translated into a PDF file by the TCPDF library. 22 | 23 | Classes required for JS: 24 | * /mod/questionnaire/module.js 25 | 26 | Data attributes required for JS: 27 | * none 28 | 29 | Context variables required for this template: 30 | 31 | Example context (json): 32 | { 33 | "fieldset": { 34 | "id": "7", 35 | "class": "questionclass" 36 | }, 37 | "qnum": "7", 38 | "required": "
*
", 39 | "skippedclass": "skippedclass", 40 | "qcontent": "HTML for the question content", 41 | "qformelement": "
HTML for the question form element
", 42 | "notifications": "
HTML for the notifications area
" 43 | } 44 | }} 45 | 46 |
47 | {{{dependencylist}}} 48 | 49 | {{#qnum}}{{/qnum}} 50 | 51 |
{{qnum}}{{{qcontent}}}
52 |
53 | {{{qformelement}}} 54 |
55 |
56 | {{#notifications}}{{{.}}}{{/notifications}} 57 | -------------------------------------------------------------------------------- /templates/questionspage.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/questionspage 19 | 20 | Template which defines a questionnaire completion page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * tabsarea - string: HTML of the tabs management area. 30 | * formarea - string: HTML of the management form. 31 | 32 | Example context (json): 33 | { 34 | "tabsarea": "
HTML of the tabs area.
", 35 | "formarea": "
HTML of the form area
" 36 | } 37 | }} 38 |
39 | {{{tabsarea}}} 40 | {{{formarea}}} 41 |
-------------------------------------------------------------------------------- /templates/response_check.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_check 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "choices": [ 33 | { 34 | "selected": "1", 35 | "name": "choice1", 36 | "content": "HTML for choice 1", 37 | "othercontent": "HTML for other content" 38 | }, 39 | { 40 | "selected": "", 41 | "name": "choice2", 42 | "content": "HTML for choice 2" 43 | } 44 | ] 45 | } 46 | }} 47 | 48 |
{{! 49 | }}{{#choices}}{{! 50 | }}{{#selected}}{{! 51 | }}{{^pdf}} 52 | {{/pdf}} 53 | {{{content}}}{{#pdf}} ✓{{/pdf}} 54 | {{#othercontent}}{{{.}}}{{/othercontent}} 55 | {{/selected}} 56 | {{^selected}} 57 | {{^pdf}} 58 | {{/pdf}} 59 | {{{content}}} 60 | {{/selected}} 61 |
62 | {{/choices}} 63 |
64 | -------------------------------------------------------------------------------- /templates/response_date.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_date 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "content": "HTML for date" 33 | } 34 | }} 35 | 36 |
37 | {{{content}}} 38 |
39 | -------------------------------------------------------------------------------- /templates/response_drop.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_drop 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "id": "q2610", 33 | "name": "choice1", 34 | "class": "select menuq2610", 35 | "options": [ 36 | { 37 | "selected": "", 38 | "value": 23, 39 | "label": "Drop one" 40 | }, 41 | { 42 | "selected": "1", 43 | "value": 24, 44 | "label": "Drop two" 45 | } 46 | ], 47 | "selectedlabel": "Drop two" 48 | } 49 | }} 50 | 51 |
52 | {{^pdf}} 53 | 58 | {{#selectedlabel}}: {{.}}{{/selectedlabel}} 59 | {{/pdf}} 60 | {{#pdf}} 61 | {{#options}} 62 | {{label}}{{#selected}} ✓{{/selected}}
63 | {{/options}} 64 | {{/pdf}} 65 |
66 | -------------------------------------------------------------------------------- /templates/response_numeric.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_numeric 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "content": "HTML for numeric" 33 | } 34 | }} 35 | 36 |
37 | {{{content}}} 38 |
39 | -------------------------------------------------------------------------------- /templates/response_radio.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_radio 19 | 20 | Template which defines a check type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "choices": [ 33 | { 34 | "horizontal": 1, 35 | "selected": "1", 36 | "name": "choice1", 37 | "content": "HTML for choice 1", 38 | "othercontent": "Text other content" 39 | }, 40 | { 41 | "horizontal": 1, 42 | "selected": "", 43 | "name": "choice2", 44 | "content": "HTML for choice 2" 45 | } 46 | ] 47 | } 48 | }} 49 | 50 |
51 | {{#choices}} 52 | {{#horizontal}}{{/horizontal}} 53 | {{#selected}} 54 | 55 | {{^pdf}} 56 | {{/pdf}} 58 | {{#pdf}}✓{{/pdf}} {{{content}}}{{#othercontent}} {{.}}{{/othercontent}} 59 | 60 | {{/selected}} 61 | {{^selected}} 62 | {{^pdf}} 63 | {{/pdf}} 64 | {{{content}}}  65 | {{/selected}} 66 | {{#horizontal}}{{/horizontal}} 67 | {{^horizontal}}
{{/horizontal}} 68 | {{/choices}} 69 |
70 | -------------------------------------------------------------------------------- /templates/response_slider.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_text 19 | 20 | Template which defines a text type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "content": "HTML for numeric" 33 | } 34 | }} 35 | 36 |
37 |
38 | {{#extradata}} 39 |
{{extradata.leftlabel}}
40 |
41 |
42 | 44 | 45 |
46 |
{{extradata.centerlabel}}
47 |
48 |
{{extradata.rightlabel}}
49 | {{/extradata}} 50 |
51 |
52 | 53 | -------------------------------------------------------------------------------- /templates/response_text.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_text 19 | 20 | Template which defines a text type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "content": "HTML for numeric" 33 | } 34 | }} 35 | 36 |
37 | {{{content}}} 38 |
39 | -------------------------------------------------------------------------------- /templates/response_yesno.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/response_yesno 19 | 20 | Template which defines a yesno type question survey display. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "yesselected": 1, 33 | "yesname": "id4102y", 34 | "stryes": "Yes", 35 | "noselected": 0, 36 | "noname": "id4102n", 37 | "strno": "No", 38 | "alabelyes": "Some question Yes", 39 | "alabelno": "Some question No" 40 | } 41 | }} 42 | 43 |
44 | {{#yesselected}} 45 | {{#pdf}}✓{{/pdf}}{{^pdf}} 46 | {{/pdf}} {{{stryes}}} 48 | {{/yesselected}} 49 | {{^yesselected}} 50 | {{^pdf}} 51 | {{/pdf}} {{{stryes}}} 53 | {{/yesselected}} 54 | {{#noselected}} 55 | {{#pdf}}  ✓{{/pdf}}{{^pdf}} 56 | {{/pdf}} {{{strno}}} 58 | {{/noselected}} 59 | {{^noselected}} 60 | {{^pdf}} 61 | {{/pdf}} {{{strno}}} 63 | {{/noselected}} 64 |
65 | -------------------------------------------------------------------------------- /templates/responselist.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/responselist 19 | 20 | Template which defines a questionnaire response list on the report page. 21 | 22 | Classes required for JS: 23 | * /mod/questionnaire/module.js 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | 30 | Example context (json): 31 | { 32 | "respondentscolumn0": { 33 | "respondentlink": [ 34 | "HTML of respondent link1", 35 | "HTML of respondent link2" 36 | ] 37 | }, 38 | "respondentscolumn1": { 39 | "respondentlink": [ 40 | "HTML of respondent link3", 41 | "HTML of respondent link4" 42 | ] 43 | }, 44 | "respondentscolumn2": { 45 | "respondentlink": [ 46 | "HTML of respondent link5", 47 | "HTML of respondent link6" 48 | ] 49 | } 50 | } 51 | }} 52 |
53 | {{#respondentscolumn0}} 54 |
55 | {{#respondentlink}} 56 | {{{.}}}
57 | {{/respondentlink}} 58 |
59 | {{/respondentscolumn0}} 60 | {{#respondentscolumn1}} 61 |
62 | {{#respondentlink}} 63 | {{{.}}}
64 | {{/respondentlink}} 65 |
66 | {{/respondentscolumn1}} 67 | {{#respondentscolumn2}} 68 |
69 | {{#respondentlink}} 70 | {{{.}}}
71 | {{/respondentlink}} 72 |
73 | {{/respondentscolumn2}} 74 |
75 |
-------------------------------------------------------------------------------- /templates/viewpage.mustache: -------------------------------------------------------------------------------- 1 | {{! 2 | This file is part of Moodle - http://moodle.org/ 3 | 4 | Moodle is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Moodle is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Moodle. If not, see . 16 | }} 17 | {{! 18 | @template mod_questionnaire/viewpage 19 | 20 | Template which defines a questionnaire view page. 21 | 22 | Classes required for JS: 23 | * none 24 | 25 | Data attributes required for JS: 26 | * none 27 | 28 | Context variables required for this template: 29 | * questionnairename - string: The name of the questionnaire (no HTML). 30 | * intro - string: The intro text (may have HTML). 31 | * message - string: Any message text. 32 | * complete - string: The text and link to complete the questionnaire. 33 | * guestuser - string: Any content for a guest user. 34 | * yourresponse - string: Content for responses by you. 35 | * allresponses - string: Content for responses by other users. 36 | 37 | Example context (json): 38 | { 39 | "questionnairename": "Questionnaire One", 40 | "intro": "HTML of the intro text.", 41 | "message": "HTML of the message text.", 42 | "complete": "HTML of the completion notice and link.", 43 | "guestuser": "HTML of guest user content.", 44 | "yourresponse": "HTML for your responses link.", 45 | "allresponses": "HTML for all responses link." 46 | } 47 | }} 48 |
49 |

{{questionnairename}}

50 | {{#intro}}
{{{intro}}}
{{/intro}} 51 | {{#message}}
{{{message}}}
{{/message}} 52 |
53 | {{#complete}}
{{{complete}}}
{{/complete}} 54 | {{#guestuser}}
{{{guestuser}}}
{{/guestuser}} 55 | {{#yourresponse}}
{{{yourresponse}}}
{{/yourresponse}} 56 | {{#allresponses}}
{{{allresponses}}}
{{/allresponses}} 57 |
58 |
-------------------------------------------------------------------------------- /tests/behat/add_questionnaire.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Add a questionnaire activity 3 | In order to conduct surveys of the users in a course 4 | As a teacher 5 | I need to add a questionnaire activity to a moodle course 6 | 7 | @javascript 8 | Scenario: Add a questionnaire to a course without questions 9 | Given the following "users" exist: 10 | | username | firstname | lastname | email | 11 | | teacher1 | Teacher | 1 | teacher1@example.com | 12 | | student1 | Student | 1 | student1@example.com | 13 | And the following "courses" exist: 14 | | fullname | shortname | category | 15 | | Course 1 | C1 | 0 | 16 | And the following "course enrolments" exist: 17 | | user | course | role | 18 | | teacher1 | C1 | editingteacher | 19 | | student1 | C1 | student | 20 | And the following "activities" exist: 21 | | activity | name | description | course | idnumber | 22 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 23 | And I log in as "student1" 24 | And I am on "Course 1" course homepage 25 | And I follow "Test questionnaire" 26 | Then I should see "This questionnaire does not contain any questions." 27 | -------------------------------------------------------------------------------- /tests/behat/anonymous_questionnaire.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Questionnaires can be anonymous 3 | When anonymous questionnaires are viewed 4 | The user name is dispplayed as "anonymous". 5 | 6 | Background: Add an anonymous questionnaire 7 | Given the following "users" exist: 8 | | username | firstname | lastname | email | 9 | | teacher1 | Teacher | 1 | teacher1@example.com | 10 | | student1 | Student | 1 | student1@example.com | 11 | And the following "courses" exist: 12 | | fullname | shortname | category | 13 | | Course 1 | C1 | 0 | 14 | And the following "course enrolments" exist: 15 | | user | course | role | 16 | | teacher1 | C1 | editingteacher | 17 | | student1 | C1 | student | 18 | And the following "activities" exist: 19 | | activity | name | description | course | idnumber | 20 | | questionnaire | Anonymous questionnaire | Anonymous questionnaire description | C1 | questionnaire0 | 21 | And I log in as "teacher1" 22 | And I am on "Course 1" course homepage 23 | And I am on the "Anonymous questionnaire" "questionnaire activity editing" page 24 | And I expand all fieldsets 25 | And I set the field "id_respondenttype" to "anonymous" 26 | And I press "Save and display" 27 | Then I should see "Anonymous questionnaire" 28 | And I navigate to "Questions" in current page administration 29 | And I add a "Yes/No" question and I fill the form with: 30 | | Question Name | Q1 | 31 | | Yes | y | 32 | | Question Text | Do you like this course | 33 | And I log out 34 | 35 | @javascript 36 | Scenario: Student completes an anonymous questionnaire 37 | And I log in as "student1" 38 | And I am on "Course 1" course homepage 39 | And I follow "Anonymous questionnaire" 40 | And I navigate to "Answer the questions..." in current page administration 41 | Then I should see "Anonymous questionnaire" 42 | And I click on "Yes" "radio" 43 | And I press "Submit questionnaire" 44 | Then I should see "Thank you for completing this Questionnaire." 45 | And I press "Continue" 46 | Then I should see "View your response(s)" 47 | And I should see "Anonymous questionnaire" 48 | And I should see "Respondent: - Anonymous -" 49 | -------------------------------------------------------------------------------- /tests/behat/checkbox_other_responses.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Checkbox questions can have other options that can be typed in. 3 | 4 | Background: Add a checkbox question to a questionnaire with an 'other' option. 5 | Given the following "users" exist: 6 | | username | firstname | lastname | email | 7 | | teacher1 | Teacher | 1 | teacher1@example.com | 8 | | student1 | Student | 1 | student1@example.com | 9 | And the following "courses" exist: 10 | | fullname | shortname | category | 11 | | Course 1 | C1 | 0 | 12 | And the following "course enrolments" exist: 13 | | user | course | role | 14 | | teacher1 | C1 | editingteacher | 15 | | student1 | C1 | student | 16 | And the following "activities" exist: 17 | | activity | name | description | course | idnumber | 18 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 19 | And I log in as "teacher1" 20 | And I am on "Course 1" course homepage 21 | And I follow "Test questionnaire" 22 | And I navigate to "Questions" in current page administration 23 | And I add a "Check Boxes" question and I fill the form with: 24 | | Question Name | Q1 | 25 | | Yes | y | 26 | | Question Text | Select one or two choices only | 27 | | Possible answers | One,Two,Three,Four,!other | 28 | And I add a "Check Boxes" question and I fill the form with: 29 | | Question Name | Q2 | 30 | | No | n | 31 | | Question Text | Select one or two choices only | 32 | | Possible answers | Red,Blue,Yellow,Green,!other=Other colour | 33 | And I log out 34 | 35 | @javascript 36 | Scenario: Student must enter a valid value when "other" is selected. 37 | And I log in as "student1" 38 | And I am on "Course 1" course homepage 39 | And I follow "Test questionnaire" 40 | And I navigate to "Answer the questions..." in current page administration 41 | Then I should see "Select one or two choices only" 42 | And I press "Submit questionnaire" 43 | Then I should see "Please answer required question #1" 44 | And I set the field "Other" to "checked" 45 | And I set the field "Other colour" to "checked" 46 | And I press "Submit questionnaire" 47 | Then I should see "There is something wrong with your answer to questions:" 48 | And I should see "#1. #2." 49 | -------------------------------------------------------------------------------- /tests/behat/download_responses.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Questionnaire responses can be downloaded as a CSV, etc. 3 | 4 | Background: 5 | Given the following "users" exist: 6 | | username | firstname | lastname | email | 7 | | teacher1 | Teacher | 1 | teacher1@example.com | 8 | | student1 | Student | 1 | student1@example.com | 9 | And the following "courses" exist: 10 | | fullname | shortname | category | 11 | | Course 1 | C1 | 0 | 12 | And the following "course enrolments" exist: 13 | | user | course | role | 14 | | teacher1 | C1 | editingteacher | 15 | | student1 | C1 | student | 16 | And the following "activities" exist: 17 | | activity | name | introduction | course | idnumber | 18 | | questionnaire | Test questionnaire download | Test questionnaire description | C1 | questionnaire1 | 19 | And I log in as "teacher1" 20 | And I am on "Course 1" course homepage 21 | And I follow "Test questionnaire download" 22 | And I navigate to "Questions" in current page administration 23 | And I add a "Text Box" question and I fill the form with: 24 | | Question Name | Q1 | 25 | | No | n | 26 | | Input box length | 10 | 27 | | Max. text length | 15 | 28 | | Question Text | Enter some text | 29 | And I log out 30 | And I log in as "student1" 31 | And I am on "Course 1" course homepage 32 | And I follow "Test questionnaire download" 33 | And I navigate to "Answer the questions..." in current page administration 34 | And I set the field "Enter some text" to "Student response" 35 | And I press "Submit questionnaire" 36 | And I log out 37 | 38 | @javascript 39 | Scenario: Download responses 40 | Given I log in as "teacher1" 41 | And I am on "Course 1" course homepage 42 | And I follow "Test questionnaire download" 43 | And I navigate to "View all responses" in current page administration 44 | Then I click on "Download" "link" 45 | # Without the ability to check the downloaded file, the absence of an 46 | # exception being thrown here is considered a success. 47 | And I click on "Download" "button" 48 | -------------------------------------------------------------------------------- /tests/behat/dropdown_feedback_question_type.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: In questionnaire, dropdown questions can be defined with scores attributed to specific answers, in order 3 | to provide score dependent feedback. 4 | In order to define a feedback question 5 | As a teacher 6 | I must add a required dropdown question type with choice/value combinations. 7 | 8 | @javascript 9 | Scenario: Create a questionnaire with a dropdown question type and verify that feedback options exist. 10 | Given the following "users" exist: 11 | | username | firstname | lastname | email | 12 | | teacher1 | Teacher | 1 | teacher1@example.com | 13 | | student1 | Student | 1 | student1@example.com | 14 | And the following "courses" exist: 15 | | fullname | shortname | category | 16 | | Course 1 | C1 | 0 | 17 | And the following "course enrolments" exist: 18 | | user | course | role | 19 | | teacher1 | C1 | editingteacher | 20 | | student1 | C1 | student | 21 | And the following "activities" exist: 22 | | activity | name | description | course | idnumber | resume | navigate | 23 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 24 | And I log in as "teacher1" 25 | And I am on "Course 1" course homepage 26 | And I follow "Test questionnaire" 27 | And I navigate to "Feedback" in current page administration 28 | Then I should see "Feedback options are available if your questionnaire contains the following question types" 29 | And I follow "Questions" 30 | Then I should see "Add questions" 31 | And I add a "Dropdown Box" question and I fill the form with: 32 | | Question Name | Q3 | 33 | | Yes | y | 34 | | Question Text | Select one choice | 35 | | Possible answers | 1=One,2=Two,3=Three,4=Four | 36 | Then I should see "[Dropdown Box] (Q3)" 37 | And I follow "Feedback" 38 | And I should see "Feedback options" 39 | And I should see "Display Scores" 40 | And I log out 41 | -------------------------------------------------------------------------------- /tests/behat/numeric_question_zero.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Numeric questions can have zero as a valid response 3 | 4 | Background: Add a numeric question to a questionnaire and accept zero 5 | Given the following "users" exist: 6 | | username | firstname | lastname | email | 7 | | teacher1 | Teacher | 1 | teacher1@example.com | 8 | | student1 | Student | 1 | student1@example.com | 9 | And the following "courses" exist: 10 | | fullname | shortname | category | 11 | | Course 1 | C1 | 0 | 12 | And the following "course enrolments" exist: 13 | | user | course | role | 14 | | teacher1 | C1 | editingteacher | 15 | | student1 | C1 | student | 16 | And the following "activities" exist: 17 | | activity | name | description | course | idnumber | 18 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 19 | And I log in as "teacher1" 20 | And I am on "Course 1" course homepage 21 | And I follow "Test questionnaire" 22 | And I navigate to "Questions" in current page administration 23 | And I add a "Numeric" question and I fill the form with: 24 | | Question Name | Q1 | 25 | | Yes | y | 26 | | Question Text | Enter a number | 27 | Then I log out 28 | 29 | @javascript 30 | Scenario: Student must enter no more than six digits and decimal points. 31 | And I log in as "student1" 32 | And I am on "Course 1" course homepage 33 | And I follow "Test questionnaire" 34 | And I navigate to "Answer the questions..." in current page administration 35 | Then I should see "Enter a number" 36 | And I set the field "Enter a number" to "0" 37 | And I press "Submit questionnaire" 38 | Then I should see "Thank you for completing this Questionnaire." 39 | And I press "Continue" 40 | Then I should see "View your response(s)" 41 | And I should see "Test questionnaire" 42 | And I should see "Enter a number" 43 | And I should see "0" 44 | -------------------------------------------------------------------------------- /tests/behat/radio_feedback_question_type.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: In questionnaire, radio questions can be defined with scores attributed to specific answers, in order 3 | to provide score dependent feedback. 4 | In order to define a feedback question 5 | As a teacher 6 | I must add a required radio question type. 7 | 8 | @javascript 9 | Scenario: Create a questionnaire with a radio question type and verify that feedback options exist. 10 | Given the following "users" exist: 11 | | username | firstname | lastname | email | 12 | | teacher1 | Teacher | 1 | teacher1@example.com | 13 | | student1 | Student | 1 | student1@example.com | 14 | And the following "courses" exist: 15 | | fullname | shortname | category | 16 | | Course 1 | C1 | 0 | 17 | And the following "course enrolments" exist: 18 | | user | course | role | 19 | | teacher1 | C1 | editingteacher | 20 | | student1 | C1 | student | 21 | And the following "activities" exist: 22 | | activity | name | description | course | idnumber | resume | navigate | 23 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 24 | And I log in as "teacher1" 25 | And I am on "Course 1" course homepage 26 | And I follow "Test questionnaire" 27 | And I navigate to "Advanced settings" in current page administration 28 | Then I should not see "Feedback options" 29 | And I follow "Questions" 30 | Then I should see "Add questions" 31 | And I add a "Radio Buttons" question and I fill the form with: 32 | | Question Name | Q6 | 33 | | Yes | y | 34 | | Horizontal | Checked | 35 | | Question Text | Select one choice | 36 | | Possible answers | 1=One,2=Two,3=Three,4=Four | 37 | Then I should see "[Radio Buttons] (Q6)" 38 | And I follow "Feedback" 39 | And I should see "Feedback options" 40 | And I should see "Display Scores" 41 | And I log out 42 | -------------------------------------------------------------------------------- /tests/behat/radio_question_other.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Radio questions allow optional "other" responses with optional labels 3 | In order to allow users to enter "other" answers to a radio button question 4 | As a teacher 5 | I need to specify an "other" choice 6 | 7 | Background: Add two radio button question to a questionnaire with both "other" choice options specified 8 | Given the following "users" exist: 9 | | username | firstname | lastname | email | 10 | | teacher1 | Teacher | 1 | teacher1@example.com | 11 | | student1 | Student | 1 | student1@example.com | 12 | And the following "courses" exist: 13 | | fullname | shortname | category | 14 | | Course 1 | C1 | 0 | 15 | And the following "course enrolments" exist: 16 | | user | course | role | 17 | | teacher1 | C1 | editingteacher | 18 | | student1 | C1 | student | 19 | And the following "activities" exist: 20 | | activity | name | description | course | idnumber | 21 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 22 | And I log in as "teacher1" 23 | And I am on "Course 1" course homepage 24 | And I follow "Test questionnaire" 25 | And I navigate to "Questions" in current page administration 26 | And I add a "Radio Buttons" question and I fill the form with: 27 | | Question Name | Q1 | 28 | | Yes | y | 29 | | Question Text | Select one | 30 | | Possible answers | Red,Blue,Black,!other | 31 | Then I should see "position 1" 32 | And I should see "[Radio Buttons] (Q1)" 33 | And I should see "Select one" 34 | And I add a "Radio Buttons" question and I fill the form with: 35 | | Question Name | Q2 | 36 | | Yes | y | 37 | | Question Text | Select another | 38 | | Possible answers | Green,Orange,Yellow,!other=Another colour: | 39 | Then I should see "position 2" 40 | And I should see "[Radio Buttons] (Q2)" 41 | And I should see "Select another" 42 | And I log out 43 | 44 | @javascript 45 | Scenario: Student selects other options and enters their own text. 46 | And I log in as "student1" 47 | And I am on "Course 1" course homepage 48 | And I follow "Test questionnaire" 49 | And I navigate to "Answer the questions..." in current page administration 50 | Then I should see "Test questionnaire" 51 | And I click on "Other:" "radio" 52 | And I set the field "Text for Other:" to "Yellow" 53 | And I click on "Another colour:" "radio" 54 | And I set the field "Text for Another colour:" to "Indigo" 55 | And I press "Submit questionnaire" 56 | Then I should see "Thank you for completing this Questionnaire." 57 | And I press "Continue" 58 | Then I should see "View your response(s)" 59 | And I should see "Test questionnaire" 60 | And I should see "Other: Yellow" 61 | And I should see "Another colour: Indigo" 62 | -------------------------------------------------------------------------------- /tests/behat/rate_feedback_question_type.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: In questionnaire, rate questions can be defined with scores attributed to specific answers, in order 3 | to provide score dependent feedback. 4 | In order to define a feedback question 5 | As a teacher 6 | I must add a required rate question type. 7 | 8 | @javascript 9 | Scenario: Create a questionnaire with an Osgood rate question type and verify that feedback options exist. 10 | Given the following "users" exist: 11 | | username | firstname | lastname | email | 12 | | teacher1 | Teacher | 1 | teacher1@example.com | 13 | | student1 | Student | 1 | student1@example.com | 14 | And the following "courses" exist: 15 | | fullname | shortname | category | 16 | | Course 1 | C1 | 0 | 17 | And the following "course enrolments" exist: 18 | | user | course | role | 19 | | teacher1 | C1 | editingteacher | 20 | | student1 | C1 | student | 21 | And the following "activities" exist: 22 | | activity | name | description | course | idnumber | resume | navigate | 23 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 24 | And I log in as "teacher1" 25 | And I am on "Course 1" course homepage 26 | And I follow "Test questionnaire" 27 | And I navigate to "Advanced settings" in current page administration 28 | Then I should not see "Feedback options" 29 | And I follow "Questions" 30 | Then I should see "Add questions" 31 | And I add a "Rate (scale 1..5)" question and I fill the form with: 32 | | Question Name | Q7 | 33 | | Yes | y | 34 | | Nb of scale items | 4 | 35 | | Type of rate scale | Osgood | 36 | | Question Text | Rate these | 37 | | Possible answers | "Cold\|Hot","Wet\|Dry" | 38 | | Named degrees | 1=One,2=Two,3=Three,4=Four | 39 | Then I should see "[Rate (scale 1..5)] (Q7)" 40 | And I follow "Feedback" 41 | And I should see "Feedback options" 42 | And I should see "Display Scores" 43 | And I log out 44 | -------------------------------------------------------------------------------- /tests/behat/rate_question_ranking.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Rate scale questions can be used to uniquely rank options 3 | In order to create a ranking question 4 | As a teacher 5 | I need to enter a rate question with with "no duplicate choices" selected 6 | 7 | @javascript 8 | Scenario: Add a rank the top three choices question 9 | Given the following "users" exist: 10 | | username | firstname | lastname | email | 11 | | teacher1 | Teacher | 1 | teacher1@example.com | 12 | | student1 | Student | 1 | student1@example.com | 13 | And the following "courses" exist: 14 | | fullname | shortname | category | 15 | | Course 1 | C1 | 0 | 16 | And the following "course enrolments" exist: 17 | | user | course | role | 18 | | teacher1 | C1 | editingteacher | 19 | | student1 | C1 | student | 20 | And the following "activities" exist: 21 | | activity | name | description | course | idnumber | 22 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 23 | And I log in as "teacher1" 24 | And I am on "Course 1" course homepage 25 | And I follow "Test questionnaire" 26 | And I navigate to "Questions" in current page administration 27 | And I add a "Rate (scale 1..5)" question and I fill the form with: 28 | | Question Name | Q1 | 29 | | Yes | y | 30 | | Nb of scale items | 3 | 31 | | Type of rate scale | No duplicate choices | 32 | | Question Text | What are your top three movies? | 33 | | Possible answers | Star Wars,Casablanca,Airplane,Citizen Kane,Anchorman | 34 | Then I should see "position 1" 35 | And I should see "[Rate (scale 1..5)] (Q1)" 36 | And I should see "What are your top three movies?" 37 | And I log out 38 | 39 | And I log in as "student1" 40 | And I am on "Course 1" course homepage 41 | And I follow "Test questionnaire" 42 | And I navigate to "Answer the questions..." in current page administration 43 | Then I should see "Test questionnaire" 44 | And I should see "What are your top three movies?" 45 | And I click on "Row 2, Star Wars: Column 2, 1." "radio" 46 | And I click on "Row 4, Airplane: Column 3, 2." "radio" 47 | And I click on "Row 3, Casablanca: Column 4, 3." "radio" 48 | And I press "Submit questionnaire" 49 | -------------------------------------------------------------------------------- /tests/behat/text_question_zero.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: Text questions can have zero as a valid response 3 | 4 | Background: Add a text question to a questionnaire and accept zero 5 | Given the following "users" exist: 6 | | username | firstname | lastname | email | 7 | | teacher1 | Teacher | 1 | teacher1@example.com | 8 | | student1 | Student | 1 | student1@example.com | 9 | And the following "courses" exist: 10 | | fullname | shortname | category | 11 | | Course 1 | C1 | 0 | 12 | And the following "course enrolments" exist: 13 | | user | course | role | 14 | | teacher1 | C1 | editingteacher | 15 | | student1 | C1 | student | 16 | And the following "activities" exist: 17 | | activity | name | description | course | idnumber | 18 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 19 | And I log in as "teacher1" 20 | And I am on "Course 1" course homepage 21 | And I follow "Test questionnaire" 22 | And I navigate to "Questions" in current page administration 23 | And I add a "Text Box" question and I fill the form with: 24 | | Question Name | Q1 | 25 | | Yes | y | 26 | | Question Text | Enter zero | 27 | Then I log out 28 | 29 | @javascript 30 | Scenario: Student must enter no more than six digits and decimal points. 31 | And I log in as "student1" 32 | And I am on "Course 1" course homepage 33 | And I follow "Test questionnaire" 34 | And I navigate to "Answer the questions..." in current page administration 35 | Then I should see "Enter zero" 36 | And I set the field "Enter zero" to "0" 37 | And I press "Submit questionnaire" 38 | Then I should see "Thank you for completing this Questionnaire." 39 | And I press "Continue" 40 | Then I should see "View your response(s)" 41 | And I should see "Test questionnaire" 42 | And I should see "Enter zero" 43 | And "//div[contains(@class,'questionnaire_text') and contains(@class,'questionnaire_response')]//span[@class='selected' and text()='0']" "xpath_element" should exist 44 | -------------------------------------------------------------------------------- /tests/behat/yesno_feedback_question_type.feature: -------------------------------------------------------------------------------- 1 | @mod @mod_questionnaire 2 | Feature: In questionnaire, yes/no questions can be defined with scores attributed to specific answers, in order 3 | to provide score dependent feedback. 4 | In order to define a feedback question 5 | As a teacher 6 | I must add a required yes/no question type. 7 | 8 | @javascript 9 | Scenario: Create a questionnaire with a yes/no question type and verify that feedback options exist. 10 | Given the following "users" exist: 11 | | username | firstname | lastname | email | 12 | | teacher1 | Teacher | 1 | teacher1@example.com | 13 | | student1 | Student | 1 | student1@example.com | 14 | And the following "courses" exist: 15 | | fullname | shortname | category | 16 | | Course 1 | C1 | 0 | 17 | And the following "course enrolments" exist: 18 | | user | course | role | 19 | | teacher1 | C1 | editingteacher | 20 | | student1 | C1 | student | 21 | And the following "activities" exist: 22 | | activity | name | description | course | idnumber | resume | navigate | 23 | | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 24 | And I log in as "teacher1" 25 | And I am on "Course 1" course homepage 26 | And I follow "Test questionnaire" 27 | And I navigate to "Advanced settings" in current page administration 28 | Then I should not see "Feedback options" 29 | And I follow "Questions" 30 | Then I should see "Add questions" 31 | And I add a "Yes/No" question and I fill the form with: 32 | | Question Name | Q1 | 33 | | Yes | y | 34 | | Question Text | Are you still in School? | 35 | Then I should see "[Yes/No] (Q1)" 36 | And I follow "Feedback" 37 | And I should see "Feedback options" 38 | And I should see "Display Scores" 39 | And I log out 40 | -------------------------------------------------------------------------------- /thirdpartylibs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | javascript/RGraph 5 | RGraph 6 | ? 7 | MIT 8 | ? 9 | 10 | -------------------------------------------------------------------------------- /version.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Questionnaire version information. 19 | * 20 | * @package mod_questionnaire 21 | * @author Mike Churchward 22 | * @copyright 2016 Mike Churchward (mike.churchward@poetopensource.org) 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | $plugin->version = 2022121601; // The current module version (Date: YYYYMMDDXX). 29 | $plugin->requires = 2024042200.00; // Moodle version (4.4.0). 30 | 31 | $plugin->component = 'mod_questionnaire'; 32 | 33 | $plugin->release = '4.4.0 (Build - 2024082900)'; 34 | $plugin->maturity = MATURITY_BETA; 35 | --------------------------------------------------------------------------------