cvs: php-master-web /scripts event_listing

From: Date: Sat, 10 Feb 2007 21:20:05 +0000
Subject: cvs: php-master-web /scripts event_listing
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-34208@lists.php.net to get a copy of this message
bjori Sat Feb 10 21:20:05 2007 UTC Modified files: /php-master-web/scripts event_listing Log: Don't keep more than one month in the same buffer Simplify category ordering http://cvs.php.net/viewvc.cgi/php-master-web/scripts/event_listing?r1=1.7&r2=1.8&diff_format=u Index: php-master-web/scripts/event_listing diff -u php-master-web/scripts/event_listing:1.7 php-master-web/scripts/event_listing:1.8 --- php-master-web/scripts/event_listing:1.7 Wed Feb 7 21:46:04 2007 +++ php-master-web/scripts/event_listing Sat Feb 10 21:20:05 2007 @@ -50,11 +50,11 @@ // Update current month information $cm = (int) $m; - // Start month with a header - fwrite($out, '<h4 class="eventmonth">' . + // Buffer month header + $headline = '<h4 class="eventmonth">' . strftime('%B', mktime(12, 0, 0, $cm, $d, $y)) . - "</h4>\n" - ); + "</h4>\n"; + $buffer[$headline] = array(); // We have not seen any events in this month $seen = array(); @@ -67,7 +67,7 @@ if ($ccat != (int) $cat) { if($ccat) { // "buffer" the current content before we move onto next category - $buffer[$ccat] = $content; + $buffer[$headline][$ccat] = $content; } $content = '<h4>' . $cats[$cat] . "</h4>\n"; @@ -87,20 +87,23 @@ } } // Add the last category to the "buffer" - $buffer[$ccat] = $content; + $buffer[$headline][$ccat] = $content; // Organize the output - if ($buffer[2]) { // Conferences - fwrite($out, $buffer[2]); - } - if ($buffer[1]) { // User Group Events - fwrite($out, $buffer[1]); - } - if ($buffer[3]) { // Training - fwrite($out, $buffer[3]); - } - if ($buffer[0]) { // Unkown - fwrite($out, $buffer[0]); + $order = array( + 2, // Conferences + 1, // User Group Events + 3, // Training + 0, // Unkown + ); + + foreach($buffer as $headline => $categories) { + // Start month with a header + fwrite($out, $headline); + + foreach($order as $category) { + fwrite($out, $buffer[$headline][$category]); + } } // End heredoc string

« previous php.mirrors (#34208) next »