root/releases/0.8rc1/_activity/index.php

Revision 659, 4.2 kB (checked in by misja, 2 years ago)

Taking gettext to a new level, see message <http://lists.elgg.org/pipermail/development/2006-October/000590.html>. In a nutshell: all gettext calls are replaced by gettext, revamped gettext handling plus some additional fixes.

  • Property svn:eol-style set to native
Line 
1 <?php
2 global $CFG;
3 //    ELGG recent activity page
4
5 // Run includes
6 require_once(dirname(dirname(__FILE__))."/includes.php");
7
8 // Initialise functions for user details, icon management and profile management
9 run("profile:init");
10
11 // Whose friends are we looking at?
12 global $page_owner;
13
14 // Weblog context
15 define("context", "weblog");
16
17 // You must be logged on to view this!
18 protect(1);
19
20 templates_page_setup();
21
22 cleanup_messages(time() - (86400 * 30));
23
24 $title = run("profile:display:name") . " :: " . __gettext("Recent activity");
25
26 // If we haven't specified a start time, start time = 1 day ago
27 $starttime = optional_param('starttime',time()-86400,PARAM_INT);
28
29 $body = "<p>" . __gettext("Currently viewing recent activity since ") . gmstrftime("%B %d, %Y", $starttime) . ".</p>";
30
31 $body .= "<p>" . __gettext("You may view recent activity during the following time-frames:") . "</p>";
32
33 $body .= "<ul><li><a href=\"index.php?starttime=" . (time() - 86400) . "\">" . __gettext("The last 24 hours") . "</a></li>";
34 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 2)) . "\">" . __gettext("The last 48 hours") . "</a></li>";
35 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 7)) . "\">" . __gettext("The last week") . "</a></li>";
36 $body .= "<li><a href=\"index.php?starttime=" . (time() - (86400 * 30)) . "\">" . __gettext("The last month") . "</a></li></ul>";
37
38 $body .= "<h2>" . __gettext("Your recent messages") . "</h2>";
39
40 $user_messages = get_messages($page_owner,null,(time() - $starttime));
41
42 if (is_array($user_messages) && !empty($user_messages)) {
43     foreach($user_messages as $user_message) {
44         $body .= "<div class=\"user_message\">" . display_message($user_message) . "</div>";
45         
46     }
47 }
48
49 $body .= "<h2>" . __gettext("Activity on weblog posts you have marked as interesting") . "</h2>";
50
51 if ($activities = get_records_sql('SELECT wc.*, u.username, u.name as weblogname, wp.weblog, wp.ident AS weblogpost, wp.title AS weblogtitle, wp.weblog AS weblog
52                                     FROM '.$CFG->prefix.'weblog_comments wc
53                                     LEFT JOIN '.$CFG->prefix.'weblog_watchlist wl ON wl.weblog_post = wc.post_id
54                                     LEFT JOIN '.$CFG->prefix.'weblog_posts wp ON wp.ident = wc.post_id
55                                     LEFT JOIN '.$CFG->prefix.'users u ON u.ident = wp.weblog
56                                     WHERE wc.posted > ? AND wl.owner = ?
57                                     ORDER BY wc.posted DESC',array($starttime, $page_owner))) {
58     foreach($activities as $activity) {
59         $commentbody = stripslashes($activity->body);
60         $commentbody .= "<br /><br /><a href=\"" . url . $activity->username . "/weblog/" . $activity->weblogpost . ".html\">" . __gettext("Read more") . "</a>";
61         $activity->postedname = stripslashes($activity->postedname);
62         $activity->weblogname = stripslashes($activity->weblogname);
63         if ($activity->weblog == $USER->ident) {
64             $activity->weblogname = __gettext("your blog");
65         }
66         if ($activity->owner == $USER->ident) {
67             $commentposter = sprintf(__gettext("<b>You</b> commented on weblog post '%s' in %s:"), stripslashes($activity->weblogtitle), $activity->weblogname);
68         } else {
69             $commentposter = sprintf(__gettext("<b>%s</b> commented on weblog post '%s' in %s:"), $activity->postedname, stripslashes($activity->weblogtitle), $activity->weblogname);
70         }
71         $body .= templates_draw(array(
72                                         'context' => 'databox1',
73                                         'name' => $commentposter,
74                                         'column1' => $commentbody
75                                       )
76                                 );
77     }
78 } else {
79     $body .= "<p>" . __gettext("No activity during this time period.") . "</p>";
80 }
81
82 $body = templates_draw(array(
83                              'context' => 'contentholder',
84                              'title' => $title,
85                              'body' => $body
86                              )
87                        );
88
89 echo templates_page_draw( array(
90                                   $title, $body
91                                   )
92          );
93
94 ?>
Note: See TracBrowser for help on using the browser.