+++ /dev/null
-<?php\r
-/************************************************************************/\r
-/* ATutor */\r
-/************************************************************************/\r
-/* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/\r
-/* Adaptive Technology Resource Centre / University of Toronto */\r
-/* http://atutor.ca */\r
-/* */\r
-/* This program is free software. You can redistribute it and/or */\r
-/* modify it under the terms of the GNU General Public License */\r
-/* as published by the Free Software Foundation. */\r
-/************************************************************************/\r
-// $Id: verify_list.php 7208 2008-01-09 16:07:24Z greg $\r
-\r
-$page = 'gradebook';\r
-\r
-define('AT_INCLUDE_PATH', '../../include/');\r
-require (AT_INCLUDE_PATH.'vitals.inc.php');\r
-authenticate(AT_PRIV_ENROLLMENT);\r
-require('lib/gradebook.inc.php');\r
-\r
-/************ GETTING INFO FROM CREATE/IMPORT CALLS **********/\r
-if (isset($_POST['cancel'])) \r
-{\r
- $msg->addFeedback('CANCELLED');\r
- header('Location: import_export_external_marks.php');\r
- exit;\r
-} \r
-else if (isset($_POST['import']))\r
-{\r
- //IMPORT\r
- if ($_FILES['file']['size'] < 1) \r
- {\r
- $msg->addError('FILE_EMPTY');\r
- header('Location: import_course_list.php');\r
- exit;\r
- } \r
- else \r
- {\r
- $fp = fopen($_FILES['file']['tmp_name'],'r');\r
- $line_number=0;\r
- while ($data = fgetcsv($fp, 100000, ',')) {\r
- $line_number++;\r
- if ($line_number > 1)\r
- {\r
- $num_fields = count($data);\r
- if ($num_fields == 4)\r
- {\r
- $students[] = check_user_info(array('fname' => $data[0], 'lname' => $data[1], 'email' => $data[2], 'grade' => $data[3], 'gradebook_test_id' => $_POST['gradebook_test_id']));\r
- } \r
- else if ($num_fields != 1) \r
- {\r
- $errors = array('INCORRECT_FILE_FORMAT', $line_number);\r
- $msg->addError($errors);\r
- header('Location: import_course_list.php');\r
- exit;\r
- } \r
- else if (($num_fields == 1) && (trim($data[0]) != '')) \r
- {\r
- $errors = array('INCORRECT_FILE_FORMAT', $line_number);\r
- $msg->addError($errors);\r
- header('Location: import_course_list.php');\r
- exit;\r
- }\r
- }\r
- }\r
- }\r
-}\r
-/************* INFO GATHERED **************/\r
-\r
-if ($_POST['verify']) {\r
- for ($i=0; $i < $_POST['count']; $i++) \r
- {\r
- $info = array('fname' => $_POST['fname'.$i], 'lname' => $_POST['lname'.$i], 'email' => $_POST['email'.$i], 'grade' => $_POST['grade'.$i], 'remove' => $_POST['remove'.$i], 'gradebook_test_id' => $_POST["gradebook_test_id"], 'solve_conflict' => $_POST["solve_conflict"]);\r
- $students[] = check_user_info($info);\r
-\r
- if (!empty($students[$i]['error']))\r
- $still_errors = TRUE;\r
- }\r
-\r
- /**************************************************************************/\r
- // !!!!!!STEP 3 - INSERT INTO DB !!!!!!!\r
- if (!$still_errors && isset($_POST['update'])) \r
- {\r
- update_gradebook_external_test($students, $_POST["gradebook_test_id"]);\r
- header('Location: import_export_external_marks.php'); \r
- exit;\r
- }\r
-}\r
-\r
-require(AT_INCLUDE_PATH.'header.inc.php');\r
-// STEP 2 - INTERNAL VERIFICATION\r
-if ($still_errors || !isset($_POST['verify']) || isset($_POST['resubmit'])) { \r
-?>\r
-\r
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">\r
- <div class="input-form">\r
- <div class="row">\r
- <p><?php echo _AT('grade_info'); ?></p>\r
- </div>\r
- </div>\r
-\r
- <input type="hidden" name="verify" value="1" />\r
- <input type="hidden" name="gradebook_test_id" value="<?php echo $_POST["gradebook_test_id"]; ?>" />\r
- <input type="hidden" name="solve_conflict" value="<?php echo $_POST["solve_conflict"]; ?>" />\r
- <input type="hidden" name="count" value="<?php echo count($students); ?>" />\r
- \r
- <table class="data static" summary="" rules="cols">\r
- <thead>\r
- <tr>\r
- <th scope="col"><?php echo _AT('status'); ?></th>\r
- <th scope="col"><?php echo _AT('first_name'); ?></th>\r
- <th scope="col"><?php echo _AT('last_name'); ?></th>\r
- <th scope="col"><?php echo _AT('email'); ?></th>\r
- <th scope="col"><?php echo _AT('grade'); ?></th>\r
- <th scope="col"><?php echo _AT('remove'); ?></th>\r
- </tr>\r
- </thead>\r
-<?php\r
-\r
- $err_count = 0;\r
- $i=0;\r
-\r
- if (is_array($students)) {\r
- echo ' <tbody>'."\n\r";\r
- foreach ($students as $student) {\r
-\r
- if (!empty($student['conflict']))\r
- $has_conflict = TRUE;\r
- \r
- echo ' <tr>'."\n\r";\r
- echo ' <td>'."\n\r";\r
-\r
- //give status\r
- if(!empty($student['error'])) {\r
- echo '<span style="color: red;">'.$student['error'];\r
- }\r
-\r
- if (empty($student['error'])) \r
- {\r
- if ($student['remove'])\r
- echo '<span style="color: purple;">'._AT('removed');\r
- else \r
- echo '<span style="color: green;">'._AT('ok'); \r
- } \r
- else \r
- $err_count++;\r
-\r
- echo '</span></td>'."\n\r";\r
-\r
- echo ' <td><input type="text" name="fname'.$i.'" value="'.$student['fname'].'" /></td>'."\n\r";\r
- echo ' <td><input type="text" name="lname'.$i.'" value="'.$student['lname'].'" /></td>'."\n\r";\r
- echo ' <td><input type="text" name="email'.$i.'" value="'.$student['email'].'" /></td>'."\n\r";\r
- echo ' <td><input type="text" name="grade'.$i.'" value="'.$student['grade'].'" /></td>'."\n\r";\r
- echo ' <td><input type="checkbox" '; \r
- echo ($student['remove'] ? 'checked="checked" value="on"' : ''); \r
- echo 'name="remove'.$i.'" /></td>'."\n\r";\r
-\r
- $i++;\r
- echo ' </tr>'."\n\r";\r
- }\r
- echo ' </tbody>'."\n\r";\r
- }\r
-\r
- $dsbld = '';\r
- if ($still_errors || $err_count>0) {\r
- $dsbld = 'disabled="disabled"';\r
- } \r
-?>\r
-\r
- <tfoot>\r
- <tr>\r
- <td colspan="6">\r
- <input type="submit" name="resubmit" value="<?php echo _AT('resubmit'); ?>" />\r
- <input type="submit" name="update" value="<?php echo _AT('update'); ?>" <?php echo $dsbld; ?> />\r
-<?php\r
-if ($has_conflict)\r
-{\r
-?>\r
- <span style="padding:0px 10px">|</span> \r
- \r
- <select name="solve_conflict">\r
- <option value="0"><?php echo _AT('how_to_solve_conflict'); ?></option>\r
- <option value="<?php echo USE_HIGHER_GRADE; ?>"><?php echo _AT('use_higher_grade'); ?></option>\r
- <option value="<?php echo USE_LOWER_GRADE; ?>"><?php echo _AT('use_lower_grade'); ?></option> \r
- <option value="<?php echo NOT_OVERWRITE; ?>"><?php echo _AT('not_overwrite'); ?></option>\r
- <option value="<?php echo OVERWRITE; ?>"><?php echo _AT('overwrite'); ?></option> \r
- </select>\r
-<?php\r
-}\r
-?>\r
- </td>\r
- </tr>\r
- </tfoot>\r
-\r
- </table>\r
- </form><?php\r
-}\r
-\r
-require(AT_INCLUDE_PATH.'footer.inc.php');\r
-?>
\ No newline at end of file