$pageTitle="Search Concepts";
include($_SERVER['DOCUMENT_ROOT'] . "/template/header.php");
//need to see if they submitted a search
$ERROR=false;
$ERROR_MESSAGE="";
$terms="";
$CONCEPT_ID_ARRAY=array();
if($_GET['searchFormTerms']){
$terms=$_GET['searchFormTerms'];
$terms=html_entity_decode($terms);
$terms=ereg_replace("[^A-Za-z0-9 ]", "", $terms);
$wikiTerms=str_replace(" ", "+", $terms);
}
else{
//there was no search submitted so show the form
displaySimpleSearchBox("center", "Perform a New Search");
include($_SERVER['DOCUMENT_ROOT'] . "/template/footer.php");
exit();
}
//check the search values
if(strlen($terms)<=1){
$ERROR=true;
$ERROR_MESSAGE="You must provide a search that is letters and numbers and at least two characters long.";
}
if(!$ERROR){
echo "
\n";
//run the standard conception query
$result=database_query("SELECT *, MATCH(concept, conception) AGAINST('$terms') AS score FROM ConceptsBeta, Authors WHERE MATCH(concept, conception) AGAINST('$terms') AND Authors.conceptID=ConceptsBeta.id AND status=1 ORDER BY score DESC LIMIT 20");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Conceptions (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
//print_r($myrow);
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
if(strlen($myrow[2])>200){
$myrow[2]=substr(strip_tags($myrow[2]),0,200);
$myrow[2]=trim($myrow[2]);
$myrow[2].="...";
}
$searchResultItem=stripslashes("
$concept (
$myrow[5]): $myrow[2]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem
\n";
echo "
\n";
echo "
\n";
echo stripslashes("Author: $myrow[9]
\n");
echo stripslashes("Year: $myrow[5]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
//OLD PLACE FOR RIGHT SIDE COLUMN
//run an author search
$result=database_query("SELECT ConceptsBeta.id, ConceptsBeta.concept, ConceptsBeta.conception, ConceptsBeta.year, Authors.name, ConceptsBeta.status, MATCH(Authors.name) AGAINST('$terms') AS score FROM Authors, ConceptsBeta WHERE MATCH(Authors.name) AGAINST('$terms') AND Authors.conceptID=ConceptsBeta.id AND ConceptsBeta.status=1 ORDER BY score DESC LIMIT 20");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Authors (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
if(strlen($myrow[2])>200){
$myrow[2]=substr(strip_tags($myrow[2]),0,200);
$myrow[2]=trim($myrow[2]);
$myrow[2].="...";
}
$searchResultItem=stripslashes("
$concept (
$myrow[3], $myrow[4]): $myrow[2]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem \n";
echo "
\n";
echo "
\n";
echo stripslashes("Author: $myrow[4]
\n");
echo stripslashes("Year: $myrow[3]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
//run a keyword search
$result=database_query("SELECT ConceptsBeta.id, ConceptsBeta.concept, ConceptsBeta.conception, ConceptsBeta.year, Keywords.keyword, ConceptsBeta.status, MATCH(Keywords.keyword) AGAINST('$terms') AS score FROM Keywords, ConceptsBeta WHERE MATCH(Keywords.keyword) AGAINST('$terms') AND Keywords.conceptID=ConceptsBeta.id AND ConceptsBeta.status=1 ORDER BY score DESC LIMIT 20");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Embedded Concepts (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
if(strlen($myrow[2])>200){
$myrow[2]=substr(strip_tags($myrow[2]),0,200);
$myrow[2]=trim($myrow[2]);
$myrow[2].="...";
}
$searchResultItem=stripslashes("
$concept (
$myrow[3], $myrow[4]): $myrow[2]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem \n";
echo "
\n";
echo "
\n";
echo stripslashes("Year: $myrow[3]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
//run a citation search
$result=database_query("SELECT ConceptsBeta.id, ConceptsBeta.concept, ConceptsBeta.conception, ConceptsBeta.year, Citations.citation, ConceptsBeta.id, ConceptsBeta.status, MATCH(Citations.citation) AGAINST('$terms') AS score FROM Citations, ConceptsBeta WHERE MATCH(Citations.citations) AGAINST('$terms') AND Citations.conceptID=ConceptsBeta.id AND ConceptsBeta.status=1 ORDER BY score DESC LIMIT 20");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Citations (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
$searchResultItem=stripslashes("
$concept (
$myrow[3]). This entry cites: $myrow[4]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem \n";
echo "
\n";
echo "
\n";
echo stripslashes("Year: $myrow[3]
\n");
echo stripslashes("Citation: $myrow[4]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
//run a notes search
$result=database_query("SELECT *, MATCH(notes) AGAINST('$terms') AS score FROM ConceptsBeta WHERE MATCH(notes) AGAINST('$terms') AND status=1 ORDER BY score DESC LIMIT 20");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Notes (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
if(strlen($myrow[2])>200){
$myrow[2]=substr(strip_tags($myrow[2]),0,200);
$myrow[2]=trim($myrow[2]);
$myrow[2].="...";
}
$searchResultItem=stripslashes("
$concept: $myrow[2]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem \n";
echo "
\n";
echo "
\n";
echo stripslashes("Year: $myrow[5]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
//run a year search
$result=database_query("SELECT * FROM ConceptsBeta WHERE (year='%$terms%' OR year LIKE '%$terms%') AND status=1 ORDER BY Concept ASC");
if($result && mysql_num_rows($result)>=1){
//there are results for a conception search, let's show them
echo "
\n";
echo "
Year (" . mysql_num_rows($result) . ")
\n";
while($myrow=mysql_fetch_row($result)){
$CONCEPT_ID_ARRAY[]=$myrow[0];
$concept=ucwords($myrow[1]);
$fullText=$myrow[2];
if(strlen($myrow[2])>200){
$myrow[2]=substr(strip_tags($myrow[2]),0,200);
$myrow[2]=trim($myrow[2]);
$myrow[2].="...";
}
$searchResultItem=stripslashes("
$concept ($myrow[5]): $myrow[2]\n");
//now we generate the code for the pop up boxes
echo "
";
echo " $searchResultItem \n";
echo "
\n";
echo "
\n";
echo stripslashes("Year: $myrow[5]
\n");
echo "
\n";
echo stripslashes("Conception: $fullText
\n");
echo "
\n\n\n";
}
echo "
\n";
}
}
else{
//there was a problem
echo "
Search Failure
\n";
echo "
There was a problem: $ERROR_MESSAGE
\n";
}
echo "
\n";
displaySimpleSearchBox("center", "Perform a New Search");
echo "
\n";
echo "
\n";
//this is the right column of the search results layout
echo "