UserPreferences

Index.php


<?php 
/*
  here's the  Copyright 2001, 2002 Douglas S. Blank

    This program is part of the Edventure Course Management System.

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA
*/

include_once "ed_lib.php";
//
//the ed_lib.php is the mother of all the functions in edventure
// $edventure_state is name of function and title
//
// there is a mixture of logging in and testing/assessment material here
//
// go, and other shortcuts go here
if ($go == 'login') {
  $edventure_state = 'login'; // complete below
} else if (! empty($go)) {
  $go_plain = urldecode($go);
  $go_plain = ereg_replace('__', ' ', $go_plain);
  $go = ereg_replace(' ', '__', $go);
  $edventure_state = 'desktop'; // something to make it open up course page/folders
  $click = "My__Courses_" . $go . "_Homepage";
  ed_header($go_plain);
  exit();
} else if (! empty($mailto) and ! empty($edventure_id)) {
  $edventure_state = 'desktop'; // something to make it open up course page/folders
  $click = "My+Stuff_Send+Email";
  // need to send subject, cc, bcc, here too
  ed_header($click, "to=$mailto");
  exit();
}

if ($click == 'take_assessment') {
  // FIX: check passowrd, if needed
  ed_plain_header();
  $dbi = new dbi();
  $dbi->query("SELECT * from exam WHERE manager_id = $mid and eid = $eid;");
  display_exam($mid, $eid, 'take_exam',   $dbi->value('ename'), "examine");
  // eid, state, title, mode
  // eid=exam id?
} else if ($click == 'Finish') {
  // OR, SEND BACK FOR COMPLETION?
  $click = '';
  $edventure_state = 'main_menu';
  ed_header_right($edventure_state);
  // Record for all cases:
  record_exam_answers($edventure_id, $f_manager_id, $f_exam_id);
  $dbi = new dbi();
  $dbi->query("SELECT * from exam where manager_id = $f_manager_id AND eid = $f_exam_id;");
  // debrief:
  print $dbi->value('debrief') . "<p>";
  // FIX: email, instant, summary, or none
  // print "Feedback: " . $dbi->value('feedback') . "<p>";
  if ($dbi->value('feedback') == 'instant') {
    $total_score = grade_exam($f_manager_id, $f_exam_id, $edventure_id, 1);
    print "Score = $total_score<p>";
  } else if ($dbi->value('feedback') == 'summary') {
    $total_score = grade_exam($f_manager_id, $f_exam_id, $edventure_id);
    print "Score = $total_score<p>";
  } else if ($dbi->value('feedback') == 'email') {
    $total_score = grade_exam($f_manager_id, $f_exam_id, $edventure_id);
    print "Emailing results...<p>";
  } else if ($dbi->value('feedback') == 'none') {
    $total_score = grade_exam($f_manager_id, $f_exam_id, $edventure_id);
    if ($dbi->value('type') == 'exam') {
      print "Results will be given back in class.<p>";
    } else if ($dbi->value('type') == 'survey') {
      print "Survey received! <p>";
    }
  }
  // store it in the gradebook
  $gradebook = $dbi->value('gradebook');
  $course_id = $dbi->value('course_id');
  if (! empty($gradebook)) {
    $dbi->query("INSERT into gradebook (course_id, gname, id, grade) VALUES ('$course_id', '$gradebook', '$edventure_id', $total_score);");
  }
  print "Click <a href=index.php>HERE</a> to continue.";
  ed_footer();
} else if ($edventure_state == 'validate_login') {
  validate_login(); // this will handle headers
} else if ($edventure_state == 'Edventure_Log__out' or $edventure__state == 'logout') {
  $edventure_state = 'main_menu';
  ed_header(ucwords(ereg_replace('_', ' ', $edventure_state)));
   // what does ucwords mean? uncommon?
  logout();
  main_menu();
  ed_footer();
} else if (function_exists($edventure_state)) {
  ed_header(ucwords(ereg_replace('_', ' ', $edventure_state)));
  $edventure_state();
  ed_footer();
} else { // this could be state = '', an error, or a hack
  $edventure_state = 'main_menu';
  ed_header(ucwords(ereg_replace('_', ' ', $edventure_state)));
// this is where the parser complains
//Fatal error: Call to undefined function: ed_header() in /var/www/html/edventure/index.php
//
  main_menu();
  ed_footer();
}
?>