<?
$livello=controlla_privilegi($db,$mov_id_ut,3);
if (!isset($tipo_elenco))
$tipo_elenco=1;
if (!isset($cerca))
$cerca='';
OpenTable(_RICERCA_FILM);
echo "<form name='form_elenco' method=\"post\" action=\"$PHP_SELF\">";
echo "<input type='hidden' name='page' value='$page'>";
echo "<tr>";
echo "<td align='center'>";
echo "<b>"._CAT."</b>";
select_categorie($db,'categorie',1);
echo "</td>";
echo "<td align='center'>";
echo "<b>"._NOME_ATTORI." :</b><input type='text' name='nome_att'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='center'>";
echo "<b>"._TITOLO_FILM." :</b><input type='text' name='titolo'>";
echo "</td>";
echo "<td align='center'>";
echo "<b>"._REGIA." :</b><input type='text' name='regia'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='center'>";
echo "Tipo:";
echo "<select name='tipo_elenco'>";
echo "<option value='0'>Classico</option>";
echo "<option value='1' selected>Con Anteprime</option>";
echo "</select>";
echo "</td>";
echo "<td align='center'>";
echo "<input type='submit' name='cerca' value='"._CERCA."'>";
echo "</td>";
echo "</tr>";
echo "</FORM>";
CloseTable();
opentable('cerca 2');
echo "<tr>";
echo "<form name='form_elenco2' method=\"post\" action=\"$PHP_SELF\">";
echo "<input type='hidden' name='page' value='$page'>";
for($i=65;$i<91;$i++)
{
$lettera_=chr($i);
echo "<td><input type='submit' name='lettera' value='$lettera_'></td>";
}
echo "</FORM>";
echo "</tr>";
closetable();
$testo='';
if (isset($lettera))
{
$testo="select * from movie where titolo like '$lettera%'";
$tipo_elenco=1;
}
if ((isset($page))and(!isset($lettera))and($cerca==_CERCA))
{
$testo="select * from movie";
$mod=0;
if (($cerca==_CERCA)and($categorie>0))
{
$testo.=" where categorie=$categorie";
$mod=1;
}
if (isset($regia)and($regia!=""))
{
if ($mod==1)
$testo.=" and";
else
$testo.=" where";
$testo.=" regia like '%$regia%'";
}
if (isset($nome_att)and ($nome_att!=""))
{
if ($mod==1)
$testo.=" and";
else
$testo.=" where";
$testo.=" attori like '%$nome_att%' ";
}
if (isset($titolo)and($titolo!=""))
{
if ($mod==1)
$testo.=" and";
else
$testo.=" where";
$testo.=" titolo like '%$titolo%' ";
}
$testo.=" order by titolo";
}
if ($testo!='')
{
$res=mysql_query($testo,$db);
//echo "<p>$testo</p>";
$num=mysql_num_rows($res);
OpenTable(_ELENCO_FILM);
if ($tipo_elenco==0){
echo "<tr bgcolor='yellow'>";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._TITOLO."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._DURATA."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._CAT."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._ANNO."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._REGIA."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._SUPPORTO."</b></font>";
echo "</td>\n";
echo "<td align=\"center\" bgcolor=$bgcolor6>";
echo "<font ><b>"._COMANDI."</b></font>";
echo "</td>\n";
echo "</tr>";
}
$a = 0;
$dcolor_A = "$bgcolor2";
$dcolor_B = "$bgcolor3";
for ($i=0;$i<$num; $i++)
{
$titolo=mysql_result($res,$i,'titolo');
$titolo=special_char_correct($titolo);
$id=mysql_result($res,$i,'id');
$durata=mysql_result($res,$i,'durata');
$anno=mysql_result($res,$i,'anno');
$regia=mysql_result($res,$i,'regia');
$categorie=mysql_result($res,$i,'categorie');
$supporto=mysql_result($res,$i,'supporto');
$nome_cat=converti_id_cat($categorie,$db);
$testo="select * from movie_img where id_film=$id";
$res2=mysql_query($testo,$db);
$num2=mysql_num_rows($res2);
$dcolor = ($a == 0 ? $dcolor_A : $dcolor_B);
//echo "<tr><td>$id - $titolo</td>";
switch ($tipo_elenco){
case 0:
echo "<tr bgcolor=$bgcolor3>";
if ($num2>0){
echo "<td><img src='grafica/film.gif'></td>";
}else
echo "<td> </td>";
echo "<td colspan=5 border=1 bordercolor='$bordercolor1' align='center'>$titolo</td>";
echo "<td><a href='$PHP_SELF?page=elenchi\scheda.php&id_film=$id'>"._SCHEDA."</a></td>";
echo "</tr>";
echo "<tr bgcolor=$bgcolor2>";
echo "<td>$id</td>";
echo "<td align=center>$durata</td>";
echo "<td>$nome_cat</td>";
echo "<td>$anno</td>";
echo "<td>$regia</td>";
echo "<td>$supporto</td>";
if ($livello==1 or $livello==10)
{
echo "<td><a href='$PHP_SELF?page=inserimento\modifica_film.php&id_film=$id&invia="._MODIFICA."'>"._MODIFICA."</a></td>";
}else
echo "<td> </td>";
echo "</tr>";
echo "<tr height=4></tr>";
break;
case 1:
echo "<tr bgcolor=$bgcolor3 height='10'>";
if ($num2>0){
$nome_img=mysql_result($res2,0,'nome_file');
$pos=strrpos($nome_img,".");
$len=strlen($nome_img)-$pos-1;
$estensione=substr($nome_img,($pos+1),$len);
$senza_ext=substr($nome_img,0,$pos);
$percorso_tmb=LOGICAL_PATH."/".$id."/".$senza_ext.THUMB_NAME.".jpg";
$percorso_high=LOGICAL_PATH."/".$id."/".$nome_img;
echo "<td rowspan='4' align='center' border=1 bordercolor='$bordercolor2'>";
echo "<IMG id=mCover src=\"$percorso_tmb\" width=95 border=0>";
echo "</td>";
}else
echo "<td rowspan='4'> </td>";
echo "<td height='12' colspan=4><font size='+1'>$titolo</font></td>";
echo "<td><a href='$PHP_SELF?page=elenchi/scheda.php&id_film=$id'>"._SCHEDA."</a></td>";
echo "</tr>";
echo "<tr height='10' bgcolor=$bgcolor2>";
//echo "<td>$id</td>";
echo "<td align=center>$durata</td>";
echo "<td>$nome_cat</td>";
echo "<td>$anno</td>";
echo "<td>$regia</td>";
if ($livello==1 or $livello==10)
{
echo "<td><a href='$PHP_SELF?page=inserimento/modifica_film.php&id_film=$id&invia="._MODIFICA."'>"._MODIFICA."</a></td>";
}else
echo "<td> </td>";
echo "</tr>";
echo "<tr bgcolor=$bgcolor2>";
echo "<td align=center>Id: $id</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td>"._SUPPORTO." : $supporto</td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr bgcolor=$bgcolor2>";
echo "<td colspan='5'> </td>";
echo "</tr>";
echo "<tr height=16></tr>";
break;
}
$a = ($dcolor == $dcolor_A ? 1 : 0);
}
CloseTable();
}
?>