remove old readme
[atutor.git] / mods / _standard / assignments / module_news.php
1 <?php
2 /***********************************************************************/
3 /* ATutor                                                                                                                          */
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010                                             */
6 /* Inclusive Design Institute                                          */
7 /* http://atutor.ca                                                                                                        */
8 /*                                                                                                                                         */
9 /* This program is free software. You can redistribute it and/or           */
10 /* modify it under the terms of the GNU General Public License             */
11 /* as published by the Free Software Foundation.                                           */
12 /***********************************************************************/
13 // $Id$
14 /*
15  * Get the latest updates of this module
16  * @return list of news, [timestamp]=>
17  */
18 function assignments_news() {
19         global $db, $enrolled_courses, $system_courses;
20         $news = array();
21
22         if ($enrolled_courses == ''){
23                 return $news;
24         } 
25
26         $sql = 'SELECT * FROM '.TABLE_PREFIX.'assignments WHERE course_id IN '.$enrolled_courses.' ORDER BY date_due DESC';
27         $result = mysql_query($sql, $db);
28         if($result){
29                 while($row = mysql_fetch_assoc($result)){
30                         $news[] = array('time'=>$row['date_due'], 
31                                                         'object'=>$row, 
32                                                         'course'=>$system_courses[$row['course_id']]['title'],
33                                                         'alt'=>_AT('assignment'),
34                                                         'thumb'=>'images/home-forums_sm.png',
35                                                         'link'=>_AT('assignment_due', $row['title'], '<small>'.AT_DATE('%F %j, %g:%i',$row['date_due']).'</small>'));
36                 }
37         }
38         return $news;
39 }
40
41 ?>