Assignments that are posted in the system but not open are now viewable.
authorSteven Schronk <[email protected]>
Fri, 25 May 2012 18:22:28 +0000 (25 13:22 -0500)
committerbob <bob@dev.(none)>
Thu, 31 May 2012 02:48:16 +0000 (30 21:48 -0500)
This allows faculty to pre-load assignments ahead of time for convenience.

Late assignments are now tracked in the system.

14 files changed:
assignment.php
classes.php
code_db.sql
comment.php
detail_lib.php
detail_root.php
gfx/bullet_black.png [new file with mode: 0644]
gfx/world_link.png [new file with mode: 0644]
index.php
legend.php
manage.php
style.css
upload.php
user_details.php

index 18c1031..705d2c3 100644 (file)
@@ -50,8 +50,15 @@ while($row = mysql_fetch_row($result))
        $html .= '<tr><td>'.$row[7].'</td>';
        //$html .= '<tr><td>'.$row[10].'</td>';
 
-       // assignment open?
-       if($row[8] > 0 || $row[10] < 0) { $html .= "<td><img src=gfx/bullet_delete.png>"; } else { $html .= "<td><img src=gfx/bullet_add.png>"; }
+       // assignment started?
+       if($row[10] < 0){
+               $html .= "<td><img src=gfx/bullet_black.png>"; 
+               $started = false;
+       } else {
+               // assignment open?
+               if($row[8] > 0 || $row[10] < 0) { $html .= "<td><img src=gfx/bullet_delete.png>"; } else { $html .= "<td><img src=gfx/bullet_add.png>"; }
+               $started = true;
+       }
 
        // assignment graded?
        if($row[12]) { $html .= "<img src=gfx/bullet_disk.png>"; } else { $html .= "<img src=gfx/bullet_wrench.png>"; }
@@ -62,9 +69,13 @@ while($row = mysql_fetch_row($result))
                        $html .= '<img src=gfx/flag_red.png>';
                } else { $html .= '<img src=gfx/flag_white.png>'; }
 
-               if(file_count($user_id, $row[7])) {
-                       $html .= '<img src=gfx/star.png></td>';
-               } else { $html .= '<img src=gfx/error.png></td>'; }
+               if(assignment_late($user_id, $row[7])) {
+                       $html .= '<img src=gfx/tick_off.png></td>';
+               } else {
+                       if(file_count($user_id, $row[7])) {
+                               $html .= '<img src=gfx/star.png></td>';
+                       } else { $html .= '<img src=gfx/error.png></td>'; }
+               }
        }
 
        if($role == 0 ) {
@@ -75,7 +86,11 @@ while($row = mysql_fetch_row($result))
 
        $html .= '<td>'.$row[1].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td>';
 
-       $html .= '<td>'.absHumanTiming($row[11]).'</td>';
+       if($started) {
+               $html .= '<td>'.absHumanTiming($row[11]).'</td>';
+       } else {
+               $html .= '<td>'.absHumanTiming($row[5]).'</td>';
+       }
 
        if($role==0) { $html .= '<td><a href="assignment_add.php?sched='.$row[7].'&action=edit">Edit</a></td>'; }
 
index d5f0861..85834f2 100644 (file)
@@ -19,8 +19,13 @@ while($row = mysql_fetch_row($result))
        //$html .= '<td>'.$row[3].'</td><td>'.$row[4].'</td></tr>';
 
        $html .= '<div class="class_block">';
-       $html .= '<table><tr><td><img src=gfx/house.png></td><td><h3><a href=assignment.php?class='.$row[0].'>'.$row[1].'</a></h3></td></tr>';
-       $html .= '<tr><td>Section:</td><td>'.$row[2].'</td></tr>';
+       //$html .= '<table><tr><td><img src=gfx/house.png></td><td><h3><a href=assignment.php?class='.$row[0].'>'.$row[1].'</a></h3></td></tr>';
+
+       $html .= '<table>
+               <tr><td><img src="gfx/house.png"></td><td class="link_header"><a href=assignment.php?class='.$row[0].'>'.$row[1].'</a></td></tr></table><br>';
+
+
+       $html .= '<table><tr><td>Section:</td><td>'.$row[2].'</td></tr>';
        $html .= '<tr><td>Location:</td><td>'.$row[3].'</td></tr>';
        $html .= '<tr><td>Instructor:</td><td>'.$row[4].'</td></tr>';
        $html .= '</table></div>';
index af4f7ee..4b109ec 100644 (file)
@@ -35,10 +35,13 @@ CREATE TABLE sched_details (
        user_viewed int,                                # comments have been viewed by user
        fac_viewed int,                                 # comments have been viewed by faculty
        help_me int,                                    # students can ask for help on thier assignments
+       late int,                                       # students who turn in work late have assignment permanently marked
        timeposted timestamp NOT NULL,                  # time comment was posted
        PRIMARY KEY (detail_id)
 );
 
+# alter table sched_details add column late int;
+
 CREATE TABLE schedule (
        sched_id int NOT NULL AUTO_INCREMENT,
        class_id int NOT NULL,                          # class section number
index 03f24e6..50568d1 100644 (file)
@@ -20,6 +20,7 @@ if($_GET["comment"] == "") { die("Comment Must Not Be Empty"); }
 if($role == 0) { // faculty comment to student
        detail_viewed_update($_GET["user"], $_GET["sched"], 0, "std");
        detail_viewed_update($_GET["user"], $_GET["sched"], 1, "fac");
+       helpme_viewed_update($_GET["user"], $_GET["sched"], 0);
        $sql = 'insert into comments values("", '.$_GET["user"].', '.$_GET["sched"].','.$user_id.','.$role.', "'.$_GET["comment"].'", NOW())';
 } else { // student comment to faculty
        detail_viewed_update($_GET["user"], $_GET["sched"], 1, "std");
index 7621c41..3682af1 100644 (file)
@@ -21,7 +21,7 @@ function detail_init($user_id, $sched_id)
 
        if($row['count'] == 0) {
 
-               $sql = 'insert into sched_details values ("", '.$sched_id.', '.$user_id.', 1,1,0, NOW())';
+               $sql = 'insert into sched_details values ("", '.$sched_id.', '.$user_id.', 1,1,0, NOW(),0)';
 
                //echo $sql;
                $result = mysql_query($sql);
@@ -116,4 +116,15 @@ function detail_help_query($user_id, $sched_id, $val)
 
 }
 
+function detail_mark_late($user_id, $sched_id)
+{
+       detail_init($user_id, $sched_id);
+       $sql = 'update sched_details set late = 1 where sched_id = '.$sched_id.' and user_id = '.$user_id;
+
+       //echo $sql;
+
+       $result = mysql_query($sql);
+       if (!$result) { die("SQL ERROR: Viewed Update"); }      
+}
+
 ?>
index 1106d9a..7aa78bf 100644 (file)
@@ -10,21 +10,12 @@ if($role != 0) { $_GET["user"] = $user_id; }
 
 if (!$_GET["sched"]) { die("No Assignment Requested"); }
 
-$_GET["sched"] = mysql_real_escape_string($_GET["sched"]);
-
-/* determine if assignment is still open */
-
-$sql = 'select count(*) from schedule where ava_date < NOW() and due_date > NOW() and sched_id ='.$_GET["sched"];
-
-$result = mysql_query($sql);
-
-$row = mysql_fetch_row($result);
-
-if($row[0] == 1) { $submission = 'Open'; } else { $submission = 'Closed'; }
+if(isset($_GET["user"])) { $user_data_sent = true; }
 
+$_GET["sched"] = mysql_real_escape_string($_GET["sched"]);
+$_GET["user"] = mysql_real_escape_string($_GET["user"]);
 
 /* get help status for this assignment */
-
 if($role == 0) {
 
        if($_GET["user"]) { 
@@ -41,10 +32,6 @@ if($role == 0) {
                        $help_stat = 'Enable';
                        $help_icon = '<img src=gfx/flag_white.png>';
                }
-
-               if(file_count($_GET["user"], $_GET["sched"])) {
-                       $file_count .= '<img src=gfx/star.png></td>';
-                       } else { $file_count .= '<img src=gfx/error.png></td>'; }
        }
 } else {
        $sql = 'select help_me from sched_details where sched_id ='.$_GET["sched"].' and user_id = '.$user_id;
@@ -60,16 +47,32 @@ if($role == 0) {
                $help_stat = 'Enable';
                $help_icon = '<img src=gfx/flag_white.png>';
        }
+}
+
+/* get files / late status for this assignment */
+if($role == 0 && $_GET["user"]) {
+       if(assignment_late($_GET["user"], $_GET["sched"])) {
+               $file_count .= '<img src=gfx/tick_off.png></td>';
+       } else {
+               if(file_count($_GET["user"], $_GET["sched"])) {
+                       $file_count .= '<img src=gfx/star.png></td>';
+               } else { $file_count .= '<img src=gfx/error.png></td>'; }
+       }
 
-       if(file_count($user_id, $_GET["sched"])) {
-               $file_count .= '<img src=gfx/star.png></td>';
+} else {
+       if(assignment_late($user_id, $_GET["sched"])) {
+               $file_count .= '<img src=gfx/tick_off.png></td>';
+       } else {
+               if(file_count($user_id, $_GET["sched"])) {
+                       $file_count .= '<img src=gfx/star.png></td>';
                } else { $file_count .= '<img src=gfx/error.png></td>'; }
+       }
 }
 
 /* get assignment details */
 $html = "";
 
-$sql = "select chapter, section_id, title, class_id, schedule.assign_type, ava_date, due_date, sched_id, NOW()-due_date as status, type_name, graded from schedule, types where (schedule.assign_type = types.assign_type) and sched_id=".$_GET["sched"]." order by due_date desc, ava_date desc";
+$sql = "select chapter, section_id, title, class_id, schedule.assign_type, ava_date, due_date, sched_id, NOW()-due_date as status, type_name, graded, NOW()-ava_date as ava from schedule, types where (schedule.assign_type = types.assign_type) and sched_id=".$_GET["sched"]." order by due_date desc, ava_date desc";
 
 $result = mysql_query($sql);
 
@@ -81,8 +84,16 @@ while($row = mysql_fetch_row($result))
 {
        $html .= '<tr>';
 
-       // assignment open?
-       if($row[8] > 0) { $html .= "<td><img src=gfx/bullet_delete.png>"; } else { $html .= "<td><img src=gfx/bullet_add.png>"; }
+       // assignment started?
+       if($row[11] < 0){
+               $html .= "<td><img src=gfx/bullet_black.png>";
+               $started = false;
+       } else {
+               // assignment open?
+               if($row[8] > 0 || $row[10] < 0) { $html .= "<td><img src=gfx/bullet_delete.png>"; } else { $html .= "<td><img src=gfx/bullet_add.png>"; }
+               $started = true;
+       }
+
 
        // assignment graded?
        if($row[12]) { $html .= "<img src=gfx/bullet_disk.png>"; } else { $html .= "<img src=gfx/bullet_wrench.png>"; }
@@ -91,7 +102,14 @@ while($row = mysql_fetch_row($result))
        $html .= $file_count."</td>";
        $html .= '<td><a href="detail_root.php?sched='.$row[7].'">'.$row[2].'</a></td><td>'.$row[9].'</td><td>'.$row[0].'</td>';
        $html .= '<td>'.$row[1].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td>';
-       $html .= '<td>'.absHumanTiming($row[6]).'</td>';
+
+       if($started) {
+               $html .= '<td>'.absHumanTiming($row[6]).'</td>';
+       } else {
+               $html .= '<td>'.absHumanTiming($row[5]).'</td>';
+       }
+
+       //$html .= '<td>'.absHumanTiming($row[6]).'</td>';
        if($role != 0 ) { $html .= '<td><a href=help_me.php?sched='.$_GET["sched"].'>'.$help_stat.'</a></td>'; }
        $html .= '</tr>';
 }
@@ -166,7 +184,8 @@ if($_GET["user"] == '' ) {
 
                // get all comments for this particular file
                //$sql = "select filecom_id, file_id, line_no, user_id, txt, timeposted from filecom where file_id=".$row[0]." order by line_no, timeposted";
-               $sql = 'select line_no, filecom.user_id, name,  timeposted, txt, role from filecom, users where (users.user_id = filecom.user_id) and file_id='.$row[1].' order by line_no, timeposted';
+               $sql = 'select line_no, filecom.user_id, name,  timeposted, txt, role from filecom, users 
+                       where (users.user_id = filecom.user_id) and file_id='.$row[1].' order by line_no, timeposted';
 
                //echo $sql;
 
@@ -187,7 +206,7 @@ if($_GET["user"] == '' ) {
                if (!$result2) { die("SQL ERROR: File Details"); }
                while($row2 = mysql_fetch_array($result2)) // moving through contents of each specific file
                {
-                       //echo $sql;
+                       //echo sql;
 
                        //echo $row2['file_name'];
                        $code = $row2['file_1'];
@@ -242,8 +261,11 @@ if($_GET["user"] == '' ) {
                        }
 
                // header for file
+
+               if(file_late($row2['file_id'])) { $late_indicator  = '<div class="file_head_late">'; } else { $late_indicator  = '<div class="file_head">'; }
+
                $files .= '<div class="file">
-                       <div class="file_head"><img src="gfx/page_white_gear.png">
+                       '.$late_indicator.'<img src="gfx/page_white_gear.png">
                                <span class="fname"><a href=file_raw.php?file_id='.$row2['file_id'].'>'.$row2['file_name'].'</a></span>
                                <span class="fsize">'.$row2['file_size'].'B</span>
                                <span class="fdate">'.$row2['time_post'].'</span>
@@ -335,12 +357,15 @@ if(isset($_GET["user"])) {
 
 $sql = 'select count(*) from schedule where ava_date < NOW() and due_date > NOW() and sched_id ='.$_GET["sched"];
 
+//echo $sql;
+
 $result = mysql_query($sql);
 
 $row = mysql_fetch_row($result);
 
 if($row[0] == 1) { // assignment is open
-       if($role == 0 && $user_id_role == 0 && isset($_GET["user"])) {
+
+       if($role == 0 && $user_id_role == 0 && $user_data_sent) { // my role is root, student role is root and a user has been sent...
                $upload_form = '<div class="comment_box">Upload File:<form action="upload.php?sched='.$_GET["sched"].'" method="post" enctype="multipart/form-data">
                <input type="file" name="file" size="40"><br><br>
                <input name="user" type="hidden" value='.$_GET["user"].'>
@@ -355,8 +380,25 @@ if($row[0] == 1) { // assignment is open
        } else {
                $upload_form = '';
        }
-} else { // assignment is closed
-       $upload_form = '';
+
+} else { // assignment is closed - show as a red upload box
+       if($role == 0 && $user_id_role == 0 && $user_data_sent) {
+               $upload_form = '<div class="comment_box_closed"><div class="comment_box_closed_message">-20 POINTS</div>
+               Upload File:<form action="upload.php?sched='.$_GET["sched"].'" method="post" enctype="multipart/form-data">
+               <input type="file" name="file" size="40"><br><br>
+               <input name="user" type="hidden" value='.$_GET["user"].'>
+               <input name="action" type="hidden" value="ret">
+               <input type="submit" name="submit" value="Submit"/>
+               </form></div>';
+       } else if($role != 0) {
+               $upload_form = '<div class="comment_box_closed"><div class="comment_box_closed_message">-20 POINTS</div>
+                       Upload File:<form action="upload.php?sched='.$_GET["sched"].'" method="post" enctype="multipart/form-data">
+                       <input type="file" name="file" size="40"><br><br>
+                       <input type="submit" name="submit" value="Submit"/>
+                       </form></div>';
+       } else {
+               $upload_form = '';
+       }
 }
 
 /* generate next and back buttons */
@@ -372,7 +414,7 @@ if($role == 0) {
 
        //echo $sql;
 
-       if ($row['user_id']) { $back_button = '<a href=detail_root.php?sched='.$_GET["sched"].'&user='.$row['user_id'].'><img src="gfx/resultset_previous.png" style="border-style: none"></a>'; } else { $back_button = '<img src="gfx/resultset_previous_disabled.png" style="border-style: none">'; }
+       if ($row['name']) { $back_button = '<a href=detail_root.php?sched='.$_GET["sched"].'&user='.$row['user_id'].'><img src="gfx/resultset_previous.png" style="border-style: none"></a>'; } else { $back_button = '<img src="gfx/resultset_previous_disabled.png" style="border-style: none">'; }
 
        $sql = 'select enrollment.user_id, name  from schedule, enrollment, users where (schedule.class_id = enrollment.class_id) and (enrollment.user_id = users.user_id) and sched_id = '.$_GET["sched"].' and name > "'.$student_user_name.'" order by name, email, user_id limit 1';
 
@@ -382,7 +424,7 @@ if($role == 0) {
 
        //echo "<br>".$sql;
 
-       if ($row['user_id']) { $next_button = '<a href=detail_root.php?sched='.$_GET["sched"].'&user='.$row['user_id'].'><img src="gfx/resultset_next.png" style="border-style: none"></a>'; } else { $next_button = '<img src="gfx/resultset_next_disabled.png" style="border-style: none">'; }
+       if ($row['name']) { $next_button = '<a href=detail_root.php?sched='.$_GET["sched"].'&user='.$row['user_id'].'><img src="gfx/resultset_next.png" style="border-style: none"></a>'; } else { $next_button = '<img src="gfx/resultset_next_disabled.png" style="border-style: none">'; }
 
 }
 
diff --git a/gfx/bullet_black.png b/gfx/bullet_black.png
new file mode 100644 (file)
index 0000000..d448caa
Binary files /dev/null and b/gfx/bullet_black.png differ
diff --git a/gfx/world_link.png b/gfx/world_link.png
new file mode 100644 (file)
index 0000000..5c1384a
Binary files /dev/null and b/gfx/world_link.png differ
index 19495d5..3da528d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -11,7 +11,7 @@ if($role == 0) { // faculty sees list of students names and assignments
 
        //$sql = 'select sched_id, title, type_name,  chapter, section_id, ava_date, due_date, graded, NOW()-due_date as due, NOW()-ava_date as ava from schedule, types where (schedule.assign_type = types.assign_type) and sched_id = ANY (select sched_id from sched_details where fac_viewed = 0 or help_me != 0 and user_id = '.$user_id.' group by sched_id) order by due_date desc, ava_date desc, title desc, chapter desc, section_id desc';
 
-       $sql ='select sched_details.sched_id, schedule.title, schedule.chapter, schedule.section_id, sched_details.user_id, users.name, help_me, sched_details.timeposted from sched_details, schedule, users where (sched_details.sched_id = schedule.sched_id) and (sched_details.user_id = users.user_id) and (fac_viewed = 0 or help_me != 0) group by sched_id order by help_me desc, sched_details.timeposted limit 50';
+       $sql ='select sched_details.sched_id, schedule.title, schedule.chapter, schedule.section_id, sched_details.user_id, users.name, help_me, sched_details.timeposted, late from sched_details, schedule, users where (sched_details.sched_id = schedule.sched_id) and (sched_details.user_id = users.user_id) and (fac_viewed = 0 or help_me != 0) group by sched_id order by help_me desc, sched_details.timeposted limit 50';
 
        $html = '<table class="gridtable">
                        <tr>
@@ -22,7 +22,7 @@ if($role == 0) { // faculty sees list of students names and assignments
 } else { // students see list of assignments
        //$sql = 'select sched_id, title, type_name,  chapter, section_id, graded, timeposted from schedule, types where (schedule.assign_type = types.assign_type) and sched_id = ANY (select sched_id from sched_details where user_viewed = 0 and user_id = '.$user_id.' group by sched_id) order by due_date desc, ava_date desc, title desc, chapter desc, section_id desc';
 
-       $sql ='select sched_details.sched_id, schedule.title, schedule.chapter, schedule.section_id, sched_details.user_id, users.name, help_me, sched_details.timeposted from sched_details, schedule, users where (sched_details.sched_id = schedule.sched_id) and (sched_details.user_id = users.user_id) and (user_viewed = 0 and sched_details.user_id = '.$user_id.') group by sched_id order by help_me desc, sched_details.timeposted limit 50';
+       $sql ='select sched_details.sched_id, schedule.title, schedule.chapter, schedule.section_id, sched_details.user_id, users.name, help_me, sched_details.timeposted, late from sched_details, schedule, users where (sched_details.sched_id = schedule.sched_id) and (sched_details.user_id = users.user_id) and (user_viewed = 0 and sched_details.user_id = '.$user_id.') group by sched_id order by help_me desc, sched_details.timeposted limit 50';
 
        $html = '<table class="gridtable">
                        <tr>
@@ -53,9 +53,15 @@ while($row = mysql_fetch_array($result))
 
                $html .= $help_icon;
 
-               if(file_count($row[4], $row[0])) {
-                       $html .= '<img src=gfx/star.png></td>';
-                       } else { $html .= '<img src=gfx/error.png></td>'; }
+
+               if($row['late']) {
+                       $html .= '<img src=gfx/tick_off.png></td>';
+               } else {
+
+                       if(file_count($row[4], $row[0])) {
+                               $html .= '<img src=gfx/star.png></td>';
+                               } else { $html .= '<img src=gfx/error.png></td>'; }
+               }
 
 
                $html .= '<td>'.$row['name'].'</td>';
@@ -87,7 +93,6 @@ while($row = mysql_fetch_array($result))
                        $html .= '<img src=gfx/star.png></td>';
                        } else { $html .= '<img src=gfx/error.png></td>'; }
 
-
                $html .= '<td><a href="detail_root.php?sched='.$row['sched_id'].'">'.$row['title'].'</a></td><td>'.$row['type_name'].'</td><td>'.$row['chapter'].'</td>';
 
                $html .= '<td>'.$row['section_id'].'</td><td>'.$row['timeposted'].'</td>';
index 7e8dc00..fe92b5b 100644 (file)
@@ -4,11 +4,12 @@
                <td><img src="gfx/bullet_disk.png"></td><td>Graded</td>
                <td><img src="gfx/flag_red.png"></td><td>Help Me Enabled</td>
                <td><img src="gfx/star.png"></td><td>Files Posted</td>
+               <td><img src="gfx/error.png"></td><td>No Files Posted</td>
        </tr>
        <tr>
                <td><img src="gfx/bullet_delete.png"></td><td>Closed for Submission</td>
                <td><img src="gfx/bullet_wrench.png"></td><td>Ungraded</td>
                <td><img src="gfx/flag_white.png"></td><td>Help Me Disabled</td>
-               <td><img src="gfx/error.png"></td><td>No Files Posted</td>
+               <td><img src=gfx/tick_off.png></td><td>Files Late</td>
        </tr>
 </table>
index cbc7352..ba58309 100644 (file)
@@ -97,14 +97,48 @@ $std_locked = $row[0];
 
 } else {               // STUDENT MENU
 
-?>
-                       <h3>Feeds:</h3>
 
-                       <img src="gfx/rss.png"><a href="comment_feed.php">Full Comments</a><br>
-                       <img src="gfx/rss.png"><a href="assignment_feed.php">Assignments Modified</a>
+$sql = 'select count(*), max(time_post) from files where user_id = '.$user_id;
+
+$result = mysql_query($sql);
+$row = mysql_fetch_row($result);
+$file_count = $row[0];
+$file_max = $row[1];
+
+$sql ='select count(*), max(timeposted) from comments where user_id = '.$user_id;
 
-                       <h3>Links:</h3>
-                       <a href="password_change.php">Change Password</a><br>
-               
+$result = mysql_query($sql);
+$row = mysql_fetch_row($result);
+$comment_count = $row[0];
+$comment_max = $row[1];
+
+$sql = 'select count(*), max(timeposted) from filecom where user_id = '.$user_id;
+
+$result = mysql_query($sql);
+$row = mysql_fetch_row($result);
+$filecomm_count = $row[0];
+$filecomm_max = $row[1];
+
+?>
+<div class="col2">
+       <table>
+               <tr><td><img src="gfx/rss.png"></td><td class="link_header">Feeds</td></tr>
+               <tr><td></td><td><a href="comment_feed.php">Full Comments</a></td></tr>
+               <tr><td></td><td><a href="assignment_feed.php">Assignments Modified</a></td></tr>
+       </table>
+       <br><br>
+       <table>
+               <tr><td><img src="gfx/world_link.png"></td><td class="link_header">Links</td></tr>
+               <tr><td></td><td><a href="password_change.php">Change Password</a></td></tr>
+       </table>
+</div>
+<div class="col">
+       <table class="gridtable">
+       <tr><th>Stat</th><th>Value</th><th>Human Time</th><th>Last Updated</th></tr>
+       <tr><td>Files:</td><td><?php echo $file_count; ?></td><td><?php echo absHumanTiming($file_max); ?></td><td><?php echo $file_max; ?></td></tr>
+       <tr><td>File Comments:</td><td><?php echo $filecomm_count; ?></td><td><?php echo absHumanTiming($filecomm_max); ?></td><td><?php echo $filecomm_max; ?></td></tr>
+       <tr><td>Comments:</td><td><?php echo $comment_count; ?></td><td><?php echo absHumanTiming($comment_max); ?></td><td><?php echo $comment_max; ?></td></tr>
+       </table>
+</div>
 
 <?php } ?>
index 44b8ee3..7de9fd7 100644 (file)
--- a/style.css
+++ b/style.css
@@ -136,6 +136,12 @@ table.gridtable td {
     border: 1px solid #000;
     background-color: #c5bcff;
 }
+.file_head_late {
+    padding-left: 15px;
+    padding-top: 3px;
+    border: 1px solid #000;
+    background-color: #faa;
+}
 /*.comment {border:1px solid #ddd; width: 95%; margin-left: 10px; margin-right: 10px;}_NO__DOTCOMMA__AFTER__*/
 .com_body { padding-left: 15px }
 /*.com_date_human { position: relative; left: 100px; top: -8px; color: #666;}_NO__DOTCOMMA__AFTER__*/
@@ -309,3 +315,18 @@ table.gridtable td {
     padding: 20px;
     font-size: 20px;
 }
+.comment_box_closed {
+    color: #d00;
+    border: 1px solid #000;
+    /*background-color: #d00;*/
+    background-color: #dedede;    
+    padding: 20px;
+    font-size: 20px;
+}
+.comment_box_closed_message {
+    position: relative;
+    float:right;
+    color: #faa;
+    font-weight:bold;
+    font-size: 120px;
+}
index 307fab6..3805680 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 include_once("auth.php");
+include_once("detail_lib.php");
 //include_once("header.php");
 
 if (!$_GET["sched"]) { die("No Assignment Sent"); }
@@ -9,6 +10,7 @@ $_GET["sched"] = mysql_real_escape_string($_GET["sched"]);
 $_FILES["file"]["name"] = mysql_real_escape_string($_FILES["file"]["name"]);
 $_FILES["file"]["size"] = mysql_real_escape_string($_FILES["file"]["size"]);
 
+/*
 $sql = "select count(*) as count, class_id, due_date from schedule where due_date > NOW() and sched_id=".$_GET["sched"];
 
 $result = mysql_query($sql);
@@ -21,6 +23,23 @@ if($row[0] == 0) { die("Assignment Not Open For Submission"); }
 
 $deadline = $row[1];
 $class_id = $row[2];
+*/
+
+/* if assignment was late - mark assignment details as late */
+$sql = 'select due_date-NOW() as late from schedule where sched_id = '.$_GET["sched"];
+
+//echo $sql;
+
+$result = mysql_query($sql);
+
+if (!$result) { die("SQL ERROR: File Details For File Late"); }
+
+$row = mysql_fetch_array($result);
+
+if($row['late'] < 0) {
+       detail_mark_late($user_id, $_GET["sched"]);
+       detail_viewed_update($user_id, $_GET["sched"], 0, "fac");
+}
 
 /* check for correct file extension */
 $allowedExtensions = array("c", "cpp", "c++", "h", "hpp");
index e3ca597..de2450f 100644 (file)
@@ -27,4 +27,32 @@ function file_count($user_id, $sched_id)
        return $row[0];
 }
 
+function file_late($file_id)
+{
+       $sql = 'select due_date - time_post as late from files, schedule where (files.sched_id = schedule.sched_id) and file_id ='.$file_id;
+
+       $result = mysql_query($sql);
+
+       if (!$result) { die("SQL ERROR: File Details For File Late"); }
+
+       $row = mysql_fetch_array($result);
+
+       if($row['late'] < 0) return true;
+
+       return false;
+}
+
+function assignment_late($user_id, $sched_id)
+{
+       if(!isset($user_id)) { return -1; }
+       $sql = 'select late from sched_details where user_id = '.$user_id.' and sched_id = '.$sched_id;
+       $result = mysql_query($sql);
+
+       if (!$result) { die("SQL ERROR"); }
+
+       $row = mysql_fetch_array($result);
+
+       return $row[0];
+}
+
 ?>