<?php
# ------------------------------------------------------------------------------
#
# Top 10 Portlet
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#
# This file is part of TVEz (tvez.sourceforge.net).
#
# TVEz 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.
#
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ------------------------------------------------------------------------------
#
# Created on 02/12/2003 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/02/09 04:52:01 $
# $Revision: 1.6 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------
# Top ten
$freq=array();
$query = "SELECT director from movies";
list ($anum,$rows) = query_db($query);
if ($anum) {
foreach ($rows as $row) {
$directors = explode("/", $row{'director'});
foreach ($directors as $director) {
if ($director != "") {
$freq{$director}++;
}
}
}
arsort($freq);
reset($freq);
$freq = array_slice($freq, 0, 10);
portlet(localize_string("Most Frequent Directors"),generic_c10($freq, "director", localize_string("View all movies directed by this director")));
}
else
portlet(localize_string("Most Frequent Directors"),localize_string("No directors have been added"));
?>