Navigation Menu

Skip to content

Commit

Permalink
Fixed bug for student view of index.php
Browse files Browse the repository at this point in the history
Replaced use of DIRECTORY_SEPARATOR constant with '/'
  • Loading branch information
gbateson committed Sep 16, 2005
1 parent d9a124d commit 4b4a288
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions mod/hotpot/lib.php
Expand Up @@ -14,9 +14,8 @@
////////////////////////////////// //////////////////////////////////
/// CONSTANTS and GLOBAL VARIABLES /// CONSTANTS and GLOBAL VARIABLES


$ds = DIRECTORY_SEPARATOR; $CFG->hotpotroot = "$CFG->dirroot/mod/hotpot";
$CFG->hotpotroot = "$CFG->dirroot{$ds}mod{$ds}hotpot"; $CFG->hotpottemplate = "$CFG->hotpotroot/template";
$CFG->hotpottemplate = "$CFG->hotpotroot{$ds}template";


define("HOTPOT_JS", "$CFG->wwwroot/mod/hotpot/hotpot-full.js"); define("HOTPOT_JS", "$CFG->wwwroot/mod/hotpot/hotpot-full.js");


Expand Down Expand Up @@ -319,6 +318,9 @@ function hotpot_get_chain(&$cm) {
$hotpot_modules = array(); $hotpot_modules = array();
} else { } else {
$hotpot_modules = get_records_select('course_modules', "id IN ($course_module_ids) AND module=$cm->module"); $hotpot_modules = get_records_select('course_modules', "id IN ($course_module_ids) AND module=$cm->module");
if (empty($hotpot_modules)) {
$hotpot_modules = array();
}
} }


// get ids of hotpot modules in this section // get ids of hotpot modules in this section
Expand Down Expand Up @@ -405,7 +407,7 @@ function hotpot_add_chain(&$hp) {


// get titles // get titles
foreach ($hp->files as $i=>$file) { foreach ($hp->files as $i=>$file) {
$filepath = $xml_quiz->fileroot.DIRECTORY_SEPARATOR.$xml_quiz->filesubdir.$file; $filepath = $xml_quiz->fileroot.'/'.$xml_quiz->filesubdir.$file;
hotpot_get_titles_and_next_ex($hp, $filepath); hotpot_get_titles_and_next_ex($hp, $filepath);
$hp->titles[$i] = $hp->exercisetitle; $hp->titles[$i] = $hp->exercisetitle;
} }
Expand All @@ -426,7 +428,7 @@ function hotpot_add_chain(&$hp) {
$hp->titles[] = $hp->exercisetitle; $hp->titles[] = $hp->exercisetitle;


if ($hp->nextexercise) { if ($hp->nextexercise) {
$filepath = $xml_quiz->fileroot.DIRECTORY_SEPARATOR.$xml_quiz->filesubdir.$hp->nextexercise; $filepath = $xml_quiz->fileroot.'/'.$xml_quiz->filesubdir.$hp->nextexercise;
} else { } else {
$filepath = ''; $filepath = '';
} }
Expand Down Expand Up @@ -629,6 +631,8 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
global $CFG; global $CFG;
$instances = array(); $instances = array();


$hotpotmoduleid = get_field('modules', 'id', 'name', 'hotpot');

if ($modinfo = unserialize($course->modinfo)) { if ($modinfo = unserialize($course->modinfo)) {


if (isset($CFG->release) && substr($CFG->release, 0, 3)>=1.2) { if (isset($CFG->release) && substr($CFG->release, 0, 3)>=1.2) {
Expand Down Expand Up @@ -667,6 +671,8 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
if ($isteacher) { if ($isteacher) {
$visible = true; $visible = true;
} else if ($mod->mod=='hotpot') { } else if ($mod->mod=='hotpot') {
$mod->coursemodule = $mod->cm;
$mod->module = $hotpotmoduleid;
$visible = hotpot_is_visible($mod); $visible = hotpot_is_visible($mod);
} else { } else {
$visible = $mod->visible; $visible = $mod->visible;
Expand Down Expand Up @@ -1185,10 +1191,10 @@ function hotpot_string($id) {
/// the class definitions to handle XML trees /// the class definitions to handle XML trees


// get the standard XML parser supplied with Moodle // get the standard XML parser supplied with Moodle
require_once($CFG->libdir.DIRECTORY_SEPARATOR.'xmlize.php'); require_once("$CFG->libdir/xmlize.php");


// get the default class for hotpot quiz templates // get the default class for hotpot quiz templates
require_once($CFG->hotpottemplate.DIRECTORY_SEPARATOR.'default.php'); require_once("$CFG->hotpottemplate/default.php");


class hotpot_xml_tree { class hotpot_xml_tree {
function hotpot_xml_tree($str, $xml_root='') { function hotpot_xml_tree($str, $xml_root='') {
Expand Down Expand Up @@ -1364,11 +1370,11 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
$this->filesubdir = ''; $this->filesubdir = '';
} }
if ($this->filesubdir) { if ($this->filesubdir) {
$this->filesubdir .= DIRECTORY_SEPARATOR; $this->filesubdir .= '/';
} }
$this->filename = basename($this->reference); $this->filename = basename($this->reference);
$this->fileroot = $CFG->dataroot.DIRECTORY_SEPARATOR.$this->filedir; $this->fileroot = "$CFG->dataroot/$this->filedir";
$this->filepath = $this->fileroot.DIRECTORY_SEPARATOR.$this->reference; $this->filepath = "$this->fileroot/$this->reference";


// read the file, if required // read the file, if required
if ($this->read_file) { if ($this->read_file) {
Expand Down Expand Up @@ -1488,8 +1494,8 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
} else { } else {
// set path(s) to template // set path(s) to template
$this->template_dir = $HOTPOT_OUTPUTFORMAT_DIR[$this->real_outputformat]; $this->template_dir = $HOTPOT_OUTPUTFORMAT_DIR[$this->real_outputformat];
$this->template_dirpath = $CFG->hotpottemplate.DIRECTORY_SEPARATOR.$this->template_dir; $this->template_dirpath = $CFG->hotpottemplate.'/'.$this->template_dir;
$this->template_filepath = $CFG->hotpottemplate.DIRECTORY_SEPARATOR.$this->template_dir.'.php'; $this->template_filepath = $CFG->hotpottemplate.'/'.$this->template_dir.'.php';


// check template class exists // check template class exists
if (!file_exists($this->template_filepath) || !is_readable($this->template_filepath)) { if (!file_exists($this->template_filepath) || !is_readable($this->template_filepath)) {
Expand Down

0 comments on commit 4b4a288

Please sign in to comment.