⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fetchdetailed.class.php

📁 开源MARC数据处理
💻 PHP
字号:
<?php
/*m 30 2004	[] I have seen again the source of this file after almost 2 years of evaluating this software.	[] my goal, to convert this in postgresql so that everyone i have no worries when it comes to 	millions of records searching.apr 2, 2004	[] here i am again, playing with those memories again. kidding	[] time to program again. 	[] my goal, to convert the looks to pythonic view.	[] hope to use smarty after all these postgresql changes.	[] all libraries has been converted into class based filenamesapr 3 ,2004	[] checking the holdings, fetchdetailed was done last night	*/

Class FetchDetailed
	{	// why is this webpac still.	// confusing	function FetchDetailed() 		{		// Constructor		// Initialize attributes		$this->pol = '';		$this->tbl = '';		$this->dbc = '';		$this->pml = '';		$this->tpl = '';		$this->usr = '';		$this->web = '';		$this->cat = '';		$this->trn = '';		$this->hld = '';		$this->fdt = '';		$this->_post = array();		$this->_get = array();		$this->_files = array();		}	function SetArgvs($_post=array(), $_get=array(), $_files=array())		{		$this->_post = $_post;		$this->_get = $_get;		$this->_files = $_files;		}	function SetNeededClasses($pol='', $pml='', $tpl='', $usr='', $web='', $cat='', $trn='', $hld='', $fdt='')		{		$this->pol = $pol;		$this->dbc = $this->pol->DBGetConn();		$this->tbl = $this->pol->DBGetTables();		$this->pml = $pml;		$this->tpl = $tpl;		$this->usr = $usr;		$this->web = $web;		$this->cat = $cat;		$this->trn = $trn;		$this->hld = $hld;		$this->fdt = $fdt;		}	function SetTags($tag_name=array(), $tag_defs=array(),$tag_deli=array())		{		$this->tag_name = $tag_name;		$this->tag_defs = $tag_defs;		$this->tag_deli = $tag_deli;		}		
	function fetch_detailed($argvs=array())
		{		// this just shows the detailed information of the book.		$tag_name = $this->tag_name;		$tag_defs = $this->tag_defs;		$tag_deli = $this->tag_deli;		$fetch_detailed = $argvs['fetch_detailed'];		$KeyWords = $argvs['KeyWords'];		$Media = $argvs['Media'];		$Heading = $argvs['Heading'];		$Operator = $argvs['Operator'];		$offset = $argvs['offset'];		$limit = $argvs['limit'];		$total = $argvs['total'];		$marc = $argvs['marc'];		$bakto = $argvs['bakto'];		$mods="catalog_search";
		list($dbconn2) = $this->dbc;		$query = $this->pml->SQLGenerator($argvs,1);		$catid = 1;		$approved = 1;
		$recordSet = $dbconn2->SelectLimit($query,1,$fetch_detailed-1);		if (!$recordSet->EOF) 			{
			list($id, $tmp, $content) = $recordSet->fields;			}
		$recordSet->Close();
		$marc_field_explode = explode(chr(30),$content);
		$marc_field_explode_count = count($marc_field_explode);
		$i = 1;
		$tags_i = 1;
		$marc_fields_count = ((strlen($marc_field_explode[0])-24)/12);
		$cc = 0;
		$rj = 0;
		while ( $i <= $marc_fields_count)
			{
			$tags='';
			$tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0]));
			$tags = substr($tags,$tags_i,3);
			$tag_value = $marc_field_explode[$i];
			$tag_value = ereg_replace(31,"$",$tag_value);
			$tags_i = $tags_i + 12;
			$ktag[$rj] = $tags;
			if(empty($tag_name[$ktag[$rj]])) $tag_name[$ktag[$rj]]='';
			$tag_names[$i] = $tag_name[$ktag[$rj]];
			$tag_content[$i] = $this->pml->convertit($tag_value);
			$tag_name_marc[$i] = $tags;
			$tag_content_marc[$i] = $tag_value;
			$vvname[$i] = $tag_name[$ktag[$rj]];
			$vvvalueplain[$i] = $this->pml->convertit($tag_value);
			$vvvaluemarc[$i] = $tag_value;
			$vvnamemarc[$i] = $tags;
			$i++;
			}
		$showing = ""._PMLSHOWINGPAGE." $fetch_detailed "._PMLOF." $total.";
		$email_print = "Email Print";
		$KeyWords =  stripslashes($KeyWords);
		$KeyWords =  rawurlencode($KeyWords);
		if(empty($newoffset)) $newoffset='';
		$brief = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$offset&total=$total&limit=$limit&marc=$marc\">"._PMLBACKTOBRIEF."</a>";
		$fpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=1&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLFIRSTPAGE."</a>";
		$lpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$total&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLLASTPAGE."</a>";
		$bottom = "<a name=\"Top\"><a href=\"#Bottom\">"._PMLBOTTOM."</a></a>";
		$top = "<a name=\"Bottom\"><a href=\"#Top\">"._PMLTOP."</a></a>";
		$labeled = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=\">"._PMLLABELEDVIEW."</a>";
		$marced = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=1\">"._PMLMARCVIEW."</a>";
		if($fetch_detailed==1) 			{ 			$prev=""._PMLPREV.""; 			} 		else
			{
			$fetch_detailed_prev = $fetch_detailed-1;
			$prev = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed_prev&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLPREV."</a>";
			}
		if($fetch_detailed==$total) 			{ 			$next=""._PMLNEXT.""; 			} 		else
			{ 
			$fetch_detailed_next = $fetch_detailed+1;
			$next = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed_next&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLNEXT."</a>"; 
			}
		$_view = ""._PMLDETAILEDVIEW.""; $_current_label = $marced;
		if(!empty($marc)) 			{ 			$_view = ""._PMLMARCVIEW.""; $_current_label = $labeled; 			}
		$bgcolor3 = $this->pml->bgcolor3();
		$bgcolor2 = $this->pml->bgcolor2();
		$bgcolor1 = $this->pml->bgcolor1();
		if(empty($marc)) 			{
			$vvvname = $vvname; 
			$vvvalue = $vvvalueplain;  
			$cvvvname =  count($vvvname);
			$ii=0; $ij=0;
			global $display_undefined;
			while($ii<=$cvvvname)
				{
				if(empty($vvvname[$ii])) { $vvvname[$ii]=''; }
				if(empty($vvvalue[$ii])) $vvvalue[$ii]='';
				if($vvvalue[$ii]) 					{ 
					if($display_undefined[1]) 						{
						if(!$vvvname[$ii]) $vvvname[$ii] = $display_undefined[2];
						$result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++;
						} 					else 						{
						if($vvvname[$ii]) { $result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++;  }
						}
					}
				$ii++;
				}
				$widthl = "20%";
				$widthr = "80%";
			} 		else 			{
			$widthl = "5%";
			$widthr = "95%";
			$vvvname = $vvnamemarc; 
			$vvvalue = $vvvaluemarc; 
			$cvvvname = count($vvvname)+1;
			$ij=0;
			for($ii=0;$ii<$cvvvname;$ii++)
				{
				if(empty($vvvname[$ii])) $vvvname[$ii] = '';
				if(empty($vvvalue[$ii])) $vvvalue[$ii]='';
				if($vvvname[$ii]) { $result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++; }
				}
			}
		$varStatic = "table1";
		$varDynamic = "loop";
		$template = $this->tpl->LoadTemplate($this->pol->GetModuleURI().'templates/detailed.html');
		$vars = array("pol::bgcolor1","pol::bgcolor2","pol::bgcolor3",
				"pol::view","pol::fpage","pol::prev",
				"pol::next","pol::lpage","pol::bottom",
				"pol::currentlabel","pol::brief","pol::showing",
				"pol::widthl","pol::widthr","pol::top"
				);
		$vals = array("$bgcolor1","$bgcolor2","$bgcolor3",
				"$_view","$fpage","$prev",
				"$next","$lpage","$bottom",
				"$_current_label","$brief","$showing",
				"$widthl","$widthr","$top"
				);
		$template = $this->tpl->ReplaceStatic($template, $vars, $vals);
		$vars = array("pol::marc","pol::description");
		$template = $this->tpl->DynamicRows($template, $varStatic, $varDynamic, $vars, $result);
		$template = "<br>".$template;
	return array($id, $template);
	} 
	function fetch_one($bibid="")
		{
		global $accno;
		$tag_name = $this->tag_name;		$tag_defs = $this->tag_defs;		$tag_deli = $this->tag_deli;
		list($dbconn) = $this->pol->DBGetConn();
		$sql = "SELECT id, data, mattype FROM marc where id=".$bibid." ";		$recordSet = $dbconn->Execute($sql);		$approved=1;
		if (!$recordSet->EOF) 			{
			list($id, $content, $catid) = $recordSet->fields;
			}
		$recordSet->Close();
		$marc_field_explode = explode(chr(30),$content);
		$marc_field_explode_count = count($marc_field_explode);
		$i = 1;
		$tags_i = 1;
		$marc_fields_count = ((strlen($marc_field_explode[0])-24)/12);
		$cc = 0;
		$rj = 0;
		while ( $i <= $marc_fields_count)
			{
			$bib = $bibid;
			$tags = substr($marc_field_explode[0],23,strlen($marc_field_explode[0]));
			$tags = substr($tags,$tags_i,3);
			$tag_value = $marc_field_explode[$i];
			$tag_value = ereg_replace(31,"$",$tag_value);
			$tags_i = $tags_i + 12;
			$ktag[$rj] = $tags;
			$tag_names[$i] = $tag_name[$ktag[$rj]];
			$tag_content[$i] = $this->pml->convertit($tag_value);
			$tag_name_marc[$i] = $tags;
			$tag_content_marc[$i] = $tag_value;
			$vvname[$i] = $tag_name[$ktag[$rj]];
			$vvvalueplain[$i] = $this->pml->convertit($tag_value);
			$vvvaluemarc[$i] = $tag_value;
			$vvnamemarc[$i] = $tags;
			$i++;
			}
		$showing = ""._PMLSHOWINGPAGE." $fetch_detailed "._PMLOF." $total.";
		$email_print = "Email Print";
		$brief = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$offset&total=$total&limit=$limit&marc=$marc\">"._PMLBACKTOBRIEF."</a>";
		$fpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=1&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLFIRSTPAGE."</a>";
		$lpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$total&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLLASTPAGE."</a>";
		$bottom = "<a name=\"Top\"><a href=\"#Bottom\">"._PMLBOTTOM."</a></a>";
		$top = "<a name=\"Bottom\"><a href=\"#Top\">"._PMLTOP."</a></a>";
		$labeled = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=\">"._PMLLABELEDVIEW."</a>";
		$marced = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=1\">"._PMLMARCVIEW."</a>";
		if($fetch_detailed==1) { $prev=""._PMLPREV.""; } else
			{
			$fetch_detailed_prev = $fetch_detailed-1;
			$prev = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed_prev&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLPREV."</a>";
			}
		if($fetch_detailed==$total) 			{ 			$next=""._PMLNEXT.""; 			} 		else
			{ 
			$fetch_detailed_next = $fetch_detailed+1;  	        
			$next = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."fetch_detailed=$fetch_detailed_next&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit&marc=$marc\">"._PMLNEXT."</a>"; 
			}
		$_view = ""._PMLDETAILEDVIEW.""; $_current_label = $marced;
		if(!empty($marc)) { $_view = ""._PMLMARCVIEW.""; $_current_label = $labeled; }
		$bgcolor3 = $this->pml->bgcolor3();
		$bgcolor2 = $this->pml->bgcolor2();
		$bgcolor1 = $this->pml->bgcolor1();
		if(empty($marc)) {
			$vvvname = $vvname; 
			$vvvalue = $vvvalueplain;  
			$cvvvname =  count($vvvname);
			$ii=0; $ij=0;
			global $display_undefined;
			while($ii<=$cvvvname)
				{
				if(empty($vvvname[$ii])) { $vvvname[$ii]=''; }
				if(empty($vvvalue[$ii])) $vvvalue[$ii]='';
				if($vvvalue[$ii]) 					{ 
					if($display_undefined[1]) 						{
						if(!$vvvname[$ii]) $vvvname[$ii] = $display_undefined[2];
						$result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++;
						} 					else 						{
						if($vvvname[$ii]) { $result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++;  }
						}
					}
				$ii++;
				}
			$widthl = "20%";
			$widthr = "80%";
			} 		else 			{
			$widthl = "5%";
			$widthr = "95%";
			$vvvname = $vvnamemarc; 
			$vvvalue = $vvvaluemarc;
			$cvvvname = count($vvvname)+1;
			$ij=0;
			for($ii=0;$ii<$cvvvname;$ii++)
				{ 
				//print $ij;
				if($vvvname[$ii]) { $result[$ij] = array($vvvname[$ii],$vvvalue[$ii]); $ij++; }
				}
			}
		$varStatic = "table1";
		$varDynamic = "loop";
		$template = $this->tpl->LoadTemplate($this->pol->GetModuleURI().'templates/detailed.html');
		$vars = array("pol::bgcolor1","pol::bgcolor2","pol::bgcolor3",
				"pol::view","pol::fpage","pol::prev",
				"pol::next","pol::lpage","pol::bottom",
				"pol::currentlabel","pol::brief","pol::showing",
				"pol::widthl","pol::widthr","pol::top"
				);
				
		$vals = array("$bgcolor1","$bgcolor2","$bgcolor3",
				"$_view","<b>Bibliographic Description of Accession No.</b>","<b>$accno</b>",
				"$nexts","$lpages","",
				"$_current_labels","$briefs","$showings",
				"$widthl","$widthr","$tops"
				);
		$template = $this->tpl->ReplaceStatic($template, $vars, $vals);
		$vars = array("pol::marc","pol::description");
		$template = $this->tpl->DynamicRows($template, $varStatic, $varDynamic, $vars, $result);
		$template = $template;
		return $template;
		}
	} 
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -