Location: PHPKode > projects > Graphical Botanical Database Management > xgbdmt_alpha_4_single/Branching_print.php
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 
set_magic_quotes_runtime(0);

include("include/dbcommon.php");
include("include/Branching_variables.php");



include('libs/Smarty.class.php');
$smarty = new Smarty();

$conn=db_connect();

//	Before Process event
if(function_exists("BeforeProcessPrint"))
	BeforeProcessPrint($conn);

$strWhereClause="";

if (@$_REQUEST["a"]!="") 
{
	
	$sWhere = "1=0";	
	
//	process selection
	$selected_recs=array();
	if (@$_REQUEST["mdelete"])
	{
		foreach(@$_REQUEST["mdelete"] as $ind)
		{
			$keys=array();
			$keys["PlantsID"]=refine($_REQUEST["mdelete1"][$ind-1]);
			$selected_recs[]=$keys;
		}
	}
	elseif(@$_REQUEST["selection"])
	{
		foreach(@$_REQUEST["selection"] as $keyblock)
		{
			$arr=split("&",refine($keyblock));
			if(count($arr)<1)
				continue;
			$keys=array();
			$keys["PlantsID"]=urldecode($arr[0]);
			$selected_recs[]=$keys;
		}
	}

	foreach($selected_recs as $keys)
	{
		$sWhere = $sWhere . " or ";
		$sWhere.=KeyWhere($keys);
	}
//	$strSQL = AddWhere($gstrSQL,$sWhere);
	$strSQL = gSQLWhere($sWhere);
	$strWhereClause=$sWhere;
}
else
{
	$strWhereClause=@$_SESSION[$strTableName."_where"];
	$strSQL = gSQLWhere($strWhereClause);
}



$strOrderBy=$_SESSION[$strTableName."_order"];
if(!$strOrderBy)
	$strOrderBy=$gstrOrderBy;
$strSQL.=" ".trim($strOrderBy);

$strSQLbak = $strSQL;
if(function_exists("BeforeQueryPrint"))
	BeforeQueryPrint($strSQL,$strWhereClause,$strOrderBy);

//	Rebuild SQL if needed
if($strSQL!=$strSQLbak)
{
//	changed $strSQL - old style	
	$numrows=GetRowCount($strSQL);
}
else
{
	$strSQL = gSQLWhere($strWhereClause);
	$strSQL.=" ".trim($strOrderBy);
	$numrows=gSQLRowCount($strWhereClause);
}
LogInfo($strSQL);
	
$mypage=(integer)$_SESSION[$strTableName."_pagenumber"];
if(!$mypage)
	$mypage=1;

//	page size
$PageSize=(integer)$_SESSION[$strTableName."_pagesize"];
if(!$PageSize)
	$PageSize=$gPageSize;

$recno=1;
	
if($numrows)
{
	$maxRecords = $numrows;
	$maxpages=ceil($maxRecords/$PageSize);
	if($mypage > $maxpages)
		$mypage = $maxpages;
	if($mypage<1) 
		$mypage=1;
	$maxrecs=$PageSize;
	$strSQL.=" limit ".(($mypage-1)*$PageSize).",".$PageSize;
}
$rs=db_query($strSQL,$conn);

//	hide colunm headers if needed
$recordsonpage=$numrows-($mypage-1)*$PageSize;
if($recordsonpage>$PageSize)
	$recordsonpage=$PageSize;
	if($recordsonpage>=1)
		$smarty->assign("column1show",true);
	else
		$smarty->assign("column1show",false);



//	fill $rowinfo array
	$rowinfo = array();

	$data=db_fetch_array($rs);

	while($data && $recno<=$PageSize)
	{
		$row=array();
		for($col=1;$data && $recno<=$PageSize && $col<=1;$col++)
		{

			$recno++;
			$keylink="";
			$keylink.="&key1=".htmlspecialchars(rawurlencode($data["PlantsID"]));


//	PlantsID - 
			$value="";
				$value = ProcessLargeText(GetData($data,"PlantsID", ""),"field=PlantsID".$keylink,"",MODE_PRINT);
			$row[$col."PlantsID_value"]=$value;

//	Common_Name - 
			$value="";
				$value = ProcessLargeText(GetData($data,"Common_Name", ""),"field=Common%5FName".$keylink,"",MODE_PRINT);
			$row[$col."Common_Name_value"]=$value;

//	Branching_Week1 - HTML
			$value="";
				$value = GetData($data,"Branching_Week1", "HTML");
			$row[$col."Branching_Week1_value"]=$value;

//	Branching_Week2 - HTML
			$value="";
				$value = GetData($data,"Branching_Week2", "HTML");
			$row[$col."Branching_Week2_value"]=$value;

//	Branching_Week3 - HTML
			$value="";
				$value = GetData($data,"Branching_Week3", "HTML");
			$row[$col."Branching_Week3_value"]=$value;

//	Branching_Week4 - HTML
			$value="";
				$value = GetData($data,"Branching_Week4", "HTML");
			$row[$col."Branching_Week4_value"]=$value;

//	Branching_Week5 - HTML
			$value="";
				$value = GetData($data,"Branching_Week5", "HTML");
			$row[$col."Branching_Week5_value"]=$value;

//	Branching_Week6 - HTML
			$value="";
				$value = GetData($data,"Branching_Week6", "HTML");
			$row[$col."Branching_Week6_value"]=$value;

//	Branching_Week7 - HTML
			$value="";
				$value = GetData($data,"Branching_Week7", "HTML");
			$row[$col."Branching_Week7_value"]=$value;

//	Branching_Week8 - HTML
			$value="";
				$value = GetData($data,"Branching_Week8", "HTML");
			$row[$col."Branching_Week8_value"]=$value;

//	Branching_Week9 - HTML
			$value="";
				$value = GetData($data,"Branching_Week9", "HTML");
			$row[$col."Branching_Week9_value"]=$value;

//	Branching_Week10 - HTML
			$value="";
				$value = GetData($data,"Branching_Week10", "HTML");
			$row[$col."Branching_Week10_value"]=$value;

//	Branching_Week11 - HTML
			$value="";
				$value = GetData($data,"Branching_Week11", "HTML");
			$row[$col."Branching_Week11_value"]=$value;

//	Branching_Week12 - HTML
			$value="";
				$value = GetData($data,"Branching_Week12", "HTML");
			$row[$col."Branching_Week12_value"]=$value;

//	Branching_Week13 - HTML
			$value="";
				$value = GetData($data,"Branching_Week13", "HTML");
			$row[$col."Branching_Week13_value"]=$value;

//	Branching_Week14 - HTML
			$value="";
				$value = GetData($data,"Branching_Week14", "HTML");
			$row[$col."Branching_Week14_value"]=$value;

//	Branching_Week15 - HTML
			$value="";
				$value = GetData($data,"Branching_Week15", "HTML");
			$row[$col."Branching_Week15_value"]=$value;

//	Branching_Week16 - HTML
			$value="";
				$value = GetData($data,"Branching_Week16", "HTML");
			$row[$col."Branching_Week16_value"]=$value;

//	Branching_Week17 - HTML
			$value="";
				$value = GetData($data,"Branching_Week17", "HTML");
			$row[$col."Branching_Week17_value"]=$value;

//	Branching_Week18 - HTML
			$value="";
				$value = GetData($data,"Branching_Week18", "HTML");
			$row[$col."Branching_Week18_value"]=$value;

//	Branching_Week19 - HTML
			$value="";
				$value = GetData($data,"Branching_Week19", "HTML");
			$row[$col."Branching_Week19_value"]=$value;

//	Branching_Week20 - HTML
			$value="";
				$value = GetData($data,"Branching_Week20", "HTML");
			$row[$col."Branching_Week20_value"]=$value;

//	Branching_Week21 - HTML
			$value="";
				$value = GetData($data,"Branching_Week21", "HTML");
			$row[$col."Branching_Week21_value"]=$value;

//	Branching_Week22 - HTML
			$value="";
				$value = GetData($data,"Branching_Week22", "HTML");
			$row[$col."Branching_Week22_value"]=$value;

//	Branching_Week23 - HTML
			$value="";
				$value = GetData($data,"Branching_Week23", "HTML");
			$row[$col."Branching_Week23_value"]=$value;

//	Branching_Week24 - HTML
			$value="";
				$value = GetData($data,"Branching_Week24", "HTML");
			$row[$col."Branching_Week24_value"]=$value;

//	Branching_Week25 - HTML
			$value="";
				$value = GetData($data,"Branching_Week25", "HTML");
			$row[$col."Branching_Week25_value"]=$value;

//	Branching_Week26 - HTML
			$value="";
				$value = GetData($data,"Branching_Week26", "HTML");
			$row[$col."Branching_Week26_value"]=$value;
			$row[$col."show"]=true;
			$data=db_fetch_array($rs);
		}
		$rowinfo[]=$row;
	}
	$smarty->assign("rowinfo",$rowinfo);


	

$strSQL=$_SESSION[$strTableName."_sql"];

$templatefile = "Branching_print.htm";
if(function_exists("BeforeShowPrint"))
	BeforeShowPrint($smarty,$templatefile);

$smarty->display($templatefile);

Return current item: Graphical Botanical Database Management