Location: PHPKode > projects > HuMo-gen > sources.php
<?php
$kop="bronnen";
include("header.php");
include("menu.php");

// *** Controle van gebruiker ***
if ($user["bronnen"]!='j'){
	echo $language["lng_no_authority"];
	exit();
}

include ("include/language_date.php");
include("include/date_place.php");

@set_time_limit(300);

echo '<div class=index_lijst1>';

if (isset($_POST['sorteer']) OR isset($_GET['sorteer'])){
	print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" style="display : inline">';
	print '<input type="Submit" name="geensorteer" value="'.$language["order_title"].'">';
	print '</form>';

	$querie="SELECT source_id, source_gedcomnr, source_title, source_date, source_place,
	date_format( str_to_date( source_date,'%d %b %Y' ),'%Y-%m-%d') as datum2
	FROM ".veilig($_SESSION['tree_prefix'])."sources ORDER BY datum2";
}
else{
	print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" style="display : inline">';
	print '<input type="Submit" name="sorteer" value="'.$language["order_date"].'">';
	print '</form>';

	$querie="SELECT * FROM ".veilig($_SESSION['tree_prefix'])."sources ORDER BY source_title";
}

// *** BLADZIJDEN ***
$start=0; if (isset($_GET["start"])){ $start=$_GET["start"]; }
$item=0; if (isset($_GET['item'])){ $item=$_GET['item']; }
$aantal_bronnen=$humo_option['personen_weergeven'];
// *** Totale bronnen querie ***
$bron_totaal=mysql_query($querie,$db);
$bron=mysql_query($querie." LIMIT ".veilig($item).",".$aantal_bronnen,$db);
$bladzijderegel=$language["main_page"];
		
// "<="
if ($start>1){
	$start2=$start-20;
	$berekend=($start-2)*$aantal_bronnen;
	$bladzijderegel.= "<a href=\"".$_SERVER['PHP_SELF']."?start=$start2&amp;item=$berekend";
	if (isset($_GET['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_GET['sorteer']; }
	if (isset($_POST['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_POST['sorteer']; }
	$bladzijderegel.=  "\">&lt;= </a>";
}
if ($start<=0){$start=1;}

// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
for ($i=$start; $i<=$start+19; $i++) {
	$berekend=($i-1)*$aantal_bronnen;
	if ($berekend<@mysql_num_rows($bron_totaal)){
		if ($item==$berekend){
			$bladzijderegel.=  " <b>$i</B>";
		}
		else {
			$bladzijderegel.=  "<a href=\"".$_SERVER['PHP_SELF']."?item=$berekend&amp;start=$start";
			if (isset($_GET['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_GET['sorteer']; }
			if (isset($_POST['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_POST['sorteer']; }
			$bladzijderegel.=  "\"> $i</a>";
		}
	}
}

// "=>"
$berekend=($i-1)*$aantal_bronnen;
if ($berekend<@mysql_num_rows($bron_totaal)){
	$bladzijderegel.=  "<a href=\"".$_SERVER['PHP_SELF']."?start=$i&amp;item=$berekend";
	if (isset($_GET['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_GET['sorteer']; }
	if (isset($_POST['sorteer'])){ $bladzijderegel.=  "&amp;sorteer=".$_POST['sorteer']; }
	$bladzijderegel.=  "\"> =&gt;</a>";
}

echo ' '.$bladzijderegel."<br>\n";

	echo '<div class=index_lijst2>';
		while (@$bronDb=mysql_fetch_object($bron)){
			print '<a href="source.php?database='.$_SESSION['tree_prefix'].'&amp;id='.$bronDb->source_gedcomnr.'">';
			// *** Aldfaer bronnen hebben (nog?) geen titel! ***
			if ($bronDb->source_title){ echo $bronDb->source_title; } else { echo $bronDb->source_text; }
			echo '</a> '.datumplaats($bronDb->source_date, $bronDb->source_place).'<br>';
		}
	echo '</div>';
	
echo '<br>'.$bladzijderegel;

echo '</div>';

//mysql_close($db); //databaseverbinding sluiten.
include("footer.php");
?>
Return current item: HuMo-gen