From: Chris S. <san...@us...> - 2005-08-16 15:51:53
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18518 Modified Files: Tag: development_xmlrqp index.php quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.25.2.2 retrieving revision 1.25.2.3 diff -C2 -d -r1.25.2.2 -r1.25.2.3 *** quiz.php 16 Aug 2005 14:00:59 -0000 1.25.2.2 --- quiz.php 16 Aug 2005 15:51:35 -0000 1.25.2.3 *************** *** 54,58 **** // Now datetime $tnow = time(); ! $dtnow = date("F j, Y, g:i a"); //////////////////////////////////////////////// --- 54,58 ---- // Now datetime $tnow = time(); ! $dtnow = stack_time_display($tnow); //////////////////////////////////////////////// *************** *** 132,135 **** --- 132,136 ---- // (4.4) At this point we should have a $quiz and $quizInst to work on. + // Find out if we have quiz options. $quiz_options = array(); *************** *** 137,142 **** $quiz_options = $quiz['quizOptions']; } - $quizmode = $quiz_options['QuizMode']; // (4.5) Reconstruct $quizInst from previous data --- 138,154 ---- $quiz_options = $quiz['quizOptions']; } + $quizmode = $quiz_options['QuizMode']; + + $duedate = ''; + $duedate_display = ''; + $duedate_passed = FALSE; + if (array_key_exists('quizDueDate',$quiz)){ + $duedate = $quiz['quizDueDate']; + $duedate_display = stack_time_display($duedate); + if ($tnow>$duedate) { + $duedate_passed = TRUE; + } + } // (4.5) Reconstruct $quizInst from previous data *************** *** 488,503 **** stack_page_header($title,''); - echo "\n<a name='top'></a>\n"; - echo "<h2>".$quiz['quizName']."</h2>"; - - echo get_string('stackOptions_QuizMode','stack','').': '.$quizmode; - - echo "<font size='-2'>(".get_string('quiz_page_created','stack',$dtnow).")</font>"; - - // echo get_string('quiz_due_date','stack',''); - // Add javascript for quiz forms require_once("{$stack_root}/html/quizjava.html"); if ('quiz_error' == $action) { --- 500,524 ---- stack_page_header($title,''); // Add javascript for quiz forms require_once("{$stack_root}/html/quizjava.html"); + + // (3.1) Print a summary of the context of this quiz. + echo "\n<a name='top'></a>\n"; + echo '<table>'; + echo '<tr><td><b>'.get_string('stackQuiz_quizName','stack','').'</b></td><td>'.$quiz['quizName'].'</td></tr>'; + echo '<tr><td><b>'.get_string('stackOptions_QuizMode','stack','').'</b></td><td>'.$quizmode.'</td></tr>'; + echo '<tr><td><b>'.get_string('quiz_page_created','stack','').'</b></td><td>'.$dtnow.'</td></tr>'; + if ( '' != $duedate_display) { + echo '<tr><td><b>'.get_string('quiz_duedate','stack','').'</b></td><td>'. $duedate_display.'</td></tr>'; + } + //echo '<tr><td><b></b></td><td></td></tr>'; + echo '</table>'; + + // (3.2) Has the due date passed? + if ($duedate_passed) { + echo "<p><font color='red'>".get_string('quiz_duedate_passed','stack','')."</font></p>"; + } + if ('quiz_error' == $action) { *************** *** 597,630 **** } ! if ('solutions' != $action) { $RA = $this_attempt['RawAns']; ! echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); } // Do we show solutions? ! if ('Always' == $options['ShowSol']) { ! stack_question_inst_show_sol($qInst,$errors); ! } else if ('Never' != $options['ShowSol'] and 'solutions' == $action) { stack_question_inst_show_sol($qInst,$errors); ! } else if ('After correct answer' == $options['ShowSol']) { ! ! $show_sol = FALSE; ! if (array_key_exists('questionAttempts',$qInst)) { ! if (is_array($qInst['questionAttempts'])) { ! foreach($qInst['questionAttempts'] as $atn=>$anattempt) { ! if (1 == $anattempt['RawMark'] and 'mark' == $anattempt['Action'] ) { ! $show_sol = TRUE; ! } ! } ! } ! } ! ! if ($show_sol) { ! stack_question_inst_show_sol($qInst,$errors); ! } ! ! } ! ! } // End of feedback & errors } // End of print if focused. --- 618,631 ---- } ! if ('solutions' != $action and TRUE != $duedate_passed) { $RA = $this_attempt['RawAns']; ! echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); } // Do we show solutions? ! if ('solutions' == $action or $duedate_passed) { stack_question_inst_show_sol($qInst,$errors); ! } ! } // End of feedback & errors } // End of print if focused. *************** *** 682,688 **** echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr> ! <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizid);\">".get_string('NewVersion','stack','')."</a></td> ! <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> <td>".get_string('ClickHereTryQuiz','stack','')."</td></tr>\n --- 683,693 ---- echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr>"; ! ! if ('Practice' == $quizmode) { ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizid);\">".get_string('NewVersion','stack','')."</a></td> ! <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; ! } ! echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> <td>".get_string('ClickHereTryQuiz','stack','')."</td></tr>\n Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -C2 -d -r1.23.2.1 -r1.23.2.2 *** index.php 3 Aug 2005 17:02:21 -0000 1.23.2.1 --- index.php 16 Aug 2005 15:51:35 -0000 1.23.2.2 *************** *** 1,239 **** <?php - /** - * - * Welcome to STACK. A system for teaching and assessment using a - * computer algebra kernel. - * <br> - * This file is licensed under the GPL License. - * <br> - * A copy of the license is in your STACK distribution called - * license.txt. If you are missing this file you can obtain - * it from: - * http://www.stack.bham.ac.uk/license.txt - * <br> - * Copyright (c) 2005, Christopher James Sangwin - * - * @author Chris Sangwin C.J...@bh... - * @author Laura Naismith L.N...@bh... - * @author Juliette White jv...@jv... - * - * This file contains the front end logic for the main frontend pages - * TO DO: Some of the code in this file needs to be factored out into separate - * algorithms- ideally we should have a function for each action on entry and - * for display. - * @package Stack - */ - - - /** - * - */ - session_start(); - - /////////////////////////////////////////////////////////////// - // (1) Process Input - this sets $action, $user and $username - /////////////////////////////////////////////////////////////// - - if (file_exists('stackstd.php')) { - include('stackstd.php'); - } else { - //echo "STACK is not correctly installed."; //View the installation instructions include('lang/en/doc/about_install.php'); - die(); - } - - $default_action = 'loginscreen'; - include_once($stack_root.'/frontend_general/front_end_display.php'); - include($stack_root.'/frontend_general/process_input.php'); - - - /////////////////////////////////////////////////////////////// - // (2) Take any actions required - /////////////////////////////////////////////////////////////// - - // Note that we need to unset the user before printing the header. - if ('logout' == $action) { - $user = NULL; - session_unregister('user'); - unset($_SESSION['user']); - $_GET['expand'] = 0; - } - - include('frontend_general/loginregister.php'); - $err = nsf($errors,'user'); - $errun = stack_get_errun($err); - $errps = stack_get_errps($err); - - ////////////////////////////////////////////////////////////// - // (2) Print the page. - ////////////////////////////////////////////////////////////// - - include('html/pagehead.php'); - - if ('logout' == $action) { - echo '<h1>Thank you</h1><p>Thank you for using STACK.'; - $action = 'loginscreen'; - } - - if ('welcome' == $action) { - echo "<h1>Welcome</h1> <p>Welcome to STACK, {$user['firstname']} {$user['lastname']}.</p>"; - if ('admin' != $user['username']) { - $action = 'choose_quiz'; - } - } - - if ('loginerr' == $action) { - echo "<h1>Problems with your login.</h1> <p>You could not be logged into STACK as <tt>{$user['username']}</tt> for the following reason.</p>"; - echo $errors['user']; - $action = 'loginscreen'; - } - - switch ($action) { - case 'loginscreen': - stack_display_main_login($username, $errun, $errps); - break; - case 'registration_screen': - include_once($stack_root."/scripts/stackUser.php"); - stack_display_main_register($username, $user, $errors, $err); - break; - case 'update_info': - if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { - stack_user_update_info($user, $errors); - } else { - echo '<h1>Update user information</h1>'; - echo '<p>Please logout and login as a personal user first to update your information.</p>'; - } - break; - case 'error': - echo "There was an error with the login or registration"; - break; - case 'choose_quiz': - $quiz_store = stack_db_quiz_get(); - stack_quiz_student_select($quiz_store, $user); - break; - } - - include('html/pagefoot.php'); - - ?> - - --- 1,121 ---- |