2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or*/
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /****************************************************************/
\r
14 define('AT_INCLUDE_PATH', '../../../include/');
\r
15 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
16 require_once(AT_INCLUDE_PATH .'classes/subscribe.class.php');
\r
18 $sub = new subscription();
\r
21 if ($_GET['subscribe'] == "set"){
\r
22 if($sub->set_subscription('blog',$_SESSION['member_id'],$_GET['group_id'])){;
\r
23 $msg->addFeedback('BLOG_SUBSCRIBED');
\r
25 } else if ($_GET['subscribe'] == "unset"){
\r
26 $sub->unset_subscription('blog',$_SESSION['member_id'],$_GET['group_id']);
\r
27 $msg->addFeedback('BLOG_UNSUBSCRIBED');
\r
31 require (AT_INCLUDE_PATH.'header.inc.php');
\r
33 $sql = "SELECT G.group_id, G.title, G.modules FROM ".TABLE_PREFIX."groups G INNER JOIN ".TABLE_PREFIX."groups_types T USING (type_id) WHERE T.course_id=$_SESSION[course_id] ORDER BY G.title";
\r
34 $result = mysql_query($sql, $db);
\r
36 echo '<ol id="tools">';
\r
39 while ($row = mysql_fetch_assoc($result)) {
\r
40 if (strpos($row['modules'], '_standard/blogs') !== FALSE) {
\r
41 // retrieve the last posted date/time from this blog
\r
42 $sql = "SELECT MAX(date) AS date FROM ".TABLE_PREFIX."blog_posts WHERE owner_type=".BLOGS_GROUP." AND owner_id={$row['group_id']}";
\r
43 $date_result = mysql_query($sql, $db);
\r
44 if (($date_row = mysql_fetch_assoc($date_result)) && $date_row['date']) {
\r
45 $last_updated = ' - ' . _AT('last_updated', AT_date(_AT('forum_date_format'), $date_row['date'], AT_DATE_MYSQL_DATETIME));
\r
50 echo '<li class="top-tool" style="position:relative;"><a href="'.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP. SEP .'oid='.$row['group_id']).'">'.AT_print($row['title'], 'blog_posts.title').$last_updated.'</a>';
\r
52 // Check if subscribed and make appropriate button
\r
53 if ($sub->is_subscribed('blog',$_SESSION['member_id'],$row['group_id'])){
\r
54 echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id']. SEP .'subscribe=unset"><img border="0" src="'.AT_BASE_HREF.'images/unsubscribe-envelope.png" alt="" /> '._AT('blog_unsubscribe').'</a>';
\r
56 echo '<a style="float:right;clear:right;padding-right:20px;" href="'.$_SERVER['PHP_SELF'].'?group_id='.$row['group_id']. SEP .'subscribe=set"><img border="0" src="'.AT_BASE_HREF.'images/subscribe-envelope.png" alt="" /> '._AT('blog_subscribe').'</a>';
\r
65 echo _AT('none_found');
\r
69 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>