<?php
# ------------------------------------------------------------------------------
#
# This file contains porlet functions
#
# ------------------------------------------------------------------------------
#
# 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/08/31 08:13:44 $
# $Revision: 1.13 $
# $Author: pachikov $
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Prints a portlet with title
# ------------------------------------------------------------------------------
function portlet ($title,$content,$width=null) {
if ($width=="x")
echo '<table cellspacing="0" class="portlet_wide">';
else
echo '<table cellspacing="0" class="portlet">';
echo '
<tr><td class="portlet_title">'.$title.'</td></tr>
<tr><td class="portlet_content">
'.$content.'
</td></tr></table>
';
}
# ------------------------------------------------------------------------------
# Generates a list of ten entries
# ------------------------------------------------------------------------------
function generic_c10($hashValues, $searchField, $mouseOver) {
$c = "<table>\n";
$i=0;
foreach ($hashValues as $key => $value) {
$c .= "<tr><td>".($i+1).".</td><td class=portlet_nums>($value)</td><td><a href=\"".$_SERVER['PHP_SELF']."?content=movies&page=movies&field=$searchField&search=$key\" title=\"$mouseOver\">$key</a></td></tr>";
$i++;
}
$c .= "</table>\n";
return $c;
}
function c10 ($movies) {
$c = "<table>\n";
$max = (sizeof($movies)<10) ? sizeof($movies) : 10;
for ($i=0;$i<$max;$i++) {
if (isset($movies[$i]{'votes'})) {
if ($movies[$i]{'votes'}==0) continue;
$rate = round(($movies[$i]{'points'}/$movies[$i]{'votes'}),1);
$pStr = "$rate/".$movies[$i]{'votes'};
$tle = $movies[$i]{'title'};
$link = "content=movies&page=movies&field=id&search=".$movies[$i]{'id'}."&view=small";
} elseif (isset($movies[$i]{'year'})) {
$pStr = $movies[$i]{'year'};
$tle = $movies[$i]{'title'};
$link = "content=movies&page=movies&field=id&search=".$movies[$i]{'id'}."&view=small";
} elseif (isset($movies[$i]{'director'})) {
$pStr = $movies[$i]{'times'};
$tle = $movies[$i]{'director'};
$link = "content=movies&page=movies&field=director&search=$tle&view=small";
} else {
$pStr = $movies[$i]{'played'};
$tle = $movies[$i]{'title'};
$link = "content=movies&page=movies&field=id&search=".$movies[$i]{'id'}."&view=small";
}
$title = substr($tle,0,17);
if (strlen($title) < strlen($tle)) $title .= "...";
$c .= "<tr><td>".($i+1).".</td><td class=portlet_nums>($pStr)</td><td><a href=\"".$_SERVER['PHP_SELF']."?$link\" title=\"".localize_string("View Movie Info")."\">$title</a></td></tr>";
}
$c .= "</table>\n";
return $c;
}
# ------------------------------------------------------------------------------
# Generate the content for the new additions
# ------------------------------------------------------------------------------
function news_view($movie) {
require "../config/config_file.php";
$img = get_valid_img("small",$movie['id']);
$plot = substr($movie["plot"],0,450);
if (strlen($plot) < strlen($movie{'plot'})) $plot .= "...";
$content = "
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td rowspan=\"3\" valign=\"top\">
<a href=\"".$_SERVER['PHP_SELF']."?content=movies&page=movies&field=id&search=".$movie["id"]."&view=large\" title=\"".localize_string("View Movie Info")."\"><img src=\"$img\" vspace=\"0\" hspace=\"4\" border=\"0\" width=\"100\" alt=\"".$movie["title"]."\" title=\"".localize_string("View Movie Info")."\"></a>
</td>
<td class=\"portlet_movietitle\" colspan=\"2\">
";
if (isset($_SESSION['tvezAccess']) || !$LOGIN_ENABLED)
$content .= "
<a href=\"player/plcontrol.php?tvst=play ".$movie["path"]."\" target=\"playlist\" class=\"title\" title=\"".localize_string("Play")." '".$movie["title"]."'\">";
$content .= $movie["title"];
if (isset($_SESSION['tvezAccess']) || !$LOGIN_ENABLED)
$content .= "</a>";
$content .= " <span class=\"portlet_year\" valign=\"top\"> <<a href=\"".$_SERVER['PHP_SELF']."?content=movies&page=movies&field=year&search=".$movie["year"]."\" title=\"".localize_string("View all movies from ==1==", $movie["year"])."\">".$movie["year"]."</a>>
</td>
</tr>
<tr>
<td valign=top class=\"portlet_plot\" colspan=\"2\">
".$plot."<br><br>
</td>
</tr>
<tr>
<td valign=\"bottom\" align=\"left\">
Runtime: ".$movie['time']." min
</td>
<td valign=\"bottom\" align=\"right\">
<a href=\"player/plcontrol.php?tvst=play ".$movie['path']."\" target=\"playlist\"> <b>".localize_string("Play")."</b></a> <b>|</b>
<a href=\"".$_SERVER['PHP_SELF']."?content=movies&page=movies&field=id&search=".$movie["id"]."&view=large\" title=\"".localize_string("View Movie Info")."\"><b>".localize_string("More")."</b></a>
</td>
</tr>
</table>
";
return $content;
}
?>