<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: admin.php 554 2006-04-12 10:37:20Z buddhafly $
 * Authors: András Micsik 
 */
require "init.inc.php";
$smarty->assign('PAGETITLE', $page->getlocalized('AdminPage'));
$page->forceLogin();
//$page->errorURL = "admin.php";
checkPerm('node', 'change');
$actionsToCount = "'listens','downloads'";
$sql = "SELECT p.id, p.title, s.id AS station_id, s.name AS station_name, count(distinct h.user_id) as count FROM sotf_programmes p, sotf_stations s, sotf_user_history h WHERE p.station_id=s.id AND p.id=h.object_id AND h.action IN ({$actionsToCount}) GROUP BY p.id, p.title, s.id, s.name ORDER BY count DESC";
$count = $db->getOne("SELECT COUNT(*) FROM ({$sql}) s");
$limit = $page->splitList($count, $scriptUrl);
$res = $db->limitQuery($sql, $limit["from"], $limit["maxresults"]);
if (DB::isError($res)) {
    raiseError($res);
}
$results = null;
while (DB_OK === $res->fetchInto($row)) {
    $row['groups'] = sotf_Group::listGroupsOfObject($row['id']);
    $results[] = $row;
}
debug("TOPLIST", $results);
$smarty->assign('TOPLIST', $results);
$page->send();
Esempio n. 2
0
    $smarty->assign('REFS', $prg->getRefs());
    // statistics
    $smarty->assign('STATS', $prg->getStats());
    // add this visit to statistics
    $prg->addStat('', "visits");
    // rating
    $rating = new sotf_Rating();
    $smarty->assign('RATING', $rating->getInstantRating($id));
    // my rating?
    $myRating = $rating->getMyRating($id);
    debug("r", $myRating);
    $smarty->assign('MY_RATING', $myRating);
    if (nodeConfig('payableMode')) {
        $smarty->assign('CURRENCY', $config['currency']);
        if (!$prg->isFree()) {
            $smarty->assign('LISTEN_GROUPS', sotf_Group::listGroupsOfObject($id, 'listen'));
        }
    }
    if ($page->loggedIn()) {
        // is in my playlist?
        $smarty->assign('inplaylist', sotf_UserPlaylist::contains($id));
    }
}
$db->commit();
// online counter for statistics
if ($config['counterMode']) {
    $chCounter_status = 'active';
    $chCounter_visible = 0;
    $chCounter_page_title = 'Programm-Detailansicht - get.php';
    include $config['counterURL'];
}