(root)/subscriptionupdates.php - Rev 438
Rev 341 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?PHP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of Travelsized CMS
* A content management system with modules, based on wiki syntax
*
* Author: Dan Jensen <admin@leinir.dk>
* Copyright 2003/2004
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License is available at: http://www.gnu.org/copyleft/
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$page_author = "Dan Jensen";
$page_author_email = "admin@NOSPAMleinir.dk";
$page_menu = 100;
$page_date = formatTime
( time() );
$page_title = i18n
("Recent Updates");
function renderUpdates
()
{
global $subscriptions;
if( count( $subscriptions->updates ) > 0 )
{
$firstTime = "";
$thisTime = "";
$entriesPerPage = 20;
$currentpage = 0;
if( array_key_exists( "currentpage", $_GET ) )
$currentpage = $_GET["currentpage"];
$lowerBound = $currentpage * $entriesPerPage;
$upperBound = ($currentpage + 1) * $entriesPerPage;
$position = 0;
$rendered = "
<dl class=\"updates\">";
krsort($subscriptions->updates);
foreach( $subscriptions->updates as $key => $value )
{
if( !userAllows
( $value["owner"], $value["viewLevel"] ) )
continue;
if( $position >= $upperBound )
break;
if( $position >= $lowerBound )
{
$oldTime = $thisTime;
$thisTime = date("Y-m-d" ,$value["timestamp"]);
if($oldTime != $thisTime)
$rendered .= "$firstTime<div class=\"updates_date\">$thisTime</div><dl class=\"updates\">";
$thumbData = getGlobalIDThumbnail
( $value["globalID"] );
$authorAndTime = i18n
( "By ##0## on ##1##", array( parse_profilelinks
( "%%" . $value["owner"] . "%%" ), formatTime
( $value["timestamp"] ) ) );
$thumbnailURI = getGlobalIDThumbnail
($value["globalID"]);
$rendered .= "
<a href=\"" . globalIDtoURL
( $value["globalID"] ) . "\"><img class=\"updates_thumbnail\" src=\"" . $thumbData["uri"] . "\" width=\"" . $thumbData["width"] . "\" height=\"" . $thumbData["height"] . "\" alt=\"" . $value["subject"] . "\" /></a>
<dt class=\"updates\"><a href=\"" . globalIDtoURL
( $value["globalID"] ) . "\">" . $value["subject"] . "</a></dt>
<dd class=\"updates\"><div class=\"updates_message\">" . parse_page_data
( $value["message"] ) . "</div><div class=\"updates_authorandtime\">" . $authorAndTime . "</div></dd>";
$firstTime = "</dl>";
}
$position++;
}
$rendered .= "
</dl>";
$navigator = renderNavigator
(count($subscriptions->updates), $currentpage, $lowerBound, $upperBound, $entriesPerPage);
$rendered = $navigator . $rendered . $navigator;
}
else
$rendered = renderInformationBox
( i18n
("No updates"), i18n
("Sorry, there are currently no updates to show you - please wait for someone to upload images to a gallery, a document to documents, an entry in a discussion, or make a comment.") );
return $rendered;
}
$page_content = renderUpdates
();
?>