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

📄 webpac.class.php

📁 开源MARC数据处理
💻 PHP
字号:
<?php/*m-21-2004	[]Started the hopefully to be finished new version of phpmylibrary using postgresql	[]Searching works ok. Applying it to the fetch detailed class and then implementing	the more that one keyword search sql generator.m-30-2004	[]the link of the title, author and publisher are now combined. This is the solution from the	problem before in which for example there's no title and only author is available, the user 	will not be able to click it.	[]I have worries about the session management which I have planned to convert. 	[]I am worried about the use of this software in windows. But I feel calm when I'm thinking	of sqlite to rescue the windows user. I cannot wait to use the mysql intersect and union function.	My big problem is, when will mysql release that kind of feature. As much as possible I don't want to	be bounded by limitations imposed by popular yet non-complete opensource database.	[]I will be using the following tags for searching, 100 for author search, 245 for title, 500 for notes,	260 for publisher, 630,650,700 for subject search.I will be removing the any search. for the sake of design	i will use any as 630,650,700.	[]searching default is taken from this tags 630.650,700	[]webpac is considered done. at last, proceeding to fetch_detailed.	[] i am adopting the adodb implementation	[] :: has been replaced with ->*/Class Webpac 	{	//Webpac	//Class to that accepts a user query	//it will give the output in an array. Then will convert to HTML	//Author: Polerio Babao III (polerio@users.sourceforge.net)	//Date: October 20, 2002	//cleans		function Webpac() 		{		// 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 GetBriefResult($argvs=array()) 		{		//GetBriefResult		//Input, keywords, operators, etc.		//Output the result in an array so that its output is not enclosed in HTML		//With this, the programmer can make his/her output in XML, etc.		list($dbconn2) = $this->dbc;		settype($argvs['total'],"integer");		if($argvs['total']==0) 			{			$q = $this->pml->SQLGenerator($argvs,1);			$recordSet = $dbconn2->Execute($q);			$total = $recordSet->RecordCount();			$argvs['total'] = $total;			}		$q = $this->pml->SQLGenerator($argvs,0);
		$recordSet = $dbconn2->Execute($q);
		$cc = array();		$content = array();		$cy=0;		while(!$recordSet->EOF)			{			list($row0, $row1, $row2) = $recordSet->fields;			$cc[$cy] = array($row0, $row2, '1','1','1');			$cy++;			$recordSet->MoveNext();			}		$recordSet->Close();				$fieldcontent = $cc;		$rs2array['fieldcontent'] = $fieldcontent;		$rs2array['argvs'] = $argvs;		return $rs2array; 		}	}Class Webpac_html extends Webpac 	{	//Webpac_html	//Class to that accepts a user query	//it will give the output in an array. Then will convert to HTML	//Author: Polerio Babao III (polerio@users.sourceforge.net)	//Date: October 20, 2002	function GetBriefResult_html($rs2array) {		//GetBriefResult		//Input, keywords, operators, etc.		//Ouput array of result from db in HTML format		global $conf;		global $pmlconfig;		$argvs = $rs2array['argvs'];		$total = $argvs['total'];		$KeyWords = $argvs['KeyWords'];		$Media = $argvs['Media'];		$Heading = $argvs['Heading'];		$Operator = $argvs['Operator'];		$offset = $argvs['offset'];		$limit = $argvs['limit'];				$msg = $this->pml->Message(_PMLYOURQUERYRESULTS." $total "._PMLMATCHES."</h5></b><br>");		if($total > 0) 			{			if($offset) $msg='';			if($pmlconfig['PnThOver']!=0) 				{				$bgcolor3 = $pmlconfig['bgcolor3'];				$bgcolor2 = $pmlconfig['bgcolor2'];				$bgcolor1 = $pmlconfig['bgcolor1']; 				}			else 				{				global $bgcolor1,$bgcolor2,$bgcolor3;				$bgcolor3 = $bgcolor3;				$bgcolor2 = $bgcolor2;				$bgcolor1 = $bgcolor1; 				}			$fieldcontent = $rs2array['fieldcontent'];			$GetModuleURI = $this->pol->GetModuleURI();			$ca = $this->pol->GetBaseURL().'polerio/inc';			if($this->pol->PostNuke()) $ca = $this->pol->GetBaseURL().'modules/PhpMyLibrary/polerio/inc';			$incl = "<script src=\"$ca/functions.js\" type=\"text/javascript\" language=\"javascript\"></script>";			$Row = $offset + 1;			$Start = $Row;			if($offset+$limit <= $total) 				{				$End = $limit+$offset; 				}			else 				{				$End = $total; 				}			$_user_action = '<input type="text" name="email" value="'._PMLYOUREMAILADDHERE.'">&nbsp;<select name="submit_user_action" onchange="this.form.submit();">';			$_user_action .='<option value="User selected:" selected="selected">'._PMLUSERSELECTED.':</option>				<option value="ZIP MARC" >'._PMLZIPMARC.'</option>				<option value="Print MARC" ONSELECT ="window.open(Header.php)" >'._PMLPRINTMARC.'</option>				<option value="Email MARC" >'._PMLEMAILMARC.'</option>				<option value="ZIP DATA" >'._PMLZIPDATA.'</option>				<option value="Print DATA" >'._PMLPRINTDATA.'</option>				<option value="Email DATA" >'._PMLEMAILDATA.'</option>				</select>&nbsp;&nbsp;';			if($this->pol->SelectGID()==2)				{				$_user_action = '<input type="submit" name="delete_selected" value=Go>&nbsp;&nbsp;<b>Delete Selected Bibliographic Entries!</b>';				}			$bottom = "<a name=\"Top\"><a href=\"";			$bottom .= "#Bottom\">"._PMLBOTTOM."</a></a>";			$top = "<a name=\"Bottom\"><a href=\"";			$top .= "#Top\">"._PMLTOP."</a></a>";			if($offset > 1) 				{				$_fpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=0&total=$total&limit=$limit\">"._PMLFIRSTPAGE."</a>\n";				} 			else 				{				$_fpage = ""._PMLFIRSTPAGE."\n"; 				}			if(!(($offset+$limit) > $total))				{				$_total = (($total-1)-($limit-1));				$_lpage = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$_total&total=$total&limit=$limit\">"._PMLLASTPAGE."</a>\n";				}			else				{				$_lpage = ""._PMLLASTPAGE."\n"; 				}			$offlim = $offset-$limit;			if(($offset > 1) && ( $offlim > 0)) 				{				$prevoffset=$offset-$limit;				$_prev = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$prevoffset&total=$total&limit=$limit\">"._PMLPREV."</a>\n";				}			else				{				$_prev = ""._PMLPREV."\n"; 				}			if(!(($offset+$limit) >= $total)) 				{				$newoffset=$offset+$limit;				$_next = "<a href=\"".$this->pol->GetModuleURL().$this->pol->Med()."KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$newoffset&total=$total&limit=$limit\">"._PMLNEXT."</a>\n";				}			else 				{				$_next = ""._PMLNEXT."\n"; 				}			$_showing = ""._PMLSHOWING." $Start "._PMLTO." $End "._PMLOF." $total";			$_checking = "<a href=\"\" onclick=\"setCheckboxes('tablesForm', true); return false;\">"._PMLCHECKALL."</a>&nbsp;&nbsp;";			$_checking .="<a href=\"\" onclick=\"setCheckboxes('tablesForm', false); return false;\">"._PMLUNCHECKALL."</a>";			$record_no=0;			$g=0;			$KeyWords =  stripslashes($KeyWords);			$KeyWords = rawurlencode($KeyWords);			for($cc=0;$cc<count($fieldcontent);$cc++)				{				$id = $fieldcontent[$cc][0];				$content = $fieldcontent[$cc][1];				$catid = $fieldcontent[$cc][2];				$approved = $fieldcontent[$cc][3];				$marc_field_explode = explode(chr(30),$content);				$marc_field_explode_count = count($marc_field_explode);				$row=0;				$i = 1;				$tags_i = 1;				$author='';				$title='';				$publisher='';				$all_bibid='';				$bibid='';				$marc_fields_count = ((strlen($marc_field_explode[0])-24)/12);				while ( $i <= $marc_fields_count)					{					$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;					$i++;					if($tags == "245")  { $title = $tag_value; }					if($tags == "100")  { $author = $tag_value; }					if($tags == "260")  { $publisher = $tag_value; }					}				$title = $this->pml->convertit($title);				$author = $this->pml->convertit($author);				$publisher = $this->pml->convertit($publisher);				$seek = $Row;				$_link = "<a href=\"";				$_link .= $this->pol->GetModuleURL();				$_link .= $this->pol->Med();				$_link .= "fetch_detailed=$seek&KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$offset&total=$total&limit=$limit\">$title $author $publisher</a>\n";				if($this->pol->SelectGID()==2 || $this->pol->SelectGID()==4 || $this->pol->SessionGetVar('uid')==2) 					{					$bakto = "KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$offset&total=$total&limit=$limit";					$bakto = $this->pml->BackToEncoder($bakto);					$Edit = "<a href=\"";					$Edit .= $this->pol->GetModuleURL();					$Edit .= $this->pol->Med();					$Edit .= "_a=2&EditID=$id&bakto=$bakto\">"._PMLEDIT."</a>\n";					$Delete = "<a href=\"";					$Delete .= $this->pol->GetModuleURL();					$Delete .= $this->pol->Med();					$Delete .= "_a=2&DeleteID=$id&bakto=$bakto\" onclick=\"return confirmLink(this, '"._PMLDELETETHISRECORDNO.". ".$Row."','"._PMLDOYOUREALLYWANTTO."')\">"._PMLDELETE."</a>\n";					}				else					{					$Edit=''; $Delete='';					}				$content = "$_link ";				if($catid==1) { $img="Media_bk.gif"; $nm = _PMLBOOKS;}				elseif($catid==2) { $img="Media_se.gif"; $nm = _PMLSERIALS;}				elseif($catid==3) { $img="Media_mp.gif"; $nm = _PMLMAPS;}				elseif($catid==4) { $img="Media_mu.gif"; $nm = _PMLMUSIC;}				elseif($catid==5) { $img="Media_vm.gif"; $nm = _PMLVIDEOMATERIAL;}				elseif($catid==6) { $img="Media_cf.gif"; $nm = _PMLCOMPUTERFILES;}				elseif($catid==7) { $img="Media_bk.gif"; $nm = _PMLMIXEDMATERIAL;}				elseif($catid==8) { $img="Media_bk.gif"; $nm = _PMLTHESIS;}				$RowColor = $this->pol->useColora();				if(empty($RowColor)) $RowColor = "#ffffff";				$image_url = $this->pol->GetModuleURI()."/images";					$MouseOver = $this->pml->MouseOver();				$mouse = "onmouseover=\"setPointer(this, '".$MouseOver."', '".$RowColor."')\" onmouseout=\"setPointer(this, '".$RowColor."', '".$RowColor."')\"";				$checkboxid = $id;				$imguri = "$image_url/$img";				$imgtype = "$nm";				$detailedresult[$g] = array("$Row","$RowColor","$mouse","$checkboxid","$imguri","$imgtype","$Edit","$Delete","$content");				$g++;				$row++;				$Row++;				$all_bibid = $all_bibid." ".$bibid;				$author="";				$title="";				}			$KeyWords =  stripslashes($KeyWords);			$KeyWords =  rawurldecode($KeyWords);			$RowColor = $this->pol->useColora();			$_view = _PMLBROWSINGRESULTSFROMYOURQUERY.": ".$KeyWords;			$varStatic = "table1";			$varDynamic = "loop";			$getmoduleurl = $this->pol->GetModuleURL();			$getbaseurl = $this->pol->GetBaseURL().'Headers.php';			if($this->pol->PostNuke()) $getbaseurl = $this->pol->GetBaseURL().'modules/PhpMyLibrary/Headers.php';			$target = 'target="otherwin"';			if($this->pol->SelectGID()==2)				{				$target = '';				$KeyWords = $this->wpc_KeyWords;				$getbaseurl  = $this->pol->GetModuleURL();				$getbaseurl .= $this->pol->Med();				$getbaseurl .= "KeyWords=$KeyWords&Media=$Media&Heading=$Heading&Operator=$Operator&offset=$offset&total=$total&limit=$limit";				}			$template = "$incl".$this->tpl->LoadTemplate($this->pol->GetModuleURI().'templates/brief.html');					$vars = array("pol::bgcolor1","pol::bgcolor2","pol::bgcolor3",					"pol::view","pol::fpage","pol::prev",					"pol::next","pol::lpage","pol::bottom",					"pol::checking","pol::showing",					"pol::useraction","pol::getmoduleurl","pol::top","pol::getbaseurl","pol::target"					);			$vals = array("$bgcolor1","$bgcolor2","$bgcolor3",					"$_view","$_fpage","$_prev",					"$_next","$_lpage","$bottom",					"$_checking","$_showing",					"$_user_action","$getmoduleurl","$top","$getbaseurl","$target"					);			$template = $this->tpl->ReplaceStatic($template, $vars, $vals);			$vars = array("pol::rowno","pol::rowcolor","pol::mouse","pol::checkboxid","pol::imguri","pol::imgtype","pol::edit","pol::delete","pol::content");			$template = $msg."".$this->tpl->DynamicRows($template, $varStatic, $varDynamic, $vars, $detailedresult);							}		elseif($total < 0) $template = "<b><h3>"._PMLWARNING."!.</h3><br>"._PMLYOUVEMADEANERRORINYOURSEARCHTERM.".<br>"._PMLORYOUVESEARCHEDFORAWORDLESSTHAN." ".$pmlconfig[keyword_length]." "._PMLINLENGTH.".</b><br><br><br>";		else $template = $msg;		return $template;		}	} ?>

⌨️ 快捷键说明

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