<?php
/**
* @version 2.2
* @since 2.0 2008-08-06
* @package kwalbum
*/
require_once 'include/IPage.php';
class IndexPage implements IPage
{
function GetHead(&$title)
{
$title = MAIN_TITLE;
return '';
}
function ShowBody()
{
global $URLP, $DB;
$limit = 15;
$query = 'SELECT Location, SUM(ItemCount) as Total
FROM '.LOCATION_TABLE.'
LEFT JOIN '.ITEM_TABLE.'
ON ItemLocationIdFk=LocationId
WHERE ItemCount != 0
GROUP BY LocationId
ORDER BY Total DESC
LIMIT '.$limit;
$popLocationResults = $DB->Query($query);
global $URLP, $DB;
$query = 'SELECT Tag, SUM(ItemCount) as Total
FROM '.TAG_TABLE.'
LEFT JOIN '.TAG_MAP_TABLE.'
ON TagId=TagIdFk
LEFT JOIN '.ITEM_TABLE.'
ON ItemId=ItemIdFk
GROUP BY TagId
ORDER BY Total DESC
LIMIT '.$limit;
$popTagResults = $DB->Query($query);
$query = 'SELECT Location, MAX(ItemAddedTs) as NewestDate
FROM '.LOCATION_TABLE.'
LEFT JOIN '.ITEM_TABLE.'
ON ItemLocationIdFk=LocationId
WHERE Location != "unknown location"
GROUP BY LocationId
ORDER BY NewestDate DESC
LIMIT '.$limit;
$newLocationResults = $DB->Query($query);
$query = 'SELECT Tag, MAX(ItemAddedTs) as NewestDate
FROM '.TAG_TABLE.'
LEFT JOIN '.TAG_MAP_TABLE.'
ON TagId=TagIdFk
LEFT JOIN '.ITEM_TABLE.'
ON ItemId=ItemIdFk
GROUP BY TagId
ORDER BY NewestDate DESC
LIMIT '.$limit;
$newTagResults = $DB->Query($query);
require 'IndexPage.html.php';
}
}
?>