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";
}
?>