2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2008 */
\r
6 /* Written by Greg Gay & Joel Kronenberg & Chris Ridpath */
\r
7 /* Inclusive Design Institute */
\r
8 /* http://atutor.ca */
\r
10 /* This program is free software. You can redistribute it and/or*/
\r
11 /* modify it under the terms of the GNU General Public License */
\r
12 /* as published by the Free Software Foundation. */
\r
13 /****************************************************************/
\r
15 define('AT_INCLUDE_PATH', '../../../include/');
\r
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 authenticate(AT_PRIV_READING_LIST);
\r
19 if (isset($_POST['submit_no'])) {
\r
20 $msg->addFeedback('CANCELLED');
\r
21 Header('Location: index_instructor.php');
\r
23 } else if (isset($_POST['submit_yes'])) {
\r
24 $_POST['id'] = intval($_POST['id']);
\r
25 $reading_id = $_POST['id'];
\r
27 // delete the reading from the list
\r
28 $sql = "DELETE FROM ".TABLE_PREFIX."reading_list WHERE course_id=$_SESSION[course_id] AND reading_id=$reading_id";
\r
29 $result = mysql_query($sql, $db);
\r
31 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
32 header('Location: index_instructor.php');
\r
36 require(AT_INCLUDE_PATH.'header.inc.php');
\r
38 $_GET['id'] = intval($_GET['id']);
\r
39 $reading_id = $_GET['id'];
\r
41 // get the resource ID for this reading
\r
42 $sql = "SELECT resource_id FROM ".TABLE_PREFIX."reading_list WHERE course_id=$_SESSION[course_id] AND reading_id=$reading_id";
\r
43 $result = mysql_query($sql, $db);
\r
45 if ($row = mysql_fetch_assoc($result)){
\r
46 // get the external resource using the resource ID from the reading
\r
47 $resource_id = $row['resource_id'];
\r
48 $sql = "SELECT title, date FROM ".TABLE_PREFIX."external_resources WHERE course_id=$_SESSION[course_id] AND resource_id=$resource_id";
\r
49 $resource_result = mysql_query($sql, $db);
\r
50 if ($resource_row = mysql_fetch_assoc($resource_result)){
\r
51 $hidden_vars['id'] = $reading_id;
\r
52 $confirm = array('RL_DELETE_READING', AT_print($resource_row['title'], 'reading_list.title'));
\r
53 $msg->addConfirm($confirm, $hidden_vars);
\r
54 $msg->printConfirm();
\r
57 $msg->printErrors('ITEM_NOT_FOUND');
\r
60 require(AT_INCLUDE_PATH.'footer.inc.php');
\r