forked from PoetOS/moodle-mod_questionnaire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ec8ab4
commit 5aa96f4
Showing
88 changed files
with
1,696 additions
and
1,116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ | |
/** | ||
* Provides support for the conversion of moodle1 backup to the moodle2 format | ||
* | ||
* @package mod | ||
* @subpackage questionnaire | ||
* @package mod_questionnaire | ||
* @copyright 2011 Robin de Vries <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
@@ -33,7 +32,7 @@ class moodle1_mod_questionnaire_handler extends moodle1_mod_handler { | |
/** | ||
* Declare the paths in moodle.xml we are able to convert | ||
* | ||
* The method returns list of {@link convert_path} instances. For each path returned, | ||
* The method returns list of convert_path instances. For each path returned, | ||
* at least one of on_xxx_start(), process_xxx() and on_xxx_end() methods must be | ||
* defined. The method process_xxx() is not executed if the associated path element is | ||
* empty (i.e. it contains none elements or sub-paths only). | ||
|
@@ -42,7 +41,7 @@ class moodle1_mod_questionnaire_handler extends moodle1_mod_handler { | |
* actually exist in the file. The last element with the module name was | ||
* appended by the moodle1_converter class. | ||
* | ||
* @return array of {@link convert_path} instances | ||
* @return array of convert_path instances | ||
*/ | ||
public function get_paths() { | ||
return array( | ||
|
@@ -62,9 +61,11 @@ public function get_paths() { | |
new convert_path('question_choice', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION/QUESTION_CHOICE'), | ||
); | ||
} | ||
|
||
/** | ||
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE | ||
* data available | ||
* data available. | ||
* @param array $data | ||
*/ | ||
public function process_questionnaire($data) { | ||
// Get the course module id and context id. | ||
|
@@ -88,17 +89,18 @@ public function process_questionnaire($data) { | |
/** | ||
* This is executed when we reach the closing </MOD> tag of our 'questionnaire' path | ||
*/ | ||
|
||
public function on_questionnaire_end() { | ||
// Close questionnaire.xml. | ||
$this->xmlwriter->end_tag('surveys'); | ||
$this->xmlwriter->end_tag('questionnaire'); | ||
$this->xmlwriter->end_tag('activity'); | ||
$this->close_xml_writer(); | ||
} | ||
|
||
/** | ||
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY | ||
* data available | ||
* @param array $data | ||
*/ | ||
public function process_survey($data) { | ||
$this->xmlwriter->begin_tag('survey', array('id' => $data['id'])); | ||
|
@@ -120,6 +122,7 @@ public function on_survey_end() { | |
/** | ||
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION | ||
* data available | ||
* @param array $data | ||
*/ | ||
public function process_question($data) { | ||
|
||
|
@@ -144,9 +147,9 @@ public function on_question_end() { | |
/** | ||
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUESTIONNAIRE/SURVEY/QUESTION/QUESTION_CHOICE | ||
* data available | ||
* @param array $data | ||
*/ | ||
public function process_question_choice($data) { | ||
$this->write_xml('quest_choice', $data, array('/question_choice/id')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
// Because it exists (must). | ||
|
@@ -29,8 +22,11 @@ | |
require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/backup_questionnaire_settingslib.php'); | ||
|
||
/** | ||
* questionnaire backup task that provides all the settings and steps to perform one | ||
* complete backup of the activity | ||
* Questionnaire backup task that provides all the settings and steps to perform one complete backup of the activity. | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class backup_questionnaire_activity_task extends backup_activity_task { | ||
|
||
|
@@ -52,6 +48,8 @@ protected function define_my_steps() { | |
/** | ||
* Code the transformations to perform in the activity in | ||
* order to get transportable (encoded) links | ||
* @param string $content | ||
* @return array|string|string[]|null | ||
*/ | ||
public static function encode_content_links($content) { | ||
global $CFG; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* The required settingslib file. | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,24 +14,24 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* Define all the backup steps that will be used by the backup_questionnaire_activity_task. | ||
* | ||
* Define the complete choice structure for backup, with file and id annotations. | ||
* | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* Define all the backup steps that will be used by the backup_questionnaire_activity_task | ||
*/ | ||
|
||
/** | ||
* Define the complete choice structure for backup, with file and id annotations | ||
*/ | ||
class backup_questionnaire_activity_structure_step extends backup_activity_structure_step { | ||
|
||
/** | ||
* Defines the backup structure. | ||
* @return backup_nested_element | ||
*/ | ||
protected function define_structure() { | ||
global $DB; | ||
// To know if we are including userinfo. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,21 +14,17 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
// Because it exists (must). | ||
require_once($CFG->dirroot . '/mod/questionnaire/backup/moodle2/restore_questionnaire_stepslib.php'); | ||
|
||
/** | ||
* questionnaire restore task that provides all the settings and steps to perform one | ||
* complete restore of the activity | ||
* Questionnaire restore task that provides all the settings and steps to perform one complete restore of the activity. | ||
* @package mod_questionnaire | ||
* @copyright 2016 Mike Churchward ([email protected]) | ||
* @author Mike Churchward | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class restore_questionnaire_activity_task extends restore_activity_task { | ||
|
||
|
@@ -78,9 +74,9 @@ public static function define_decode_rules() { | |
|
||
/** | ||
* Define the restore log rules that will be applied | ||
* by the {@link restore_logs_processor} when restoring | ||
* by the restore_logs_processor when restoring | ||
* questionnaire logs. It must return one array | ||
* of {@link restore_log_rule} objects | ||
* of restore_log_rule objects | ||
*/ | ||
public static function define_restore_log_rules() { | ||
$rules = array(); | ||
|
@@ -97,9 +93,9 @@ public static function define_restore_log_rules() { | |
|
||
/** | ||
* Define the restore log rules that will be applied | ||
* by the {@link restore_logs_processor} when restoring | ||
* by the restore_logs_processor when restoring | ||
* course logs. It must return one array | ||
* of {@link restore_log_rule} objects | ||
* of restore_log_rule objects | ||
* | ||
* Note this rules are applied when restoring course logs | ||
* by the restore final task, but are defined here at | ||
|
Oops, something went wrong.