Commit Graph

140 Commits

Author SHA1 Message Date
Marina Glancy
b355a1c97c MDL-50851 core_question: use new tag API 2016-01-10 15:25:47 +08:00
Eoin Campbell
dcd4464ea3 MDL-50642 qformat_xml: fix import of tags in Cloze questions 2015-08-05 19:11:11 +01:00
Adrian Greeve
08000e535d MDL-49880 mod_lesson: Fixed notice while importing questions.
Cloze questions (not supported by lesson) threw up a notice saying that
the course wasn't set.
2015-04-20 09:12:20 +08:00
Tim Hunt
46e4c35aa9 MDL-42519 qformat_xml: Correctly export questions containing ]]> 2014-12-22 19:46:23 +00:00
Tim Hunt
013fa7a444 MDL-46308 qformat_xml: fix import of broken calculated questions.
Questions like this should not exist, of course. But they do, so we
should avoid generating errors in this case.
2014-08-08 17:58:44 +01:00
Tim Hunt
66de66fe6a MDL-46148 qtype_calculated: fix validation when importing.
In order to do this in a sane way, I cleaned up a lot of old mess,
inclduing:

1. Previously, qtype_calcuated used ->answeres when importing, and
->answer when saving the form. This was crazy, so I fixed it, and
stripped out the code that made the alternative variable name work.

2. Similarly, it could handle ->answer being either an array, such as
you would get form the HTML editor, or a simple string, which is what
you get form the form. I simplified that too.

3. Finally, I made import use a transaction around saving each
question, so we don't get half questions in the database when an error
occurs.
2014-07-09 13:35:09 +01:00
Tim Hunt
f4fe3968a2 MDL-46212 questions: add {} whenver vars are put into "" strings
Having had one subtle bug cased be this, I decided to do a search and
fix all of these.
2014-07-03 14:02:39 +01:00
Jean-Michel Vedrine
624ff5ba57 MDL-42033 Files in subdirs not exported correctly by question XML format 2014-02-16 19:37:09 +01:00
Tim Hunt
5c0b5ba575 MDL-43809 qformat_xml messes up $s in multianswer questions. 2014-01-23 15:26:38 +00:00
Kyle Temkin
a4f765eb1d MDL-39756 add advanced attachment options to essay question type
Adds a set of options to the essay question type which implement
the following new features:

-Adds an input format which accepts only file uploads, and no
 inline text.
-Adds an option to make the inline text response optional when
 attachments are enabled, so students can choose to upload
 an essay file.
-Adds an option to make attachments required, so essays without
 attachments will be marked incomplete.
2014-01-15 12:43:04 -05:00
Jean-Michel Vedrine
d2fd7262af MDL-39404 Update question/format files to match codechecker standards 2013-07-26 21:32:34 +02:00
Dan Poltawski
a3f92b2e0e Revert "MDL-26511 Images in Cloze multichoice"
This reverts commit feec4f8941.
2013-06-11 11:38:34 +08:00
ppichet
feec4f8941 MDL-26511 Images in Cloze multichoice
vertical and horizontal answer and in feedback of all qtype answers
2013-06-10 11:28:46 +08:00
Jamie Pratt
397acdfda2 MDL-39230 Question bank - refactor xml import
Allow for reuse of code to read xml questions.
2013-04-30 11:38:26 +08:00
Jean-Michel Vedrine
b31d6664e6 MDL-39283 GIFT and XML question export broken for unsupported qtypes
Do no write any data to the export for unsupported qtypes
2013-04-23 09:42:53 +02:00
Jean-Michel Vedrine
c80fb6d95e MDL-38880 Imported Cloze questions lose embedded images or other media 2013-04-11 16:22:20 +02:00
Jean-Michel Vedrine
60527d0c34 MDL-10516 Pre-populated answer (template) in essay questions 2013-04-03 11:30:42 +08:00
Jean-Michel Vedrine
ded5cddb32 MDL-37967 Improve XML question import format handling of duplicated files 2013-02-18 07:38:22 +01:00
Dan Poltawski
a9081ce630 MDL-37313 question: fix trailing whitespace 2013-01-15 16:36:14 +08:00
Jean-Michel Vedrine
2387d1cde5 MDL-37313 Moodle XML import format should use draft file areas, not arrays 2013-01-11 19:54:06 +01:00
Jean-Michel Vedrine
e9af609176 MDL-28183 add num parts correct and clear wrong to multianswer 2012-12-30 11:55:21 +01:00
Tim Hunt
7e252acff1 MDL-36942 xml question import: don't add spaces.
They are not necessary anyway, there is a \n character at the end of
each line.

Thanks to Richard Lobb for fining the problem and how to fix it.
2012-11-30 15:59:11 +00:00
Jean-Michel Vedrine
bedbfd6dfa MDL-32865 Backwards compatibility, deal with the old image tag 2012-11-17 16:38:03 +01:00
Jean-Michel Vedrine
7c86628de6 MDL-32865 CLOZE Questions imported from another course end up with broken image links 2012-11-17 16:38:02 +01:00
Tim Hunt
cacb8fa08a MDL-34841 error importing questions with long names.
The problem was with the non-UTF-8-safe way that a question name
was being constructed from the question text.

I have done a proper fix with methods in the base class to
carefully construct a question name that is reasonable, and
which will fit in the database column. Then I have changed all
importers to use the new methods.

I also remembered not to break the lesson in the process.
2012-09-11 15:04:00 +01:00
Tim Hunt
e231a3ffa2 MDL-27799 question bank: remove last traces of qtype constants.
Using consants to refer to plugin names is crazy. The whole point of
plugins is that you can install more, hence the list of constants will
never be complete.
2012-08-30 13:15:52 +01:00
Tim Hunt
4d18892676 MDL-32220 question import: files sometimes stored in the wrong context.
Sadly, this involves a small API change, but I don't believe anyone was
using the argument I had to remove (because we were sometimes passing a
wrong value, and there is not way to compute the right value at that
point in the code.)

Also sadly, the code to compute the context we are importing into is now
rather spaghetti-like, but it works.
2012-03-29 14:13:28 +01:00
Petr Skoda
e2bb3c9275 MDL-32094 some more E_STRICT fixes 2012-03-18 20:40:20 +01:00
Sam Hemelryk
b64a3e1ac1 MDL-30485 whitespace fix 2011-11-30 11:55:55 +13:00
Tim Hunt
3385a144b8 MDL-30485 XML import from 1.9 does not handle files in subfolders. 2011-11-28 17:26:17 +00:00
Eloy Lafuente (stronk7)
48e74d2c10 Merge branch 'MDL-29060' of git://github.com/timhunt/moodle 2011-11-23 11:47:51 +01:00
Tim Hunt
2ecbad416e MDL-30397 qformat_xml::format() should be public. 2011-11-22 07:21:04 +00:00
Tim Hunt
7e7fdf59c6 MDL-29060 q export: writefiles should be public write_files & belongs to XML format. 2011-11-20 11:49:41 +00:00
Aparup Banerjee
92f6c2eb7f Merge branch 'MDL-30021' of git://github.com/timhunt/moodle 2011-11-09 12:19:20 +08:00
Aparup Banerjee
097ba12ba0 Merge branch 'MDL-29058' of git://github.com/timhunt/moodle 2011-11-09 11:29:45 +08:00
Aparup Banerjee
98901d3ea9 Merge branch 'MDL-29739' of git://github.com/timhunt/moodle 2011-11-08 20:34:41 +08:00
Tim Hunt
4a84c94bec MDL-30135 question formats: trans_format/get_format should be public.
They need to be used by third-party qtype developers.
2011-11-07 11:31:27 +00:00
Tim Hunt
de529cd253 MDL-30021 qtype numerical better showunits default when coming from 1.9
This applies to:
1. Upgrade from 1.9,
2. Import of questions exported from 1.9, and
3. Restore of courses backed-up from 1.9.

It also applies to the calculated question type.
2011-11-03 11:27:41 +00:00
Tim Hunt
78fc17ebdf MDL-29058 question export: include files from hints & combined feedback. 2011-11-03 11:27:39 +00:00
Tim Hunt
fe5f412104 MDL-29739 question import used a bad default for text formats.
The new logic is that the questiontext defaults to HTML if the format is
not specified, then all other fields default to the same format of the
question text.

However, good practice is that the XML file should specify the format
for each bit of text content.

This code is not 100% backwards-compatible, since some methods have new
arguments, however for question types that have not been updated, it
will just generate a PHP Warning, which is, I think, and OK way to let
qtype developers know that they need to update their question types.
2011-11-03 11:27:37 +00:00
Tim Hunt
77d0f5f07b MDL-29644 qtype multianswer, hints lost doing Moodle XML export.
This commit also includes a lot of useful tidying up of some of the unit
test helper code. I turned out that I could not use all the helper code
in my new tests, but despite that it will be useful in the future, so I
am committing it here.
2011-10-04 22:23:58 +01:00
Tim Hunt
474abf1221 MDL-29366 qtype_essay import/export as Moodle XML loses files from graderinfo 2011-09-14 19:01:18 +01:00
Tim Hunt
1b343d5241 MDL-28564 question type importing, improve Jamie's fix. 2011-08-27 08:16:47 +01:00
Tim Hunt
19f7bb5b7e MDL-28049 conditional include so xml question format can work for both lesson and 3rd party qtypes.
This is a regression caused by MDL-27956.
2011-06-27 13:59:57 +01:00
Rajesh Taneja
ba15c346b1 MDL-27956 Lesson - Fixed strings and readquestions scope 2011-06-22 09:11:32 +08:00
ppichet
2a6c5c52ee MDL-24594 qtype_multichoice should allow images in the choices.
This change was massively re-worked by Tim Hunt to update Pierre Pichet's original patch for Moodle 2.0 to work in Moodle 2.1.
2011-06-17 18:41:13 +01:00
Tim Hunt
1f1c60c6a7 MDL-27797 supplimental. Fix two minor issues found by Sam H during testing. 2011-06-15 15:38:46 +01:00
Tim Hunt
8a5d05eea8 MDL-27854 qformat_xml fix import/export of essay questions to include the new options. 2011-06-14 17:36:11 +01:00
Tim Hunt
79e25fb456 MDL-27797 fix all the codechecker issues in format_xml
After this change, I can still export my test course with one of each question type, and all the unit tests still pass.
2011-06-14 17:06:55 +01:00
Tim Hunt
67b8b40cfa MDL-27797 fix bugs with Moodle XML export. 2011-06-14 16:34:14 +01:00