Index: temp_moodle_dev/lamstwo/tooladapter_quiz.php
===================================================================
RCS file: /usr/local/cvsroot/temp_moodle_dev/lamstwo/Attic/tooladapter_quiz.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ temp_moodle_dev/lamstwo/tooladapter_quiz.php 14 Nov 2008 06:16:59 -0000 1.1
@@ -0,0 +1,60 @@
+libdir.'/datalib.php');
+ include_once('../quiz/lib.php');
+
+ $ts = optional_param('ts', '', PARAM_TEXT);
+ $username = optional_param('un', '', PARAM_TEXT);
+ $hs = optional_param('hs', '', PARAM_TEXT);
+
+
+ if ( ! isset($CFG->lamstwo_serverid) || ! isset($CFG->lamstwo_serverkey) ) {
+ header('HTTP/1.1 401 Unauthenticated');
+ exit(1);
+ }
+ $plaintext = trim($ts).trim($username).trim($CFG->lamstwo_serverid).trim($CFG->lamstwo_serverkey);
+ $hash = sha1(strtolower($plaintext));
+ //
+ if ( $hash != $hs ){
+ header('HTTP/1.1 401 Unauthenticated');
+ exit(1);
+ }
+
+
+
+ $method = optional_param('method', '', PARAM_TEXT);
+ $cmid = optional_param('extToolContentID', 0, PARAM_INT);
+ $sectionid = optional_param('section', 1, PARAM_INT);
+ $courseid = optional_param('cs', 1, PARAM_INT);
+ $outputname = optional_param('oname', '', PARAM_TEXT);
+
+ $user = get_record('user', 'username', $username);
+
+ switch ($method) {
+ case 'clone':
+ $newcmid = quiz_clone_instance($cmid, $sectionid, $courseid);
+ echo $newcmid;
+ break;
+ case 'import':
+ $newcmid = quiz_import_instance($_FILES['upload_file']['tmp_name'], $user->id, $courseid, $sectionid);
+ echo $newcmid;
+ break;
+ case 'export':
+ quiz_export_instance($cmid);
+ break;
+ case 'export_portfolio':
+ $text = quiz_export_portfolio($cmid, $user->id);
+ echo $text;
+ break;
+ case 'output':
+ $output = quiz_get_tool_output($cmid, $user->id);
+ echo $output;
+ break;
+ default:
+ }
+ ?>
\ No newline at end of file
Index: temp_moodle_dev/moodle/course/lamsbuttons.php
===================================================================
RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/lamsbuttons.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ temp_moodle_dev/moodle/course/lamsbuttons.php 14 Nov 2008 06:16:59 -0000 1.1
@@ -0,0 +1,57 @@
+
+
+ LAMS frame
+
+
+
+
+
+
+
+ ');
+ ?>
+
+
+ ';
+ ?>
+
+
+
+
+
Index: temp_moodle_dev/moodle/course/lamsframes.php
===================================================================
RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/lamsframes.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ temp_moodle_dev/moodle/course/lamsframes.php 14 Nov 2008 06:16:59 -0000 1.1
@@ -0,0 +1,41 @@
+
+lamsframes
+
+
+
+
+
+
+
Index: temp_moodle_dev/moodle/course/modedit-lams.php
===================================================================
RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/modedit-lams.php,v
diff -u -r1.2 -r1.3
--- temp_moodle_dev/moodle/course/modedit-lams.php 21 Aug 2008 00:19:55 -0000 1.2
+++ temp_moodle_dev/moodle/course/modedit-lams.php 14 Nov 2008 06:16:59 -0000 1.3
@@ -5,14 +5,16 @@
require_once("../config.php");
require_once("lib.php");
require_once($CFG->libdir.'/gradelib.php');
+
require_login();
$add = optional_param('add', 0, PARAM_ALPHA);
$update = optional_param('update', 0, PARAM_INT);
$return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true
$type = optional_param('type', '', PARAM_ALPHANUM);
- $lamsupdateurl = required_param('lamsUpdateURL', PARAM_TEXT);
+ $lamsupdateurl = optional_param('lamsUpdateURL', PARAM_TEXT); //get lamsupdateurl variable if coming from a Lams activity
+ $is_learner = optional_param('is_learner', 0, PARAM_INT);
if (!empty($add)) {
$section = required_param('section', PARAM_INT);
@@ -29,7 +31,7 @@
if (! $module = get_record("modules", "name", $add)) {
error("This module type doesn't exist");
}
-
+
$cw = get_course_section($section, $course->id);
if (!course_allowed_module($course, $module->id)) {
@@ -39,7 +41,7 @@
$cm = null;
$form->section = $section; // The section number itself - relative!!! (section column in course_sections)
- $form->visible = $cw->visible;
+ $form->visible = 1;// We always mark as visible our Lams Courses because we have our is_lams variable to hide/unhide them if necessary old $cw->visible;
$form->course = $course->id;
$form->module = $module->id;
$form->modulename = $module->name;
@@ -101,7 +103,7 @@
$form->coursemodule = $cm->id;
$form->section = $cw->section; // The section number itself - relative!!! (section column in course_sections)
- $form->visible = $cm->visible; //?? $cw->visible ? $cm->visible : 0; // section hiding overrides
+ $form->visible = 1;// We always mark as visible our Lams Courses because we have our is_lams variable to hide/unhide them if necessary, old $cm->visible; //?? $cw->visible ? $cm->visible : 0; // section hiding overrides
$form->cmidnumber = $cm->idnumber; // The cm IDnumber
$form->groupmode = groups_get_activity_groupmode($cm); // locked later if forced
$form->groupingid = $cm->groupingid;
@@ -300,6 +302,7 @@
}
if (! $sectionid = add_mod_to_section($fromform) ) {
error("Could not add the new course module to that section");
+
}
if (! set_field("course_modules", "section", $sectionid, "id", $fromform->coursemodule)) {
@@ -414,8 +417,14 @@
rebuild_course_cache($course->id);
grade_regrade_final_grades($course->id);
-
- redirect("$lamsupdateurl&extToolContentID=$fromform->coursemodule");
+
+ //LAMS: one you submit if you are in a Quiz you continue editing the quiz, if you're finished then return to Lams
+ if (isset($fromform->submitbutton)) {
+ // If is a Lams activity we add editing variable to know in the sequence when to display Next activity button or back to Lams button, we also passes is_learner variable so we know if teacher is acting as a learner or as a teacher
+ redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule&is_learner=$is_learner&editing=1");
+ } else {
+ redirect("$lamsupdateurl&extToolContentID=$fromform->coursemodule");
+ }
exit;
} else {
@@ -428,31 +437,33 @@
$streditinga = get_string("editinga", "moodle", $fullmodulename);
$strmodulenameplural = get_string("modulenameplural", $module->name);
-
- /*
- $navlinks = array();
- $navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
- if ($navlinksinstancename) {
- $navlinks[] = $navlinksinstancename;
- }
- $navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'title');
- */
-
+ /*
+ $navlinks = array();
+ $navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
+ if ($navlinksinstancename) {
+ $navlinks[] = $navlinksinstancename;
+ }
+ $navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'title');
+ */
$navigation = ''; //build_navigation($navlinks);
-
- print_header_simple($streditinga, "LAMS", $navigation, $mform->focus(), "", false);
-
- if (!empty($cm->id)) {
+
+ //We don't want to display Moodle navigation top menus in Lams
+ print_header();
+ //old print_header_simple($streditinga, "LAMS", $navigation, $mform->focus(), "", false,$strupdatemodule);
+
+ // In Lams we don't need horitzontal extra tabs while editing
+ /*if (!empty($cm->id)) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$overridableroles = get_overridable_roles($context);
$assignableroles = get_assignable_roles($context);
$currenttab = 'update';
include_once($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php');
- }
+ }*/
$icon = '
';
print_heading_with_help($pageheading, "mods", $module->name, $icon);
$mform->display();
- //print_footer($course);
+ //We don't want to display Moodle navigation bottom menu in Lams
+ //print_footer($course);
}
?>
Index: temp_moodle_dev/moodle/lib/weblib.php
===================================================================
RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/lib/weblib.php,v
diff -u -r1.1 -r1.2
--- temp_moodle_dev/moodle/lib/weblib.php 14 Nov 2008 05:57:17 -0000 1.1
+++ temp_moodle_dev/moodle/lib/weblib.php 14 Nov 2008 06:16:59 -0000 1.2
@@ -2835,32 +2835,38 @@
* @param string $bodytags This text will be included verbatim in the tag (useful for onload() etc)
* @param bool $return If true, return the visible elements of the header instead of echoing them.
*/
+//we pass a new parameter (is_lams) so it will be useful for lams navigation
function print_header_simple($title='', $heading='', $navigation='', $focus='', $meta='',
- $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false) {
+ $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false,$is_lams=null) {
global $COURSE, $CFG;
-
- // if we have no navigation specified, build it
- if( empty($navigation) ){
- $navigation = build_navigation('');
- }
-
- // If old style nav prepend course short name otherwise leave $navigation object alone
- if (!is_newnav($navigation)) {
- if ($COURSE->id != SITEID) {
- $shortname = ''. $COURSE->shortname .' ->';
- $navigation = $shortname.' '.$navigation;
- }
- }
-
- $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $navigation, $focus, $meta,
- $cache, $button, $menu, $usexml, $bodytags, true);
-
- if ($return) {
- return $output;
- } else {
- echo $output;
- }
+ //If is lams don't print top navigation menu (just let the header be blank)
+ if($is_lams==1){
+ print_header();
+ }else{ // print the header normally
+ // if we have no navigation specified, build it
+ if( empty($navigation) ){
+ $navigation = build_navigation('');
+ }
+
+ // If old style nav prepend course short name otherwise leave $navigation object alone
+ if (!is_newnav($navigation)) {
+ if ($COURSE->id != SITEID) {
+ $shortname = ''. $COURSE->shortname .' ->';
+ $navigation = $shortname.' '.$navigation;
+ }
+ }
+
+ $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $navigation, $focus, $meta,
+ $cache, $button, $menu, $usexml, $bodytags, true);
+
+
+ if ($return) {
+ return $output;
+ } else {
+ echo $output;
+ }
+ }
}
@@ -2876,110 +2882,113 @@
* @param boolean $return output as string
* @return mixed string or void
*/
-function print_footer($course=NULL, $usercourse=NULL, $return=false) {
- global $USER, $CFG, $THEME, $COURSE;
-
- if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) {
- admin_externalpage_print_footer();
- return;
- }
-
-/// Course links or special footer
- if ($course) {
- if ($course === 'empty') {
- // special hack - sometimes we do not want even the docs link in footer
- $output = '';
- if (!empty($THEME->open_header_containers)) {
- for ($i=0; $i<$THEME->open_header_containers; $i++) {
- $output .= print_container_end_all(); // containers opened from header
- }
- } else {
- //1.8 theme compatibility
- $output .= "\n"; // content div
- }
- $output .= "\n\n\n