Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
68dcf79
First version of qcreate for Moodle 2.7
Aug 25, 2014
7358b9c
Fix delete question broken by renderization
Aug 25, 2014
42cbeb5
Bug student should not be notified in scheduled task
Aug 26, 2014
ce1a071
Improve activity settings form
Aug 26, 2014
a0e376b
Missing strings and modify default qtypes allowed
Sep 4, 2014
6224579
Update README
Nov 7, 2014
9e49087
Whitespaces and non English lang files removed
Nov 11, 2014
70fa9a5
Correct copyright infos
Nov 11, 2014
4951931
CONTRIB-5419 mod_qcreate breaks backup functionality in 2.8
Nov 18, 2014
4b5cacb
Bugfix: export good questions broken by sinmple quotes
Mar 1, 2015
9f08ddc
Small fixes for moodle 2.9 and 3.0
Jan 15, 2016
29d9625
Some changes for 3.5 compatibility NOT READY YET
Dec 22, 2017
ba10249
Fix name edition with pencil
Dec 22, 2017
af2200a
Add Travis file
Dec 26, 2017
30c0ed4
Fix test of deprecated print_overview
Dec 30, 2017
543bb98
Small chnage to test print_overview
Dec 30, 2017
e2f32c2
Codechecker fixes
Dec 30, 2017
e867614
First behat tests
Jan 8, 2018
3789a25
Third Behat test
Jan 8, 2018
ac2b981
Fix backup restore Behat test
Jan 8, 2018
e9a71bb
wrong component in behat test
Jan 8, 2018
cc298ac
Run scheduled task in test
Jan 8, 2018
e48f0cb
Wrong name of task
Jan 8, 2018
3a55c15
Try to fix capabilities
Jan 8, 2018
07c0df5
Capabilities problem not fixed
Jan 8, 2018
af3c7a5
capabilities problem 1
Jan 8, 2018
6f386f0
Fix display after question creation
Jan 8, 2018
49a3fe9
Clean styles.css
Jan 8, 2018
799ab23
Fix grunt errors 1
Jan 8, 2018
1730942
First Behat step
Jan 8, 2018
46d9ed7
Student can preview question test
Jan 9, 2018
ba36038
Wrong question locator in student view
Jan 9, 2018
149a9cf
Test teacher grading (not finished)
Jan 9, 2018
1576375
correct grading test
Jan 9, 2018
e3cc8fb
Add labels to grading cells
Jan 9, 2018
9f1ef40
First version of the grading test
Jan 10, 2018
4c6b60a
New test grading 2 questions
Jan 10, 2018
9b8de3f
Styles adjustments
Jan 11, 2018
88583db
Re-enable module administration menu
Jan 11, 2018
4f21302
Bump version before release
Jan 11, 2018
a23e61c
Improve module navigation and display
Jan 12, 2018
1c3711b
Improve accessibility
Jan 16, 2018
45f9609
Test for export good questions
Jan 16, 2018
acf47e5
Problem in garding test with Postgesql
Jan 17, 2018
9f6607c
Calendar events fix and test
May 14, 2018
f52498b
Tests for calendar event actions
May 14, 2018
f43e380
Bump version before release
May 15, 2018
737923a
Add more php versions to travis job
May 15, 2018
67da2c7
Privacy api
May 18, 2018
b2e2da9
Fix privacy provider and tests
May 19, 2018
81e0918
Fix codecheker errors
May 19, 2018
8485c16
@file_upload tag in Behat test
May 19, 2018
096dfdb
calendar_provide_event_action accept userid
Apr 29, 2019
f71be56
Update Travis job
Apr 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
language: php

sudo: required

addons:
firefox: "47.0.1"
postgresql: "9.3"
apt:
packages:
- openjdk-8-jre-headless

cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm

php:
- 7.0
- 7.1
- 7.2

env:
global:
- MOODLE_BRANCH=MOODLE_34_STABLE
matrix:
- DB=pgsql
- DB=mysqli

before_install:
- phpenv config-rm xdebug.ini
- nvm install 8.9
- nvm use 8.9
- cd ../..
- composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^2
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"

install:
- moodle-plugin-ci add-plugin maths/moodle-qbehaviour_adaptivemultipart
- moodle-plugin-ci install

script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat
62 changes: 49 additions & 13 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,69 @@
This activity is for Moodle 2.x-versions, it will not work in Moodle 1.9 (or below)
This activity is for Moodle 2.7 and ulterior versions, it will not work with Moodle previous versions.

This module was originally created by Jamie Pratt (e-Mail: me@jamiep.org) with funding from Future University Hakodate http://www.fun.ac.jp/e/
The module was originally conceived and partially designed by Peter Ruthven-Stuart (http://www.ruthven-stuart.org), Future University - Hakodate.
It has been migrated to Moodle 2.x-versions by gtn gmbh (global training network ltd. - http://gtn-solutions.com, http://www.exabis.at)
This module was originally created by Jamie Pratt (e-Mail: me@jamiep.org) with funding from Future University Hakodate
http://www.fun.ac.jp/e/
The module was originally conceived and partially designed by Peter Ruthven-Stuart (http://www.ruthven-stuart.org),
Future University - Hakodate.
It has been migrated to Moodle 2.x-versions by gtn gmbh (global training network ltd. - http://gtn-solutions.com,
http://www.exabis.at
It was upgraded to Moodle 2.7 and enhanced by Jean-Michel Vedrine (email vedrine@vedrine.net).


* qcreate - Bugs, Feature Requests, and Improvements *

If you have any problems installing this activity or suggestions for improvement please mailto: office@gtn-solutions.com
If you have any problems installing this activity or suggestions for improvement please mailto: vedrine@vedrine.net

* qcreate - Description *

* qcreate - Disclaimer *

As with any customization, it is recommended that you have a good backup of your Moodle site before attempting to install contributed code.
While those contributing code make every effort to provide the best code that they can, using contributed code nevertheless entails a certain degree of risk as contributed code is not as carefully reviewed and/or tested as the Moodle core code.
Hence, use this block at your own risk.
As with any customization, it is recommended that you have a good backup of your Moodle site before attempting to install
contributed code.
While those contributing code make every effort to provide the best code that they can, using contributed code nevertheless
entails a certain degree of risk as contributed code is not as carefully reviewed and/or tested as the Moodle core code.
Hence, use this plugin at your own risk.

* qcreate - History *

First official publishing-date: 2007/11/21 09:19:34 jamiesensei
Migration to Moodle 2.4 2013/03/28 gtn gmbh
Migration to Moodle 2.7 2014/08/02 Jean-Michel Vedrine

* qcreate - Installation *
QUICK INSTALL
=============

1) Save the zip file somewhere onto your local computer and extract all the files
There are two installation methods that are available. Follow one of these, then log into your Moodle site as an administrator
and visit the notifications page to complete the install.

2) Transfer the folder qcreate to the mod-directory of Moodle
==================== MOST RECOMMENDED METHOD - Git ====================

3) Log in as 'administrator' and click on the 'Home' link (Moodle 2.x)
If you do not have git installed, please see the below link. Please note, it is not necessary to set up the SSH Keys.
This is only needed if you are going to create a repository of your own on github.com.

That's it!
Information on installing git - http://help.github.com/set-up-git-redirect/

Once you have git installed, simply visit the Moodle root directory and clone git://github.com/jmvedrine/qcreate.git
Remember to rename the folder to qcreate if you do not specify this in the clone command

Eg. Linux command line would be as follow -

git clone -b git://github.com/jmvedrine/qcreate.git mod/qcreate

Use git pull to update this repository periodically to ensure you have the latest version.

==================== Download the qcreate module. ====================

Visit https://github.com/jmvedrine/qcreate/ and download the zip, uncompress this zip and extract the folder.
The folder will have a name similar to qcreate-master, you MUST rename this to qcreate.
Place this folder in your mod folder in your Moodle directory.

nb. The reason this is not the recommended method is due to the fact you have to over-write the contents of this folder
to apply any future updates to the qcreate module. In the above method there is a simple command to update the files.

IMPORTANT NOTE:
==============
This activity needs that your Moodle cron is working and executed at regular and short intervals.
Since Moodle 2.7 and the introduction of scheduled tasks the recommended interval between cron executions is 1 minute.
See https://docs.moodle.org/27/en/Scheduled_tasks . The creation activity rely on scheduled tasks to upgrade grades and
more importantly to update students capacities on question categories. If the cron is not working properly, you students
will not be able to create any question and they will receive an error message when they try to do so.
155 changes: 155 additions & 0 deletions backup/moodle1/lib.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Provides support for the conversion of moodle1 backup to the moodle2 format
* Based off of a template @ http://docs.moodle.org/dev/Backup_1.9_conversion_for_developers
*
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

/**
* Qcreate conversion handler
*/
class moodle1_mod_qcreate_handler extends moodle1_mod_handler {

/** @var moodle1_file_manager */
protected $fileman = null;

/** @var int cmid */
protected $moduleid = null;

/**
* 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 corresponding conversion method must be
* defined.
*
* Note that the path /MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE does not
* 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
*/
public function get_paths() {
return array(
new convert_path(
'qcreate', '/MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE',
array(
'newfields' => array(
'completionquestions' => 0,
),
)
),
new convert_path('qcreate_requireds',
'/MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE/REQUIREDS'),
new convert_path('qcreate_required',
'/MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE/REQUIREDS/REQUIRED'),
new convert_path('qcreate_grades',
'/MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE/GRADES'),
new convert_path('qcreate_grade',
'/MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE/GRADE')
);
}

/**
* This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QCREATE
* data available
*/
public function process_qcreate($data) {
global $CFG;

// Get the course module id and context id.
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$this->moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);

// Get a fresh new file manager for this instance.
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_qcreate');

// Convert course files embedded into the intro.
$this->fileman->filearea = 'intro';
$this->fileman->itemid = 0;
$data['intro'] = moodle1_converter::migrate_referenced_files(
$data['intro'], $this->fileman);

// Start writing qcreate.xml.
$this->open_xml_writer("activities/qcreate_{$this->moduleid}/qcreate.xml");
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid,
'moduleid' => $this->moduleid, 'modulename' => 'qcreate',
'contextid' => $contextid));
$this->xmlwriter->begin_tag('qcreate', array('id' => $instanceid));

foreach ($data as $field => $value) {
if ($field <> 'id') {
$this->xmlwriter->full_tag($field, $value);
}
}

return $data;
}

public function on_qcreate_requireds_start() {
$this->xmlwriter->begin_tag('requireds');
}

public function on_qcreate_requireds_end() {
$this->xmlwriter->end_tag('requireds');
}

public function process_qcreate_required($data) {
$this->write_xml('required', $data, array('/required/id'));
}

public function on_qcreate_grades_start() {
$this->xmlwriter->begin_tag('grades');
}

public function on_qcreate_grades_end() {
$this->xmlwriter->end_tag('grades');
}

public function process_qcreate_grade($data) {
$this->write_xml('grade', $data, array('/grade/id'));
}

/**
* This is executed when we reach the closing </MOD> tag of our 'qcreate' path
*/
public function on_qcreate_end() {
// Finish writing qcreate.xml.
$this->xmlwriter->end_tag('qcreate');
$this->xmlwriter->end_tag('activity');
$this->close_xml_writer();

// Write inforef.xml.
$this->open_xml_writer("activities/qcreate_{$this->moduleid}/inforef.xml");
$this->xmlwriter->begin_tag('inforef');
$this->xmlwriter->begin_tag('fileref');
foreach ($this->fileman->get_fileids() as $fileid) {
$this->write_xml('file', array('id' => $fileid));
}
$this->xmlwriter->end_tag('fileref');
$this->xmlwriter->end_tag('inforef');
$this->close_xml_writer();
}
}
90 changes: 90 additions & 0 deletions backup/moodle2/backup_qcreate_activity_task.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Defines backup_qcreate_activity_task class
*
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot . '/mod/qcreate/backup/moodle2/backup_qcreate_stepslib.php');

/**
* Provides the steps to perform one complete backup of the Quiz instance
*
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_qcreate_activity_task extends backup_activity_task {

/**
* No specific settings for this activity
*/
protected function define_my_settings() {
}

/**
* Defines backup steps to store the instance data and required questions
*/
protected function define_my_steps() {
// Generate the qcreate.xml file containing all the qcreate information
// and annotating used questions.
$this->add_step(new backup_qcreate_activity_structure_step('qcreate_structure', 'qcreate.xml'));

// Note: Following steps must be present
// in all the activities using question banks.

// Process all the annotated questions to calculate the question
// categories needing to be included in backup for this activity
// plus the categories belonging to the activity context itself.
$this->add_step(new backup_calculate_question_categories('activity_question_categories'));

// Clean backup_temp_ids table from questions. We already
// have used them to detect question_categories and aren't
// needed anymore.
$this->add_step(new backup_delete_temp_questions('clean_temp_questions'));
}

/**
* Encodes URLs to the index.php and view.php scripts
*
* @param string $content some HTML text that eventually contains URLs to the activity instance scripts
* @return string the content with the URLs encoded
*/
public static function encode_content_links($content) {
global $CFG;

$base = preg_quote($CFG->wwwroot, '/');

// Link to the list of qcreatezes.
$search = "/(".$base."\/mod\/qcreate\/index.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@QCREATEINDEX*$2@$', $content);

// Link to qcreate view by moduleid.
$search = "/(".$base."\/mod\/qcreate\/view.php\?id\=)([0-9]+)/";
$content = preg_replace($search, '$@QCREATEVIEWBYID*$2@$', $content);

// Link to qcreate view by qcreateid.
$search = "/(".$base."\/mod\/qcreate\/view.php\?a\=)([0-9]+)/";
$content = preg_replace($search, '$@QCREATEVIEWBYA*$2@$', $content);

return $content;
}
}
Loading