include getenv("DOCUMENT_ROOT")."/omdb/omdb.php"; ?>
$PROTECT=new protect(0);
$USER=$PROTECT->USER;
$navPath=array("search");
$ss=new songs(1);
$ss->makeOptions($songid);
$artists=new artists(0);
$artists->assnGet();
$artists->makeOptions($band);
$aats=new artistassntypes(1);
$aats->makeOptions($band_assntype);
$ppl=new people(0);
$ppl->sitinGet();
$ppl->extraDefs();
$ppl->optionTextField="lastnamefirst";
$ppl->makeOptions($sitin_person);
$instrs=new instruments(0);
$instrs->sitinGet();
$instrs->makeOptions($sitin_instr);
?>
include getenv("DOCUMENT_ROOT")."/inc/header.php"; ?>
Enter your search criteria below. You can use one or both of the date fields to select an open ended or closed ended date range, select a song that was played, or restrict the search to particular venues or locations.
$shows=new shows();
$o=new base();
if($action=="search") {
if($USER->loggedin) {
$USER->getShows();
$USER->getRecordings();
}
$tables=array("shows s");
$whereItems=array();
$vs=new venues(1);
if($date_low!="" && $date_low!="yyyy-mm-dd") {
$whereItems[]="s.showdate >= '".$date_low."'";
$querystr.="&date_low=".$date_low;
}
if($date_high!="" && $date_high!="yyyy-mm-dd") {
$whereItems[]="s.showdate <= '".$date_high."'";
$querystr.="&date_high=".$date_high;
} else {
$whereItems[]="s.showdate < '".date("Y-m-d")."'";
}
if($notes!="") {
$whereItems[]="s.notes like'%".$o->valesc($notes,"'")."%'";
$querystr.="¬es=".$notes;
}
if($venue!="") {
$tables[]="venues";
$whereItems[]="venues.id=s.venue";
$whereItems[]="venues.name like'%".$o->valEsc($venue,"'")."%'";
$querystr.="&venue=".$venue;
}
if($recording=="1") {
$whereItems[]="(s.archiveorgurl != '' or s.livedownloadurl != '')";
$querystr.="&recording=".$recording;
}
if($recording=="0") {
$whereItems[]="s.archiveorgurl = ''";
$whereItems[]="s.livedownloadurl = ''";
$querystr.="&recording=".$recording;
}
if($poster=="1") {
$whereItems[]="(s.posterfullurl != '' or s.posterthumburl != '')";
$querystr.="&poster=".$poster;
}
if($sitin_person!="" || $sitin_instr!="") {
$tables[]="show_person as sp";
if($sitin_person!="" && $sitin_instr!="") {
$whereItems[]="(sp.showid=s.id and (sp.personid='".$sitin_person."' ".$sitin_andor." sp.instrumentid='".$sitin_instr."'))";
}
if($sitin_person!="" && $sitin_instr=="") {
$whereItems[]="sp.showid=s.id and sp.personid='".$sitin_person."'";
}
if($sitin_person=="" && $sitin_instr=="") {
$whereItems[]="sp.showid=s.id and sp.instrumentid='".$sitin_instr."'";
}
$querystr.="&sitin_person=".$sitin_person;
$querystr.="&sitin_andor=".$sitin_andor;
$querystr.="&sitin_instr=".$sitin_instr;
}
if($band!="" || $band_assntype!="") {
$tables[]="artists_shows as ats";
$whereItems[]="ats.showid=s.id";
if($band!="") {
$whereItems[]="ats.artistid=".$band;
}
if($band_assntype!="") {
$whereItems[]="ats.assntype=".$band_assntype;
}
$querystr.="&band=".$band;
$querystr.="&artist_assntype=".$artist_assntype;
}
if($poster=="0") {
$whereItems[]="s.posterfullurl = ''";
$whereItems[]="s.posterthumburl = ''";
$querystr.="&poster=".$poster;
}
if(count($songid) and !empty($songid[0])) {
$tables[]="showsets";
$tables[]="setsongs";
$whereItems[]="showsets.showid=s.id";
$whereItems[]="setsongs.showset=showsets.id";
foreach($songid as $sid) {
$whereItems[]="setsongs.song = $sid";
$querystr.="&songid[]=".$sid;
}
}
if($state!="") {
if(!in_array("venues",$tables)) { $tables[]="venues"; }
if(!in_array("venues.id=s.venue",$whereItems)) { $whereItems[]="venues.id=s.venue"; }
$whereItems[]="venues.state='$state'";
$querystr.="&state=".$state;
}
if(count($whereItems)) {
$whereClause=" where ".join(" and ",$whereItems);
}
$sql = "select s.* from ".join(", ",$tables).$whereClause.";";
$rs=new rs($sql);
$rs->popRecords("id");
$shows->rsToObj($rs);
$shows->withsitins=array();
if($shows->numItems>0) {
$rs=new rs("select distinct(showid) from show_person where showid in (".join(",",array_keys($shows->items)).")");
$rs->popRecords("showid");
$shows->withsitins=$rs->keys;
}
if(empty($sortCol) && !isset($noinsert)) {
$saveSearch=new mbsearch();
$saveSearch->mbnid=$USER->id;
$saveSearch->querystr=getenv("QUERY_STRING");
$saveSearch->created=date("Y-m-d H:i:s");
$saveSearch->searchtype="1";
$saveSearch->status="1";
$OMDBMQGPC=0;
$saveSearch->insert();
$OMDBMQGPC=1;
}
$sortCol=empty($sortCol)?"dates":$sortCol;
$sortDir=empty($sortDir)?"r":$sortDir;
?>
| = $shows->numItems; ?> shows= !empty($y)?" in ".$y:""; ?> |
} // end of search routine ?>
include getenv("DOCUMENT_ROOT")."/inc/footer.php"; ?>