|
From: mdw c. <myd...@li...> - 2001-11-02 16:02:48
|
MyDynaWeb CVS committal
Author : sukria
Project : mydynaweb
Module : htdocs
Dir : mydynaweb/htdocs/tools/events
Modified Files:
stats.php
Log Message:
Adding the what's up box.
To use it add in main.html :
~WHATSUP_BOX~
it shows the last news posted and the last comment posted
enjoy !
===================================================================
RCS file: /cvsroot/mydynaweb/mydynaweb/htdocs/tools/events/stats.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- stats.php 2001/10/04 21:00:42 1.10
+++ stats.php 2001/11/02 16:02:17 1.11
@@ -151,7 +151,7 @@
return(1);
}
-function get_whatsup_box($DBH)
+function get_whatsup_box($DBH, $hash_box)
/*
This function returns the "What's Up Box".
That box would contains
@@ -161,6 +161,39 @@
*/
{
$BOX = '';
+
+ // last news
+ $sql = "select titre, num_news
+ from news
+ where lang = '".USER_LANG."'
+ order by num_news desc";
+ $rqt = new query($DBH);
+ $rqt->query($DBH, $sql);
+ $row = $rqt->getrow();
+ $ELEMS["LAST_NEWS"] = (translate('DERNIERE_NEWS', $DBH) . " : <a href='comment.php?news=$row[1]'>".$row[0]."</a>");
+
+ // last comment
+ $sql = "select title, news.num_news, titre
+ from comments, news
+ where news.lang = '".USER_LANG."'
+ and news.num_news = comments._num_news
+ order by comments.num_cmt desc";
+ $rqt = new query($DBH);
+ $rqt->query($DBH, $sql);
+ $row = $rqt->getrow();
+ $ELEMS["LAST_COMMENT"] = (translate('DERNIER_COMMENTAIRE', $DBH) . " : <a href='comment.php?news=$row[1]'>".$row[0]."</a> ($row[2])");
+
+ $tokens['TITLE'] = translate('WHAZAA', $DBH);
+ $BOX = get_hash_template($hash_box['HEAD'], $tokens);
+
+ $tokens['CONTENT'] = $ELEMS["LAST_NEWS"];
+ $BOX .= get_hash_template($hash_box['LINE'], $tokens);
+
+ $tokens['CONTENT'] = $ELEMS['LAST_COMMENT'];
+ $BOX .= get_hash_template($hash_box['LINE'], $tokens);
+
+ $BOX .= get_hash_template($hash_box['FOOT'], $tokens);
+
return ($BOX);
}
|