2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2008 */
\r
6 /* Written by Greg Gay & Joel Kronenberg & Chris Ridpath */
\r
7 /* Adaptive Technology Resource Centre / University of Toronto */
\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_ASSIGNMENTS);
\r
19 if (isset($_GET['edit'])) {
\r
20 $_GET['assignment'] = intval($_GET['assignment']);
\r
21 header('Location: edit_assignment.php?id='. $_GET['assignment']);
\r
23 } else if (isset($_GET['delete'])) {
\r
24 $_GET['assignment'] = intval($_GET['assignment']);
\r
25 header('Location: delete_assignment.php?id='. $_GET['assignment']);
\r
27 } else if (isset($_GET['submissions'])){
\r
28 $_GET['assignment'] = intval($_GET['assignment']);
\r
29 header('Location: '.url_rewrite('file_storage/index.php?ot='.WORKSPACE_ASSIGNMENT.SEP.'oid='.$_GET['assignment'], AT_PRETTY_URL_IS_HEADER));
\r
33 require(AT_INCLUDE_PATH.'header.inc.php');
\r
35 // sort order of table
\r
36 $orders = array('ASC' => 'DESC', 'DESC' => 'ASC');
\r
37 $cols = array('title' => 1, 'date_due' => 1);
\r
40 if (isset($_GET['sort'])){
\r
41 $sort = isset($cols[$_GET['sort']]) ? $_GET['sort'] : 'title';
\r
43 if (isset($_GET['order'])){
\r
44 $order = $addslashes($_GET['order']);
\r
45 if (($order != 'ASC') && ($order != 'DESC')){
\r
49 $sql = "SELECT * FROM ".TABLE_PREFIX."assignments WHERE course_id=$_SESSION[course_id] ORDER BY $sort $order";
\r
50 $result = mysql_query($sql, $db);
\r
53 <?php $msg->printInfos('ASSIGNMENT_FS_SUBMISSIONS'); ?>
\r
55 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
\r
56 <table class="data" style="width: 90%;" rules="cols">
\r
58 <?php if ($sort == 'title'): ?>
\r
60 <col class="sort" />
\r
62 <?php elseif($sort == 'assign_to'): ?>
\r
64 <col class="sort" />
\r
66 <?php elseif($sort == 'date_due'): ?>
\r
68 <col class="sort" />
\r
75 <th scope="col"><a href="assignments/index_instructor.php?sort=title<?php echo SEP; ?>order=<?php echo $orders[$order]; ?>"><?php echo _AT('title'); ?></a></th>
\r
76 <th scope="col"><?php echo _AT('assigned_to'); ?></th>
\r
77 <th scope="col"><a href="assignments/index_instructor.php?sort=date_due<?php echo SEP; ?>order=<?php echo $orders[$order]; ?>"><?php echo _AT('due_date'); ?></a></th>
\r
80 <?php if (($result != 0) && ($row = mysql_fetch_assoc($result))) : ?>
\r
84 <input type="submit" name="submissions" value="<?php echo _AT('submissions'); ?>" />
\r
85 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
\r
86 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
\r
93 <tr onmousedown="document.form['a<?php echo $row['assignment_id']; ?>'].checked = true; rowselect(this);" id="a_<?php echo $row['assignment_id']; ?>_0">
\r
95 <td><input type="radio" id="a<?php echo $row['assignment_id']; ?>" name="assignment" value="<?php echo $row['assignment_id']; ?>"
\r
97 <?php // set first item as checked if nothing selected
\r
98 if (isset($_GET['assignment_id'])){
\r
99 if ($_GET['assignment_id'] == $row['assignment_id']){
\r
100 echo ' checked="checked"';
\r
104 echo ' checked="checked"';
\r
105 $_GET['assignment_id'] = $row['assignment_id'];
\r
109 <td><label for="a<?php echo $row['assignment_id']; ?>"><?php echo $row['title']; ?></label></td>
\r
111 <td><?php if($row['assign_to'] == '0'){echo _AT('all_students'); } else {
\r
112 $sql = "SELECT title FROM ".TABLE_PREFIX."groups_types WHERE type_id=$row[assign_to] AND course_id=$_SESSION[course_id]";
\r
113 $type_result = mysql_query($sql, $db);
\r
114 $type_row = mysql_fetch_assoc($type_result);
\r
115 echo $type_row['title']; } ?></td>
\r
117 <td><?php if ($row['date_due'] == '0000-00-00 00:00:00'){
\r
120 echo AT_Date(_AT('forum_date_format'), $row['date_due'], AT_DATE_MYSQL_DATETIME);
\r
123 <?php } while($row = mysql_fetch_assoc($result)); ?>
\r
127 <td colspan="4"><em><?php echo _AT('none_found'); ?></em></td>
\r
134 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>