2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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 /***********************************************************************/
15 * Get the latest updates of this module
16 * @return list of news, [timestamp]=>
18 function polls_news() {
19 global $db, $enrolled_courses, $system_courses;
22 if ($enrolled_courses == ''){
26 $sql = 'SELECT * FROM '.TABLE_PREFIX.'polls WHERE course_id IN'.$enrolled_courses.' ORDER BY created_date DESC';
27 $result = mysql_query($sql, $db);
29 while($row = mysql_fetch_assoc($result)){
30 $news[] = array('time'=>$row['created_date'],
33 'course'=>$system_courses[$row['course_id']]['title'],
34 'thumb'=>'images/home-polls_sm.png',
35 'link'=>'<a href="bounce.php?course='.$row['course_id'].'&p='.urlencode('mods/_standard/polls/index.php#'.$row['poll_id']).'"'.
36 (strlen($row['question']) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($row['question'], 'polls.question').'"' : '') .'>'.
37 AT_print(validate_length($row['question'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'polls.question') .'</a>');