session_start();
include "shared.php";
initialise();
workOutSearchTabs();
?>
insertHead("CRUMB - Search Site");
?>
insertTopBlock("Search CRUMB","Search Site");
?>
| | |
insertContent();
?>
| | | |
| | | | | | |
function insertContent(){
global $searchTerm, $tabBlock, $link_id;
?>
| |
//for two panels data and images/bdase branding ?>
|
|
}
function initialise(){
$_SESSION['lastLoc']=$_SERVER['REQUEST_URI'];
$_SESSION['bref']=$_SERVER['REQUEST_URI'];
if ($_SESSION['searchDisc']==$nothing){
$_SESSION['searchDisc']=1;
}
global $searchTerm, $focus, $searchTermNOSP;
$searchTerm=$_GET['search']." ";
$searchTermNOSP=$_GET['search'];
$_SESSION['searchDisc']=$_GET['searchDisc'];
}
?>
function insertPeopleMenu(){
echo("
");
?>
}
?>
function insertKeywordsMenu(){
?>
//starts again
}
?>
function showSearchQuantities(){
global $countArray, $focus;
$typeArray = array("Interviews","Presentations","Images","Sounds","Videos","Biographies","Downloads","Links","List Postings");
$refArray = array("Interviews","Presentations","images","sounds","videos","biographies","downloads","links","List Postings");
$refArray2 = array("Interview","Presentation","image","sound","video","biography","download","link","List Posting");
$refarrayContent=array("","","","","","","","","",""); //for storing summary
$haveDone=0;
for ($lop=0; $lop<9; $lop++){
if ($countArray[$lop]<>0){
if ($haveDone==1){echo(", ");}
if ($countArray[$lop]==1){
$useRef=$refArray2[$lop];
}else{
$useRef=$refArray[$lop];
}
if ($haveDone==0){
$focus=$typeArray[$lop];
$haveDone=1;
}
echo($countArray[$lop]." ".$useRef);
}
}
}
?>
function showSearchContext($thisString){
global $searchTerm, $searchTermNOSP;
$m=$thisString;
//$m1=str_replace("
", " ",$m);
$m2=str_replace(" > ", " ",$m);
$m=$m2;
$startTerm=strpos($m,$searchTerm);
$origPlace=$startTerm;
$startTerm=$startTerm-20;
$startTerm2=$startTerm;
if($startTerm<1){
$startTerm2=1;
}
$startTerm2=strpos($m," ",$startTerm2);
$endTerm=strpos($m,". ",$origPlace);
if ($endTerm<$startTerm+10){
$endTerm=$endTerm+10;
}
//echo(" $searchTerm $startTerm $endTerm ");
$context=substr($m,$startTerm2, $endTerm-$startTerm2);
$context2=$context;
//$startTerm2=strpos($context2," ",$startTerm2);
//$endTerm=strpos($context2,". ",$origPlace);
if (strpos($context2, "")>0){
$startBody=strpos($context2, "
")+3;
//echo("startbody= $startBody");
$context2=substr($context2,$startBody);
}
$lowerSearch=strtolower($searchTerm);
$lowerSearchNOSP=strtolower($searchTermNOSP);
$context3=str_replace("$searchTerm", "$searchTerm",$context2);
$context4=str_replace("$lowerSearch", "$lowerSearch",$context3);
$context5=str_replace("$searchTermNOSP,", "$searchTermNOSP,",$context4);
$context6=str_replace("$lowerSearchNOSP,", "$lowerSearchNOSP,",$context5);
$context7=str_replace("$searchTermNOSP.", "$searchTermNOSP.",$context6);
$context8=str_replace("$lowerSearchNOSP.", "$lowerSearchNOSP.",$context7);
$context4=$context8;
$context5=str_replace("
", " ",$context4);
if (strLen($context5)>220){
$context5=subStr($context5,1,220);
}
echo("...".strip_tags($context5)."...
");
}
?>
function workOutSearchTabs(){
// WORK OUT SEARCH TABS
$id=$_GET[id];
//get
global $countVal;
global $countArray, $cats, $summary, $searchTerm, $tabBlock;
$tabBlock="$tabBlock >Summary | ";
$countArray = array();
$cats=array();
$discSearchTerm=urlencode($searchTerm);
$refArray = array("interviews","presentations","images","sound","video","bio","downloads","links","discussion");
$typedArray = array("Interviews","Presentations","Images","Sound","Video","Profile","Downloads","Links", "Discussion");
$dbArray=array("CoreDatabase","CoreDatabase","AssetDatabase","AssetDatabase","AssetDatabase","CoreDatabase","AssetDatabase","AssetDatabase","jiscDiscussionDatabase");
$queryArray=array("SELECT COUNT(*) FROM interviewContent WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR transcript LIKE '%$searchTerm%' OR introText LIKE '%$searchTerm%'","SELECT COUNT(*) FROM presentationtable WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR fullT LIKE '%$searchTerm%' OR fragments LIKE '%$searchTerm%' OR keywords LIKE '%searchTerm%'","SELECT COUNT(*) FROM imageDatabase WHERE imageTitle LIKE '%$searchTerm%' OR imageAbstract LIKE '%$searchTerm%' OR imageCredit LIKE '%$searchTerm%'","SELECT COUNT(*) FROM sounddatabase WHERE soundTitle LIKE '%$searchTerm%' OR soundAbstract LIKE '%$searchTerm%' OR soundCredit LIKE '%$searchTerm%'","SELECT COUNT(*) FROM videodatabase WHERE videoTitle LIKE '%$searchTerm%' OR videoAbstract LIKE '%$searchTerm%' OR videoCredit LIKE '%$searchTerm%'","SELECT COUNT(*) FROM peopletable WHERE name LIKE '%$searchTerm%' OR surName LIKE '%$searchTerm%' OR shortBio LIKE '%$searchTerm%' OR longBio LIKE '%$searchTerm%'","SELECT COUNT(*) FROM reportdatabase WHERE reportTitle LIKE '%$searchTerm%' OR reportAbstract LIKE '%$searchTerm%' OR reportCredit LIKE '%$searchTerm%' OR fP LIKE '%$searchTerm%' OR misc LIKE '%$searchTerm%' OR fT LIKE '%$searchTerm%'","SELECT COUNT(*) FROM linktable WHERE linkName LIKE '%$searchTerm%' OR linkShortDesc LIKE '%$searchTerm%' OR linkLongDesc LIKE '%$searchTerm%'","SELECT COUNT(*) FROM jiscdiscussiontable WHERE content LIKE '%$searchTerm%' OR content LIKE '%$discSearchTerm%'");
$queryArrayContent=array("SELECT * FROM interviewContent WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR transcript LIKE '%$searchTerm%' OR introText LIKE '%$searchTerm%'","SELECT * FROM presentationtable WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR fullT LIKE '%$searchTerm%' OR fragments LIKE '%$searchTerm%' OR keywords LIKE '%searchTerm%'","SELECT * FROM imageDatabase WHERE imageTitle LIKE '%$searchTerm%' OR imageAbstract LIKE '%$searchTerm%' OR imageCredit LIKE '%$searchTerm%'","SELECT * FROM sounddatabase WHERE soundTitle LIKE '%$searchTerm%' OR soundAbstract LIKE '%$searchTerm%' OR soundCredit LIKE '%$searchTerm%'","SELECT * FROM videodatabase WHERE videoTitle LIKE '%$searchTerm%' OR videoAbstract LIKE '%$searchTerm%' OR videoCredit LIKE '%$searchTerm%'","SELECT * FROM peopletable WHERE name LIKE '%$searchTerm%' OR surName LIKE '%$searchTerm%' OR shortBio LIKE '%$searchTerm%' OR longBio LIKE '%$searchTerm%'","SELECT * FROM reportdatabase WHERE reportTitle LIKE '%$searchTerm%' OR reportAbstract LIKE '%$searchTerm%' OR reportCredit LIKE '%$searchTerm%' OR fP LIKE '%$searchTerm%' OR misc LIKE '%$searchTerm%' OR fT LIKE '%$searchTerm%'","SELECT * FROM linktable WHERE linkName LIKE '%$searchTerm%' OR linkShortDesc LIKE '%$searchTerm%' OR linkLongDesc LIKE '%$searchTerm%'","SELECT * FROM jiscdiscussiontable WHERE content LIKE '%$searchTerm%' OR content LIKE '%$discSearchTerm%'");
?>
global $bigScore;
$bigScore=0;
$lopTerm=9;
$tabcounter=1;
for ($lop=1; $lop<=$lopTerm; $lop++){
$doShow="F";
$doShow=testQuery2($dbArray[$lop-1], $queryArray[$lop-1], $queryArrayContent[$lop-1], $refArray[$lop-1], $typedArray[$lop-1]);
array_push($countArray, $countVal);
$bigScore=$bigScore+$countVal;
if ($_GET['search']==$nothing){
$doShow="F";
}
if ($doShow=="T"){
array_push($cats, $typedArray[$lop-1]);
//echo("$countVal");
//array_push($countArray, $countVal);
?>
$tabcounter=$tabcounter+1;
//$tabBlock="$tabBlock $typedArray[$lop-1] | >".$typedArray[$lop-1]." ";
if ($tabcounter==2){
$tabcounter=0;
$tabBlock="$tabBlock";
}
?>
}//doshow
}//for
$tabBlock="$tabBlock
";
//
//END OF WORK OUT SEARCH TABS
}
?>
function getPresentations(){
global $searchTerm, $link_id;
selectDatabase("coredatabase");
$sql="SELECT * FROM presentationtable WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR fullT LIKE '%$searchTerm%' OR fragments LIKE '%$searchTerm%' OR keywords LIKE '%searchTerm%'";
$result=mysql_query($sql,$link_id);
while ($row = mysql_fetch_row($result)) {
$presID=$row[0];
//now get seminar collection
$sql2="SELECT * from presentationCollectionTable WHERE presentationCollectionIDs LIKE '%/$presID/%'";
$result2=mysql_query($sql2);
while ($row2 = mysql_fetch_row($result2)) {
// echo("
collection $row2[0]
");
$sql3="SELECT Seminar from seminarpresentationlinks WHERE presentationCollection=$row2[0]";
$result3=mysql_query($sql3,$link_id);
while ($row3 = mysql_fetch_row($result3)) {
// echo("seminar:$row3[0]");
$sID=$row3[0];
}
}
echo("Presentation: $row[2]
");
showSearchContext($row[7]." ".$row[6]." ".$row[1]);
}
}
//ends presentations
?>
function getInterviews(){
global $searchTerm,$link_id;
selectDatabase("coredatabase");
$sql="SELECT * FROM interviewContent WHERE title LIKE '%$searchTerm%' OR keywords LIKE '%$searchTerm%' OR transcript LIKE '%$searchTerm%' OR introText LIKE '%$searchTerm%' ORDER BY date";
// echo($sql);
$result=mysql_query($sql,$link_id);
while ($row = mysql_fetch_row($result)) {
//now find the ordinal position for the left side menu - it is ordered in terms of date
$sql2="SELECT id, date FROM interviewContent ORDER by date";
$result2=mysql_query($sql2,$link_id);
$ord=0;
$ordinal=0;
while ($row2 = mysql_fetch_row($result2)) {
$ordinal=$ordinal+1;
if ($row2[0]==$row[0]){
$ord=$ordinal;
}
}
//$ordinal should now be the number for the side menu
echo("Interview: $row[1]
");
showSearchContext($row[5]." ".$row[4]." ".$row[1]);
}
}
?>
function getProfile(){
global $searchTerm, $link_id;
selectDatabase("coredatabase");
$sql="SELECT * FROM peopletable WHERE name LIKE '%$searchTerm%' OR surName LIKE '%$searchTerm%' OR shortBio LIKE '%$searchTerm%' OR longBio LIKE '%$searchTerm%' ORDER BY surName";
//echo($sql);
$result=mysql_query($sql, $link_id);
while ($row = mysql_fetch_row($result)) {
echo("Profile: $row[1] $row[3] $row[2]
");
showSearchContext($row[7]." ".$row[6]." ");
}
}
?>
function getLinks2(){
global $searchTerm, $link_id;
selectDatabase("assetdatabase");
$sql="SELECT * FROM linktable WHERE linkName LIKE '%$searchTerm%' OR linkShortDesc LIKE '%$searchTerm%' OR linkLongDesc LIKE '%$searchTerm%'";
//echo($sql);
$result=mysql_query($sql, $link_id);
while ($row = mysql_fetch_row($result)) {
echo("Link: $row[1]
$row[3] $row[4]
[$row[2]]
");
//showSearchContext($row[1]." ".$row[2]." ".$row[3]." ".$row[4]);
}
}
?>
function getDownloads(){
global $searchTer, $link_id;;
selectDatabase("assetdatabase");
$sql="SELECT * FROM reportdatabase WHERE reportTitle LIKE '%$searchTerm%' OR reportAbstract LIKE '%$searchTerm%' OR reportCredit LIKE '%$searchTerm%' OR fP LIKE '%$searchTerm%' OR misc LIKE '%$searchTerm%' OR fT LIKE '%$searchTerm%'";
$result=mysql_query($sql);
while ($row = mysql_fetch_row($result)) {
echo("Download: $row[1]
$row[2]
");
//showSearchContext($row[1]." ".$row[2]." ".$row[4]);
}
}
?>
function getSound(){
global $searchTerm, $link_id;
selectDatabase("assetdatabase");
$sql="SELECT * FROM sounddatabase WHERE soundTitle LIKE '%$searchTerm%' OR soundAbstract LIKE '%$searchTerm%' OR soundCredit LIKE '%$searchTerm%'";
$result=mysql_query($sql, $link_id);
while ($row = mysql_fetch_row($result)) {
echo("Sound: $row[1]
");
}
}
?>
function getVideo(){
global $searchTerm, $link_id;
selectDatabase("assetdatabase");
$sql="SELECT * FROM videoDatabase WHERE videoTitle LIKE '%$searchTerm%' OR videoAbstract LIKE '%$searchTerm%' OR videoCredit LIKE '%$searchTerm%'";
$result=mysql_query($sql, $link_id);
while ($row = mysql_fetch_row($result)) {
echo("Video: $row[1] - $row[2]
");
}
}
?>
function getDiscussion(){
global $searchTerm, $link_id;
selectDatabase("jiscdiscussiondatabase");
$discSearchTerm=urlEncode($searchTerm);
if ($searchTerm!=""){
$query="SELECT * FROM jiscdiscussiontable WHERE content LIKE '%$searchTerm%' OR content LIKE '%$discSearchTerm%'";
$res=mysql_query($query, $link_id);
while($row10=mysql_fetch_row($res)){
$m=urlDecode($row10[5]);
$m2=str_replace(" > ", " ",$m);
$m=$m2;
//echo($m);
//get list extract
$startTerm=strpos($m,$searchTerm);
$origPlace=$startTerm;
$startTerm=$startTerm-20;
$startTerm2=$startTerm;
if($startTerm<1){
$startTerm2=1;
}
$startTerm2=strpos($m," ",$startTerm2);
$endTerm=strpos($m,". ",$origPlace);
//echo(" $searchTerm $startTerm $endTerm ");
$context=substr($m,$startTerm2, $endTerm-$startTerm2);
$context2=$context;
//$startTerm2=strpos($context2," ",$startTerm2);
//$endTerm=strpos($context2,". ",$origPlace);
if (strpos($context2, "")>0){
$startBody=strpos($context2, "
")+3;
//echo("startbody= $startBody");
$context2=substr($context2,$startBody);
}
$lowerSearch=strtolower($searchTerm);
$lowerSearchNOSP=strtolower($searchTermNOSP);
$context3=str_replace("$searchTerm", "$searchTerm",$context2);
$context4=str_replace("$lowerSearch", "$lowerSearch",$context3);
$context5=str_replace("$searchTermNOSP,", "$searchTermNOSP,",$context4);
$context6=str_replace("$lowerSearchNOSP,", " $lowerSearchNOSP,",$context5);
$context7=str_replace("$searchTermNOSP.", " $searchTermNOSP.",$context6);
$context8=str_replace("$lowerSearchNOSP.", " $lowerSearchNOSP.",$context7);
$context4=$context8;
$fromSubs=strpos ($m,'');
$fromSube=strpos ($m,'
',$fromSubs+1);
$fromSubBlock=substr($m,$fromSubs, $fromSube-$fromSubs);
$fromSubBlock=str_replace('');
$subend=strpos($m,'
',($substart+1));
$subject=substr($m,$substart, $subend-$substart);
$subs2=strpos($subject,'')+28;
$subj2=substr($subject,$subs2);
$subj2=str_replace('">','', $subj2);
//echo($subj2);
$subs3=strpos($subj2,'">')+2;
//echo($subs3);
$subj3=substr($subj2,$subs3);
//echo("");
$fullBlock="
List Posting: $subj3
$fromSubBlock
".chr(13);
$fullBlock2=str_replace('', "",$fullBlock);
$fullBlock3=str_replace('', "", $fullBlock2);
$summary="$summary $fullBlock3";
$context5=str_replace("
", " ",$context4);
if (strLen($context5)>220){
$context5=subStr($context5,1,220);
}
$summary="$summary...$context5...
";
//$summary="$summary Discussion: $row10[1] $row10[3] $row10[2]
";
//$summary="$summary
function getImages(){
global $searchTerm, $link_id;
$_SESSION['imageViewerBack']=$_SERVER['REQUEST_URI'];
selectDatabase("assetdatabase");
$sql="SELECT * FROM imageDatabase WHERE imageTitle LIKE '%$searchTerm%' OR imageAbstract LIKE '%$searchTerm%' OR imageCredit LIKE '%$searchTerm%'";
// $sql="SELECT * FROM imageDatabase";
echo("
");
//echo($result);
global $projID, $haveFound, $userow, $link_id;
$result=mysql_query($sql,$link_id);
while($userow=mysql_fetch_row($result)){
$caption=$userow[1];
//now get the project
selectDatabase("assetdatabase");
$SQL2="SELECT * FROM imagecollectiontable WHERE imageCollectionIDs LIKE '%/$userow[0]/%'";
//echo($SQL2);
$result2=mysql_query($SQL2, $link_id);
//echo("PROJID=$projID");
//echo("hello");
$thumbWidth=$userow[6];
$thumbHeight=$userow[7];
//echo("a- $thumbWidth $thumbHeight");
if ($thumbWidth>0){
$showThumbHeight=$thumbHeight/($thumbHeight/100);
$showThumbWidth=$thumbWidth/($thumbHeight/100);
//echo("b");
$largeWidth=$userow[8];
$largeHeight=$userow[9];
//echo("a - $thumbWidth $thumbHeight");
//$showLargeHeight=$largeHeight/($largeHeight/100);
//$showLargeWidth=$largeWidth/($largeHeight/100);
$imCount=$imCount+1;
$imsrc=$userow[16];
if($imsrc==""){
$imsrc=$userow[4];
}
?>
| |
$projID=-1;
if ($imCount>2){
$imCount=0;
echo(" |
|
");
}
$imString=subStr($imString, $nextSlash, strLen($imString));
}//closed here both
global $work, $artist;
//echo("
");
?>
//////////////////////////////////////////
} //END OF ONLY DO THIS IF WE HAVE IMAGES
//////////////////////////////////////////
}
?>
function dumpImageCollection(){
global $searchTerm, $link_id;
selectDatabase("assetdatabase");
echo("");
$imCount=1;
$result="SELECT * FROM imageDatabase WHERE imageTitle LIKE '%$searchTerm%' OR imageAbstract LIKE '%$searchTerm%' OR imageCredit LIKE '%$searchTerm%'";
//echo($result);
$sql=mysql_query($result,$link_id);
while($userow=mysql_fetch_row($sql)){
$thumbWidth=120;
$thumbHeight=90;
//echo("$thumbWidth $thumbHeight");
//$showThumbHeight=$thumbHeight/($thumbHeight/90);
//$showThumbWidth=$thumbWidth/($thumbHeight/90);
//$largeWidth=$userow[8];
//$largeHeight=$userow[9];
//echo("$thumbWidth $thumbHeight");
//$showLargeHeight=$largeHeight/($largeHeight/90);
//$showLargeWidth=$largeWidth/($largeHeight/90);
$title=$userow[10];
$imCount=$imCount+1;
$imsrc=$userow[16];
if($imsrc==""){
$imsrc=$userow[4];
}
//echo("seeval is $seekVal
");
?>
| > |
|
if ($imCount>3){
$imCount=1;
echo("
");
}
$imString=subStr($imString, $nextSlash, strLen($imString));
}
echo("
");
//echo("
");
//end now show the images
}
?>