Re: cvs: phpweb / index.php /include layout.inc
| From: | Gabor Hojtsy | Date: | Mon, 02 Jun 2003 15:59:34 +0000 |
| Subject: | Re: cvs: phpweb / index.php /include layout.inc | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-18386@lists.php.net to get a copy of this message | ||
Wow, this looks good, and much more organized. Though a bit more lengthy then the previous version. Great job.
Goba
rasmus Sun Jun 1 15:16:54 2003 EDTModified files: /phpweb index.php /phpweb/include layout.inc Log:New categorized look for the calendar sidebar Might take a couple of hours for the backend data and this new frontend ui to get in synch. Index: phpweb/index.php diff -u phpweb/index.php:1.387 phpweb/index.php:1.388 --- phpweb/index.php:1.387 Thu May 29 12:46:17 2003 +++ phpweb/index.php Sun Jun 1 15:16:54 2003 @@ -146,38 +146,44 @@ if ($fp) {// Current month number (for delimiter additions) - $cm = 0; + $cm = $ccat = 0;+ $cats = array('unknown','User Group Events','Conferences','Training');// Event duplication check hash $seen = array(); + $RSIDEBAR_DATA .= '<div align="left"><b>Upcoming Events</b></div><div align="right"><a href="submit-event.php">[add event]</a></div>';+// While we can read the events file - while (!feof($fp)) { + while (true) { // Get information event elements from file - list($d, $m, $y, $ccode, $desc, $id) = fgetcsv($fp, 8192); + $elems = fgetcsv($fp, 8192); + if($elems === false) { break; } + list($d, $m, $y, $ccode, $desc, $id, , , , , , ,$cat) = $elems; // Fgetcvs() returns an array with a single null element // for a blank line, which we need to skip if ($d === NULL) { continue; } + if ($ccat != (int)$cat) { + $RSIDEBAR_DATA .= '<br /><div align="left"><tt><u><b>'.$cats[$cat].'</b></u></tt><br /></div>';+ $ccat = $cat; + } +// If the month number changed if ($cm != (int) $m) { // If we are not at the begining if ($cm) { - $RSIDEBAR_DATA .= "<br />\n"; - } - // If we are at the begining - else { - $RSIDEBAR_DATA .= '<div align="center"><h3>Upcoming Events<br /><a href="submit-event.php">[add event]</a></h3></div>'; +# $RSIDEBAR_DATA .= "<br />\n"; } // Update current month information $cm = (int) $m; - // Add month name - $RSIDEBAR_DATA .= "<h4>" . strftime('%B', mktime(12, 0, 0, $cm, $d, $y)) . "</h4>\n"; + // Get abbreviated month name+ $mon = strftime('%b', mktime(12, 0, 0, $cm, $d, $y));// We have not seen any events in this month $seen = array();@@ -186,9 +192,9 @@// There is no event with this description in this month if (!isset($seen[$desc])) { // Add event to sidebar - $RSIDEBAR_DATA .= "<span class=\"event_$ccode\">$d. <a href=\"cal.php?id=$id\">" . + $RSIDEBAR_DATA .= "<span class=\"event_$ccode\"><div class=\"small\">$mon.$d <a href=\"cal.php?id=$id\">" . htmlspecialchars(stripslashes($desc)) . - "</a></span><br />\n"; + "</a></div></span>\n"; // Set seen flag $seen[$desc] = TRUE; }Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.162 phpweb/include/layout.inc:1.163 --- phpweb/include/layout.inc:1.162 Sun Jun 1 11:52:37 2003 +++ phpweb/include/layout.inc Sun Jun 1 15:16:54 2003 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.inc,v 1.162 2003/06/01 15:52:37 rasmus Exp $ */ +/* $Id: layout.inc,v 1.163 2003/06/01 19:16:54 rasmus Exp $ */ $www_static_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ? 'http://static.php.net/www.php.net' : ''; @@ -317,7 +317,7 @@ echo "</td></tr></table></td>"; if (!empty($RSIDEBAR_DATA)) { ?> <td bgcolor="#cccccc" background="<?php echo $www_static_root; ?>/images/checkerboard.gif" width="1"><?php spacer(); ?></td> -<td width="175" bgcolor="#f0f0f0"> +<td width="185" bgcolor="#f0f0f0"> <table width="100%" cellpadding="4" cellspacing="0"> <tr valign="top"><td class="sidebar"><?php echo $RSIDEBAR_DATA?></td></tr> </table>