Location: PHPKode > projects > OPACIAL > opacial_v1-2/scan.php
<html>
		<head>
		<title>OPACIAL - Library & Information Service, Panteion University</title>
	  <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
	  <LINK REL='StyleSheet' HREF='style_opac.css' TYPE='text/css'>
	</head>
	<body>
		
<?php
/* 
 * OPACIAL - v.1.2
 * Copyright 2008 Library & Inormation Service, Panteion University
 * Analysis/Development: Dimitris Gavrilis (hide@address.com)
  * Licensed under the Academic Free License version 3.0
*/

require_once "config.php";
require_once "lib/Z3950.inc";
require_once "lib/Social.inc";
require_once "lib/Pandemos.inc";
require_once "lib/Lang.inc";
echo "<script src=\"ajax.js\" type=\"text/javascript\"></script>";

error_reporting(0);

$catalog 	= 1;
if(isset($_GET[catalog])) $catalog = $_GET[catalog];
if(isset($_POST[catalog])) $catalog = $_POST[catalog];

$search_field	= 1;
if(isset($_GET[search_field])) $search_field = $_GET[search_field];
if(isset($_POST[search_field])) $search_field = $_POST[search_field];

$search_field2	= 1;
if(isset($_GET[search_field2])) $search_field2 = $_GET[search_field2];
if(isset($_POST[search_field2])) $search_field2 = $_POST[search_field2];

$search_field3	= 1;
if(isset($_GET[search_field3])) $search_field3 = $_GET[search_field3];
if(isset($_POST[search_field3])) $search_field3 = $_POST[search_field3];

$view 		= 1;
if(isset($_GET[view])) $view = $_GET[view];
if(isset($_POST[view])) $view = $_POST[view];

$language = "el";
if(isset($_GET[language])) $language = $_GET[language];
if(isset($_POST[language])) $language = $_POST[language];

$numhits 		= 10;
if(isset($_GET[numhits])) $numhits = $_GET[numhits];
if(isset($_POST[numhits])) $numhits = $_POST[numhits];

$query = "";
if(isset($_GET[query])) $query = $_GET[query];
if(isset($_POST[query])) $query = $_POST[query];

$query2 = "";
if(isset($_GET[query2])) $query2 = $_GET[query2];
if(isset($_POST[query2])) $query2 = $_POST[query2];

$query3 = "";
if(isset($_GET[query3])) $query3 = $_GET[query3];
if(isset($_POST[query3])) $query3 = $_POST[query3];

$bool_field1 = "";
if(isset($_GET[bool_field1])) $bool_field1 = $_GET[bool_field1];
if(isset($_POST[bool_field1])) $bool_field1 = $_POST[bool_field1];

$bool_field2 = "";
if(isset($_GET[bool_field2])) $bool_field2 = $_GET[bool_field2];
if(isset($_POST[bool_field2])) $bool_field2 = $_POST[bool_field2];

$page 		= 1;
if(isset($_GET[page])) $page = $_GET[page];
if(isset($_POST[page])) $page = $_POST[page];

$op		 		= "";
if(isset($_GET[op])) $op = $_GET[op];
if(isset($_POST[op])) $op = $_POST[op];

$scansize	= "20";
if(isset($_GET[scansize])) $scansize = $_GET[scansize];
//if(intval($scansize)<=0 || isset($_POST[scansize])) $scansize=20;

	
$db				= dbConnect($db_host,3306,$db_user,$db_pass,$db_name);
$z 				= yazConnect($db,$catalog);

if($language=="en") require_once "language/lang-en.php";
else require_once "language/lang-el.php";


if($language=="en") $back_img="back_eng.png";
else $back_img="back_gr.png";


echo "<table border=0 cellpadding=0 cellspacing=0 width=650 align=center><tr><td align=right valign=top><a href='index.php?language=$language&catalog=$catalog'><img src='images/logo_sopac.png' border=0></a></td></tr></table>";

	// **********************************************************************
	echo "<table border=0 cellpadding=0 cellspacing=8 width=650 align=center style='border-top: 4px solid #000000; border-bottom: 4px solid #CC3333; border-left: 1px solid #000000; border-right: 1px solid #000000;  background-image: url(images/details_back.png); background-repeat: repeat;'>";
	echo "<tr><td valign=top align=left width=300 colspan=2>&nbsp;&nbsp;"
			."<font class='BoxTagsTitle'>"._INDEX_SCAN_."</font>"
			."</td><td valign=top align=right nowrap><font class='BoxTagsTitle'>"._INDEX_SEARCH_.":</font> "
			."<form name=scan style='display:inline;' method=post action='scan.php?language=$language&catalog=$catalog'>";

	echo "<select name=search_field>";
	$search_fields = getAvailableSearchFields($db,$catalog,$language);
	for($i=0; $i<count($search_fields); $i++) {
		list($id,$field) = $search_fields[$i];
		if($id==$search_field) $sel="SELECTED"; else $sel="";
		echo "<option value=$id $sel>$field</option>";
	}
	echo "</select> ";
		

	echo "<input type=text size=20 id=query name=query value='".$query."' \">"
			//."<input type=hidden name=scansize value='".$scansize."'> "
			."<input type=submit name=submit value='OK'>"
			."</form>&nbsp;&nbsp;</td></tr>";
	echo "<tr><td valign=top align=justify width=300 colspan=3>";
	// **********************************************************************

	$next_scansize = $scansize + 20;
	$prev_scansize = $scansize - 20;
	if($prev_scansize<=20) $prev_scansize=20;
	echo "<table border=0 width=100%>";
	echo "<tr><td valign=top align=left><a href='scan.php?op=results&catalog=$catalog&view=1&language=$language&numhits=$numhits&query=$query&search_field=$search_field&bool_field1=$bool_field1&query2=$query2&search_field2=$search_field2&bool_field2=$bool_field2&query3=$query3&search_field3=$search_field3&scansize=$prev_scansize' style='text-decoration: none;'><img src='images/arrow_left.png' valign=bottom border=0></a></td>";
	echo "<td width=100%></td>";
	echo "<td valign=top align=right><a href='scan.php?op=results&catalog=$catalog&view=1&language=$language&numhits=$numhits&query=$query&search_field=$search_field&bool_field1=$bool_field1&query2=$query2&search_field2=$search_field2&bool_field2=$bool_field2&query3=$query3&search_field3=$search_field3&scansize=$next_scansize' style='text-decoration: none;'><img src='images/arrow_right.png' valign=bottom border=0></a></td></tr>";
	echo "</table>";
  echo "<hr width='592'>";
  echo "<div id='resultsCloud' class='boxAjax'>";

	echo "<table>";

	exec("/export/programs/yaz-3.0.8/client/yaz-client ".getCatalogUrl($db,$catalog)." ".$scansize." ".substr(getFieldValue($db,$search_field),5)." ".fromGreek($query),$output);
	$start_offset = count($output)-20;
	if(strlen($query)==0) $start_offset=0;
	for($i=$start_offset; $i<count($output); $i++) {
		$num=0;
		$outg = trim(toGreek($output[$i]));
		
		if($outg[0]=="*") $outg = substr($outg,1);
		
		$head = "";
		if(strpos($outg,"[See>",0)===0) {
			$outg = substr($outg,5);
			if($language=="en") $head = "[See>"; $head = "[Βλέπε >";
		} else if(strpos($outg,"[See Also>",0)===0) {
			$outg = substr($outg,10);
			if($language=="en") $head = "[See Also>";	$head = "[Βλέπε Επίσης >";
		} else if(strpos($outg,"[See Also Narrower Term]",0)===0) {
			$outg = substr($outg,26);
			if($language=="en") $head = "[See Also Narrower Term]";	$head = "[Βλέπε Επίσης Στενότερος Όρος]";
		} else if(strpos($outg,"[See Also Broader Term]",0)===0) {
			$outg = substr($outg,25);
			if($language=="en") $head = "[See Also Broader Term]"; $head = "[Βλέπε Επίσης Ευρύτερος Όρος]";
		}


		// ----------------------------------	
		if($search_field==1) {		
		
			$parts = explode("--",$outg);
			$body=$parts[0];
			for($j=1; $j<count($parts)-1; $j++) {
				$part = $parts[$j];
				$body = $body ." -- ".$part;
			}

			$foot=$parts[count($parts)-1];
			if(strlen(trim($foot))==0) {
				$num="(0)";
			} else {
				$num_ar = preg_match("/[(]\d+[)]/",$foot,$matches);
				if(count($num_ar)>0) $num = $matches[0];
			}
			$foot = preg_replace("/[(]\d+[)]/","",$foot);

		// ----------------------------------	
		} else if($search_field==3) {

                        $parts = explode("--",$outg);
                        $body=$parts[0];
                        for($j=1; $j<count($parts)-1; $j++) {
                                $part = $parts[$j];
                                $body = $body ." -- ".$part;
                        }

                        $foot=$parts[count($parts)-1];
                        if(strlen(trim($foot))==0) {
                                $num="(0)";
                        } else {
                                $num_ar = preg_match("/[(]\d+[)]/",$foot,$matches);
                                if(count($num_ar)>0) $num = $matches[0];
                        }
                        $foot = preg_replace("/[(]\d+[)]/","",$foot);



		// ----------------------------------	
		} else {

			$parts = explode("--",$outg);
			$part = $parts[0];
			$part = preg_replace("/[(]\d+[)]/","",$part);
			$body=$part;
			for($j=1; $j<count($parts); $j++) {
				$part = $parts[$j];
				$part = preg_replace("/[(]\d+[)]/","",$part);
				$body = $body ." -- ".$part;
			}

			$foot=$parts[count($parts)-1];
			if(strlen(trim($foot))==0) {
				$num="(0)";
			} else {
				$num_ar = preg_match("/[(]\d+[)]/",$foot,$matches);
				if(count($num_ar)>0) $num = $matches[0];
			}
			preg_replace("/[(]\d+[)]/","",$foot);
			$foot="";
			
		}		
		
		
		echo "<tr><td width=100%>"
				."<div style='display: inline; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal;'>".trim($head)."</font></div> "
				."<a href='index.php?op=results&catalog=$catalog&view=1&language=$language&numhits=$numhits&query=".trim(strip_tags($body))."&search_field=$search_field&page=1&structure_type=1' style='font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal;'>".strip_tags($body)."</a></div>"
				."<div style='display: inline; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal;'> -- ".$foot."</div></td>"
				."<td valign=top align=right><div style='display: inline; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal;'>".$num."</div></td></tr>";
	}
	echo "</table>";
  echo "</div>";
  
	
	// **********************************************************************
	echo "</td></tr>";
	echo "<tr><td valign=top align=right width=300 colspan=3 style=''>";
	echo "<a href='cloud.php?catalog=$catalog'><a href='index.php?language=$language&catalog=$catalog' style='text-decoration: none;'><img src='images/$back_img' border=0 alt='"._INDEX_HOME_."'></a>";
	echo "&nbsp;&nbsp;</td></tr>";
	echo "</table>";
	// **********************************************************************


?>

	</body>
</html>
Return current item: OPACIAL