root/releases/0.1.1b/units/weblogs/weblogs_view_month.php

Revision 2, 1.4 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // View a weblog's posts for a particular month
4     
5     // Get the current profile ID
6     
7         global $profile_id;
8         
9     // If the months haven't been set, they're the current months
10         if (!isset($_REQUEST['month'])) {
11             $month = (int) gmdate("m");
12         } else {
13             $month = (int) $_REQUEST['month'];
14         }
15         
16     // If the years haven't been set, they're the current years
17         if (!isset($_REQUEST['year'])) {
18             $year = (int) gmdate("Y");
19         } else {
20             $year = (int) $_REQUEST['year'];
21         }
22         
23     // Get all posts in the system that we can see
24     
25         $where = run("users:access_level_sql_where",$_SESSION['userid']);
26         $posts = db_query("select * from weblog_posts
27                             where ($where)
28                             and owner = $profile_id
29                             and posted >= ".gmmktime(0,0,0,$month,1,$year)."
30                             and posted < ".gmmktime(0,0,0,($month + 1), 1, $year)."
31                             order by posted asc");
32                 
33         if (sizeof($posts > 0) || sizeof($friendsposts > 0)) {
34             
35             $lasttime = "";
36             
37             $run_result .= "<h1 class=\"weblogdateheader\">" . gmdate("F Y",gmmktime(0,0,0,$month,1,$year)) . "</h1>\n";
38             
39             foreach($posts as $post) {
40                 
41                 $time = gmdate("F d, Y",$post->posted);
42                 if ($time != $lasttime) {
43                     $run_result .= "<h2 class=\"weblogdateheader\">$time</h2>\n";
44                     $lasttime = $time;
45                 }
46                 
47                 $run_result .= run("weblogs:posts:view",$post);
48                 
49             }
50             
51         }
52
53 ?>
Note: See TracBrowser for help on using the browser.