Location: PHPKode > projects > Mummi (Multi-user MOD_MP3 Interface) > mummi.0.6/lib/design.inc
<?
ob_start("ob_gzhandler");



$GLOBALS[bg_clr00] = "#FFFFFF";
$GLOBALS[bg_clr01] = "#EEEEEE";
$GLOBALS[bg_clr02] = "#999999";
$GLOBALS[br_color] = "#AA3333";
$GLOBALS[nav_head_font_clr] = "#FFFFFF";
$GLOBALS[nav_text_font_clr] = "#000000";
$GLOBALS[body_head_font_clr] = "#FFFFFF";
$GLOBALS[body_text_font_clr] = "#000000";
$GLOBALS[body_bg_color] = "#ffffff";
$GLOBALS[bg_link] = "#0033CC";
$GLOBALS[bg_alink] = "#0033CC";
$GLOBALS[bg_vlink] = "#0033CC";

$GLOBALS[body_font_face] = "times";
$GLOBALS[body_font_size] = 3;
$GLOBALS[result_font_size] = 2;

// How many record (per page / pages per page) that should be displayed at any gien time
$GLOBALS[rpp] = 25;
$GLOBALS[ppp] = 10;


// THe reason this is so high up in the script is because this is so important to the rest of the html.
// In fact, Since this convinient snipt can be used anywhere, it goes up top.

$GLOBALS[sp12] = <<<ENDsp12

	<!-- spacer table -->
	<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR>
		<TD><IMG SRC="$img_path/clrdot.gif" HEIGHT="3" WIDTH="1" ALT=""></TD>
	</TR></TABLE>
	<!-- end spacer table -->

ENDsp12;





// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



function draw_header($page_title="", $meta="", $js=""){
	header("Content-type: text/html; charset=ISO-8859-1");
echo <<<ENDpage_header
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><HEAD><TITLE>$GLOBALS[page_title]</TITLE>

$meta

$js

</HEAD>
<BODY BGCOLOR="$GLOBALS[bg_clr00]" LINK="$GLOBALS[bg_link]" ALINK="$GLOBALS[bg_alink]" VLINK="$GLOBALS[bg_vlink]">
<A NAME="#top"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr00]"><TR>
	<TD>

		<TABLE BGCOLOR="$GLOBALS[br_color]" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR>
			<TD>
				<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" BGCOLOR="$GLOBALS[br_color]"><TR>
					<TD>
						<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr02]"><TR>
							<TD WIDTH="50%" ALIGN="left" VALIGN="bottom">&nbsp;<a href="$GLOBALS[url_path]/"><FONT SIZE="5" COLOR="$GLOBALS[body_head_font_clr]"><B>$GLOBALS[server_name]</B></FONT></A>&nbsp;</TD>
							<TD WIDTH="50%" ALIGN="right" VALIGN="bottom">&nbsp;<FONT COLOR="$GLOBALS[body_head_font_clr]">$GLOBALS[current_time]</FONT>&nbsp;</TD>
						</TR></TABLE>
					</TD>
				</TR></TABLE>
			</TD>
		</TR></TABLE>
		$GLOBALS[sp12]
		<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR VALIGN="top">
			<TD WIDTH="165">
<!-- page_header_END -->

ENDpage_header;

}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


function draw_nav($nav_array){

	for($i=0;$i<count($nav_array);$i++){
		include_once "$GLOBALS[nav_path]/$nav_array[$i].nav";
		$nav_string .= $GLOBALS["$nav_array[$i]"."_navbar"];
	}

echo $nav_string;
echo <<<ENDpage_middle


				</TD>
				<TD><img src="$img_path/clrdot.gif" height="1" WIDTH="5" ALT=""></TD>
				<TD ALIGN="left" WIDTH="100%">
					<TABLE BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr00]"><TR>
						<TD ALIGN="left" WIDTH="100%">

ENDpage_middle;
}



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


function draw_sect($sect_array){



	while(list($key, $val) = @each($sect_array)){

echo <<<ENDcontents_end

				<TABLE BGCOLOR="$GLOBALS[br_color]" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR>
					<TD>
						<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr02]"><TR>
							<TD>
								<TABLE BGCOLOR="$GLOBALS[br_color]" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR>
									<TD ALIGN="left">
										<TABLE WIDTH="100%" BORDER="0" CELLPADDING="4" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr02]"><TR>
											<TD ALIGN="left" WIDTH="100%">
												<b><FONT SIZE="4" COLOR="$GLOBALS[body_head_font_clr]">

												$key

												</FONT></b>
											</TD>
											<TD ALIGN="right">&nbsp;</TD>
										</TR></TABLE>
									</TD>
								</TR></TABLE>
								<TABLE BGCOLOR="$GLOBALS[br_color]" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR>
									<TD>
										<TABLE WIDTH="100%" BORDER="0" CELLPADDING="4" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr01]"><TR>
											<TD>

											$val

											</TD>
										</TR></TABLE>
									</TD>
								</TR></TABLE>
							</TD>
						</TR></TABLE>
					</TD>
				</TR></TABLE>
			$GLOBALS[sp12]

ENDcontents_end;
	}//eo while

}//eo function

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


function draw_footer($quote="&nbsp;"){

echo <<<ENDpage_footer

<!-- FOOTER_START -->
					</TD>
				</TR></TABLE>
			</TD>
		</TR></TABLE>
		<TABLE BGCOLOR="$GLOBALS[br_color]" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR>
			<TD>
				<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" BGCOLOR="$GLOBALS[br_color]"><TR>
					<TD>
						<TABLE BORDER="0" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" BGCOLOR="$GLOBALS[bg_clr02]"><TR>
							<TD ALIGN="left"><FONT SIZE="2" COLOR="$GLOBALS[body_head_font_clr]">$quote</FONT></TD>
							<TD ALIGN="right"><FONT SIZE="2" COLOR="$GLOBALS[body_head_font_clr]">copyright &copy; 2002 audiodevil.com.</FONT></TD>
						</TR></TABLE>
					</TD>
				</TR></TABLE>
			</TD>
		</TR></TABLE>
	</TD>
</TR></TABLE>
</BODY></HTML>
<!-- FOOTER_END -->
ENDpage_footer;

}//eo function


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function draw_pagenumbers($cur_page, $rpp){

	// Getting the total number of pages
	$last_pagenum = $GLOBALS[real_return_array_count]/$rpp;
	$total_num_pages = $last_pagenum = ceil($GLOBALS[real_return_array_count]/$rpp);

	$query_string = getenv(QUERY_STRING);
	if(strstr($query_string, '&cur_page=')) $query_string = eregi_replace("&cur_page=[0-9]{1,3}","", $query_string);

	// Generating the page number string to display
	// if the current page is greater than the 'pages per page' value then the
	// user needs to see the link that will show there are pages behind this,
	// but only takes them back one page
	// they are on.


	// Drawing left arrow so the user can move back
	if($cur_page>1){
		$back_page = $cur_page-1;
		$query_string01 = $query_string . "&cur_page=$back_page";
		$page_string  .= "<a href=\"$PHP_SELF?$query_string01\"><font size=2><<</font></a>\n";
	}


	// This is where the page generation happens.. there are 2 for loops, but they
	// are needed in each part. test and verified.
	if($cur_page > $GLOBALS[ppp]){

		$a=0;
		for($i=0; $i<=$total_num_pages; $i++){
			if($cur_page < $GLOBALS[ppp]*$a+1){
				$start_page_range = ($GLOBALS[ppp]*$a)-$GLOBALS[ppp]+1;
				break;
			}
			$a++;
		}


		// this is the value at which the numbering starts
		$ii=$start_page_range;
		for($i=0; $i<=$GLOBALS[ppp]-1; $i++){
			$query_string02 = $query_string . "&cur_page=$ii";

				// don't make a link for the page the user is currently on
				if($cur_page == $ii) $page_string  .= "$ii\n";
				else $page_string  .= "<a href=\"$PHP_SELF?$query_string02\">$ii</a>\n";
			if($ii>=$total_num_pages) break;

			$ii++;
		}

	}else{

		// this is the value at which the numbering starts
		$ii=1;
		for($i=1; $i<=$GLOBALS[ppp]; $i++){
			$query_string02 = $query_string . "&cur_page=$ii";

				// don't make a link for the page the user is currently on
				if($cur_page == $ii) $page_string  .= "$ii\n";
				else $page_string  .= "<a href=\"$PHP_SELF?$query_string02\">$ii</a>\n";
			//if($ii>=$start_page_range+$GLOBALS[ppp]) break;
			if($ii>=$total_num_pages) break;

			$ii++;
		}
	}

	// Draw the right arrow so the use can move forward
	if($cur_page < $total_num_pages){
		$forward_page = $cur_page+1;
		$query_string03 = $query_string . "&cur_page=$forward_page";
		$page_string  .= "<a href=\"$PHP_SELF?$query_string03\"><font size=2>>></font></a>\n";

	}//eo IF



	// Getting the range or entries that is being displayed
	if($cur_page == 1){
		if($GLOBALS[real_return_array_count] < $rpp){
			if($GLOBALS[real_return_array_count] == 0){
				$range_low = 0;
				$range_high = 0;
			}else{
				$range_low = 1;
				$range_high = $GLOBALS[real_return_array_count];
			}
		}else{
			$range_low = 1;
			$range_high = $range_low+$rpp-1;
		}
	}else{
		$range_low = $cur_page*$rpp-$rpp+1;
		$range_high = $range_low+$rpp-1;
		if($range_high > $GLOBALS[real_return_array_count]) $range_high=$GLOBALS[real_return_array_count];
	}


$contents = <<<ENDcontents
	<font face="$GLOBALS[body_font_face]" size="$GLOBALS[body_font_size]">
	<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#ffffff"><tr>
		<td width="50%" align="left" valign="top">
			&nbsp;Total:&nbsp;<b>$GLOBALS[real_return_array_count]</b>&nbsp;Page&nbsp;<b>$cur_page</b>
			of&nbsp;<b>$total_num_pages</b>&nbsp;(<b>$range_low&nbsp;-&nbsp;$range_high</b>)
		</td><td align="right">
			<b>$page_string</b>&nbsp
		</td>
	</tr></table>
	</font>

ENDcontents;


return $contents;
}//eo function



// Added 03.28.2002(jack mays)
// This is the construct of all the smaller tables that have information in
// them.  Like in the file viewer. This should reduce the file size a little
// bit.
function draw_innerbox($title="", $contents){

$contents01 = <<<ENDcontents01
			<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
				<td align="left" valign="top">

					<table width="100%" cellpadding="1" cellspacing="0" border="0"><tr>
						<td bgcolor="#aaaaaa">&nbsp;<font COLOR="$GLOBALS[body_head_font_clr]"><b>$title</b></font></td>
					</tr></table>

					<table width="100%" cellpadding="1" cellspacing="0" border="0"><tr>
						<td bgcolor="$GLOBALS[body_bg_color]">$contents</td>
					</tr></table>

				</td>
			</tr></table>

ENDcontents01;

return $contents01;
}//eo function





?>
Return current item: Mummi (Multi-user MOD_MP3 Interface)