new file and folder icons
[elgg.git] / _activity / index.php
blob582d2fd92a2858d4bd92f3d3aacb7ce91b5385ba
1 <?php
3 // ELGG recent activity page
5 // Run includes
6 require("../includes.php");
8 // Initialise functions for user details, icon management and profile management
9 run("profile:init");
11 // Whose friends are we looking at?
12 global $page_owner;
14 // Weblog context
15 define("context", "weblog");
17 // You must be logged on to view this!
18 protect(1);
20 $title = run("profile:display:name") . " :: " . gettext("Recent activity");
22 // If we haven't specified a start time, start time = 1 day ago
24 if (!isset($_REQUEST['starttime'])) {
25 $starttime = time() - 86400;
26 } else {
27 $starttime = (int) $_REQUEST['starttime'];
30 $body = "<p>" . gettext("Currently viewing recent activity since ") . gmdate("F d, Y",$starttime) . ".</p>";
32 $body .= "<p>" . gettext("You may view recent activity during the following time-frames:") . "</p>";
34 $body .= "<ul><li><a href=\"index.php?starttime=" . (time() - 86400) . "\">" . gettext("The last 24 hours") . "</a></li>";
35 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 2)) . "\">" . gettext("The last 48 hours") . "</a></li>";
36 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 7)) . "\">" . gettext("The last week") . "</a></li>";
37 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 30)) . "\">" . gettext("The last month") . "</a></li></ul>";
39 $body .= "<h2>" . gettext("Activity on your weblog posts") . "</h2>";
41 $activities = db_query("select users.username, weblog_comments.*, weblog_posts.ident as weblogpost, weblog_posts.title as weblogtitle, weblog_posts.weblog as weblog from weblog_comments left join weblog_posts on weblog_posts.ident = weblog_comments.post_id left join users on users.ident = weblog_posts.weblog where weblog_comments.posted >= $starttime and weblog_posts.owner = $page_owner order by weblog_comments.posted desc");
42 if (is_array($activities) && sizeof($activities) > 0) {
43 foreach($activities as $activity) {
44 $commentbody = stripslashes($activity->body);
45 $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>";
46 $commentposter = sprintf(gettext("<b>%s</b> posted on weblog post '%s'"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle));
47 $body .= run("templates:draw", array(
48 'context' => 'databox1',
49 'name' => $commentposter,
50 'column1' => $commentbody
54 } else {
55 $body .= "<p>" . gettext("No activity during this time period.") . "</p>";
58 $body .= "<h2>" . gettext("Activity on weblog posts you have marked as interesting") . "</h2>";
60 $activities = db_query("select distinct users.username, users.name as weblogname, weblog_comments.*, weblog_posts.weblog, weblog_posts.ident as weblogpost, weblog_posts.title as weblogtitle, weblog_posts.weblog as weblog from weblog_watchlist left join weblog_comments on weblog_comments.post_id = weblog_watchlist.weblog_post left join weblog_posts on weblog_posts.ident = weblog_comments.post_id left join users on users.ident = weblog_posts.weblog where weblog_watchlist.owner = $page_owner and weblog_comments.posted >= $starttime order by weblog_comments.posted desc");
61 if (is_array($activities) && sizeof($activities) > 0) {
62 foreach($activities as $activity) {
63 $commentbody = stripslashes($activity->body);
64 $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . gettext("Read more") . "</a>";
65 $commentposter = sprintf(gettext("<b>%s</b> commented on weblog post '%s' in %s:"),stripslashes($activity->postedname), stripslashes($activity->weblogtitle), stripslashes($activity->weblogname));
66 $body .= run("templates:draw", array(
67 'context' => 'databox1',
68 'name' => $commentposter,
69 'column1' => $commentbody
73 } else {
74 $body .= "<p>" . gettext("No activity during this time period.") . "</p>";
77 $body = run("templates:draw", array(
78 'context' => 'contentholder',
79 'title' => $title,
80 'body' => $body
84 echo run("templates:draw:page", array(
85 $title, $body