MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup
This commit is contained in:
@@ -186,4 +186,4 @@ $mod_glossary_capabilities = array(
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file replaces:
|
||||
// * STATEMENTS section in db/install.xml
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the glossary module
|
||||
@@ -208,4 +208,4 @@ function xmldb_glossary_upgrade($oldversion) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
$Id$
|
||||
|
||||
GLOSSARY FORMAT PLUGINS
|
||||
-----------------------
|
||||
|
||||
Starting with Moodle 1.4, the glossary module supports a plugin
|
||||
architecture to create your own formats. This plugin system allows
|
||||
architecture to create your own formats. This plugin system allows
|
||||
you to "invent" your own presentations for your glossary data. :-)
|
||||
|
||||
To facilitate the creation process a TEMPLATE format has been created.
|
||||
To facilitate the creation process a TEMPLATE format has been created.
|
||||
You should use it as the base for your own modifications (this requires
|
||||
some basic PHP skills). The template includes all the available data.
|
||||
|
||||
@@ -17,7 +15,7 @@ Please, follow these STEPS:
|
||||
For further reference in this document, we call it "THENAME".
|
||||
2.-Duplicate the TEMPLATE directory (under mod/glossary/formats/TEMPLATE).
|
||||
3.-Rename it to THENAME
|
||||
4.-Go into the THENAME directory and rename the TEMPLATE_format.php file
|
||||
4.-Go into the THENAME directory and rename the TEMPLATE_format.php file
|
||||
to THENAME_format.php
|
||||
5.-Edit the THENAME_format.php file. Change every ocurrence of TEMPLATE to
|
||||
THENAME.
|
||||
@@ -25,8 +23,8 @@ Please, follow these STEPS:
|
||||
7.-Edit (configure) your glossary. In the Format popup you'll see a new
|
||||
entry. It will be showed as "displayformatTHENAME". Select it and view
|
||||
your glossary.
|
||||
8.-Edit the THENAME_format.php. Make your format modifications and reload your
|
||||
web page to see them in your glossary. This file has been commented to make
|
||||
8.-Edit the THENAME_format.php. Make your format modifications and reload your
|
||||
web page to see them in your glossary. This file has been commented to make
|
||||
things easier to understand (further suggestions welcome!)
|
||||
9.-If you want to translate your THENAME format name to some nice name to
|
||||
be showed in the Format popup, simply, edit your lang/XX/glossary.php
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
global $CFG, $USER, $DB, $OUTPUT;
|
||||
|
||||
|
||||
|
||||
$user = $DB->get_record('user', array('id'=>$entry->userid));
|
||||
$strby = get_string('writtenby', 'glossary');
|
||||
|
||||
if ($entry) {
|
||||
|
||||
|
||||
echo '<table class="glossarypost TEMPLATE">';
|
||||
echo '<tr>';
|
||||
echo '<td class="entryheader">';
|
||||
@@ -32,7 +32,7 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
|
||||
//Comments: Configuration not supported
|
||||
echo get_string('lastedited').': '. userdate($entry->timemodified) . '<br /></span>';
|
||||
|
||||
//Use this function to show the approval button. It'll be shown if necessary
|
||||
//Use this function to show the approval button. It'll be shown if necessary
|
||||
//Comments: You can configure this parameters:
|
||||
//----Define where to show the approval button
|
||||
$approvalalign = 'right'; //Values: left, center and right (default right)
|
||||
@@ -50,7 +50,7 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
|
||||
|
||||
//Use this function to show the attachment. It'll be showed if necessary
|
||||
//Comments: You can configure this parameters:
|
||||
//----Define how to show the attachment
|
||||
//----Define how to show the attachment
|
||||
$attachmentformat = 'html'; //Values: html (link) and NULL (inline image if possible) (default NULL)
|
||||
//----Define where to show the attachment
|
||||
$attachmentalign = 'right'; //Values: left, center and right (default right)
|
||||
@@ -74,7 +74,7 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
|
||||
//Line separator not normally needed now.
|
||||
//echo "<br />\n";
|
||||
|
||||
//Use this function to show the definition
|
||||
//Use this function to show the definition
|
||||
//Comments: Configuration not supported
|
||||
glossary_print_entry_definition($entry, $glossary, $cm);
|
||||
|
||||
@@ -93,11 +93,11 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
|
||||
// use it only if you are really sure!
|
||||
//$printicons = false;
|
||||
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
|
||||
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "</table>\n";
|
||||
} else {
|
||||
} else {
|
||||
echo '<div style="text-align:center">';
|
||||
print_string('noentry', 'glossary');
|
||||
echo '</div>';
|
||||
@@ -119,4 +119,4 @@ function glossary_print_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode=''
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=false) {
|
||||
|
||||
@@ -15,7 +15,7 @@ function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode='
|
||||
glossary_print_entry_definition($entry, $glossary, $cm);
|
||||
$entry->alias = '';
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
echo '<tr valign="top"><td class="entrylowersection">';
|
||||
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
|
||||
echo '</td>';
|
||||
@@ -34,7 +34,7 @@ function glossary_print_entry_continuous($course, $cm, $glossary, $entry, $mode=
|
||||
|
||||
//Call to view function (without icons, ratings and aliases) and return its result
|
||||
return glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
|
||||
@@ -34,4 +34,4 @@ function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode=
|
||||
return glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='',$hook='',$printicons=1,$ratings=NULL, $aliases=true) {
|
||||
global $CFG, $USER, $DB, $OUTPUT;
|
||||
@@ -12,9 +12,9 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
|
||||
echo '<table class="glossarypost encyclopedia" cellspacing="0">';
|
||||
echo '<tr valign="top">';
|
||||
echo '<td class="left picture">';
|
||||
|
||||
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
|
||||
|
||||
echo '</td>';
|
||||
echo '<th class="entryheader">';
|
||||
echo '<div class="concept">';
|
||||
@@ -28,11 +28,11 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
|
||||
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
|
||||
|
||||
echo '</th>';
|
||||
|
||||
|
||||
echo '<td class="entryapproval">';
|
||||
glossary_print_entry_approval($cm, $entry, $mode);
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr valign="top">';
|
||||
@@ -57,16 +57,16 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
|
||||
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings, $aliases);
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
|
||||
echo '</td></tr>';
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
} else {
|
||||
echo '<div style="text-align:center">';
|
||||
print_string('noentry', 'glossary');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ function glossary_print_entry_encyclopedia($course, $cm, $glossary, $entry, $mod
|
||||
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
|
||||
|
||||
//Call to view function (without icons, ratings and aliases) and return its result
|
||||
|
||||
|
||||
return glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
global $USER;
|
||||
@@ -60,4 +60,4 @@ function glossary_print_entry_entrylist($course, $cm, $glossary, $entry, $mode='
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
global $USER;
|
||||
@@ -57,4 +57,4 @@ function glossary_print_entry_faq($course, $cm, $glossary, $entry, $mode='', $ho
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
global $CFG, $USER, $DB, $OUTPUT;
|
||||
@@ -11,11 +11,11 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
|
||||
if ($entry) {
|
||||
echo '<table class="glossarypost fullwithauthor" cellspacing="0">';
|
||||
echo '<tr valign="top">';
|
||||
|
||||
|
||||
echo '<td class="picture">';
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<th class="entryheader">';
|
||||
|
||||
echo '<div class="concept">';
|
||||
@@ -47,7 +47,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
|
||||
echo '<tr valign="top">';
|
||||
echo '<td class="left"> </td>';
|
||||
echo '<td colspan="2" class="entrylowersection">';
|
||||
|
||||
|
||||
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
|
||||
echo ' ';
|
||||
echo '</td></tr>';
|
||||
@@ -72,4 +72,4 @@ function glossary_print_entry_fullwithauthor($course, $cm, $glossary, $entry, $m
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
|
||||
global $CFG, $USER;
|
||||
@@ -34,7 +34,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
|
||||
echo '</td></tr>';
|
||||
echo '<tr valign="top"><td colspan="2" class="entrylowersection">';
|
||||
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
|
||||
|
||||
|
||||
echo ' ';
|
||||
echo '</td></tr>';
|
||||
echo "</table>\n";
|
||||
@@ -58,4 +58,4 @@ function glossary_print_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
|
||||
require_once("$CFG->dirroot/mod/glossary/lib.php");
|
||||
require_once("$CFG->dirroot/$CFG->admin/generator.php");
|
||||
@@ -58,4 +58,4 @@ class testGlossaryPortfolioCallers extends portfoliolib_test {
|
||||
parent::test_caller_with_plugins();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
/**
|
||||
* SQL.PHP
|
||||
* This file is include from view.php and print.php
|
||||
* @version $Id$
|
||||
* @copyright 2003
|
||||
**/
|
||||
|
||||
|
||||
+12
-12
@@ -1,11 +1,11 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
if (!isset($sortorder)) {
|
||||
$sortorder = '';
|
||||
}
|
||||
}
|
||||
if (!isset($sortkey)) {
|
||||
$sortkey = '';
|
||||
}
|
||||
|
||||
|
||||
//make sure variables are properly cleaned
|
||||
$sortkey = clean_param($sortkey, PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
|
||||
$sortorder = clean_param($sortorder, PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC)
|
||||
@@ -21,19 +21,19 @@
|
||||
}
|
||||
|
||||
|
||||
$browserow[] = new tabobject(GLOSSARY_STANDARD_VIEW,
|
||||
$browserow[] = new tabobject(GLOSSARY_STANDARD_VIEW,
|
||||
$CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=letter',
|
||||
get_string('standardview', 'glossary'));
|
||||
|
||||
$browserow[] = new tabobject(GLOSSARY_CATEGORY_VIEW,
|
||||
$CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=cat',
|
||||
$browserow[] = new tabobject(GLOSSARY_CATEGORY_VIEW,
|
||||
$CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=cat',
|
||||
get_string('categoryview', 'glossary'));
|
||||
|
||||
$browserow[] = new tabobject(GLOSSARY_DATE_VIEW,
|
||||
$browserow[] = new tabobject(GLOSSARY_DATE_VIEW,
|
||||
$CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=date',
|
||||
get_string('dateview', 'glossary'));
|
||||
|
||||
$browserow[] = new tabobject(GLOSSARY_AUTHOR_VIEW,
|
||||
$browserow[] = new tabobject(GLOSSARY_AUTHOR_VIEW,
|
||||
$CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=author',
|
||||
get_string('authorview', 'glossary'));
|
||||
|
||||
@@ -62,12 +62,12 @@
|
||||
<div class="entrybox">
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if (!isset($category)) {
|
||||
$category = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch ($tab) {
|
||||
case GLOSSARY_CATEGORY_VIEW:
|
||||
glossary_print_categories_menu($cm, $glossary, $hook, $category);
|
||||
@@ -103,8 +103,8 @@
|
||||
glossary_print_alphabet_menu($cm, $glossary, "letter", $hook, $sortkey, $sortorder);
|
||||
if ($mode == 'search' and $hook) {
|
||||
echo "<h3>$strsearch: $hook</h3>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo '<hr />';
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// Code fragment to define the version of glossary
|
||||
@@ -9,4 +9,4 @@ $module->version = 2009042006;
|
||||
$module->requires = 2009041700; // Requires this Moodle version
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
$PAGE->navbar->add($strwaitingapproval);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strwaitingapproval);
|
||||
} else { /// Print standard header
|
||||
} else { /// Print standard header
|
||||
echo $OUTPUT->header();
|
||||
}
|
||||
|
||||
@@ -526,4 +526,3 @@ echo $OUTPUT->footer();
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
?>
|
||||
@@ -16,7 +16,7 @@ This is v2.4.2 of the HotPot module for Moodle 1.9
|
||||
This software is provided "AS IS" without a warranty of any kind.
|
||||
|
||||
Sponsors who have generously contributed to the development of this software:
|
||||
- Agencia de Gestio d'Ajuts Universitaris i de Recerca (AGAUR),
|
||||
- Agencia de Gestio d'Ajuts Universitaris i de Recerca (AGAUR),
|
||||
Autonomous Government of Catalonia, Spain
|
||||
(via Josep M. Fontana, Universitat Pompeu Fabra)
|
||||
- Rikkyo Univeristy, Japan (via Paul Allum)
|
||||
@@ -33,9 +33,9 @@ IMPORTANT NOTICE
|
||||
TO INSTALL OR UPDATE THE HOTPOT MODULE
|
||||
======================================
|
||||
|
||||
You should install only this module by installing a complete Moodle 1.9 package.
|
||||
You should install only this module by installing a complete Moodle 1.9 package.
|
||||
|
||||
Similarly, the recommended way to upgrade this module is to upgrade to a complete Moodle 1.8 package.
|
||||
Similarly, the recommended way to upgrade this module is to upgrade to a complete Moodle 1.8 package.
|
||||
|
||||
However, it is possible to download and unzip a complete Moodle 1.9 package and extract the "mod/hotpot" folder for use on your live Moodle 1.8 site.
|
||||
|
||||
@@ -53,7 +53,7 @@ TO USE THE HOTPOT MODULE
|
||||
|
||||
5. On the main page for the Moodle course, confirm editing is turned on (click the "Turn editing on" button), then, in the section where you want to add the HotPot activity, select "Hot Potatoes Quiz" on the "Add an activity" drop-down menu .
|
||||
|
||||
If "Hot Potatoes Quiz" does not appear on the "Add an activity" menu, you may need to enable the HotPot module as follows:
|
||||
If "Hot Potatoes Quiz" does not appear on the "Add an activity" menu, you may need to enable the HotPot module as follows:
|
||||
|
||||
a) from the site's front page select "Admin" then "Modules"
|
||||
b) click the "closed eye" icon for the "Hot Potatoes Quiz" module
|
||||
@@ -75,9 +75,9 @@ HOT POTATOES CONDITIONS OF USE
|
||||
** Reproduced from the Hot Potatoes site **
|
||||
|
||||
Hot Potatoes is offered free to the educational community by the University of Victoria Humanities Computing and Media Centre (formerly the Language Centre), under certain conditions. Hot Potatoes is free for use by state educational institutions which are non-profit making, on the condition that the material produced using the program is freely available to anyone via the WWW. However, you need to purchase a licence under any of the following conditions:
|
||||
* You do not work for a public sector educational establishment.
|
||||
* You charge money for access to the material you make with Hot Potatoes.
|
||||
* You restrict access to the material in some way. (The only exception here is if you have an account on www.hotpot.net, where you ARE allowed to use password restrictions.)
|
||||
* You do not work for a public sector educational establishment.
|
||||
* You charge money for access to the material you make with Hot Potatoes.
|
||||
* You restrict access to the material in some way. (The only exception here is if you have an account on www.hotpot.net, where you ARE allowed to use password restrictions.)
|
||||
* You want to use the Masher program included with the Hot Potatoes suite.
|
||||
|
||||
For more information on licences, and details on how to purchase one, check out our Website at:
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// redirect to the next quiz or the course page
|
||||
// redirect to the next quiz or the course page
|
||||
redirect($next_url, get_string('resultssaved', 'hotpot'));
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ function hotpot_set_attempt_details(&$attempt) {
|
||||
}
|
||||
|
||||
// remove "correct" and "wrong" values from "ignored" values
|
||||
$response->ignored = array_diff($response->ignored,
|
||||
$response->ignored = array_diff($response->ignored,
|
||||
$response->correct, $response->wrong, $oldresponse->correct, $oldresponse->wrong
|
||||
);
|
||||
|
||||
@@ -577,4 +577,4 @@ function hotpot_set_attempt_details(&$attempt) {
|
||||
// $attempt->status = HOTPOT_STATUS_INPROGRESS;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?PHP //$Id$
|
||||
<?php
|
||||
//This php script contains all the stuff to backup/restore
|
||||
//quiz mods
|
||||
//-----------------------------------------------------------
|
||||
@@ -344,4 +344,4 @@
|
||||
$search = "/($base)([a-z]+).php\?([a-z]+)\=([0-9]+)/";
|
||||
return preg_replace($search, '$@HOTPOT*$2*$3*$4@$', $content);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -79,4 +79,4 @@ $mod_hotpot_capabilities = array(
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file replaces:
|
||||
// * STATEMENTS section in db/install.xml
|
||||
@@ -12,6 +12,6 @@ function xmldb_hotpot_install() {
|
||||
$DB->set_field('modules', 'visible', 0, array('name'=>'hotpot'));
|
||||
|
||||
/// Install logging support here
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to the hotpot module
|
||||
//
|
||||
@@ -30,4 +30,4 @@ function xmldb_hotpot_upgrade($oldversion) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
redirect('view.php?id='.$cm->id);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+73
-73
@@ -1,27 +1,27 @@
|
||||
<!--
|
||||
// PLEASE NOTE that this version is more recent than the incorrectly
|
||||
// numbered v6.1, dated 2003.11.17. From now on, version numbers will
|
||||
// PLEASE NOTE that this version is more recent than the incorrectly
|
||||
// numbered v6.1, dated 2003.11.17. From now on, version numbers will
|
||||
// follow those of Hot Potatoes.
|
||||
/* hot-potatoes.js (v6.0.4.0 - 2005.02.18)
|
||||
* =======================================
|
||||
* by Gordon Bateson, February 2003
|
||||
* Copyright (c) 2003 Gordon Bateson. All Rights Reserved.
|
||||
*
|
||||
* You are hereby granted a royalty free license to use or modify this
|
||||
* software provided that this copyright notice appears on all copies.
|
||||
* You are hereby granted a royalty free license to use or modify this
|
||||
* software provided that this copyright notice appears on all copies.
|
||||
*
|
||||
* This software is provided "AS IS" without a warranty of any kind.
|
||||
*
|
||||
* Documentation and downloads may be available from:
|
||||
*
|
||||
* Documentation and downloads may be available from:
|
||||
* http://www.kanazawa-gu.ac.jp/~gordon/research/hot-potatoes/
|
||||
*/
|
||||
// This JavaScript library modifies the SendResults and StartUp functions
|
||||
// This JavaScript library modifies the SendResults and StartUp functions
|
||||
// used by hotpot v5 and v6, so that more (or less!) details about the
|
||||
// student can be input, and more details of a quiz's questions and answers
|
||||
// student can be input, and more details of a quiz's questions and answers
|
||||
// can be submitted to the server when the quiz is finished
|
||||
// If the arrays below (Login, DB, JBC, ...) are set BEFORE calling this
|
||||
// script, they will NOT be overwritten. Any array that is not set, will
|
||||
// use the defaults below. This is useful if you want to use different
|
||||
// If the arrays below (Login, DB, JBC, ...) are set BEFORE calling this
|
||||
// script, they will NOT be overwritten. Any array that is not set, will
|
||||
// use the defaults below. This is useful if you want to use different
|
||||
// settings for different quizzes.
|
||||
// ************
|
||||
// Login Screen
|
||||
@@ -29,7 +29,7 @@
|
||||
if (window.Login==null) {
|
||||
Login = new Array();
|
||||
Login[0] = true; // Show prompt for user name
|
||||
// This can also be a string of user names ...
|
||||
// This can also be a string of user names ...
|
||||
// Login[0] = "Guest,Peter,Paul,Mary,Webmaster";
|
||||
// or an array of user names (and on-screen texts) (and passwords) ...
|
||||
// Login[0] = new Array("Guest", "001,Peter,xxxx", "002,Paul,yyyy", "003,Mary,zzzz", "Webmaster");
|
||||
@@ -42,21 +42,21 @@ if (window.Login==null) {
|
||||
// new Array("Webmaster")
|
||||
// );
|
||||
Login[1] = true; // Show prompt for student's UserID
|
||||
// If there is no password prompt (i.e. Logon[3] is false), this value
|
||||
// If there is no password prompt (i.e. Logon[3] is false), this value
|
||||
// will be checked against the password information, if any, in Login[0]
|
||||
Login[2] = false; // Show prompt for student's email
|
||||
Login[3] = false; // Show prompt for quiz password, and check this value against
|
||||
Login[3] = false; // Show prompt for quiz password, and check this value against
|
||||
// the password information, if any, in Login[0]
|
||||
// This can also be a string required to start the quiz ...
|
||||
// Login[3] = "password";
|
||||
Login[4] = true; // Show prompt for the cookie expiry date
|
||||
// If false, cookies expire at the end of the current session
|
||||
Login[5] = "guest,webmaster"
|
||||
// guest user names (case insensitive) ...
|
||||
// Login[5] = "guest,webmaster";
|
||||
// guest user names (case insensitive) ...
|
||||
// Login[5] = "guest,webmaster";
|
||||
// These users do NOT need to fill in other login fields
|
||||
// and their quiz results are NOT added to the database
|
||||
// the Login prompts and error messages
|
||||
// the Login prompts and error messages
|
||||
// are defined in the MSG array (see below)
|
||||
}
|
||||
// *********
|
||||
@@ -65,25 +65,25 @@ if (window.Login==null) {
|
||||
if (window.DB==null) {
|
||||
DB = new Array();
|
||||
DB[0] = true; // append form fields to database on server
|
||||
// If you are NOT using BFormMail's database feature,
|
||||
// If you are NOT using BFormMail's database feature,
|
||||
// set DB[0]=false, and you can then safely ignore DB[1 to 5]
|
||||
DB[1] = "/home/gordon/public_html/cgi/hot-potatoes-data";
|
||||
DB[1] = "/home/gordon/public_html/cgi/hot-potatoes-data";
|
||||
// append_db folder path (no trailing slash)
|
||||
// Can be either an absolute path e.g. "/home/gordon/public_html/cgi/hot-potatoes-data"
|
||||
// or a relative (to CGI bin) path e.g. "hot-potatoes-data"
|
||||
DB[2] = "hot-potatoes";
|
||||
DB[2] = "hot-potatoes";
|
||||
// append_db file name (no extension)
|
||||
// If left blank, the quiz file name, without extension, will be used
|
||||
// i.e. each quiz will have its results stored in a different file.
|
||||
// If filled in, this file will store the results for ALL quizzes.
|
||||
// Database files and folders must be set up BEFORE running the quiz
|
||||
// Database files and folders must be set up BEFORE running the quiz
|
||||
// must have appropriate access privileges (on Unix, use "chmod 666").
|
||||
DB[3] = ""; // append_db extension (if left blank, ".txt" will be used)
|
||||
DB[4] = ""; // db_fields (if left blank, ALL quiz fields will be sent)
|
||||
DB[5] = ""; // db_delimiter (if left blank, tab will be used)
|
||||
DB[6] = "REMOTE_ADDR,HTTP_USER_AGENT";
|
||||
DB[6] = "REMOTE_ADDR,HTTP_USER_AGENT";
|
||||
// env_report ('REMOTE_ADDR','HTTP_USER_AGENT' and a few others)
|
||||
// for a complete description of these fields are, see ...
|
||||
// for a complete description of these fields are, see ...
|
||||
// http://www.infosheet.com/stuff/BFormMail.readme
|
||||
// Switches DB[7] and DB[8] force the settings in the ResultForm
|
||||
// In v5 and v6 quizzes, these settings wil be override those in the original quiz
|
||||
@@ -94,7 +94,7 @@ if (window.DB==null) {
|
||||
DB[8] = ''; // email address to which results should be sent
|
||||
// e.g. [email protected]
|
||||
}
|
||||
// By default the quiz's question's scores will be returned.
|
||||
// By default the quiz's question's scores will be returned.
|
||||
// If you want more detailed information, set the flags below:
|
||||
// ********
|
||||
// JBC
|
||||
@@ -162,16 +162,16 @@ if (window.JCloze==null) {
|
||||
// [0] : (unused)
|
||||
// [1] : array of JCLOZE_ANSWER_TEXTs
|
||||
// [2] : clue for this answer
|
||||
// JCLOZE_ANSWER_TEXT :
|
||||
// JCLOZE_ANSWER_TEXT :
|
||||
// [0] : array (seems unnecessary, just the text would be enough?)
|
||||
// [0] : text of possible answer
|
||||
// State : array of JCLOZE_ANSWER_STATEs
|
||||
// JCLOZE_ANSWER_STATE (v5) :
|
||||
// JCLOZE_ANSWER_STATE (v5) :
|
||||
// [0] : clue asked for or not
|
||||
// [1] : number of hints (show next letter) and penalties ('check' an incorrect answer)
|
||||
// [2] : length of answer matched
|
||||
// [3] : score for this item
|
||||
// [4] : already answered correctly
|
||||
// [4] : already answered correctly
|
||||
// [5] : answer entered in text box (right or not)
|
||||
// JCLOZE_ANSWER_STATE (v6)
|
||||
// this.ClueGiven = false;
|
||||
@@ -196,16 +196,16 @@ if (window.JCross==null) {
|
||||
JCross[8] = true; // show number of checks
|
||||
// there are no "ignored" answers for JCross quizzes
|
||||
}
|
||||
// JCross quizzes use the following global variables:
|
||||
// JCross quizzes use the following global variables:
|
||||
// L : letters (of correct answers)
|
||||
// C : clue numbers (CL in v6)
|
||||
// G : guesses
|
||||
// 'L', 'C' ('CL') and 'G' are all 2-dimensional arrays (rows x cols)
|
||||
//
|
||||
// v5 quizzes additionally use the following single-dimension arrays
|
||||
// A : clues for across (horizontal) words
|
||||
// D : clues for down (vertical) words
|
||||
// N.B. form is only sent when all answers are correct so
|
||||
// A : clues for across (horizontal) words
|
||||
// D : clues for down (vertical) words
|
||||
// N.B. form is only sent when all answers are correct so
|
||||
// you can't find out what 'wrong' answers were entered
|
||||
// ********
|
||||
// JMatch
|
||||
@@ -251,7 +251,7 @@ if (window.JMatch==null) {
|
||||
// [0] : text
|
||||
// [1] : tag of the F item to which it SHOULD be dragged
|
||||
// [2] : tag of the F item to which it was dragged (initally 0)
|
||||
// N.B. form is only sent when all answers are correct so
|
||||
// N.B. form is only sent when all answers are correct so
|
||||
// you can't find out what 'wrong' answers were entered
|
||||
// ********
|
||||
// JMix
|
||||
@@ -266,8 +266,8 @@ if (window.JMix==null) {
|
||||
JMix[5] = true; // show number of checks
|
||||
JMix[6] = true; // show number of hints (=show next word)
|
||||
}
|
||||
// JMix quizzes use the global variables
|
||||
// 'Segments', 'GuessSequence' and 'Penalties'
|
||||
// JMix quizzes use the global variables
|
||||
// 'Segments', 'GuessSequence' and 'Penalties'
|
||||
// Segments : array of JMix_QUESTIONs
|
||||
// JMix_QUESTION:
|
||||
// [0] : text
|
||||
@@ -305,7 +305,7 @@ if (window.JQuiz==null) {
|
||||
// [0] : array (seems unnecessary, just the text would be enough?)
|
||||
// [0] : text of possible answer
|
||||
// Status : array of JQUIZ_ANSWER_STATEs
|
||||
// JQUIZ_ANSWER_STATE :
|
||||
// JQUIZ_ANSWER_STATE :
|
||||
// [0] : question done or not
|
||||
// [1] : number of wrong checks
|
||||
// [2] : number of hints asked for
|
||||
@@ -324,23 +324,23 @@ if (window.JQuiz==null) {
|
||||
// [1] : feedback text
|
||||
// [2] : correct answer flag (1=a correct answer, 0=a wrong answer)
|
||||
// [3] : weighted score (as percentage) if correct
|
||||
// [4] : flag (usually set to 1, but for hybrid answers that are not
|
||||
// [4] : flag (usually set to 1, but for hybrid answers that are not
|
||||
// to be included in multiple choice options, it is set to 0)
|
||||
// State : array of JQUIZ_QUESTION_STATEs
|
||||
// JQUIZ_QUESTION_STATE :
|
||||
// JQUIZ_QUESTION_STATE :
|
||||
// [0] : score (-1 shows not done yet)
|
||||
// [1] : array showing on which number try each JQUIZ_ANSWER was selected
|
||||
// [2] : number of attempts at this question
|
||||
// [3] : total of weighted scores of correct answers that were selected
|
||||
// i.e. each time a correct answer is selected,
|
||||
// i.e. each time a correct answer is selected,
|
||||
// its JQUIZ_ANSWER[3] weighting is added to this total
|
||||
// so when all the correct answers have been selected, this will be 100
|
||||
// [4] : penalties incurred for hints (score is set to zero if >= 1)
|
||||
// [5] : - for multiple choice, short-answer and hybrid questions, this is a
|
||||
// comma-delimited list showing order in which answers were chosen
|
||||
// - for multi-select fields, this is bar-delimted ('|') list of settings
|
||||
// showing whether each checkbox was selected ('Y') on not ('N') when the
|
||||
// 'Check' button was clicked. The final item in the list will be the
|
||||
// - for multi-select fields, this is bar-delimted ('|') list of settings
|
||||
// showing whether each checkbox was selected ('Y') on not ('N') when the
|
||||
// 'Check' button was clicked. The final item in the list will be the
|
||||
// settings for the correct answer.
|
||||
// N.B. JBC, JMatch(v5) and JQuiz(v5) all use global variables 'I' and 'Status'
|
||||
// JBC : I[0].length==3 && !window.RItems
|
||||
@@ -624,7 +624,7 @@ function checkOK(w, n){
|
||||
function getValue(w, n, flag) {
|
||||
var obj = w.document.forms[0].elements[n];
|
||||
var TYPE = obj.type.toUpperCase(); // required for ns4 (win)
|
||||
if (obj.options && TYPE.indexOf('SELECT')>=0){
|
||||
if (obj.options && TYPE.indexOf('SELECT')>=0){
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
} else {
|
||||
var v = obj.value;
|
||||
@@ -634,7 +634,7 @@ function getValue(w, n, flag) {
|
||||
if (n=='Password' || (n=='UserID' && !Login[3])) {
|
||||
var pwd = getPassword(w);
|
||||
if (pwd && v!=pwd) msg = MSG[n=='Password' ? 13 : 14];
|
||||
}
|
||||
}
|
||||
if (n=='UserEmail' && window.RegExp) {
|
||||
var r = '(\\w|-)+';
|
||||
r = r + '(\\.' + r + ')';
|
||||
@@ -784,7 +784,7 @@ function SendAllResults(Score) {
|
||||
// if this is a Netscape browser, check if the referer will be set OK
|
||||
if (navigator.appName=='Netscape' && (location.protocol=='file:' || navigator.userAgent.indexOf('Netscape6')>=0)) {
|
||||
// ns4 and ns7 set referer to 'file:// ...' when running a quiz offline
|
||||
// ns6.2 (at least) always sets referer to 'about:blank'
|
||||
// ns6.2 (at least) always sets referer to 'about:blank'
|
||||
// Netscape's setting of referer can cause BFormMail
|
||||
// to reject the form, so encode the form data as a URL
|
||||
var url = form.action;
|
||||
@@ -931,11 +931,11 @@ function GetQuestionDetails() {
|
||||
var hp = hpVersion();
|
||||
var t = hpQuizType();
|
||||
var v = hpQuizVersion();
|
||||
return (t==1) ? GetJbcQuestionDetails(hp, v) :
|
||||
(t==2) ? GetJClozeQuestionDetails(hp, v) :
|
||||
(t==3) ? GetJCrossQuestionDetails(hp, v) :
|
||||
(t==4) ? GetJMatchQuestionDetails(hp, v) :
|
||||
(t==5) ? GetJMixQuestionDetails(hp, v) :
|
||||
return (t==1) ? GetJbcQuestionDetails(hp, v) :
|
||||
(t==2) ? GetJClozeQuestionDetails(hp, v) :
|
||||
(t==3) ? GetJCrossQuestionDetails(hp, v) :
|
||||
(t==4) ? GetJMatchQuestionDetails(hp, v) :
|
||||
(t==5) ? GetJMixQuestionDetails(hp, v) :
|
||||
(t==6) ? GetJQuizQuestionDetails(hp, v) :
|
||||
(t==7) ? GetRhubarbDetails(hp, v) :
|
||||
(t==8) ? GetSequiturDetails(hp, v) : '';
|
||||
@@ -944,7 +944,7 @@ function GetJbcQuestionDetails(hp, v) {
|
||||
qDetails = '';
|
||||
// check the quiz version
|
||||
if (hp==5 || hp==6) {
|
||||
// get question details
|
||||
// get question details
|
||||
for(var q=0; q<I.length; q++) {
|
||||
// initialize strings to hold answer details
|
||||
var aDetails = new Array();
|
||||
@@ -953,7 +953,7 @@ function GetJbcQuestionDetails(hp, v) {
|
||||
aDetails[2] = new Array(); // ignored
|
||||
// get answer details
|
||||
for(var a=0; a<I[q][1].length; a++) {
|
||||
var i = (Status[q][1][a]=='R') ? 0 : (Status[q][1][a]=='0') ? 2 : 1;
|
||||
var i = (Status[q][1][a]=='R') ? 0 : (Status[q][1][a]=='0') ? 2 : 1;
|
||||
aDetails[i][aDetails[i].length] = (JBC[6] ? a : I[q][1][a][0]);
|
||||
}
|
||||
// format 'Q' (a padded, two-digit version of 'q')
|
||||
@@ -1076,7 +1076,7 @@ function GetJCrossQuestionDetails(hp, v) {
|
||||
for (var row=0; row<L.length; row++) {
|
||||
for (var col=0; col<L[row].length; col++) {
|
||||
// increment letter count, if required
|
||||
if (L[row][col]) letters++;
|
||||
if (L[row][col]) letters++;
|
||||
// show answers and clues, if required
|
||||
var q = (hp==5) ? C[row][col] : CL[row][col];
|
||||
if (q) {
|
||||
@@ -1384,7 +1384,7 @@ function GetJQuizAnswerDetails(q, flag) {
|
||||
}
|
||||
x[i] = a.join('+');
|
||||
}
|
||||
} else if (x) { // multiple-choice, short-answer and hybrid
|
||||
} else if (x) { // multiple-choice, short-answer and hybrid
|
||||
if (x.charAt(x.length-1)==',') {
|
||||
// HP 6.0 and 6.1 (always has trailing comma)
|
||||
x = x.substring(0, x.length-1).split(',');
|
||||
@@ -1577,7 +1577,7 @@ function hpClickCheck(hp, t, v, args) {
|
||||
if (window.MakeIndividualDropdowns) {
|
||||
var is_wrong = (ii!=0);
|
||||
g = I[i][1][ii][0];
|
||||
} else {
|
||||
} else {
|
||||
var is_wrong = (ii!=i);
|
||||
g = I[ii][1][0][0];
|
||||
}
|
||||
@@ -1592,11 +1592,11 @@ function hpClickCheck(hp, t, v, args) {
|
||||
if (!HP[_guesses][i]) HP[_guesses][i] = new Array();
|
||||
var ii = HP[_guesses][i].length;
|
||||
// is this a new guess at this gap?
|
||||
if (ii==0 || g!=HP[_guesses][i][ii-1]) {
|
||||
if (ii==0 || g!=HP[_guesses][i][ii-1]) {
|
||||
HP[_guesses][i][ii] = g;
|
||||
if (r==1) {
|
||||
// Rottmeier DropDown 2.4
|
||||
// do nothing
|
||||
// do nothing
|
||||
} else {
|
||||
var G = g.toUpperCase();
|
||||
var ii_max = I[i][1].length;
|
||||
@@ -1944,7 +1944,7 @@ function hpHiddenField(name, value, comma, forceHTML) {
|
||||
var values = value;
|
||||
var i_max = values.length;
|
||||
value = '';
|
||||
if (comma==null) comma = ',';
|
||||
if (comma==null) comma = ',';
|
||||
for (var i=0; i<i_max; i++) {
|
||||
values[i] = trim(values[i]);
|
||||
if (values[i]!=null && values[i]!='') {
|
||||
@@ -1999,8 +1999,8 @@ function getTime(obj) {
|
||||
// get year, month and day
|
||||
// for an LMS : yyyy-mm-dd
|
||||
// for email : DayName MonthName dd yyyy
|
||||
var s = is_LMS() ?
|
||||
obj.getFullYear() + '-' + pad(obj.getMonth()+1, 2) + '-' + pad(obj.getDate(), 2) :
|
||||
var s = is_LMS() ?
|
||||
obj.getFullYear() + '-' + pad(obj.getMonth()+1, 2) + '-' + pad(obj.getDate(), 2) :
|
||||
MSG[16][obj.getDay()] + ' ' + MSG[17][obj.getMonth()] + ' ' + pad(obj.getDate(), 2) + ' ' + obj.getFullYear()
|
||||
;
|
||||
// get hours, minutes and seconds (hh:mm:ss)
|
||||
@@ -2093,7 +2093,7 @@ function getPrompt(fn) {
|
||||
// Note: netscape uses double-quote as delimiter, others use single quote
|
||||
var s = getFuncCode(fn);
|
||||
var i1 = s.indexOf('prompt') + 8;
|
||||
var i2 = s.indexOf(s.charAt(i1-1), i1);
|
||||
var i2 = s.indexOf(s.charAt(i1-1), i1);
|
||||
var p = (i1>=8 && i2>i1) ? s.substring(i1, i2) : '';
|
||||
// make sure browser has decoded the unicode prompt properly
|
||||
// this check is mainly for ns4, but there may be others
|
||||
@@ -2109,13 +2109,13 @@ function getPrompt(fn) {
|
||||
}
|
||||
function getStartUpCode(fn) {
|
||||
// the main initialization code comes from the StartUp function
|
||||
// v5 : the code before "UserName", if any,
|
||||
// v5 : the code before "UserName", if any,
|
||||
// and the code after the 2nd subsequent '}'
|
||||
// v6 : the code before and after 'GetUserName();'
|
||||
// v6 : the code before and after 'GetUserName();'
|
||||
// i.e. all the code except the call to 'GetUserName();'
|
||||
var s = getFuncCode(fn);
|
||||
var i1 = s.indexOf('GetUserName();');
|
||||
if (i1>=0) { // v6
|
||||
if (i1>=0) { // v6
|
||||
var i2 = i1 + 14;
|
||||
} else { // v5
|
||||
var i1 = s.indexOf('UserName');
|
||||
@@ -2317,7 +2317,7 @@ function hpInterceptHints() {
|
||||
if (a[0]=='ShowHint') {
|
||||
if (a[1]=='QNum') {
|
||||
// JQuiz v3, v5-v6[HP5]
|
||||
x = 'if(ShowHint)hpClick(1,QNum);';
|
||||
x = 'if(ShowHint)hpClick(1,QNum);';
|
||||
} else {
|
||||
// JQuiz v4
|
||||
x = 'if(ShowHint)hpClick(1,QNum-1);'; // QNum is a global variable
|
||||
@@ -2397,7 +2397,7 @@ function hpInterceptChecks() {
|
||||
// JCross none
|
||||
// JMatch HP5 v3, v5, v6: CheckAnswer(), HP5 v4: CheckResults(), HP6: CheckAnswers()
|
||||
// JMix CheckAnswer(CheckType)
|
||||
// JQuiz
|
||||
// JQuiz
|
||||
// HP5: CheckAnswer(ShowHint, QNum)
|
||||
// HP6: CheckMCAnswer, CheckMultiSelAnswer, CheckShortAnswer
|
||||
// Rhubarb CheckWord(InputWord)
|
||||
@@ -2440,7 +2440,7 @@ function hpInterceptChecks() {
|
||||
if (a[0]=='ShowHint') {
|
||||
if (a[1]=='QNum') {
|
||||
// JQuiz v3, v5-v6[HP5]
|
||||
x = 'if(!ShowHint&&Status[QNum][0]<1)hpClick(3,QNum);';
|
||||
x = 'if(!ShowHint&&Status[QNum][0]<1)hpClick(3,QNum);';
|
||||
} else {
|
||||
// JQuiz v4
|
||||
x = 'if(!ShowHint&&State[QNum-1][0]<1)hpClick(3,QNum-1);'; // QNum is a global variable
|
||||
@@ -2452,7 +2452,7 @@ function hpInterceptChecks() {
|
||||
// Sequitur
|
||||
x = 'if (!(CurrentNumber==TotalSegments||AllDone||Btn.innerHTML==IncorrectIndicator))hpClick(3,Chosen);';
|
||||
}
|
||||
} else if (window.CheckWord) {
|
||||
} else if (window.CheckWord) {
|
||||
f = 'CheckWord';
|
||||
var a = getFuncArgs(f, true);
|
||||
if (a[0]=='InputWord') {
|
||||
@@ -2492,7 +2492,7 @@ if (Array.prototype && Array.prototype.push==null) {
|
||||
Array.prototype.push = new Function("x", "this[this.length]=x");
|
||||
}
|
||||
// add attachEvent function, if required (allows HP5 v6 quizzes to run on ie5mac)
|
||||
// NOTE: to allow v6 quizzes on ie5mac, the following code
|
||||
// NOTE: to allow v6 quizzes on ie5mac, the following code
|
||||
// needs to be inserted BEFORE the Hot Potatoes javascript
|
||||
if (window.attachEvent==null) {
|
||||
window.attachEvent = new Function('evt', 'fn', 'eval("window."+evt+"="+fn)');
|
||||
@@ -2534,7 +2534,7 @@ if (navigator.userAgent.indexOf("Netscape6")>=0 && window.ShowMessage) {
|
||||
// JBC uses "QForm" form, which contains elements called "FB_*_**" (* and ** start at 0)
|
||||
// JCloze uses "Cloze" form
|
||||
// JCross writes out "AnswerForm" from a variable called "GetAnswerOpener"
|
||||
// HP5.3: uses "AnswerForm" in "BottomFrame"
|
||||
// HP5.3: uses "AnswerForm" in "BottomFrame"
|
||||
// HP5.5: uses "AnswerForm" in "TopFrame", but it is only there when an answer is being input
|
||||
// JMatch uses "QForm" form, which contains elements called "sel*" (which disappear by the time the quiz is finished)
|
||||
// JMix uses "ButtonForm"
|
||||
@@ -2542,14 +2542,14 @@ if (navigator.userAgent.indexOf("Netscape6")>=0 && window.ShowMessage) {
|
||||
// === v6 ===
|
||||
// JBC uses "QForm" form (elements have no name or id)
|
||||
// JCloze uses "Cloze" form (elements have no name or id)
|
||||
// JCross does not use any forms,
|
||||
// JCross does not use any forms,
|
||||
// HP5: has "GridDiv" in "MainDiv"
|
||||
// HP6: has "Clues" table in "MainDiv"
|
||||
// JMatch has "MatchDiv" in "MainDiv"
|
||||
// HP5: uses "QForm" form, which contains elements called "sel*"
|
||||
// HP6: uses "QForm" form, which contains elements called "s*_**"
|
||||
// JMix does not use any forms, but has "SegmentDiv" in "MainDiv"
|
||||
// JQuiz
|
||||
// JQuiz
|
||||
// HP5: uses "QForm" form, which contains an element called "Guess"
|
||||
// HP6: has "Questions" ordered list in "MainDiv"
|
||||
// === v6+ ===
|
||||
@@ -2833,7 +2833,7 @@ function hpTimedOut() {
|
||||
}
|
||||
function hpFinished() {
|
||||
// assume false result
|
||||
var x = false;
|
||||
var x = false;
|
||||
var hp = hpVersion();
|
||||
var t = hpQuizType();
|
||||
var v = hpQuizVersion();
|
||||
@@ -2971,7 +2971,7 @@ function Finish(quizstatus) {
|
||||
}
|
||||
}
|
||||
// create form to send results
|
||||
if (DB[7] && DB[8] && !is_LMS()) {
|
||||
if (DB[7] && DB[8] && !is_LMS()) {
|
||||
ResultForm = ''
|
||||
+ '<html><body>'
|
||||
+ '<form name="Results" action="" method="post" enctype="x-www-form-encoded">'
|
||||
|
||||
+14
-14
@@ -63,7 +63,7 @@
|
||||
// do nothing (user is not diplaying this section)
|
||||
} else {
|
||||
$hotpots[$hotpot_instance->id] = $hotpot_instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($hotpots)) {
|
||||
@@ -190,9 +190,9 @@
|
||||
if ($concat_field) {
|
||||
$records = $DB->get_records_sql("
|
||||
SELECT $concat_field, COUNT(*), hotpot, name
|
||||
FROM {hotpot_questions}
|
||||
FROM {hotpot_questions}
|
||||
WHERE hotpot IN ($hotpotids)
|
||||
GROUP BY hotpot, name
|
||||
GROUP BY hotpot, name
|
||||
HAVING COUNT(*) >1
|
||||
");
|
||||
if ($records) {
|
||||
@@ -264,31 +264,31 @@
|
||||
}
|
||||
|
||||
switch ($course->format) {
|
||||
case 'weeks' :
|
||||
case 'weeks' :
|
||||
$title = get_string("week");
|
||||
break;
|
||||
case 'topics' :
|
||||
case 'topics' :
|
||||
$title = get_string("topic");
|
||||
break;
|
||||
default :
|
||||
default :
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
if ($title) {
|
||||
array_push($table->head, $title);
|
||||
array_push($table->head, $title);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
if (has_capability('moodle/course:manageactivities', $coursecontext)) {
|
||||
array_push($table->head, $strupdate);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
get_string("quizcloses", "quiz"),
|
||||
get_string("bestgrade", "quiz"),
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
get_string("quizcloses", "quiz"),
|
||||
get_string("bestgrade", "quiz"),
|
||||
get_string("attempts", "quiz")
|
||||
);
|
||||
array_push($table->align,
|
||||
array_push($table->align,
|
||||
"left", "left", "center", "left"
|
||||
);
|
||||
if (has_capability('mod/hotpot:grade', $coursecontext)) {
|
||||
@@ -330,7 +330,7 @@
|
||||
$bestscore = " ";
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$cm = get_coursemodule_from_instance('hotpot', $hotpot->id);
|
||||
// report number of attempts and users
|
||||
$report = get_string("viewallreports","quiz", $totals[$hotpot->id]->attemptcount);
|
||||
@@ -402,4 +402,4 @@
|
||||
|
||||
// Finish the page
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
+8
-8
@@ -282,11 +282,11 @@ function hotpot_update_events($hotpot) {
|
||||
$event->timeduration = ($hotpot->timeclose - $hotpot->timeopen);
|
||||
|
||||
if ($event->timeduration > HOTPOT_MAX_EVENT_LENGTH) { /// Long durations create two events
|
||||
|
||||
|
||||
$event->name = $hotpot->name.' ('.get_string('hotpotopens', 'hotpot').')';
|
||||
$event->timeduration = 0;
|
||||
add_event($event);
|
||||
|
||||
|
||||
$event->timestart = $hotpot->timeclose;
|
||||
$event->eventtype = 'close';
|
||||
$event->name = $hotpot->name.' ('.get_string('hotpotcloses', 'hotpot').')';
|
||||
@@ -866,7 +866,7 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
|
||||
if ($rawmods = $DB->get_records_sql($query, $params)) {
|
||||
|
||||
// cache $isteacher setting
|
||||
|
||||
|
||||
$isteacher = has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
|
||||
$explodesection = array();
|
||||
@@ -1137,7 +1137,7 @@ function hotpot_print_recent_activity($course, $isteacher, $timestart) {
|
||||
foreach ($records as $id => $record){
|
||||
if ($cm = get_coursemodule_from_instance('hotpot', $record->id, $course->id)) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
|
||||
if (has_capability('mod/hotpot:viewreport', $context)) {
|
||||
$href = "$CFG->wwwroot/mod/hotpot/view.php?hp=$id";
|
||||
$name = ' <a href="'.$href.'">'.$record->name.'</a>';
|
||||
@@ -1549,7 +1549,7 @@ function hotpot_get_participants($hotpotid) {
|
||||
* it it has support for grading and scales. Commented code should be
|
||||
* modified if necessary. See forum, glossary or journal modules
|
||||
* as reference.
|
||||
*
|
||||
*
|
||||
* @param int $hotpotid
|
||||
* @param int $scaleid
|
||||
* @return bool
|
||||
@@ -1609,7 +1609,7 @@ function hotpot_add_attempt($hotpotid) {
|
||||
$attempt->status = HOTPOT_STATUS_ABANDONED;
|
||||
$DB->update_record('hotpot_attempts', $attempt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create and add new attempt record
|
||||
$attempt = new stdClass();
|
||||
@@ -2750,7 +2750,7 @@ function hotpot_string_ids($field_value) {
|
||||
/**
|
||||
* @global object
|
||||
* @param string $str
|
||||
* @return int|string
|
||||
* @return int|string
|
||||
*/
|
||||
function hotpot_string_id($str) {
|
||||
global $DB;
|
||||
@@ -2968,7 +2968,7 @@ function hotpot_reset_userdata($data) {
|
||||
|
||||
/**
|
||||
* Called by course/reset.php
|
||||
*
|
||||
*
|
||||
* @param $mform form passed by reference
|
||||
*/
|
||||
function hotpot_reset_course_form_definition(&$mform) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php // $id$
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Media plugin filtering
|
||||
//
|
||||
// This filter will replace any links to a media file with
|
||||
//
|
||||
// This filter will replace any links to a media file with
|
||||
// a media plugin that plays that media inline
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/// This is the filtering function itself. It accepts the
|
||||
/// This is the filtering function itself. It accepts the
|
||||
/// courseid and the text to be filtered (in HTML form).
|
||||
|
||||
function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
@@ -40,7 +40,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
$replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
|
||||
$replace .= '</embed>';
|
||||
$replace .= '</object> ';
|
||||
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_flv) {
|
||||
$search = '/<a(.*?)href=\"([^<]+)\.flv\"([^>]*)>(.*?)<\/a>/is';
|
||||
|
||||
|
||||
$replace = '\\0 <object class="mediaplugin flv" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
|
||||
$replace .= ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
|
||||
$replace .= ' width="480" height="360" id="flvplayer">';
|
||||
@@ -97,7 +97,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
$replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
|
||||
$replace .= '</embed>';
|
||||
$replace .= '</object> ';
|
||||
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
$replace .= '<param name="autoplay" value="false" />';
|
||||
$replace .= '<embed src="\\2.\\3" width="240" height="180" controller="true" autoplay="false"> </embed>';
|
||||
$replace .= '</object></p>';
|
||||
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
@@ -172,10 +172,10 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
$replace .= '<param name="autoplay" value="false" />';
|
||||
$replace .= '<embed src="\\2.avi" width="240" height="180" controller="true" autoplay="false"> </embed>';
|
||||
$replace .= '</object></p>';
|
||||
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_ram) {
|
||||
$search = '/<a(.*?)href=\"([^<]+)\.ram\"([^>]*)>(.*?)<\/a>/is';
|
||||
|
||||
@@ -200,7 +200,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_rpm) {
|
||||
$search = '/<a(.*?)href=\"([^<]+)\.rpm\"([^>]*)>(.*?)<\/a>/is';
|
||||
|
||||
@@ -225,7 +225,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_rm) {
|
||||
$search = '/<a(.*?)href=\"([^<]+)\.rm\"([^>]*)>(.*?)<\/a>/is';
|
||||
|
||||
@@ -253,4 +253,3 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
|
||||
|
||||
return $text;
|
||||
}
|
||||
?>
|
||||
@@ -327,4 +327,3 @@ class mod_hotpot_mod_form extends moodleform_mod {
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
?>
|
||||
+12
-12
@@ -1,4 +1,4 @@
|
||||
<?PHP // $Id$
|
||||
<?php
|
||||
|
||||
// This script uses installed report plugins to print quiz reports
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
if (! $hotpot = $DB->get_record("hotpot", array("id"=>$cm->instance))) {
|
||||
print_error('invalidhotpotid', 'hotpot');
|
||||
}
|
||||
@@ -221,8 +221,8 @@
|
||||
$fields = 'a.*, u.firstname, u.lastname, u.picture';
|
||||
if ($mode=='click') {
|
||||
$fields .= ', u.idnumber';
|
||||
} else {
|
||||
// overview, simple and detailed reports
|
||||
} else {
|
||||
// overview, simple and detailed reports
|
||||
// get last attempt record in clickreport series
|
||||
$ids = array();
|
||||
foreach ($cr_attempts as $cr_attempt) {
|
||||
@@ -394,7 +394,7 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
|
||||
}
|
||||
if (count($ids)) {
|
||||
list($ids, $idparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'crid0');
|
||||
$params = array_merge($params, $idparams);
|
||||
$params = array_merge($params, $idparams);
|
||||
$select = "hotpot=:hotpotid AND clickreportid $ids";
|
||||
}
|
||||
break;
|
||||
@@ -421,14 +421,14 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// functions to print the report headings and
|
||||
/// functions to print the report headings and
|
||||
/// report selector menus
|
||||
|
||||
function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
|
||||
global $OUTPUT;
|
||||
$strmodulenameplural = get_string("modulenameplural", "hotpot");
|
||||
$strmodulename = get_string("modulename", "hotpot");
|
||||
|
||||
|
||||
$modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
if (has_capability('mod/hotpot:viewreport',$modulecontext)) {
|
||||
if ($mode=='overview' || $mode=='simplestat' || $mode=='fullstat') {
|
||||
@@ -446,10 +446,10 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'hotpot'));
|
||||
echo $OUTPUT->header();
|
||||
|
||||
|
||||
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
|
||||
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
|
||||
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
|
||||
. get_string('seeallcoursegrades', 'grades') . '</a></div>';
|
||||
}
|
||||
echo $OUTPUT->heading($hotpot->name);
|
||||
@@ -492,9 +492,9 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
|
||||
|
||||
// get users who have ever atetmpted this HotPot
|
||||
$users = $DB->get_records_sql("
|
||||
SELECT
|
||||
SELECT
|
||||
u.id, u.firstname, u.lastname
|
||||
FROM
|
||||
FROM
|
||||
{user} u,
|
||||
{hotpot_attempts} ha
|
||||
WHERE
|
||||
@@ -665,4 +665,4 @@ function hotpot_get_users_by_capability(&$modulecontext, $capability) {
|
||||
}
|
||||
return $users[$capability];
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/// Overview report just displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
|
||||
@@ -338,7 +338,7 @@ class hotpot_report extends hotpot_default_report {
|
||||
if (!function_exists('clean_getstring_data')) { // Moodle 1.4 (and less)
|
||||
$reportpercentscore = str_replace('%', '%%', $reportpercentscore);
|
||||
}
|
||||
array_push($table->head,
|
||||
array_push($table->head,
|
||||
get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')),
|
||||
get_string('reportsofar', 'hotpot', get_string('reportquestionstried', 'hotpot')),
|
||||
get_string('reportthisclick', 'hotpot', get_string('reportright', 'hotpot')),
|
||||
@@ -426,7 +426,7 @@ class hotpot_report extends hotpot_default_report {
|
||||
$records = $DB->get_records_sql_menu("
|
||||
SELECT userid, MIN(time) AS logouttime
|
||||
FROM {log}
|
||||
WHERE userid=? AND action='logout' AND time>?
|
||||
WHERE userid=? AND action='logout' AND time>?
|
||||
GROUP BY userid
|
||||
", array($attempt->userid, $attempt->cr_timefinish));
|
||||
if (empty($records)) {
|
||||
@@ -539,4 +539,4 @@ class hotpot_report extends hotpot_default_report {
|
||||
}
|
||||
}
|
||||
} // end class
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?PHP // $Id$
|
||||
<?PHP // $Id$
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// Default class for report plugins
|
||||
///
|
||||
/// Doesn't do anything on it's own -- it needs to be extended.
|
||||
/// This class displays quiz reports. Because it is called from
|
||||
///
|
||||
/// Doesn't do anything on it's own -- it needs to be extended.
|
||||
/// This class displays quiz reports. Because it is called from
|
||||
/// within /mod/quiz/report.php you can assume that the page header
|
||||
/// and footer are taken care of.
|
||||
///
|
||||
/// This file can refer to itself as report.php to pass variables
|
||||
/// to itself - all these will also be globally available. You must
|
||||
///
|
||||
/// This file can refer to itself as report.php to pass variables
|
||||
/// to itself - all these will also be globally available. You must
|
||||
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class hotpot_default_report {
|
||||
|
||||
function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) {
|
||||
function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) {
|
||||
/// This function just displays the report
|
||||
// it is replaced by the "display" functions in the scripts in the "report" folder
|
||||
return true;
|
||||
@@ -68,7 +68,7 @@ class hotpot_default_report {
|
||||
|
||||
// add $value to answers array, if it was not there
|
||||
if ($i==$i_max) {
|
||||
$table->legend[$q]['answers'][$i] = $value;
|
||||
$table->legend[$q]['answers'][$i] = $value;
|
||||
}
|
||||
|
||||
// convert $value to alphabetic index (A, B ... AA, AB ...)
|
||||
@@ -98,12 +98,12 @@ class hotpot_default_report {
|
||||
foreach($table->legend as $q=>$question) {
|
||||
|
||||
$legend->stat[] = array(
|
||||
get_string('questionshort', 'hotpot', $q+1),
|
||||
get_string('questionshort', 'hotpot', $q+1),
|
||||
$question['name']
|
||||
);
|
||||
foreach($question['answers'] as $a=>$answer) {
|
||||
$legend->stat[] = array(
|
||||
$this->dec_to_ALPHA($a),
|
||||
$this->dec_to_ALPHA($a),
|
||||
$answer
|
||||
);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ class hotpot_default_report {
|
||||
|
||||
function print_report_finish(&$course, &$hotpot, &$options) {
|
||||
switch ($options['reportformat']) {
|
||||
case 'txt' :
|
||||
case 'txt' :
|
||||
// do nothing
|
||||
break;
|
||||
case 'xls':
|
||||
@@ -454,7 +454,7 @@ class hotpot_default_report {
|
||||
$col = 0; // column index
|
||||
while ($col<$table->colspan && isset($cells[$i])) {
|
||||
if (empty($skipcol[$col])) {
|
||||
$cell = &$cells[$i++];
|
||||
$cell = &$cells[$i++];
|
||||
$td = $table->td[$col];
|
||||
if (is_object($cell)) {
|
||||
$text = $cell->text;
|
||||
@@ -551,7 +551,7 @@ class hotpot_default_report {
|
||||
}
|
||||
function print_text_start(&$course, &$hotpot, &$options) {
|
||||
$downloadfilename = clean_filename("$course->shortname $hotpot->name.txt");
|
||||
header("Content-Type: application/download\n");
|
||||
header("Content-Type: application/download\n");
|
||||
header("Content-Disposition: attachment; filename=$downloadfilename");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
|
||||
@@ -663,7 +663,7 @@ class hotpot_default_report {
|
||||
$this->print_excel_stat($wb, $ws, $table, $row, $options);
|
||||
$this->print_excel_foot($wb, $ws, $table, $row, $options);
|
||||
}
|
||||
|
||||
|
||||
// close the workbook (and send it to the browser)
|
||||
$wb->close();
|
||||
}
|
||||
@@ -684,8 +684,8 @@ class hotpot_default_report {
|
||||
function print_excel_head(&$wb, &$ws, &$table, &$row, &$options) {
|
||||
// define format properties
|
||||
$properties = array(
|
||||
'bold'=>1,
|
||||
'align'=>'center',
|
||||
'bold'=>1,
|
||||
'align'=>'center',
|
||||
'v_align'=>'bottom',
|
||||
'text_wrap'=>1
|
||||
);
|
||||
@@ -851,4 +851,4 @@ class hotpot_default_report {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/// Overview report just displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
|
||||
@@ -39,9 +39,9 @@ class hotpot_report extends hotpot_default_report {
|
||||
}
|
||||
// headings for name, attempt number, score/grade and penalties
|
||||
$table->head = array(
|
||||
get_string("name"),
|
||||
get_string("name"),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
get_string('attempt', 'quiz'),
|
||||
get_string('attempt', 'quiz'),
|
||||
);
|
||||
$table->align = array('left', 'center', 'center');
|
||||
$table->size = array(150, 80, 10);
|
||||
@@ -50,8 +50,8 @@ class hotpot_report extends hotpot_default_report {
|
||||
// question headings
|
||||
$this->add_question_headings($questions, $table, 'left', 0, false, 2);
|
||||
// penalties (not always needed) and raw score
|
||||
array_push($table->head,
|
||||
get_string('penalties', 'hotpot'),
|
||||
array_push($table->head,
|
||||
get_string('penalties', 'hotpot'),
|
||||
get_string('score', 'quiz')
|
||||
);
|
||||
array_push($table->align, 'center', 'center');
|
||||
@@ -82,7 +82,7 @@ class hotpot_report extends hotpot_default_report {
|
||||
}
|
||||
$cells = array ($name, $grade, $attemptnumber);
|
||||
// $name and $grade are only printed on first line per user
|
||||
$name = $blank;
|
||||
$name = $blank;
|
||||
$grade = $blank;
|
||||
$start_col = count($cells);
|
||||
foreach ($questionids as $col => $id) {
|
||||
@@ -446,4 +446,4 @@ return <<<SHOWHIDE_SET
|
||||
SHOWHIDE_SET
|
||||
;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/// Overview report just displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
|
||||
@@ -29,13 +29,13 @@ class hotpot_report extends hotpot_default_report {
|
||||
$table->size[] = 10;
|
||||
$table->wrap[] = "nowrap";
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
get_string("attempt", "quiz"),
|
||||
get_string("time", "quiz"),
|
||||
get_string("reportstatus", "hotpot"),
|
||||
get_string("timetaken", "quiz"),
|
||||
get_string("attempt", "quiz"),
|
||||
get_string("time", "quiz"),
|
||||
get_string("reportstatus", "hotpot"),
|
||||
get_string("timetaken", "quiz"),
|
||||
get_string("score", "quiz")
|
||||
);
|
||||
array_push($table->align, "left", "center", "center", "left", "center", "center", "center");
|
||||
@@ -96,7 +96,7 @@ class hotpot_report extends hotpot_default_report {
|
||||
if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade
|
||||
$score = '<span class="highlight">'.$score.'</span>';
|
||||
}
|
||||
array_push($data,
|
||||
array_push($data,
|
||||
$attemptnumber,
|
||||
$checkbox.$starttime,
|
||||
hotpot_format_status($attempt),
|
||||
@@ -166,4 +166,4 @@ END_OF_JAVASCRIPT
|
||||
;
|
||||
} // end function
|
||||
} // end class
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/// Overview report: displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
|
||||
@@ -29,9 +29,9 @@ class hotpot_report extends hotpot_default_report {
|
||||
$table->size[] = 10;
|
||||
}
|
||||
// name, grade and attempt number
|
||||
array_push($table->head,
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
get_string("attempt", "quiz")
|
||||
);
|
||||
array_push($table->align, "left", "center", "center");
|
||||
@@ -39,8 +39,8 @@ class hotpot_report extends hotpot_default_report {
|
||||
// question headings
|
||||
$this->add_question_headings($questions, $table);
|
||||
// penalties and raw score
|
||||
array_push($table->head,
|
||||
get_string('penalties', 'hotpot'),
|
||||
array_push($table->head,
|
||||
get_string('penalties', 'hotpot'),
|
||||
get_string('score', 'quiz')
|
||||
);
|
||||
array_push($table->align, "center", "center");
|
||||
@@ -200,4 +200,4 @@ class hotpot_report extends hotpot_default_report {
|
||||
$tables[] = &$table;
|
||||
}
|
||||
} // end class
|
||||
?>
|
||||
|
||||
|
||||
+14
-14
@@ -1,17 +1,17 @@
|
||||
<?PHP //$Id$
|
||||
<?php
|
||||
//This php script contains all the stuff to restore hotpot mods
|
||||
//-----------------------------------------------------------
|
||||
// This is the "graphical" structure of the hotpot mod:
|
||||
//-----------------------------------------------------------
|
||||
//
|
||||
// hotpot
|
||||
// (CL, pk->id,
|
||||
// (CL, pk->id,
|
||||
// fk->course, files)
|
||||
// |
|
||||
// +--------------+---------------+
|
||||
// | |
|
||||
// hotpot_attempts hotpot_questions
|
||||
// (UL, pk->id, (UL, pk->id,
|
||||
// (UL, pk->id, (UL, pk->id,
|
||||
// fk->hotpot) fk->hotpot, text)
|
||||
// | | |
|
||||
// +-------------------+----------+ |
|
||||
@@ -40,7 +40,7 @@ require_once ("$CFG->dirroot/mod/hotpot/lib.php");
|
||||
function hotpot_restore_mods($mod, $restore) {
|
||||
//This function restores a single hotpot activity
|
||||
|
||||
// This function is called by "restore_create_modules" (in "backup/restorelib.php")
|
||||
// This function is called by "restore_create_modules" (in "backup/restorelib.php")
|
||||
// which is called by "backup/restore_execute.html" (included by "backup/restore.php")
|
||||
// $mod is an object
|
||||
// id : id field in 'modtype' table
|
||||
@@ -129,7 +129,7 @@ function hotpot_restore_questions(&$restore, $status, &$xml, &$record) {
|
||||
// $xml is an XML tree for a hotpot record
|
||||
// $record is the newly added hotpot record
|
||||
$foreignkeys = array(
|
||||
'hotpot'=>$record->id,
|
||||
'hotpot'=>$record->id,
|
||||
'text'=>'hotpot_strings'
|
||||
);
|
||||
return hotpot_restore_records(
|
||||
@@ -242,7 +242,7 @@ function hotpot_restore_records(&$restore, $status, &$xml, $table, $foreign_keys
|
||||
// $record_TAG : (optional) the name of an XML tag which starts a single record
|
||||
// If no $record_TAG is specified, the block of records is assumed to be a single record
|
||||
// other parameters are explained in "hotpot_restore_record" below
|
||||
|
||||
|
||||
$i = 0; // index for $records_TAG
|
||||
do {
|
||||
unset($xml_records);
|
||||
@@ -289,10 +289,10 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
|
||||
// $foreign_keys : array of foreign keys, if any, specifed as $key=>$value
|
||||
// $key : the name of a field in the current $record
|
||||
// $value : if $value is numeric, then $record->$key is set to $value.
|
||||
// Otherwise $value is assumed to be a table name and $record->$key
|
||||
// Otherwise $value is assumed to be a table name and $record->$key
|
||||
// is treated as a comma separated list of ids in that table
|
||||
// $more_restore : optional PHP code to be eval(uated) for each record
|
||||
// $secondary_key :
|
||||
// $secondary_key :
|
||||
// the name of the secondary key field, if any, in the current $record.
|
||||
// If this field is specified, then the current record will only be added
|
||||
// if the $record->$secondarykey value does not already exist in $table
|
||||
@@ -302,7 +302,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
|
||||
|
||||
static $table_columns = array();
|
||||
if (empty($table_columns[$table])) {
|
||||
global $CFG, $DB;
|
||||
global $CFG, $DB;
|
||||
$table_columns[$table] = $DB->get_columns($table);
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
|
||||
}
|
||||
print "was not restored</li></ul>";
|
||||
}
|
||||
$ok = false;
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
|
||||
if (isset($record->old_id)) {
|
||||
backup_putid($restore->backup_unique_code, $table, $record->old_id, $record->id);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
// failed to add (or find) $record
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
print "<ul><li>Record could not be added: table=$table</li></ul>";
|
||||
@@ -455,7 +455,7 @@ function hotpot_restore_logs($restore, $log) {
|
||||
break;
|
||||
case "attempt":
|
||||
case "submit":
|
||||
case "review":
|
||||
case "review":
|
||||
if ($log->cmid) {
|
||||
//Get the new_id of the module (to recode the info field)
|
||||
$mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
|
||||
@@ -464,7 +464,7 @@ function hotpot_restore_logs($restore, $log) {
|
||||
$attemptid = substr(strrchr($log->url,"="),1);
|
||||
//Get the new_id of the attempt (to recode the url field)
|
||||
$attempt = backup_getid($restore->backup_unique_code,"hotpot_attempts",$attemptid);
|
||||
if ($attempt) {
|
||||
if ($attempt) {
|
||||
$log->url = "review.php?id=".$log->cmid."&attempt=".$attempt->new_id;
|
||||
$log->info = $mod->new_id;
|
||||
$status = true;
|
||||
@@ -523,4 +523,4 @@ function hotpot_decode_content_link($scriptname, $paramname, $paramvalue, &$rest
|
||||
|
||||
return "$CFG->wwwroot/mod/hotpot/$scriptname.php?$paramname=$new_id";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
require_login($course, true, $cm);
|
||||
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
if (!has_capability('mod/hotpot:viewreport',$context)) {
|
||||
if (!$hotpot->review) {
|
||||
@@ -107,10 +107,10 @@ function hotpot_print_attempt_summary(&$hotpot, &$attempt) {
|
||||
$value = hotpot_format_status($attempt);
|
||||
break;
|
||||
case 'timerecorded':
|
||||
$value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish);
|
||||
$value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish);
|
||||
break;
|
||||
case 'timetaken':
|
||||
$value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart);
|
||||
$value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart);
|
||||
break;
|
||||
default:
|
||||
$value = isset($attempt->$field) ? $attempt->$field : NULL;
|
||||
@@ -252,4 +252,4 @@ function hotpot_print_attempt_details(&$hotpot, &$attempt) {
|
||||
print "</table>\n";
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('hotpot_showtimes', get_string('showtimes', 'hotpot'),
|
||||
$settings->add(new admin_setting_configcheckbox('hotpot_showtimes', get_string('showtimes', 'hotpot'),
|
||||
get_string('configshowtimes', 'hotpot'), 0) );
|
||||
|
||||
$settings->add(new admin_setting_configtext('hotpot_excelencodings', get_string('excelencodings', 'hotpot'),
|
||||
get_string('configexcelencodings', 'hotpot'), '') );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class hotpot_xml_template_default {
|
||||
$rrggbb = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i';
|
||||
if ((
|
||||
preg_match($rgb, $x, $x_matches) ||
|
||||
preg_match($rrggbb, $x, $x_matches)
|
||||
preg_match($rrggbb, $x, $x_matches)
|
||||
) && (
|
||||
preg_match($rgb, $y, $y_matches) ||
|
||||
preg_match($rrggbb, $y, $y_matches)
|
||||
@@ -105,4 +105,4 @@ class hotpot_xml_template_default {
|
||||
return $color;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
+12
-12
@@ -1,4 +1,4 @@
|
||||
<?PHP
|
||||
<?PHP
|
||||
|
||||
class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
// left and right items for JMatch
|
||||
@@ -9,13 +9,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
function hotpot_xml_quiz_template(&$parent) {
|
||||
|
||||
$this->parent = &$parent;
|
||||
|
||||
|
||||
$get_js = optional_param('js', false);
|
||||
$get_css = optional_param('css', false);
|
||||
|
||||
if (!empty($get_css)) {
|
||||
// set $this->css
|
||||
$this->v6_expand_StyleSheet();
|
||||
$this->v6_expand_StyleSheet();
|
||||
|
||||
} else if (!empty($get_js)) {
|
||||
// set $this->js
|
||||
@@ -173,7 +173,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
return empty($value) ? '' : ('<h3 class="ExerciseSubtitle">'.$value.'</h3>');
|
||||
}
|
||||
|
||||
// timer
|
||||
// timer
|
||||
|
||||
function v6_expand_Timer() {
|
||||
return $this->int_value('data,timer,include-timer');
|
||||
@@ -185,7 +185,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
return $this->parent->xml_value('data,timer,seconds');
|
||||
}
|
||||
|
||||
// send results
|
||||
// send results
|
||||
|
||||
function v6_expand_SendResults() {
|
||||
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',send-email');
|
||||
@@ -307,7 +307,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
}
|
||||
function v6_expand_NavLightColor() {
|
||||
$color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color');
|
||||
return $this->get_halfway_color($color, '#ffffff');
|
||||
return $this->get_halfway_color($color, '#ffffff');
|
||||
}
|
||||
function v6_expand_NavShadeColor() {
|
||||
$color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color');
|
||||
@@ -540,7 +540,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
$value = strtr($value, $ENTITIES);
|
||||
if (preg_match_all($pattern, $value, $matches)) {
|
||||
$chars = array_merge($chars, $matches[0]);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1299,7 +1299,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
$str .= '<p class="QuestionText">'.$question_text.'</p>';
|
||||
|
||||
if (
|
||||
$question_type==HOTPOT_JQUIZ_SHORTANSWER ||
|
||||
$question_type==HOTPOT_JQUIZ_SHORTANSWER ||
|
||||
$question_type==HOTPOT_JQUIZ_HYBRID
|
||||
) {
|
||||
$size = 9; // default size
|
||||
@@ -1337,13 +1337,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
}
|
||||
|
||||
if (
|
||||
$question_type==HOTPOT_JQUIZ_MULTICHOICE ||
|
||||
$question_type==HOTPOT_JQUIZ_MULTICHOICE ||
|
||||
$question_type==HOTPOT_JQUIZ_HYBRID ||
|
||||
$question_type==HOTPOT_JQUIZ_MULTISELECT
|
||||
) {
|
||||
|
||||
switch ($question_type) {
|
||||
case HOTPOT_JQUIZ_MULTICHOICE:
|
||||
case HOTPOT_JQUIZ_MULTICHOICE:
|
||||
$str .= '<ol class="MCAnswers">'."\n";
|
||||
break;
|
||||
case HOTPOT_JQUIZ_HYBRID:
|
||||
@@ -1510,6 +1510,6 @@ function hotpot_keypad_sort_value($char) {
|
||||
}
|
||||
|
||||
return $sort_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
@@ -61,9 +61,9 @@
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
|
||||
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
|
||||
<!-- BeginTopNavButtons -->
|
||||
|
||||
[inclNavButtons]
|
||||
|
||||
@@ -54,7 +54,7 @@ var AnswersTried = '';
|
||||
FC = new Array();
|
||||
DC = new Array();
|
||||
|
||||
function onEndDrag(){
|
||||
function onEndDrag(){
|
||||
//Is it dropped on any of the fixed cards?
|
||||
var Docked = false;
|
||||
var DropTarget = DroppedOnFixed(CurrDrag);
|
||||
@@ -79,7 +79,7 @@ function onEndDrag(){
|
||||
DC[CurrDrag].tag = 0;
|
||||
D[CurrDrag][2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DroppedOnFixed(DNum){
|
||||
var Result = -1;
|
||||
@@ -143,7 +143,7 @@ function StartUp(){
|
||||
for (var i=0; i<F.length; i++){
|
||||
CardContent = F[i][0];
|
||||
FC[i] = new Card('F' + i, 10);
|
||||
FC[i].elm.innerHTML = CardContent;
|
||||
FC[i].elm.innerHTML = CardContent;
|
||||
if (FC[i].GetW() > Widest){
|
||||
Widest = FC[i].GetW();
|
||||
}
|
||||
@@ -162,7 +162,7 @@ function StartUp(){
|
||||
DC[i] = new Card('D' + i, 10);
|
||||
CardContent = D[i][0];
|
||||
// if (CardContent.indexOf('<img ') > -1){CardContent += '<br clear="all" />';} //used to be required for Navigator rendering bug with images
|
||||
DC[i].elm.innerHTML = CardContent;
|
||||
DC[i].elm.innerHTML = CardContent;
|
||||
if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);}
|
||||
DC[i].css.cursor = 'move';
|
||||
DC[i].css.backgroundColor = '[strExBGColor]';
|
||||
@@ -303,7 +303,7 @@ function CheckAnswers(){
|
||||
TotalCorrect++;
|
||||
}
|
||||
else{
|
||||
//Change made for version 6.0.3.41: don't send wrong items home,
|
||||
//Change made for version 6.0.3.41: don't send wrong items home,
|
||||
//show them in a more conspicuous way.
|
||||
// DC[i].GoHome();
|
||||
DC[i].SetL(DC[i].GetL() + 10);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
@@ -61,9 +61,9 @@
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
|
||||
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
|
||||
<!-- BeginTopNavButtons -->
|
||||
|
||||
[inclNavButtons]
|
||||
|
||||
@@ -142,7 +142,7 @@ function GetGuessSequence(){
|
||||
}
|
||||
|
||||
function CompDrags(a,b){
|
||||
return a.GetL() - b.GetL();
|
||||
return a.GetL() - b.GetL();
|
||||
}
|
||||
|
||||
function FindSegment(SegID){
|
||||
@@ -233,7 +233,7 @@ function CheckAnswer(CheckType){
|
||||
LongestCorrect[k] = TempCorrect[k];
|
||||
}
|
||||
HintToReturn = TempHint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (WhichCorrect > -1){
|
||||
@@ -304,7 +304,7 @@ function CheckAnswer(CheckType){
|
||||
Locked = true;
|
||||
Finished = true;
|
||||
setTimeout('Finish()', SubmissionTimeout);
|
||||
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
|
||||
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
|
||||
}
|
||||
|
||||
[inclScorm1.2]
|
||||
@@ -329,18 +329,18 @@ var Answers = new Array();
|
||||
function doDrag(e) {
|
||||
if (CurrDrag == -1) {return};
|
||||
if (C.ie){var Ev = window.event}else{var Ev = e}
|
||||
var difX = Ev.clientX-window.lastX;
|
||||
var difY = Ev.clientY-window.lastY;
|
||||
var newX = Cds[CurrDrag].GetL()+difX;
|
||||
var newY = Cds[CurrDrag].GetT()+difY;
|
||||
Cds[CurrDrag].SetL(newX);
|
||||
var difX = Ev.clientX-window.lastX;
|
||||
var difY = Ev.clientY-window.lastY;
|
||||
var newX = Cds[CurrDrag].GetL()+difX;
|
||||
var newY = Cds[CurrDrag].GetT()+difY;
|
||||
Cds[CurrDrag].SetL(newX);
|
||||
Cds[CurrDrag].SetT(newY);
|
||||
window.lastX = Ev.clientX;
|
||||
window.lastY = Ev.clientY;
|
||||
window.lastX = Ev.clientX;
|
||||
window.lastY = Ev.clientY;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function beginDrag(e, DragNum) {
|
||||
function beginDrag(e, DragNum) {
|
||||
CurrDrag = DragNum;
|
||||
if (C.ie){
|
||||
var Ev = window.event;
|
||||
@@ -349,25 +349,25 @@ function beginDrag(e, DragNum) {
|
||||
}
|
||||
else{
|
||||
var Ev = e;
|
||||
window.onmousemove=doDrag;
|
||||
window.onmousemove=doDrag;
|
||||
window.onmouseup=endDrag;
|
||||
}
|
||||
}
|
||||
Cds[CurrDrag].SwapColours();
|
||||
topZ++;
|
||||
Cds[CurrDrag].css.zIndex = topZ;
|
||||
window.lastX=Ev.clientX;
|
||||
window.lastX=Ev.clientX;
|
||||
window.lastY=Ev.clientY;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
function endDrag(e) {
|
||||
if (CurrDrag == -1) {return};
|
||||
Cds[CurrDrag].SwapColours();
|
||||
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
|
||||
onEndDrag();
|
||||
CurrDrag = -1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function onEndDrag(){
|
||||
//Snap to lines
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
|
||||
@@ -51,7 +51,7 @@ function StartUp(){
|
||||
[inclScorm1.2]
|
||||
initAPI(window);
|
||||
if (API != null){
|
||||
API.LMSInitialize('');
|
||||
API.LMSInitialize('');
|
||||
API.LMSSetValue('cmi.core.lesson_status', 'browsed');
|
||||
API.LMSSetValue('cmi.comments', 'This exercise has no checking or scoring features.');
|
||||
API.LMSCommit('');
|
||||
|
||||
@@ -16,7 +16,7 @@ body{
|
||||
font-family: [strFontFace];
|
||||
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
|
||||
color: [strTextColor];
|
||||
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
|
||||
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
|
||||
margin-right: 5%;
|
||||
margin-left: 5%;
|
||||
font-size: [strFontSize];
|
||||
@@ -73,14 +73,14 @@ div.StdDiv{
|
||||
text-align: right;
|
||||
font-size: 150%;
|
||||
direction: rtl;
|
||||
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
|
||||
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
|
||||
}
|
||||
|
||||
.CentredRTLText{
|
||||
text-align: center;
|
||||
font-size: 150%;
|
||||
direction: rtl;
|
||||
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
|
||||
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
|
||||
}
|
||||
|
||||
button p.RTLText{
|
||||
|
||||
@@ -5,7 +5,7 @@ function Client(){
|
||||
|
||||
this.ua = navigator.userAgent;
|
||||
this.name = navigator.appName;
|
||||
this.ver = navigator.appVersion;
|
||||
this.ver = navigator.appVersion;
|
||||
|
||||
//Get data about the browser
|
||||
this.mac = (this.ver.indexOf('Mac') != -1);
|
||||
|
||||
@@ -105,18 +105,18 @@ Card.prototype.GoHome=CardGoHome;
|
||||
function doDrag(e) {
|
||||
if (CurrDrag == -1) {return};
|
||||
if (C.ie){var Ev = window.event}else{var Ev = e}
|
||||
var difX = Ev.clientX-window.lastX;
|
||||
var difY = Ev.clientY-window.lastY;
|
||||
var newX = DC[CurrDrag].GetL()+difX;
|
||||
var newY = DC[CurrDrag].GetT()+difY;
|
||||
DC[CurrDrag].SetL(newX);
|
||||
var difX = Ev.clientX-window.lastX;
|
||||
var difY = Ev.clientY-window.lastY;
|
||||
var newX = DC[CurrDrag].GetL()+difX;
|
||||
var newY = DC[CurrDrag].GetT()+difY;
|
||||
DC[CurrDrag].SetL(newX);
|
||||
DC[CurrDrag].SetT(newY);
|
||||
window.lastX = Ev.clientX;
|
||||
window.lastY = Ev.clientY;
|
||||
window.lastX = Ev.clientX;
|
||||
window.lastY = Ev.clientY;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function beginDrag(e, DragNum) {
|
||||
function beginDrag(e, DragNum) {
|
||||
CurrDrag = DragNum;
|
||||
if (C.ie){
|
||||
var Ev = window.event;
|
||||
@@ -125,18 +125,18 @@ function beginDrag(e, DragNum) {
|
||||
}
|
||||
else{
|
||||
var Ev = e;
|
||||
window.onmousemove=doDrag;
|
||||
window.onmousemove=doDrag;
|
||||
window.onmouseup=endDrag;
|
||||
}
|
||||
}
|
||||
DC[CurrDrag].Highlight();
|
||||
topZ++;
|
||||
DC[CurrDrag].css.zIndex = topZ;
|
||||
window.lastX=Ev.clientX;
|
||||
window.lastX=Ev.clientX;
|
||||
window.lastY=Ev.clientY;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
function endDrag(e) {
|
||||
if (CurrDrag == -1) {return};
|
||||
DC[CurrDrag].Unhighlight();
|
||||
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
|
||||
@@ -145,7 +145,7 @@ function endDrag(e) {
|
||||
//Need a bugfix for Opera focus problem here
|
||||
if (C.opera){FocusAButton();}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var CurrDrag = -1;
|
||||
var topZ = 100;
|
||||
|
||||
@@ -330,7 +330,7 @@ function ShowAnswers(QNum){
|
||||
//Display feedback
|
||||
ShowMessage(Ans);
|
||||
|
||||
//Set the score for this question to 0 if no
|
||||
//Set the score for this question to 0 if no
|
||||
if (State[QNum][0] < 1){
|
||||
State[QNum][0] = 0;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<param name="type" value="audio/x-pn-realaudio-plugin" />
|
||||
<param name="src" value="[strFilePath]" />
|
||||
<param name="autostart" value="false" />
|
||||
<param name="controls" value="[inclVideo]ImageWindow,[/inclVideo]ControlPanel" />
|
||||
<param name="controls" value="[inclVideo]ImageWindow,[/inclVideo]ControlPanel" />
|
||||
[strContent]</object>[/Real Player]
|
||||
|
||||
[Flash Player]<object codebase="[strFilePath]" type="application/x-shockwave-flash" width="[strWidth]" height="[strHeight]" data="[strFilePath]"> <param name="movie" value="[strFilePath]" />[strContent]</object>[/Flash Player]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xml:lang="en"><head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
Page Title
|
||||
@@ -31,7 +31,7 @@ Page Title
|
||||
</div>
|
||||
|
||||
<div id="MainDiv" class="StdDiv">
|
||||
|
||||
|
||||
<p>Page content...</p>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,7 @@ function ShowElements(Show, TagName, ContainerToReverse){
|
||||
Els[i].style.visibility = 'hidden';
|
||||
if (C.mac && C.gecko) {Els[i].style.display = 'none';}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// tagName is either input or select (that is, Form Elements)
|
||||
// ie6 has a problem with Form elements, so manipulate those
|
||||
|
||||
@@ -57,13 +57,13 @@ function GetViewportHeight(){
|
||||
|
||||
function TopSettingWithScrollOffset(TopPercent){
|
||||
var T = Math.floor(GetViewportHeight() * (TopPercent/100));
|
||||
return GetScrollTop() + T;
|
||||
return GetScrollTop() + T;
|
||||
}
|
||||
|
||||
//CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back()
|
||||
var InTextBox = false;
|
||||
|
||||
function SuppressBackspace(e){
|
||||
function SuppressBackspace(e){
|
||||
if (InTextBox == true){return;}
|
||||
if (C.ie) {
|
||||
thisKey = window.event.keyCode;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
@@ -120,7 +120,7 @@
|
||||
[/inclHint]
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<div id="ClozeDiv">
|
||||
<form id="Cloze" method="post" action="" onsubmit="return false;">
|
||||
<div class="ClozeBody">
|
||||
|
||||
@@ -48,7 +48,7 @@ function ItemState(){
|
||||
|
||||
var Feedback = '';
|
||||
var Correct = '[strCorrect]';
|
||||
var Incorrect = '[strIncorrect]';
|
||||
var Incorrect = '[strIncorrect]';
|
||||
var GiveHint = '[strGiveHint]';
|
||||
var CaseSensitive = [boolCaseSensitive];
|
||||
var YourScoreIs = '[strYourScoreIs]';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
@@ -120,7 +120,7 @@
|
||||
<button id="CheckButton1" class="FuncButton" onmouseover="FuncBtnOver(this)" onfocus="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onblur="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="CheckAnswers()"> [strCheckCaption] </button>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<table class="CrosswordGrid">
|
||||
<tbody>
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ var Feedback = '';
|
||||
var AcrossCaption = '';
|
||||
var DownCaption = '';
|
||||
var Correct = '[strCorrect]';
|
||||
var Incorrect = '[strIncorrect]';
|
||||
var Incorrect = '[strIncorrect]';
|
||||
var GiveHint = '[strGiveHint]';
|
||||
var YourScoreIs = '[strYourScoreIs]';
|
||||
var BuiltGrid = '';
|
||||
@@ -45,7 +45,7 @@ var Score = 0;
|
||||
var InTextBox = false;
|
||||
var Locked = false;
|
||||
var TimeOver = false;
|
||||
var CaseSensitive = [boolCaseSensitive];
|
||||
var CaseSensitive = [boolCaseSensitive];
|
||||
|
||||
var InputStuff = '<form method="post" action="" onsubmit="return false;"><span class="ClueNum">[strClueNum]: </span>';
|
||||
InputStuff += '[strClue] <input onfocus="CurrentBox=this;InTextBox=true;" onblur="InTextBox=false;" id="[strBoxId]" type="edit" size="[strEditSize]" maxlength="[strMaxLength]"></input>';
|
||||
@@ -88,7 +88,7 @@ function GetAnswerLength(Across,x,y){
|
||||
while ((x<L.length)&&(L[x][y].length > 0)){
|
||||
Result += L[x][y].length;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
else{
|
||||
@@ -269,7 +269,7 @@ function CheckAnswers(){
|
||||
var AllCorrect = true;
|
||||
var TotLetters = 0;
|
||||
var CorrectLetters = 0;
|
||||
var LetterFromKey = '';
|
||||
var LetterFromKey = '';
|
||||
var LetterFromGuess = '';
|
||||
|
||||
//Check each letter
|
||||
@@ -285,7 +285,7 @@ function CheckAnswers(){
|
||||
LetterFromKey = L[i][j].toUpperCase();
|
||||
LetterFromGuess = G[i][j].toUpperCase();
|
||||
}
|
||||
if (LetterFromGuess != LetterFromKey){
|
||||
if (LetterFromGuess != LetterFromKey){
|
||||
G[i][j] = '';
|
||||
//Blank that square in the grid
|
||||
SetGridSquareValue(i,j,'');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
|
||||
<title></title>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
|
||||
@@ -233,7 +233,7 @@ function CheckAnswers(){
|
||||
Parent.removeChild(Select);
|
||||
Parent.innerHTML = AnsText;
|
||||
Parent.nextSibling.innerHTML = CorrectIndicator;
|
||||
}
|
||||
}
|
||||
else{
|
||||
AllDone = false;
|
||||
Parent = Select.parentNode;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
|
||||
@@ -227,7 +227,7 @@ function CheckAnswer(CheckType){
|
||||
LongestCorrect[k] = TempCorrect[k];
|
||||
}
|
||||
HintToReturn = TempHint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (WhichCorrect > -1){
|
||||
@@ -311,7 +311,7 @@ function CheckAnswer(CheckType){
|
||||
Locked = true;
|
||||
Finished = true;
|
||||
setTimeout('Finish()', SubmissionTimeout);
|
||||
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
|
||||
WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
|
||||
}
|
||||
[inclScorm1.2]
|
||||
if (AllDone == true){
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[strDublinCoreMetadata]
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainTitle]
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
|
||||
<div id="MainDiv" class="StdDiv">
|
||||
|
||||
|
||||
<div id="QNav" class="QuestionNavigation">
|
||||
|
||||
<p style="text-align: right;">
|
||||
@@ -126,7 +126,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
[strQuestionOutput]
|
||||
|
||||
[inclKeypad]
|
||||
|
||||
@@ -89,7 +89,7 @@ function CompleteEmptyFeedback(){
|
||||
}
|
||||
|
||||
function SetUpQuestions(){
|
||||
var AList = new Array();
|
||||
var AList = new Array();
|
||||
var QList = new Array();
|
||||
var i, j;
|
||||
Qs = document.getElementById('Questions');
|
||||
@@ -172,7 +172,7 @@ function SetFocusToTextbox(){
|
||||
|
||||
function ChangeQ(ChangeBy){
|
||||
//The following line prevents moving to another question until the current
|
||||
//question is answered correctly. Uncomment it to enable this behaviour.
|
||||
//question is answered correctly. Uncomment it to enable this behaviour.
|
||||
// if (State[CurrQNum][0] == -1){return;}
|
||||
if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
|
||||
QArray[CurrQNum].style.display = 'none';
|
||||
@@ -571,9 +571,9 @@ function CalculateOverallScore(){
|
||||
Score = Math.floor((TotalScore/TotalWeighting)*100);
|
||||
}
|
||||
else{
|
||||
//if TotalWeighting is 0, no questions so far have any value, so
|
||||
//if TotalWeighting is 0, no questions so far have any value, so
|
||||
//no penalty should be shown.
|
||||
Score = 100;
|
||||
Score = 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xml:lang="en"><head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
<title>
|
||||
[strPlainIndexTitle]
|
||||
@@ -21,7 +21,7 @@ body{
|
||||
font-family: [strFontFace];
|
||||
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
|
||||
color: [strTextColor];
|
||||
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
|
||||
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
|
||||
padding-left: 5%;
|
||||
padding-right: 5%;
|
||||
font-size: [strFontSize];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?PHP // $Id$
|
||||
<?php
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// Code fragment to define the version of hotpot
|
||||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
@@ -13,4 +13,4 @@ $module->cron = 0; // period for cron to check this module (secs)
|
||||
// DD : day
|
||||
// X : point release version 1,2,3 etc
|
||||
// Y : increment between point releases
|
||||
?>
|
||||
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@
|
||||
} else if ($hotpot->subnet && !address_in_subnet(getremoteaddr(), $hotpot->subnet)) {
|
||||
$error = get_string("subneterror", "quiz");
|
||||
// check number of attempts
|
||||
} else if ($hotpot->attempts && $hotpot->attempts <= $DB->count_records_select('hotpot_attempts', 'hotpot=? AND userid=?', array($hotpot->id, $USER->id), 'COUNT(DISTINCT clickreportid)')) {
|
||||
} else if ($hotpot->attempts && $hotpot->attempts <= $DB->count_records_select('hotpot_attempts', 'hotpot=? AND userid=?', array($hotpot->id, $USER->id), 'COUNT(DISTINCT clickreportid)')) {
|
||||
$error = get_string("nomoreattempts", "quiz");
|
||||
// get password
|
||||
} else if ($hotpot->password && empty($hppassword)) {
|
||||
@@ -484,4 +484,4 @@ function hotpot_feedback_teachers(&$course, &$hotpot) {
|
||||
}
|
||||
return $teacherdetails;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
//This php script contains all the stuff to backup/restore
|
||||
//label mods
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
function label_backup_mods($bf,$preferences) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$status = true;
|
||||
$status = true;
|
||||
|
||||
////Iterate over label table
|
||||
if ($labels = $DB->get_records ("label","course", array($preferences->backup_course=>"id"))) {
|
||||
@@ -32,14 +32,14 @@
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
function label_backup_one_mod($bf,$preferences,$label) {
|
||||
global $CFG, $DB;
|
||||
|
||||
|
||||
if (is_numeric($label)) {
|
||||
$label = $DB->get_record('label', array('id'=>$label));
|
||||
}
|
||||
|
||||
|
||||
$status = true;
|
||||
|
||||
//Start mod
|
||||
@@ -67,12 +67,12 @@
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
//First the course data
|
||||
$info[0][0] = get_string("modulenameplural","label");
|
||||
$info[0][1] = $DB->count_records("label", array("course"=>$course));
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
////Return an array of info (name,value)
|
||||
function label_check_backup_mods_instances($instance,$backup_unique_code) {
|
||||
@@ -82,4 +82,4 @@
|
||||
return $info;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file replaces:
|
||||
// * STATEMENTS section in db/install.xml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// This file keeps track of upgrades to
|
||||
// the label module
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
@@ -79,4 +79,4 @@ function xmldb_label_upgrade($oldversion) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/label/index.php', array('id'=>
|
||||
|
||||
redirect("$CFG->wwwroot/course/view.php?id=$id");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ function label_get_types() {
|
||||
|
||||
/**
|
||||
* This function is used by the reset_course_userdata function in moodlelib.
|
||||
*
|
||||
*
|
||||
* @param object $data the data submitted from the reset course.
|
||||
* @return array status array
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
|
||||
|
||||
class mod_label_mod_form extends moodleform_mod {
|
||||
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
//This php script contains all the stuff to backup/restore
|
||||
//label mods
|
||||
|
||||
//This is the "graphical" structure of the label mod:
|
||||
//This is the "graphical" structure of the label mod:
|
||||
//
|
||||
// label
|
||||
// label
|
||||
// (CL,pk->id)
|
||||
//
|
||||
// Meaning: pk->primary key field of the table
|
||||
@@ -31,17 +31,17 @@
|
||||
//traverse_xmlize($info); //Debug
|
||||
//print_object ($GLOBALS['traverse_array']); //Debug
|
||||
//$GLOBALS['traverse_array']=""; //Debug
|
||||
|
||||
|
||||
//Now, build the LABEL record structure
|
||||
$label->course = $restore->course_id;
|
||||
$label->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
|
||||
$label->intro = backup_todb($info['MOD']['#']['CONTENT']['0']['#']);
|
||||
$label->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];
|
||||
|
||||
|
||||
//The structure is equal to the db, so insert the label
|
||||
$newid = $DB->insert_record ("label",$label);
|
||||
|
||||
//Do some output
|
||||
//Do some output
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "<li>".get_string("modulename","label")." \"".format_string($label->name,true)."\"</li>";
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
//We have the newid, update backup_ids
|
||||
backup_putid($restore->backup_unique_code,$mod->modtype,
|
||||
$mod->id, $newid);
|
||||
|
||||
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
@@ -102,9 +102,9 @@
|
||||
//This function returns a log record with all the necessay transformations
|
||||
//done. It's used by restore_log_module() to restore modules log.
|
||||
function label_restore_logs($restore,$log) {
|
||||
|
||||
|
||||
$status = false;
|
||||
|
||||
|
||||
//Depending of the action, we recode different things
|
||||
switch ($log->action) {
|
||||
case "add":
|
||||
@@ -141,4 +141,4 @@
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// Code fragment to define the version of label
|
||||
@@ -9,4 +9,4 @@ $module->version = 2009080400; // The current module version (Date: YYYYMMDDXX
|
||||
$module->requires = 2009041700; // Requires this Moodle version
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+1
-1
@@ -36,4 +36,4 @@ require_login($course, true, $cm);
|
||||
|
||||
redirect("$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for adding a branch table. Prints an HTML form.
|
||||
*
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for adding a cluster page
|
||||
*
|
||||
@@ -11,9 +11,9 @@
|
||||
// first get the preceeding page
|
||||
// if $pageid = 0, then we are inserting a new page at the beginning of the lesson
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
|
||||
$timenow = time();
|
||||
|
||||
|
||||
if ($pageid == 0) {
|
||||
if (!$page = $DB->get_record("lesson_pages", array("prevpageid" => 0, "lessonid" => $lesson->id))) {
|
||||
print_error('cannotfindpagerecord', 'lesson');
|
||||
@@ -40,10 +40,10 @@
|
||||
if ($pageid != 0) {
|
||||
$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid));
|
||||
}
|
||||
|
||||
|
||||
if ($pageid == 0) {
|
||||
$page->nextpageid = $page->id;
|
||||
}
|
||||
}
|
||||
if ($page->nextpageid) {
|
||||
// the new page is not the last page
|
||||
$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid));
|
||||
@@ -57,4 +57,4 @@
|
||||
$newanswerid = $DB->insert_record("lesson_answers", $newanswer);
|
||||
lesson_set_message(get_string('addedcluster', 'lesson'), 'notifysuccess');
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for adding an end of branch page
|
||||
*
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
|
||||
$timenow = time();
|
||||
|
||||
// the new page is not the first page (end of branch always comes after an existing page)
|
||||
@@ -51,11 +51,11 @@
|
||||
$newanswer->timecreated = $timenow;
|
||||
$newanswer->jumpto = $btpageid;
|
||||
$newanswerid = $DB->insert_record("lesson_answers", $newanswer);
|
||||
|
||||
|
||||
lesson_set_message(get_string('addedanendofbranch', 'lesson'), 'notifysuccess');
|
||||
} else {
|
||||
lesson_set_message(get_string('nobranchtablefound', 'lesson'));
|
||||
}
|
||||
|
||||
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for adding an end of cluster page
|
||||
*
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
|
||||
$timenow = time();
|
||||
|
||||
|
||||
// the new page is not the first page (end of cluster always comes after an existing page)
|
||||
if (!$page = $DB->get_record("lesson_pages", array("id" => $pageid))) {
|
||||
print_error('cannotfindpages', 'lesson');
|
||||
}
|
||||
|
||||
|
||||
// could put code in here to check if the user really can insert an end of cluster
|
||||
|
||||
|
||||
$newpage = new stdClass;
|
||||
$newpage->lessonid = $lesson->id;
|
||||
$newpage->prevpageid = $pageid;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for adding a question page. Prints an HTML form.
|
||||
*
|
||||
@@ -9,7 +9,7 @@
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
$qtype = optional_param('qtype', LESSON_MULTICHOICE, PARAM_INT);
|
||||
|
||||
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
@@ -24,9 +24,9 @@
|
||||
$jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
|
||||
}
|
||||
if (!optional_param('firstpage', 0, PARAM_INT)) {
|
||||
$linkadd = "";
|
||||
$linkadd = "";
|
||||
$apageid = $DB->get_field("lesson_pages", "id", array("lessonid" => $lesson->id, "prevpageid" => 0));
|
||||
|
||||
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
$title = $DB->get_field("lesson_pages", "title", array("id" => $apageid));
|
||||
@@ -58,7 +58,7 @@
|
||||
<?php
|
||||
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
|
||||
echo $OUTPUT->help_icon(moodle_help_icon::make("questiontypes", get_string("questiontype", "lesson"), "lesson"))."<br />";
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $qtype,
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $qtype,
|
||||
"lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd);
|
||||
|
||||
if ( $qtype == LESSON_SHORTANSWER || $qtype == LESSON_MULTICHOICE ) { // only display this option for Multichoice and shortanswer
|
||||
@@ -131,7 +131,7 @@
|
||||
echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
} else {
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for confirming the deletion of a page
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
echo $title."<br />\n";
|
||||
}
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string("confirmdeletionofthispage","lesson"),
|
||||
echo $OUTPUT->confirm(get_string("confirmdeletionofthispage","lesson"),
|
||||
"lesson.php?action=delete&id=$cm->id&pageid=$pageid",
|
||||
"view.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* HTML template for continue.php
|
||||
*
|
||||
@@ -8,9 +8,9 @@
|
||||
?>
|
||||
|
||||
<?php if ($lesson->displayleft) { // Skip navigation anchor ?>
|
||||
|
||||
|
||||
<a name="maincontent" id="maincontent" title="<?php print_string('anchortitle', 'lesson') ?>"></a>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
@@ -27,7 +27,7 @@
|
||||
<form id="endoflesson" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
|
||||
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
|
||||
<input type="hidden" name="pageid" value="<?php echo LESSON_EOL; ?>" />
|
||||
|
||||
|
||||
<p align="center">
|
||||
<?php print_string("savechangesandeol", "lesson") ?>
|
||||
</p>
|
||||
@@ -40,22 +40,22 @@
|
||||
<p align="center">
|
||||
<?php print_string("continuetoanswer", "lesson") ?>
|
||||
</p>
|
||||
|
||||
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($lesson->review && !$correctanswer && !$noanswer && !$isessayquestion) { // Review button back ?>
|
||||
|
||||
|
||||
<form id="reviewback" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
|
||||
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
|
||||
<input type="hidden" name="pageid" value="<?php echo $pageid; ?>" />
|
||||
|
||||
|
||||
<p>
|
||||
<?php lesson_print_submit_link(get_string('reviewquestionback', 'lesson'), 'reviewback'); ?>
|
||||
</p>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<form id="pageform" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for processing page answers by users
|
||||
*
|
||||
@@ -789,4 +789,4 @@
|
||||
lesson_print_header($cm, $course, $lesson, 'view', true, $page->id);
|
||||
|
||||
include(dirname(__FILE__).'/continue.html');
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for deleting a page
|
||||
*
|
||||
@@ -56,4 +56,4 @@
|
||||
}
|
||||
lesson_set_message(get_string('deletedpage', 'lesson').': '.format_string($thispage->title, true), 'notifysuccess');
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for editing a page. Prints an HTML form.
|
||||
*
|
||||
@@ -6,11 +6,11 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
|
||||
|
||||
// get the page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
$redirect = optional_param('redirect', '', PARAM_ALPHA);
|
||||
|
||||
|
||||
if (!$page = $DB->get_record("lesson_pages", array("id" => $pageid))) {
|
||||
print_error('cannotfindpages', 'lesson');
|
||||
}
|
||||
@@ -58,8 +58,8 @@
|
||||
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
|
||||
<input type="hidden" name="action" value="updatepage" />
|
||||
<input type="hidden" name="pageid" value="<?php echo $pageid ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
|
||||
<input type="hidden" name="redirect" value="<?php echo $redirect ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
|
||||
<input type="hidden" name="redirect" value="<?php echo $redirect ?>" />
|
||||
<input type="hidden" name="redisplay" value="0" />
|
||||
<center>
|
||||
<?php
|
||||
@@ -67,7 +67,7 @@
|
||||
case LESSON_MULTICHOICE :
|
||||
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
|
||||
echo $OUTPUT->help_icon(moodle_help_icon::make("questiontypes", get_string("questiontype", "lesson"), "lesson"))."<br />";
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
|
||||
"getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
|
||||
echo "<p><b><label for=\"qoption\">".get_string('multianswer', 'lesson').":</label></b> \n";
|
||||
@@ -82,7 +82,7 @@
|
||||
case LESSON_SHORTANSWER :
|
||||
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
|
||||
echo $OUTPUT->help_icon(moodle_help_icon::make("questiontypes", get_string("questiontype", "lesson"), "lesson"))."<br />";
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
|
||||
"getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
|
||||
echo "<p><b><label for=\"qoption\">".get_string('casesensitive', 'lesson').":</label></b> \n";
|
||||
@@ -100,7 +100,7 @@
|
||||
case LESSON_NUMERICAL :
|
||||
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
|
||||
echo $OUTPUT->help_icon(moodle_help_icon::make("questiontypes", get_string("questiontype", "lesson"), "lesson"))."<br />";
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
|
||||
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
|
||||
"getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
|
||||
break;
|
||||
@@ -133,7 +133,7 @@
|
||||
echo "<input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
|
||||
} else {
|
||||
echo "<input name=\"display\" type=\"checkbox\" value=\"1\" />";
|
||||
}
|
||||
}
|
||||
echo get_string("displayinleftmenu", "lesson")."\n";
|
||||
echo "</center></td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";
|
||||
@@ -141,18 +141,18 @@
|
||||
case LESSON_CLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
|
||||
echo "<tr><td><b>".get_string("clustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
break;
|
||||
case LESSON_ENDOFCLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
|
||||
echo "<tr><td><b>".get_string("endofclustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
break;
|
||||
case LESSON_ENDOFBRANCH :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
|
||||
echo "<tr><td><b>".get_string("endofbranch", "lesson")."</b> \n";
|
||||
break;
|
||||
default :
|
||||
echo "<tr><td>";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
echo "</td></tr>\n";
|
||||
@@ -200,7 +200,7 @@
|
||||
echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $ncorrected:</label></b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
|
||||
"<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
|
||||
"<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
|
||||
echo $OUTPUT->help_icon(moodle_help_icon::make("useeditor", get_string("useeditor", "lesson"), "lesson"));
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
@@ -232,7 +232,7 @@
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $nplus1:</label></b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR and $page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) {
|
||||
echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
|
||||
@@ -341,7 +341,7 @@
|
||||
$n++;
|
||||
if ($page->qtype == LESSON_ESSAY) {
|
||||
break; // only one answer for essays
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page->qtype != LESSON_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
@@ -465,7 +465,7 @@
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="button" value="<?php print_string("redisplaypage", "lesson") ?>"
|
||||
<input type="button" value="<?php print_string("redisplaypage", "lesson") ?>"
|
||||
onclick="getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();" />
|
||||
<input type="submit" value="<?php print_string("savepage", "lesson") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for processing the form from addpage action and inserts the page.
|
||||
*
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
|
||||
|
||||
$form = data_submitted();
|
||||
$newpage = new stdClass;
|
||||
$newanswer = new stdClass;
|
||||
@@ -78,7 +78,7 @@
|
||||
$newpage->display = clean_param($form->display, PARAM_INT);
|
||||
} else {
|
||||
$newpage->display = 0;
|
||||
}
|
||||
}
|
||||
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$newpage->contents = trim($form->contents);
|
||||
$newpage->title = $newpage->title;
|
||||
@@ -104,7 +104,7 @@
|
||||
$newpage->display = clean_param($form->display, PARAM_INT);
|
||||
} else {
|
||||
$newpage->display = 0;
|
||||
}
|
||||
}
|
||||
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$newpage->contents = trim($form->contents);
|
||||
$newpage->title = $newpage->title;
|
||||
@@ -162,7 +162,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lesson_set_message(get_string('insertedpage', 'lesson').': '.format_string($newpage->title, true), 'notifysuccess');
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action that displays an interface for moving a page
|
||||
*
|
||||
@@ -6,11 +6,11 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
|
||||
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
$title = $DB->get_field("lesson_pages", "title", array("id" => $pageid));
|
||||
echo $OUTPUT->heading(get_string("moving", "lesson", format_string($title)));
|
||||
|
||||
|
||||
$params = array ("lessonid" => $lesson->id, "prevpageid" => 0);
|
||||
if (!$page = $DB->get_record_select("lesson_pages", "lessonid = :lessonid AND prevpageid = :prevpageid", $params)) {
|
||||
print_error('cannotfindfirstpage', 'lesson');
|
||||
@@ -38,4 +38,4 @@
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for actually moving the page (database changes)
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
if (!$after) {
|
||||
// the moved page is the new first page
|
||||
$newfirstpageid = $pageid;
|
||||
// reset $after so that is points to the last page
|
||||
// reset $after so that is points to the last page
|
||||
// (when the pages are in a ring this will in effect be the first page)
|
||||
if ($page->nextpageid) {
|
||||
if (!$after = $DB->get_field("lesson_pages", "id", array("lessonid" => $lesson->id, "nextpageid" => 0))) {
|
||||
@@ -39,8 +39,8 @@
|
||||
}
|
||||
}
|
||||
// the rest is all unconditional...
|
||||
|
||||
// second step. join pages into a ring
|
||||
|
||||
// second step. join pages into a ring
|
||||
if (!$firstpageid = $DB->get_field("lesson_pages", "id", array("lessonid" => $lesson->id, "prevpageid" => 0))) {
|
||||
print_error("Moveit: firstpageid not found");
|
||||
}
|
||||
@@ -67,7 +67,7 @@
|
||||
if (!$DB->set_field("lesson_pages", "prevpageid", $prevpageid, array("id" => $nextpageid))) {
|
||||
print_error("Moveit: unable to update link");
|
||||
}
|
||||
|
||||
|
||||
// fourth step. insert page to be moved in new place...
|
||||
if (!$nextpageid = $DB->get_field("lesson_pages", "nextpageid", array("id" => $after))) {
|
||||
print_error("Movit: nextpageid not found");
|
||||
@@ -85,7 +85,7 @@
|
||||
if (!$DB->set_field("lesson_pages", "nextpageid", $nextpageid, array("id" => $pageid))) {
|
||||
print_error("Moveit: unable to update link");
|
||||
}
|
||||
|
||||
|
||||
// fifth step. break the ring
|
||||
if (!$newlastpageid = $DB->get_field("lesson_pages", "prevpageid", array("id" => $newfirstpageid))) {
|
||||
print_error("Moveit: newlastpageid not found");
|
||||
@@ -98,4 +98,4 @@
|
||||
}
|
||||
lesson_set_message(get_string('movedpage', 'lesson'), 'notifysuccess');
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Action for processing the form in editpage action and saves the page
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
* @package lesson
|
||||
**/
|
||||
confirm_sesskey();
|
||||
|
||||
|
||||
$redirect = optional_param('redirect', '', PARAM_ALPHA);
|
||||
|
||||
$timenow = time();
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
$page = new stdClass;
|
||||
$page->id = clean_param($form->pageid, PARAM_INT);
|
||||
|
||||
|
||||
// check to see if the cancel button was pushed
|
||||
if (optional_param('cancel', '', PARAM_ALPHA)) {
|
||||
if ($redirect == 'navigation') {
|
||||
@@ -46,7 +46,7 @@
|
||||
$page->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$page->contents = trim($form->contents);
|
||||
$page->title = $page->title;
|
||||
|
||||
|
||||
$DB->update_record("lesson_pages", $page);
|
||||
if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_ESSAY || $page->qtype == LESSON_CLUSTER || $page->qtype == LESSON_ENDOFCLUSTER) {
|
||||
// there's just a single answer with a jump
|
||||
@@ -67,7 +67,7 @@
|
||||
$DB->delete_records("lesson_answers", array("id" => $answer->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$DB->update_record("lesson_answers", $oldanswer);
|
||||
} else {
|
||||
// it's an "ordinary" page
|
||||
@@ -141,13 +141,13 @@
|
||||
}
|
||||
if (!isset($form->responseeditor[$i])) {
|
||||
$form->responseeditor[$i] = 0;
|
||||
}
|
||||
}
|
||||
$oldanswer->flags = $form->answereditor[$i] * LESSON_ANSWER_EDITOR +
|
||||
$form->responseeditor[$i] * LESSON_RESPONSE_EDITOR;
|
||||
$oldanswer->timemodified = $timenow;
|
||||
$oldanswer->answer = NULL;
|
||||
$DB->update_record("lesson_answers", $oldanswer);
|
||||
}
|
||||
}
|
||||
} elseif (!empty($form->answerid[$i])) {
|
||||
// need to delete blanked out answer
|
||||
$DB->delete_records("lesson_answers", array("id" => clean_param($form->answerid[$i], PARAM_INT)));
|
||||
@@ -159,7 +159,7 @@
|
||||
if ($form->redisplay) {
|
||||
redirect("$CFG->wwwroot/mod/lesson/lesson.php?id=$cm->id&action=editpage&pageid=$page->id&redirect=$redirect");
|
||||
}
|
||||
|
||||
|
||||
lesson_set_message(get_string('updatedpage', 'lesson').': '.format_string($page->title, true), 'notifysuccess');
|
||||
if ($redirect == 'navigation') {
|
||||
// takes us back to viewing the page
|
||||
@@ -167,4 +167,4 @@
|
||||
} else {
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
+20
-20
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
/**
|
||||
* Lesson's backup routine
|
||||
*
|
||||
@@ -6,10 +6,10 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
//This is the "graphical" structure of the lesson mod:
|
||||
//This is the "graphical" structure of the lesson mod:
|
||||
//
|
||||
// lesson_default lesson ----------------------------|--------------------------|--------------------------|
|
||||
// (UL, pk->id,fk->courseid) (CL,pk->id) | | |
|
||||
// (UL, pk->id,fk->courseid) (CL,pk->id) | | |
|
||||
// | | | |
|
||||
// | lesson_grades lesson_high_scores lesson_timer
|
||||
// | (UL, pk->id,fk->lessonid) (UL, pk->id,fk->lessonid) (UL, pk->id,fk->lessonid)
|
||||
@@ -53,17 +53,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
return $status;
|
||||
return $status;
|
||||
}
|
||||
|
||||
function lesson_backup_one_mod($bf,$preferences,$lesson) {
|
||||
|
||||
global $CFG, $DB;
|
||||
|
||||
|
||||
if (is_numeric($lesson)) {
|
||||
$lesson = $DB->get_record('lesson',array ('id' => $lesson));
|
||||
}
|
||||
|
||||
|
||||
$status = true;
|
||||
|
||||
//Start mod
|
||||
@@ -248,11 +248,11 @@
|
||||
//Start Attempt
|
||||
$status =fwrite ($bf,start_tag("ATTEMPT",9,true));
|
||||
//Print attempt contents
|
||||
fwrite ($bf,full_tag("USERID",10,false,$attempt->userid));
|
||||
fwrite ($bf,full_tag("RETRY",10,false,$attempt->retry));
|
||||
fwrite ($bf,full_tag("CORRECT",10,false,$attempt->correct));
|
||||
fwrite ($bf,full_tag("USERID",10,false,$attempt->userid));
|
||||
fwrite ($bf,full_tag("RETRY",10,false,$attempt->retry));
|
||||
fwrite ($bf,full_tag("CORRECT",10,false,$attempt->correct));
|
||||
fwrite ($bf,full_tag("USERANSWER",10,false,$attempt->useranswer));
|
||||
fwrite ($bf,full_tag("TIMESEEN",10,false,$attempt->timeseen));
|
||||
fwrite ($bf,full_tag("TIMESEEN",10,false,$attempt->timeseen));
|
||||
//End attempt
|
||||
$status =fwrite ($bf,end_tag("ATTEMPT",9,true));
|
||||
}
|
||||
@@ -355,7 +355,7 @@
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
// backup lesson_high_score contents (executed from backup_lesson_mods)
|
||||
function backup_lesson_high_scores($bf, $preferences, $lessonid) {
|
||||
global $CFG, $DB;
|
||||
@@ -384,7 +384,7 @@
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
// backup lesson_default contents (executed from backup_lesson_mods)
|
||||
function backup_lesson_default ($bf,$preferences) {
|
||||
global $CFG, $DB;
|
||||
@@ -395,7 +395,7 @@
|
||||
$default = $DB->get_record("lesson_default", array("course" => $preferences->backup_course));
|
||||
if ($default) {
|
||||
//Start mod
|
||||
$status =fwrite ($bf,start_tag("DEFAULTS",4,true));
|
||||
$status =fwrite ($bf,start_tag("DEFAULTS",4,true));
|
||||
//Print default data
|
||||
fwrite ($bf,full_tag("PRACTICE",5,false,$default->practice));
|
||||
fwrite ($bf,full_tag("MODATTEMPTS",5,false,$default->modattempts));
|
||||
@@ -430,9 +430,9 @@
|
||||
fwrite ($bf,full_tag("MAXHIGHSCORES",5,false,$default->maxhighscores));
|
||||
$status =fwrite ($bf,end_tag("DEFAULTS",4,true));
|
||||
}
|
||||
return $status;
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
//Return an array of info (name,value)
|
||||
function lesson_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) {
|
||||
if (!empty($instances) && is_array($instances) && count($instances)) {
|
||||
@@ -453,7 +453,7 @@
|
||||
//Now, if requested, the user_data
|
||||
if ($user_data) {
|
||||
$info[1][0] = get_string("attempts","lesson");
|
||||
if ($ids = lesson_attempts_ids_by_course ($course)) {
|
||||
if ($ids = lesson_attempts_ids_by_course ($course)) {
|
||||
$info[1][1] = count($ids);
|
||||
} else {
|
||||
$info[1][1] = 0;
|
||||
@@ -471,7 +471,7 @@
|
||||
//Now, if requested, the user_data
|
||||
if (!empty($instance->userdata)) {
|
||||
$info[$instance->id.'1'][0] = get_string("attempts","lesson");
|
||||
if ($ids = lesson_attempts_ids_by_instance ($instance->id)) {
|
||||
if ($ids = lesson_attempts_ids_by_instance ($instance->id)) {
|
||||
$info[$instance->id.'1'][1] = count($ids);
|
||||
} else {
|
||||
$info[$instance->id.'1'][1] = 0;
|
||||
@@ -501,7 +501,7 @@
|
||||
|
||||
// INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
|
||||
|
||||
//Returns an array of lesson id
|
||||
//Returns an array of lesson id
|
||||
function lesson_ids ($course) {
|
||||
|
||||
global $CFG, $DB;
|
||||
@@ -511,7 +511,7 @@
|
||||
FROM {lesson} l
|
||||
WHERE l.course = :course", $params);
|
||||
}
|
||||
|
||||
|
||||
//Returns an array of lesson_submissions id
|
||||
function lesson_attempts_ids_by_course ($course) {
|
||||
|
||||
@@ -535,4 +535,4 @@
|
||||
FROM {lesson_attempts} a
|
||||
WHERE a.lessonid = :lessonid", $params);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Capability definitions for the lesson module.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file replaces:
|
||||
// * STATEMENTS section in db/install.xml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// This file keeps track of upgrades to
|
||||
// the lesson module
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
@@ -56,4 +56,4 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+26
-26
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Provides the interface for overall authoring of lessons
|
||||
*
|
||||
@@ -15,19 +15,19 @@
|
||||
$display = optional_param('display', 0, PARAM_INT);
|
||||
$mode = optional_param('mode', get_user_preferences('lesson_view', 'collapsed'), PARAM_ALPHA);
|
||||
$pageid = optional_param('pageid', 0, PARAM_INT);
|
||||
|
||||
|
||||
if ($mode != 'single') {
|
||||
set_user_preference('lesson_view', $mode);
|
||||
}
|
||||
|
||||
|
||||
list($cm, $course, $lesson) = lesson_get_basics($id);
|
||||
|
||||
|
||||
if ($firstpage = $DB->get_record('lesson_pages', array('lessonid' => $lesson->id, 'prevpageid' => 0))) {
|
||||
if (!$pages = $DB->get_records('lesson_pages', array('lessonid' => $lesson->id))) {
|
||||
print_error('cannotfindrecords', 'lesson');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($pageid) {
|
||||
if (!$singlepage = $DB->get_record('lesson_pages', array('id' => $pageid))) {
|
||||
print_error('invalidpageid', 'lesson');
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/lesson:manage', $context);
|
||||
|
||||
|
||||
lesson_print_header($cm, $course, $lesson, $mode);
|
||||
|
||||
if (empty($firstpage)) {
|
||||
@@ -70,7 +70,7 @@
|
||||
$pageid = $firstpage->id;
|
||||
$prevpageid = 0;
|
||||
$npages = count($pages);
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
case 'collapsed':
|
||||
$table = new html_table();
|
||||
@@ -81,7 +81,7 @@
|
||||
$table->cellspacing = 0;
|
||||
$table->cellpadding = '2px';
|
||||
$table->data = array();
|
||||
|
||||
|
||||
while ($pageid != 0) {
|
||||
$page = $pages[$pageid];
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
$jumps[] = lesson_get_jump_name($answer->jumpto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table->data[] = array("<a href=\"$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&mode=single&pageid=".$page->id."\">".format_string($pages[$pageid]->title,true).'</a>',
|
||||
lesson_get_qtype_name($page->qtype),
|
||||
implode("<br />\n", $jumps),
|
||||
@@ -108,18 +108,18 @@
|
||||
);
|
||||
$pageid = $page->nextpageid;
|
||||
}
|
||||
|
||||
|
||||
echo $OUTPUT->table($table);
|
||||
break;
|
||||
|
||||
|
||||
case 'single':
|
||||
// Only viewing a single page in full - change some variables to display just one
|
||||
$prevpageid = $singlepage->prevpageid;
|
||||
$pageid = $singlepage->id;
|
||||
|
||||
|
||||
$pages = array();
|
||||
$pages[$singlepage->id] = $singlepage;
|
||||
|
||||
|
||||
case 'full':
|
||||
echo '<table class="boxaligncenter" cellpadding="5" border="0" style="width:80%;">
|
||||
<tr>
|
||||
@@ -134,7 +134,7 @@
|
||||
echo "<tr><td>\n";
|
||||
echo "<table style=\"width:100%;\" border=\"1\" class=\"generalbox\"><tr><th colspan=\"2\" scope=\"col\">".format_string($page->title)." \n";
|
||||
lesson_print_page_actions($cm->id, $page, $npages);
|
||||
echo "</th></tr>\n";
|
||||
echo "</th></tr>\n";
|
||||
echo "<tr><td colspan=\"2\">\n";
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
@@ -192,21 +192,21 @@
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><span class=\"label\">".get_string("response", "lesson")." $i</span>: \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
break;
|
||||
case LESSON_MATCHING:
|
||||
if ($n < 2) {
|
||||
if ($answer->answer != NULL) {
|
||||
if ($n == 0) {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><span class=\"label\">".get_string("correctresponse", "lesson")."</span>: \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><span class=\"label\">".get_string("wrongresponse", "lesson")."</span>: \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><span class=\"label\">".get_string("matchesanswer", "lesson")." $i</span>: \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
@@ -265,10 +265,10 @@
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
}
|
||||
} else {
|
||||
if ($lesson->custom and
|
||||
$page->qtype != LESSON_BRANCHTABLE and
|
||||
if ($lesson->custom and
|
||||
$page->qtype != LESSON_BRANCHTABLE and
|
||||
$page->qtype != LESSON_ENDOFBRANCH and
|
||||
$page->qtype != LESSON_CLUSTER and
|
||||
$page->qtype != LESSON_CLUSTER and
|
||||
$page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
echo "<tr><td align=\"right\" style=\"width:20%;\"><span class=\"label\">".get_string("score", "lesson")." $i";
|
||||
echo "</span>: </td><td style=\"width:80%;\">\n";
|
||||
@@ -292,12 +292,12 @@
|
||||
$DB->set_field("lesson_pages", "prevpageid", $prevpageid, array("id" => $page->id));
|
||||
debugging("<p>***prevpageid of page $page->id set to $prevpageid***");
|
||||
}
|
||||
|
||||
|
||||
if (count($pages) == 1) {
|
||||
echo "</td></tr>";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$prevpageid = $page->id;
|
||||
$pageid = $page->nextpageid;
|
||||
echo "</td></tr>";
|
||||
@@ -305,7 +305,7 @@
|
||||
echo "</table>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
+31
-31
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Provides the interface for grading essay questions
|
||||
*
|
||||
@@ -16,7 +16,7 @@
|
||||
$mode = optional_param('mode', 'display', PARAM_ALPHA);
|
||||
|
||||
list($cm, $course, $lesson) = lesson_get_basics($id);
|
||||
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$url = new moodle_url($CFG->wwwroot.'/mod/lesson/essay.php', array('id'=>$id));
|
||||
@@ -27,9 +27,9 @@
|
||||
$PAGE->navbar->add(get_string('manualgrading','lesson'));
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
|
||||
require_capability('mod/lesson:edit', $context);
|
||||
|
||||
|
||||
/// Handle any preprocessing before header is printed - based on $mode
|
||||
switch ($mode) {
|
||||
case 'display': // Default view - get the necessary data
|
||||
@@ -43,7 +43,7 @@
|
||||
if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) {
|
||||
$params["groupinid"] = $cm->groupingid;
|
||||
$sql = "SELECT DISTINCT u.*
|
||||
FROM {lesson_attempts} a
|
||||
FROM {lesson_attempts} a
|
||||
INNER JOIN {user} u ON u.id = a.userid
|
||||
INNER JOIN {groups_members} gm ON gm.userid = u.id
|
||||
INNER JOIN {groupings_groups} gg ON gm.groupid = :groupinid
|
||||
@@ -72,7 +72,7 @@
|
||||
break;
|
||||
case 'grade': // Grading form - get the necessary data
|
||||
confirm_sesskey();
|
||||
|
||||
|
||||
$attemptid = required_param('attemptid', PARAM_INT);
|
||||
|
||||
if (!$attempt = $DB->get_record('lesson_attempts', array('id' => $attemptid))) {
|
||||
@@ -93,9 +93,9 @@
|
||||
if (optional_param('cancel', 0, PARAM_RAW)) {
|
||||
redirect("$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
$attemptid = required_param('attemptid', PARAM_INT);
|
||||
|
||||
|
||||
if (!$attempt = $DB->get_record('lesson_attempts', array('id' => $attemptid))) {
|
||||
print_error('cannotfindattempt', 'lesson');
|
||||
}
|
||||
@@ -120,18 +120,18 @@
|
||||
$attempt->useranswer = serialize($essayinfo);
|
||||
|
||||
$DB->update_record('lesson_attempts', $attempt);
|
||||
|
||||
|
||||
// Get grade information
|
||||
$grade = current($grades);
|
||||
$gradeinfo = lesson_grade($lesson, $attempt->retry, $attempt->userid);
|
||||
|
||||
|
||||
// Set and update
|
||||
$updategrade->id = $grade->id;
|
||||
$updategrade->grade = $gradeinfo->grade;
|
||||
$DB->update_record('lesson_grades', $updategrade);
|
||||
// Log it
|
||||
add_to_log($course->id, 'lesson', 'update grade', "essay.php?id=$cm->id", $lesson->name, $cm->id);
|
||||
|
||||
|
||||
lesson_set_message(get_string('changessaved'), 'notifysuccess');
|
||||
|
||||
// update central gradebook
|
||||
@@ -144,7 +144,7 @@
|
||||
break;
|
||||
case 'email': // Sending an email(s) to a single user or all
|
||||
confirm_sesskey();
|
||||
|
||||
|
||||
// Get our users (could be singular)
|
||||
if ($userid = optional_param('userid', 0, PARAM_INT)) {
|
||||
$queryadd = " AND userid = :userid";
|
||||
@@ -186,19 +186,19 @@
|
||||
}
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
|
||||
|
||||
foreach ($attempts as $attempt) {
|
||||
$essayinfo = unserialize($attempt->useranswer);
|
||||
if ($essayinfo->graded and !$essayinfo->sent) {
|
||||
// Holds values for the essayemailsubject string for the email message
|
||||
$a = new stdClass;
|
||||
|
||||
|
||||
// Set the grade
|
||||
$params = array ("lessonid" => $lesson->id, "userid" => $attempt->userid);
|
||||
$grades = $DB->get_records_select('lesson_grades', "lessonid = :lessonid and userid = :userid", $params, 'completed', '*', $attempt->retry, 1);
|
||||
$grade = current($grades);
|
||||
$a->newgrade = $grade->grade;
|
||||
|
||||
|
||||
// Set the points
|
||||
if ($lesson->custom) {
|
||||
$a->earned = $essayinfo->score;
|
||||
@@ -219,7 +219,7 @@
|
||||
|
||||
// Subject
|
||||
$subject = get_string('essayemailsubject', 'lesson', format_string($pages[$attempt->pageid]->title,true));
|
||||
|
||||
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'lesson';
|
||||
$eventdata->userfrom = $USER;
|
||||
@@ -244,25 +244,25 @@
|
||||
redirect("$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Log it
|
||||
add_to_log($course->id, 'lesson', 'view grade', "essay.php?id=$cm->id", get_string('manualgrading', 'lesson'), $cm->id);
|
||||
|
||||
|
||||
lesson_print_header($cm, $course, $lesson, 'essay');
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
case 'display':
|
||||
// Expects $user, $essayattempts and $pages to be set already
|
||||
|
||||
|
||||
// Group all the essays by userid
|
||||
$studentessays = array();
|
||||
foreach ($essayattempts as $essay) {
|
||||
// Not very nice :) but basically
|
||||
// this organizes the essays so we know how many
|
||||
// this organizes the essays so we know how many
|
||||
// times a student answered an essay per try and per page
|
||||
$studentessays[$essay->userid][$essay->pageid][$essay->retry][] = $essay;
|
||||
$studentessays[$essay->userid][$essay->pageid][$essay->retry][] = $essay;
|
||||
}
|
||||
|
||||
|
||||
// Setup table
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('name'), get_string('essays', 'lesson'), get_string('email', 'lesson'));
|
||||
@@ -297,10 +297,10 @@
|
||||
} else {
|
||||
$essay = end($try);
|
||||
}
|
||||
|
||||
|
||||
// Start processing the attempt
|
||||
$essayinfo = unserialize($essay->useranswer);
|
||||
|
||||
|
||||
// Different colors for all the states of an essay (graded, if sent, not graded)
|
||||
if (!$essayinfo->graded) {
|
||||
$class = ' class="graded"';
|
||||
@@ -322,7 +322,7 @@
|
||||
$emailalllink = "<a href=\"$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id&mode=email&sesskey=".sesskey().'">'.get_string('emailallgradedessays', 'lesson').'</a>';
|
||||
|
||||
$table->data[] = array(' ', ' ', $emailalllink);
|
||||
|
||||
|
||||
echo $OUTPUT->table($table);
|
||||
break;
|
||||
case 'grade':
|
||||
@@ -334,7 +334,7 @@
|
||||
<input type="hidden" name="id" value="'.$cm->id.'" />
|
||||
<input type="hidden" name="mode" value="update" />
|
||||
<input type="hidden" name="attemptid" value="'.$attemptid.'" />
|
||||
<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
|
||||
// All tables will have these settings
|
||||
$originaltable = new html_table();
|
||||
@@ -352,10 +352,10 @@
|
||||
$table->data[] = array(format_text($page->contents, FORMAT_MOODLE, $options));
|
||||
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
|
||||
// Now the user's answer
|
||||
$essayinfo = unserialize($attempt->useranswer);
|
||||
|
||||
|
||||
$table = clone($originaltable);
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('studentresponse', 'lesson', fullname($user, true)));
|
||||
@@ -389,6 +389,6 @@
|
||||
</div>';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
+16
-16
@@ -1,6 +1,6 @@
|
||||
<?php // $Id$
|
||||
<?php // $Id$
|
||||
/**
|
||||
* format.php - Default format class for file imports/exports. Doesn't do
|
||||
* format.php - Default format class for file imports/exports. Doesn't do
|
||||
* everything on it's own -- it needs to be extended.
|
||||
*
|
||||
* @version $Id$
|
||||
@@ -32,7 +32,7 @@ class qformat_default {
|
||||
|
||||
function importprocess($filename, $lesson, $pageid) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
|
||||
/// Processes a given file. There's probably little need to change this
|
||||
$timenow = time();
|
||||
|
||||
@@ -45,7 +45,7 @@ class qformat_default {
|
||||
echo $OUTPUT->notification("There are no questions in this file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
echo $OUTPUT->notification(get_string('importcount', 'lesson', sizeof($questions)));
|
||||
|
||||
$count = 0;
|
||||
@@ -118,7 +118,7 @@ class qformat_default {
|
||||
// reset $pageid and put the page ID in $question, used in save_question_option()
|
||||
$pageid = $newpageid;
|
||||
$question->id = $newpageid;
|
||||
|
||||
|
||||
$this->questionids[] = $question->id;
|
||||
|
||||
// Now to save all the answers and type-specific options
|
||||
@@ -141,7 +141,7 @@ class qformat_default {
|
||||
default :
|
||||
echo $OUTPUT->notification(get_string('unsupportedqtype', 'lesson', $question->qtype));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -164,11 +164,11 @@ class qformat_default {
|
||||
}
|
||||
|
||||
function readquestions($lines) {
|
||||
/// Parses an array of lines into an array of questions,
|
||||
/// where each item is a question object as defined by
|
||||
/// readquestion(). Questions are defined as anything
|
||||
/// Parses an array of lines into an array of questions,
|
||||
/// where each item is a question object as defined by
|
||||
/// readquestion(). Questions are defined as anything
|
||||
/// between blank lines.
|
||||
|
||||
|
||||
$questions = array();
|
||||
$currentquestion = array();
|
||||
|
||||
@@ -197,8 +197,8 @@ class qformat_default {
|
||||
|
||||
|
||||
function readquestion($lines) {
|
||||
/// Given an array of lines known to define a question in
|
||||
/// this format, this function converts it into a question
|
||||
/// Given an array of lines known to define a question in
|
||||
/// this format, this function converts it into a question
|
||||
/// object suitable for processing and insertion into Moodle.
|
||||
|
||||
echo "<p>This flash question format has not yet been completed!</p>";
|
||||
@@ -210,7 +210,7 @@ class qformat_default {
|
||||
// returns an "empty" question
|
||||
// Somewhere to specify question parameters that are not handled
|
||||
// by import but are required db fields.
|
||||
// This should not be overridden.
|
||||
// This should not be overridden.
|
||||
global $CFG;
|
||||
|
||||
$question = new stdClass();
|
||||
@@ -228,13 +228,13 @@ class qformat_default {
|
||||
$question->length = 1;
|
||||
$question->qoption = 0;
|
||||
$question->layout = 1;
|
||||
|
||||
|
||||
return $question;
|
||||
}
|
||||
|
||||
function importpostprocess() {
|
||||
/// Does any post-processing that may be desired
|
||||
/// Argument is a simple array of question ids that
|
||||
/// Argument is a simple array of question ids that
|
||||
/// have just been added.
|
||||
|
||||
return true;
|
||||
@@ -242,4 +242,4 @@ class qformat_default {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
redirect('view.php?id='.$cm->id);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+28
-28
@@ -25,12 +25,12 @@
|
||||
$PAGE->set_url($url);
|
||||
|
||||
list($cm, $course, $lesson) = lesson_get_basics($id);
|
||||
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
case 'add':
|
||||
// Ensure that we came from view.php
|
||||
@@ -38,17 +38,17 @@
|
||||
print_error('invalidformdata');
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'save':
|
||||
if (confirm_sesskey() and $form = data_submitted($CFG->wwwroot.'/mod/lesson/view.php')) {
|
||||
$name = trim(optional_param('name', '', PARAM_CLEAN));
|
||||
|
||||
|
||||
// Make sure it is not empty
|
||||
if (empty($name)) {
|
||||
lesson_set_message(get_string('missingname', 'lesson'));
|
||||
$mode = 'add';
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Check for censored words
|
||||
$filterwords = explode(',', get_string('censorbadwords'));
|
||||
foreach ($filterwords as $filterword) {
|
||||
@@ -66,23 +66,23 @@
|
||||
if (!$grades = $DB->get_records_select('lesson_grades', "lessonid = :lessonid", $params, 'completed')) {
|
||||
print_error('cannotfindfirstgrade', 'lesson');
|
||||
}
|
||||
|
||||
if (!$newgrade = $DB->get_record_sql("SELECT *
|
||||
FROM {lesson_grades}
|
||||
|
||||
if (!$newgrade = $DB->get_record_sql("SELECT *
|
||||
FROM {lesson_grades}
|
||||
WHERE lessonid = :lessonid
|
||||
AND userid = :userid
|
||||
AND userid = :userid
|
||||
ORDER BY completed DESC", $params, true)) {
|
||||
print_error('cannotfindnewestgrade', 'lesson');
|
||||
}
|
||||
|
||||
|
||||
// Check for multiple submissions
|
||||
if ($DB->record_exists('lesson_high_scores', array('gradeid' => $newgrade->id))) {
|
||||
print_error('onpostperpage', 'lesson');
|
||||
}
|
||||
|
||||
|
||||
// Find out if we need to delete any records
|
||||
if ($highscores = $DB->get_records_sql("SELECT h.*, g.grade
|
||||
FROM {lesson_grades} g, {lesson_high_scores} h
|
||||
if ($highscores = $DB->get_records_sql("SELECT h.*, g.grade
|
||||
FROM {lesson_grades} g, {lesson_high_scores} h
|
||||
WHERE h.gradeid = g.id
|
||||
AND h.lessonid = :lessonid
|
||||
ORDER BY g.grade DESC", $params)) {
|
||||
@@ -93,14 +93,14 @@
|
||||
}
|
||||
if (count($uniquescores) >= $lesson->maxhighscores) {
|
||||
// Top scores list is full, might need to delete a score
|
||||
$flag = true;
|
||||
$flag = true;
|
||||
// See if the new score is already listed in the top scores list
|
||||
// if it is listed, then dont need to delete any records
|
||||
foreach ($highscores as $highscore) {
|
||||
if ($newgrade->grade == $highscore->grade) {
|
||||
$flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
// Pushing out the lowest score (could be multiple records)
|
||||
$lowscore = 0;
|
||||
@@ -126,10 +126,10 @@
|
||||
$newhighscore->nickname = $name;
|
||||
|
||||
$DB->insert_record('lesson_high_scores', $newhighscore);
|
||||
|
||||
|
||||
// Log it
|
||||
add_to_log($course->id, 'lesson', 'update highscores', "highscores.php?id=$cm->id", $name, $cm->id);
|
||||
|
||||
|
||||
lesson_set_message(get_string('postsuccess', 'lesson'), 'notifysuccess');
|
||||
redirect("$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id&link=1");
|
||||
} else {
|
||||
@@ -162,7 +162,7 @@
|
||||
if (!$grades = $DB->get_records_select("lesson_grades", "lessonid = :lessonid", $params, "completed")) {
|
||||
$grades = array();
|
||||
}
|
||||
|
||||
|
||||
echo $OUTPUT->heading(get_string("topscorestitle", "lesson", $lesson->maxhighscores), 4);
|
||||
|
||||
if (!$highscores = $DB->get_records_select("lesson_high_scores", "lessonid = :lessonid", $params)) {
|
||||
@@ -173,33 +173,33 @@
|
||||
$topscores[$grade][] = $highscore->nickname;
|
||||
}
|
||||
krsort($topscores);
|
||||
|
||||
|
||||
$table = new html_table();
|
||||
$table->align = array('center', 'left', 'right');
|
||||
$table->wrap = array();
|
||||
$table->width = "30%";
|
||||
$table->cellspacing = '10px';
|
||||
$table->size = array('*', '*', '*');
|
||||
|
||||
|
||||
$table->head = array(get_string("rank", "lesson"), get_string('name'), get_string("scores", "lesson"));
|
||||
|
||||
|
||||
$printed = 0;
|
||||
while (true) {
|
||||
$temp = current($topscores);
|
||||
$score = key($topscores);
|
||||
$rank = $printed + 1;
|
||||
sort($temp);
|
||||
sort($temp);
|
||||
foreach ($temp as $student) {
|
||||
$table->data[] = array($rank, $student, $score.'%');
|
||||
}
|
||||
$printed++;
|
||||
if (!next($topscores) || !($printed < $lesson->maxhighscores)) {
|
||||
if (!next($topscores) || !($printed < $lesson->maxhighscores)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo $OUTPUT->table($table);
|
||||
}
|
||||
|
||||
|
||||
if (!has_capability('mod/lesson:manage', $context)) { // teachers don't need the links
|
||||
echo '<div class="mdl-align">';
|
||||
if ($link) {
|
||||
@@ -212,7 +212,7 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user