Location: PHPKode > projects > Music and Discography Database > music_db/album_sheet.php
<?

## Detailed selection output ============================================= >>
#

$r = next_row(); # associative array for album details
    
print "<H1><i>".$r['performer']." - ".$r['title']." ";

if (trim($r['vote'])=='' or $r['vote']==0) $r['vote'] = 1;
if (trim($r['stars'])!='') $stars = round($r['stars']/$r['vote'],2);
else $stars = 0;

$floor = round(($stars-floor($stars))*10);
for($i=0;$i<5;$i++) {
  $last = floor($stars)/1;
  if($i<$last) print "<IMG SRC='icons/favourites-star-SH-16x16.png'>";
  elseif ($floor) {
    #print "<IMG SRC=images/star0$floor.png>";
    print "<IMG SRC='icons/favourites-star-SH-16x16.png'>";
    $floor = 0;
  }
  #else print "<IMG SRC=images/star0.png>";
}


print "</i></H1>
<TABLE CELLPADDING=0 CELLSPACING=0><TR><TD VALIGN=top> 
<FORM NAME=modify METHOD=post ENCTYPE='multipart/form-data'>
<INPUT TYPE=hidden NAME=nexus VALUE=0>
<INPUT TYPE=hidden NAME=id VALUE=\"{$r[album_id]}\">
<TABLE STYLE='width:440px'>
<TR><TD STYLE='background:#a7ada6;width:60px'>Artist</TD>
    <TD><INPUT TYPE=text NAME=performer VALUE=\"".$r['performer']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#a7ada6'>Title</TD>
    <TD><INPUT TYPE=text NAME=title VALUE=\"".$r['title']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#a7ada6'>Year</TD>
    <TD><INPUT TYPE=text NAME=year VALUE=\"".$r['year']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#a7ada6'>Time</TD>
    <TD><INPUT TYPE=text NAME=time VALUE=\"".$r['time']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#a7ada6'>Publisher</TD>
    <TD><INPUT TYPE=text NAME=publisher VALUE=\"".$r['publisher']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#a7ada6' VALIGN=top>Musicans</TD><TD STYLE='padding-left:1px'>
<INPUT TYPE=hidden NAME=musicans>
<TABLE STYLE='background:white;border: solid 1px gray;width:100%'>";

query("SELECT n.musicans_id,name FROM musicans m LEFT JOIN nexus n ON (m.musicans_id=n.musicans_id) WHERE n.album_id={$r[album_id]} GROUP BY n.musicans_id"); 
while ($row = mysql_fetch_assoc($res)) 
{
    print "<TR><TD VALIGN=top><A HREF='?filter=musicans&value={$row[musicans_id]}'>{$row[name]}</A></TD><TD>";
	$row[0] = preg_replace('/\s/','&nbsp;',$row[musicans_id],-1);
    $ires = mysql_query("SELECT name FROM $instruments_table i LEFT JOIN nexus n ON (n.instruments_id=i.instruments_id) WHERE album_id={$r[album_id]} AND musicans_id={$row[musicans_id]}",$ID);
    $iname = '';
    while ($irow = mysql_fetch_assoc($ires))
    {
        $iname .= $irow[name].',';
    }
    $iname = preg_replace('/,$/','',$iname);
    print "$iname</TD></TR>";
}
print "</TABLE>";
if (isset($inlogin)) print "<INPUT TYPE=button VALUE='Edit' OnClick='EditNexus(".$r['album_id'].")' CLASS=button>";
print "</TD></TR>";
if (isset($inlogin)) print "
<TR><TD STYLE='background:#a7ada6' ROWSPAN=2>Cover</TD><TD>file: <INPUT NAME=cover TYPE=file></TD></TR>
<TR><TD>url: <INPUT NAME=coveru TYPE=text STYLE='width:90%'></TD></TR>";

print "
<TR><TD STYLE='background:#6682aa'>Genre</TD>
    <TD><INPUT TYPE=text NAME=genre VALUE=\"".$r['genre']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#6682aa'>Rating</TD>
    <TD><SPAN STYLE='background:white;padding:4 2 4 2'>$stars</span>&nbsp;&nbsp;
            <SELECT NAME=stars><OPTION value=0>&nbsp; n/a &nbsp;</OPTION>";
			$i = 1;
			while ($i<5) {
				printf ("<OPTION>%01.1f</OPTION>",$i);
				$i += 0.1;
			} 
            print "</SELECT></TD></TR>";

if (isset($inlogin)) print "
<TR><TD COLSPAN=2><DIV STYLE='height:4px'></DIV></TD></TR>
<TR STYLE='background:#989568'><TD STYLE='font-size:10px' COLSPAN=2><b>On my shelf</b></TD></TR>
<TR><TD STYLE='background:#989568'>Type</TD>
    <TD><INPUT TYPE=text NAME=type VALUE=\"".$r['format']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#989568'>Quality</TD>
    <TD><INPUT TYPE=text NAME=quality VALUE=\"".$r['quality']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#989568'><ABBR TITLE='Catalog Number'>Cat.No.</ABBR></TD>
    <TD><INPUT TYPE=text NAME=disk VALUE=\"".$r['storage']."\" STYLE='width:100%'></TD></TR>
<TR><TD STYLE='background:#989568'>Comment</TD>
    <TD><INPUT TYPE=text NAME=log VALUE=\"".$r['comment']."\" STYLE='width:100%'></TD></TR>";
print "</TABLE>";
if (isset($RFROM)) print "<INPUT TYPE=hidden NAME=FROM VALUE=$RFROM>";
print "
<DIV STYLE='margin-top:20px;margin-left:70px'>
<INPUT TYPE=submit NAME=deselect VALUE='          Back          '> ";
if (isset($inlogin)) print "
<INPUT TYPE=submit NAME='modify' VALUE='      Modify      ' STYLE='border:1px solid orange'> 
<INPUT TYPE=submit NAME='delete' VALUE=' Delete ' STYLE='border:1px solid red'> ";
print "
</DIV>
</FORM></TD><TD VALIGN=top STYLE='padding-left:12px;color:white'>
            <IMG SRC='images.php?img={$r['album_id']}' STYLE='border:1px solid gray;padding:1px'>";

## One STEP Frame -------------------------------------------------------
#
query("SELECT musicans_id FROM nexus WHERE album_id={$r['album_id']}");
if ($nur) {
  $ms = '';
  for ($i=0;$i<$nur;$i++) {
    $rv = mysql_fetch_row($res);
    $ms .= "m.musicans_id=$rv[0] OR ";
  }
  $ms = preg_replace("/ OR $/","",$ms);
  query("SELECT a.album_id
       FROM album a,nexus n LEFT JOIN musicans m ON (n.musicans_id=m.musicans_id) 
       WHERE a.album_id!={$r['album_id']} AND ($ms) AND n.album_id=a.album_id 
	   GROUP BY a.album_id,a.performer,a.title");
  $ostd = array();
  for ($i=0;$i<$nur;$i++) {
	$rp = next_row();
	array_push($ostd,$rp['album_id']);
  }
  print "<P>One step connections with <B>$nur</B> other albums:<P><FORM METHOD=post>";

  query("SELECT a.album_id,performer,title,m.name 
       FROM album a,nexus n 
       LEFT JOIN musicans m ON (m.musicans_id=n.musicans_id)
       WHERE a.album_id!={$r['album_id']} AND ($ms) AND n.album_id=a.album_id 
	   ORDER BY performer,title");
  
  $lid = '';
  $write = TRUE;
  $line = '';
  for ($i=0;$i<$nur;$i++) {
    $rs = mysql_fetch_row($res);
	if ($lid != $rs[0]) {
		print $line;
		$linehead = $rs[3];
		$line = "<BUTTON NAME=select VALUE=$rs[0] STYLE='border:none;background:transparent;color:orange;padding:0;margin-right:5px;cursor:pointer;cursor:hand' OnClick='this.form.submit()'>view</BUTTON><ABBR TITLE='$linehead'>$rs[1] - $rs[2]</ABBR><BR>";			
	} else {
		$linehead .= ", ".$rs[3];
		$write = FALSE;
		$line = "<BUTTON NAME=select VALUE=$rs[0] STYLE='border:none;background:transparent;color:orange;padding:0;margin-right:5px;cursor:pointer;cursor:hand' OnClick='this.form.submit()'>view</BUTTON><ABBR TITLE='$linehead'>$rs[1] - $rs[2]</ABBR><BR>";
	}
	$lid = $rs[0];
  }
	if (!$WRITE) print $line;
}
?>
	</FORM>
</TD></TR></TABLE>
<DIV STYLE='background-color:#FFA800;height:2px;border-top:1px solid gray'></DIV>
<?php
## Distance matrix ----------------------------------------------------------------
#
if (isset($ostd)) {
	$rid = $r['id'];
/*	if (isset($graf) and $graf!=$rid)
		include("./graf.cgi?albumid=$rid&graf=$graf");
	else
		virtual("./graf.cgi?albumid=$rid");
*/	//include('dist-matrix.php');
}

#++++++++++ End of Distance Matrix

?>
Return current item: Music and Discography Database