Skip to content

Commit acf0a4c

Browse files
committed
Adição de módulo para questionários
1 parent f59e35c commit acf0a4c

File tree

156 files changed

+40470
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+40470
-0
lines changed

mod/questionnaire/.travis.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
language: php
2+
3+
sudo: false
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache
8+
9+
php:
10+
# - 5.6 Disaabling for release because of weired Behat error.
11+
- 7.0
12+
13+
env:
14+
global:
15+
- MOODLE_BRANCH=MOODLE_32_STABLE
16+
# Temporarily turn off checking for this file. It will be replaced.
17+
- IGNORE_PATHS=module.js,tests
18+
matrix:
19+
- DB=pgsql
20+
- DB=mysqli
21+
22+
before_install:
23+
- phpenv config-rm xdebug.ini
24+
- cd ../..
25+
- composer selfupdate
26+
- composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci dev-poet
27+
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
28+
29+
install:
30+
- moodle-plugin-ci install
31+
32+
script:
33+
- moodle-plugin-ci phplint
34+
- moodle-plugin-ci phpcpd
35+
- moodle-plugin-ci phpmd
36+
- moodle-plugin-ci codechecker
37+
- moodle-plugin-ci codechecker --standard poet
38+
- moodle-plugin-ci csslint
39+
- moodle-plugin-ci shifter
40+
- moodle-plugin-ci jshint
41+
- moodle-plugin-ci validate
42+
- moodle-plugin-ci phpunit
43+
- moodle-plugin-ci behat
44+
- moodle-plugin-ci phpunit --coverage-text

mod/questionnaire/CHANGES.txt

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Release Notes
2+
3+
Version 3.2.4 (Build - 2017042700)
4+
New Features:
5+
CONTRIB-6136 - Added submission notifications by capability.
6+
7+
Version 3.2.3
8+
Bug Fixes:
9+
CONTRIB-6813 - Remove notification from "non-respondents" screen.
10+
CONTRIB-6815 - Fixed more alignment issues on rate response display.
11+
CONTRIB-6816 - Added a space after the group selector on "all responses" screen.
12+
13+
Version 3.2.2
14+
Bug Fixes:
15+
CONTRIB-6787 - Restore doesn't recreate question dependencies properly in some cases.
16+
CONTRIB-6800 - Timing of questionnaire open/close doesn't update when course is restored.
17+
CONTRIB-6809 - Response display for rate questions using named degrees can display incorrectly.
18+
19+
20+
Version 3.2.1
21+
Improvements/features:
22+
CONTRIB-5575 - Added renderers and templates to all output code.
23+
CONTRIB-6430 - Added global search functions.
24+
25+
Bug fixes:
26+
CONTRIB-6642 - Fixed non-respondents screen.
27+
CONTRIB-6729 - Fixed group selection on CSV export.
28+
CONTRIB-6730 - Fixed printing of individual response.
29+
30+
31+
Version 3.2.0
32+
Improvements/features:
33+
CONTRIB-6093 - Upated Behat tests to work with 3.2.
34+
CONTRIB-5575 - Refactored code to use renderers and templates.
35+
36+
Bug fixes:
37+
Github PR-74 - Ensure internal links used in submission confirmation URL or restored properly from backup.
38+
CONTRIB-6611 - Ensure "resume" text is shown in navigation menu when resuming a questionnaire.
39+
CONTRIB-6603 - Ensure summary replies for anonymous questionnaires are not ordered alphabetically by user name.
40+
CONTRIB-6602 - Fixed incorrect use of $COURSE global in add_instance (Github PR-72).
41+
CONTRIB-6562 - Allow editing of parent question for label questions with parent questions already set.
42+
CONTRIB-6561 - Allow editing of parent question when creating a new question.
43+
CONTRIB-6515 - Fixed downloading response database problem for Oracle and other databases (Github PR-73).
44+
CONTRIB-6475 - Removed redundant ->groups code.
45+
CONTRIB-6471 - Fixed support for "rtl" languages in response report pages (Github PR-66).
46+
CONTRIB-6445 - Added upgrade statements to ensure alignment with db definition.
47+
CONTRIB-6142 - Added correct formatting of text responses so that filtering occurs for enabled Moodle filters.
48+
49+
(see CHANGES.TXT in release 3.1 for earlier changes.)

mod/questionnaire/README.txt

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
To Install:
7+
8+
1. Load the questionnaire module directory into your "mod" subdirectory.
9+
2. Visit your admin page to create all of the necessary data tables.
10+
11+
--------------------------------------------------------------------------------
12+
To Upgrade:
13+
14+
1. Copy all of the files into your 'mod/questionnaire' directory.
15+
2. Visit your admin page. The database will be updated.
16+
3. As part of the update, all existing surveys are assigned as either 'private',
17+
'public' or 'temmplate'. Surveys assigned to a single questionnaire are set
18+
to 'private' with the questionnaire's course as the owner. Surveys assigned
19+
to multiple questionnaires in the same course are set to 'public' with the
20+
questionnaire's course as the owner. Surveys assigned to multiple
21+
questionnaires in multiple courses are set to 'public' with the site ID as
22+
the owner. Surveys that are not deleted but have no associated questionnaires
23+
are set to 'template' with the site ID as the owner.
24+
25+
*** IMPORTANT ***
26+
27+
IF YOU ARE UPGRADING TO MOODLE 2.3...
28+
29+
Make sure that you upgrade the questionnaire module to the latest 2.2 version in
30+
a Moodle 2.2 install first.
31+
32+
--------------------------------------------------------------------------------
33+
Version 2.4.1 - Release date 20130519
34+
35+
In accordance with current Moodle languages policy, all language folders other than English have been
36+
removed from the lang folder. All translations are now available from AMOS.
37+
38+
--------------------------------------------------------------------------------
39+
Please read the releasenotes.txt file for more info about successive changes
40+
--------------------------------------------------------------------------------
41+
+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<?php
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 <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Provides support for the conversion of moodle1 backup to the moodle2 format
19+
*
20+
* @package mod
21+
* @subpackage questionnaire
22+
* @copyright 2011 Robin de Vries <[email protected]>
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
defined('MOODLE_INTERNAL') || die();
27+
28+
/**
29+
* Choice conversion handler
30+
*/
31+
class moodle1_mod_questionnaire_handler extends moodle1_mod_handler {
32+
33+
/**
34+
* Declare the paths in moodle.xml we are able to convert
35+
*
36+
* The method returns list of {@link convert_path} instances. For each path returned,
37+
* at least one of on_xxx_start(), process_xxx() and on_xxx_end() methods must be
38+
* defined. The method process_xxx() is not executed if the associated path element is
39+
* empty (i.e. it contains none elements or sub-paths only).
40+
*
41+
* Note that the path /MOODLE_BACKUP/COURSE/MODULES/MOD/CHOICE does not
42+
* actually exist in the file. The last element with the module name was
43+
* appended by the moodle1_converter class.
44+
*
45+
* @return array of {@link convert_path} instances
46+
*/
47+
public function get_paths() {
48+
return array(
49+
new convert_path(
50+
'questionnaire', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE',
51+
array(
52+
'renamefields' => array(
53+
'summary' => 'intro',
54+
),
55+
'newfields' => array(
56+
'introformat' => 0,
57+
),
58+
)
59+
),
60+
new convert_path('survey', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY'),
61+
new convert_path('question', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION'),
62+
new convert_path('question_choice', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION/QUESTION_CHOICE'),
63+
);
64+
}
65+
/**
66+
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE
67+
* data available
68+
*/
69+
public function process_questionnaire($data) {
70+
// Get the course module id and context id.
71+
$instanceid = $data['id'];
72+
$cminfo = $this->get_cminfo($instanceid);
73+
$moduleid = $cminfo['id'];
74+
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
75+
76+
// We now have all information needed to start writing into the file.
77+
$this->open_xml_writer("activities/questionnaire_{$moduleid}/questionnaire.xml");
78+
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid,
79+
'modulename' => 'questionnaire', 'contextid' => $contextid));
80+
$this->xmlwriter->begin_tag('questionnaire', array('id' => $instanceid));
81+
82+
unset($data['id']); // We already write it as attribute, do not repeat it as child element.
83+
foreach ($data as $field => $value) {
84+
$this->xmlwriter->full_tag($field, $value);
85+
}
86+
$this->xmlwriter->begin_tag('surveys');
87+
}
88+
/**
89+
* This is executed when we reach the closing </MOD> tag of our 'questionnaire' path
90+
*/
91+
92+
public function on_questionnaire_end() {
93+
// Close questionnaire.xml.
94+
$this->xmlwriter->end_tag('surveys');
95+
$this->xmlwriter->end_tag('questionnaire');
96+
$this->xmlwriter->end_tag('activity');
97+
$this->close_xml_writer();
98+
}
99+
/**
100+
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY
101+
* data available
102+
*/
103+
public function process_survey($data) {
104+
$this->xmlwriter->begin_tag('survey', array('id' => $data['id']));
105+
unset($data['id']); // We already write it as attribute, do not repeat it as child element.
106+
foreach ($data as $field => $value) {
107+
$this->xmlwriter->full_tag($field, $value);
108+
}
109+
$this->xmlwriter->begin_tag('questions');
110+
}
111+
112+
/**
113+
* This is executed when we reach the closing </SURVEY> tag
114+
*/
115+
public function on_survey_end() {
116+
$this->xmlwriter->end_tag('questions');
117+
$this->xmlwriter->end_tag('survey');
118+
}
119+
120+
/**
121+
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION
122+
* data available
123+
*/
124+
public function process_question($data) {
125+
126+
$this->xmlwriter->begin_tag('question', array('id' => $data['id']));
127+
128+
unset($data['id']); // We already write it as attribute, do not repeat it as child element.
129+
foreach ($data as $field => $value) {
130+
$this->xmlwriter->full_tag($field, $value);
131+
}
132+
133+
$this->xmlwriter->begin_tag('quest_choices');
134+
}
135+
/**
136+
* This is executed when we reach the closing </QUESTION> tag
137+
*/
138+
public function on_question_end() {
139+
$this->xmlwriter->end_tag('quest_choices');
140+
$this->xmlwriter->end_tag('question');
141+
142+
}
143+
144+
/**
145+
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION/QUESTION_CHOICE
146+
* data available
147+
*/
148+
public function process_question_choice($data) {
149+
$this->write_xml('quest_choice', $data, array('/question_choice/id'));
150+
}
151+
152+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
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 <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* @package mod_questionnaire
19+
* @copyright 2016 Mike Churchward ([email protected])
20+
* @author Mike Churchward
21+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22+
*/
23+
24+
defined('MOODLE_INTERNAL') || die();
25+
26+
// Because it exists (must).
27+
require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/backup_questionnaire_stepslib.php');
28+
// Because it exists (optional).
29+
require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/backup_questionnaire_settingslib.php');
30+
31+
/**
32+
* questionnaire backup task that provides all the settings and steps to perform one
33+
* complete backup of the activity
34+
*/
35+
class backup_questionnaire_activity_task extends backup_activity_task {
36+
37+
/**
38+
* Define (add) particular settings this activity can have
39+
*/
40+
protected function define_my_settings() {
41+
// No particular settings for this activity.
42+
}
43+
44+
/**
45+
* Define (add) particular steps this activity can have
46+
*/
47+
protected function define_my_steps() {
48+
// Choice only has one structure step.
49+
$this->add_step(new backup_questionnaire_activity_structure_step('questionnaire_structure', 'questionnaire.xml'));
50+
}
51+
52+
/**
53+
* Code the transformations to perform in the activity in
54+
* order to get transportable (encoded) links
55+
*/
56+
static public function encode_content_links($content) {
57+
global $CFG;
58+
59+
$base = preg_quote($CFG->wwwroot, "/");
60+
61+
// Link to the list of questionnaires.
62+
$search = "/(".$base."\/mod\/questionnaire\/index.php\?id\=)([0-9]+)/";
63+
$content = preg_replace($search, '$@QUESTIONNAIREINDEX*$2@$', $content);
64+
65+
// Link to questionnaire view by moduleid.
66+
$search = "/(".$base."\/mod\/questionnaire\/view.php\?id\=)([0-9]+)/";
67+
$content = preg_replace($search, '$@QUESTIONNAIREVIEWBYID*$2@$', $content);
68+
69+
return $content;
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
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 <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* @package mod_questionnaire
19+
* @copyright 2016 Mike Churchward ([email protected])
20+
* @author Mike Churchward
21+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22+
*/
23+
24+
defined('MOODLE_INTERNAL') || die();
25+
26+
// This activity has no particular settings but the inherited from the generic
27+
// backup_activity_task so here there isn't any class definition, like the ones
28+
// existing in /backup/moodle2/backup_settingslib.php (activities section).

0 commit comments

Comments
 (0)