Location: PHPKode > scripts > AmaroK Web Frontend > obsidianmusic-2.3.0/pages/year.php
<?php

//
//  ObsidianMusic
//   a.k.a. amaroK Web Frontend 2.0
//
//  Created 1/1/06
//   Copyright (C) Ryan Loebs (ObsidianX) 2005/2006
//   See LICENSE for GPL
//
//  year.php - Search according to year
//
///////////////////////////////////////

if(eregi("year.php", $_SERVER['PHP_SELF'])){
	die("Cannot access directly.");
}

// Load up the years
$yq = getquery("getyears");
$years = query($yq);

while($year = fetch_assoc($years)){
	if($year['name'] != "" && $year['name'] > 999){
		$yeara[] = array('yid' => $year['id'],
				  'year' => $year['name']);
	}
}


if(isset($_GET['year'])) {
	$currentyn = fetch_assoc(query(getquery("getyname", $sort, addslashes($_GET['year']))));
	$currentyn = $currentyn['name'];
}else{
	$currenty = $yeara[0]['yid'];
	$currentyn = $yeara[0]['year'];
}

// Make the option box select the year thats currently being viewed by default
foreach($yeara as $key=>$value){
	if($value['yid'] == $currenty){
		$yeara[$key]['selected'] = "SELECTED";
	}
}

// Actual searching
$q = query(getquery("year", $sort, $currenty));

$rows = getSongArray($q);

$tpl->setAttribute("songs", "src", "year.tpl");

$tpl->addVar("songs", "select", _SELECT);
$tpl->addVar("songs", "year_locale", _YEAR);
$tpl->addVar("songs", "year", $currentyn);
$tpl->addVar("root", "title", _PG_YEAR);
$tpl->addVar("songs", "page", _PG_YEAR);

$tpl->addRows("years", $yeara);
$tpl->addRows("row", $rows);
Return current item: AmaroK Web Frontend