Added discussion feature to site.
[Assignment-Trapper.git] / workflow_discussion.php
blob3c103c426a64e36c7735abe2d9e4ede2e18bc671
1 <?php
3 include_once("auth.php");
4 include_once("header.php");
5 include_once("time.php");
7 if($role != 0) { die("Account \"".$user_name."\" Is Not Authorized To View This Page.<br><br>This Event Will Be Logged And Reported."); }
9 $sql = 'select role, name, discussion_post.user_id, topic_id, sched_id, post_content, post_time from discussion_post, users where users.user_id = discussion_post.user_id order by post_time desc limit 75';
11 //$sql = 'select txt, name, email, title, type_name, DATE_FORMAT(comments.timeposted,"%a, %d %b %Y %T CST") AS timeposted, comments.sub_id, schedule.sched_id, comments.user_id from comments, users, schedule, types where (schedule.assign_type = types.assign_type) and (schedule.sched_id = comments.sub_id) and (comments.user_id = users.user_id) UNION select txt from filecom order by timeposted limit 30';
13 $result = mysql_query($sql);
15 $comment_list = '<table class="gridtable">
16 <tr>
17 <th>Name</th><th>Title</th><th>Type</th><th>Comment</th>
18 </tr>';
20 while($row = mysql_fetch_array($result))
22 if($row['role'] == 0 ) { $icon = '<div class="com_head_fac"><img src="gfx/user_suit.png">'; } else { $icon = '<div class="com_head"><img src="gfx/user_green.png">'; }
24 if($row['sched_id'] == "0"){ $link = '<a href=discussion.php?topic='.$row['topic_id'].'>Link To Topic</a>'; }
25 else { $link = '<a href=discussion.php?sched='.$row['sched_id'].'>Link To Assignment Discussion</a>'; }
27 $html .= '<div class="comment">'.$icon .'<span class="com_name">'.$row["name"].'</span><span class="com_date">'.$row["post_time"].'</span><span class="com_human">'.absHumanTiming($row["post_time"]).'</span><span class="com_link">'.$link.'</span></div><div class="com_body">'.$row["post_content"].'</div>
28 </div><br><br>';
32 $row['txt'] = substr( $row['txt'] ,0, 75);
33 $comment_list .= '<tr>';
34 $comment_list .= '<td>'.$row['name'].'</td>';
35 $comment_list .= '<td><a href=detail_root.php?sched='.$row['sched_id'].'&user='.$row['user_id'].'>'.$row['title'].'</a></td>';
36 $comment_list .= '<td>'.$row['type_name'].'</td>';
37 $comment_list .= '<td>'.$row['txt'].'</td>';
38 $comment_list .= '</tr>';
45 <h1>Most Recent Discussion Topics In Order of Posting</h1>
47 <?php echo $html; ?>