-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodule_news.php
More file actions
31 lines (26 loc) · 796 Bytes
/
Copy pathmodule_news.php
File metadata and controls
31 lines (26 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
* Rename the function to match the name of the module. Names of all news functions must be unique
* across all modules installed on a system. Return a variable called $news
*/
function helloworld_news() {
global $db, $enrolled_courses, $system_courses;
$news = array();
if ($enrolled_courses == ''){
return $news;
}
$sql = "SELECT * FROM %snews WHERE course_id IN '%s' ORDER BY date DESC";
$result = queryDB($sql, array(TABLE_PREFIX, $enrolled_courses));
if(count($result) > 0){
foreach($result as $row){
$news[] = array('time'=>$row['date'],
'object'=>$row,
'alt'=>_AT('announcements'),
'course'=>$system_courses[$row['course_id']]['title'],
'thumb'=>'images/flag_blue.png',
'link'=>$row['body']);
}
}
return $news;
}
?>