diff --git a/ipal/add_ejs.php b/ipal/add_ejs.php index 5b08dcc..f61b9a3 100644 --- a/ipal/add_ejs.php +++ b/ipal/add_ejs.php @@ -65,17 +65,15 @@ echo "\n
Please use the back button and try again."; exit; } -$ejs = $DB->get_record('modules', array('name' => 'ejsapp')); -$ejsid = $ejs->id;// The id for all EJS module activities. -$ejscoursemodule = $DB->get_record('course_modules', array('instance' => $ejsappid, 'course' => $courseid, 'module' => $ejsid)); -$ejscoursemoduleid = $ejscoursemodule->id; -$newcode = "src=\"".$CFG->wwwroot."/mod/ipal/viewejs.php?id=$ejscoursemoduleid\" width='600' height='410'>EJS App"; -$newcode = '"; - echo "

id."', '', - 'width=620,height=450,toolbar=no,location=no,menubar=no,copyhistory=no,status=no, - directories=no,scrollbars=yes,resizable=yes'); + echo "

id."', '', + 'width=620,height=450,toolbar=no,location=no,menubar=no,copyhistory=no,status=no,"; + echo "directories=no,scrollbars=yes,resizable=yes'); return false;\" href=\"popupgraph.php?ipalid=".$ipal->id."\" target=\"_blank\">Open a new window for the graph."; } @@ -469,6 +471,8 @@ function ipal_show_current_question() { if ($DB->record_exists('ipal_active_questions', array('ipal_id' => $ipal->id))) { $question = $DB->get_record('ipal_active_questions', array('ipal_id' => $ipal->id)); $questiontext = $DB->get_record('question', array('id' => $question->question_id)); + // Removing any EJS from the ipal/view.php page. Note: A dot does not match a new line without the s option. + $questiontext->questiontext = preg_replace("/EJS.+<\/ejsipal>/s", "EJS ", $questiontext->questiontext); echo "The current question is -> ".strip_tags($questiontext->questiontext); return(1); } else { diff --git a/ipal/show_question.php b/ipal/show_question.php deleted file mode 100644 index 78e48d6..0000000 --- a/ipal/show_question.php +++ /dev/null @@ -1,110 +0,0 @@ -. - -/** - * - * Use this file to display the selected question in an IPAL instance. - * - * @package mod_ipal - * @copyright 2013 Bill Junkin - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -?> - - - - - -get_records('question_answers', array('question' => $questionid)); - foreach ($answers as $answers) { - $answerarray[$answers->id] = $answers->answer; - } - - return($answerarray); -} - - -/** - * Function to get the question text and answers for specific question. - * - * @param int $qid The id of the question. - * @return array An array of the question id, text, and possible responses - */ -function ipal_get_questions($qid) { - global $DB; - $pagearray2 = array(); - - $aquestions = $DB->get_record('question', array('id' => $qid)); - if ($aquestions->questiontext != "") { - - $pagearray2[] = array('id' => $qid, 'question' => $aquestions->questiontext, 'answers' => ipal_get_answers($qid)); - - } - return($pagearray2); -} - -/** - * Function to display a question - * - */ -function ipal_display_standalone_question() { - global $contextid; - global $entryid; - $qid = $_GET['qid']; - $myformarray = ipal_get_questions($qid); - echo "
\n"; - $text = $myformarray[0]['question']; - $text = file_rewrite_pluginfile_urls($text, 'pluginfile.php', $contextid->id, 'question', 'questiontext/'.$entryid.'/1', $qid); - echo $text; - echo "
"; - foreach ($myformarray[0]['answers'] as $k => $v) { - echo " ".strip_tags($v)."
\n"; - } - echo "
"; -} - -// Add entry to the question_usages table so that pluginfile.php will work. -$id = $_GET['id']; - -$ipal = $DB->get_record('ipal', array('id' => $_GET['id'])); -$courseid = $ipal->course; -$contextid = $DB->get_record('context', array('instanceid' => $courseid, 'contextlevel' => 50)); - $record = new Stdclass(); - $record->contextid = $contextid->id; - $record->component = 'mod_ipal'; - $record->preferredbehaviour = 'deferredfeedback'; - $lastinsertid = $DB->insert_record('question_usages', $record); - $entryid = $lastinsertid; - -ipal_display_standalone_question(); - -?> - - diff --git a/ipal/version.php b/ipal/version.php index bfa420b..bf8966c 100644 --- a/ipal/version.php +++ b/ipal/version.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2014100100; // The current module version (Date: YYYYMMDDXX). -$module->requires = 2011033003; // Requires this Moodle version. +$module->version = 2014101300; // The current module version (Date: YYYYMMDDXX). +$module->requires = 2014051200; // Requires this Moodle version. $module->cron = 60; // Period for cron to check this module (secs). -$module->release = '2.0.0 (Build: 2014100100'; \ No newline at end of file +$module->release = '2.0.1 (Build: 2014101300'; \ No newline at end of file