Location: PHPKode > projects > OSADS Alliance Database > OSADS-2.1/includes/spalten.php
<?php
/* +----------------------------------------------------------------------
// | OSADS v2.0
// |
// | PHP Source
// +----------------------------------------------------------------------
// | Copyright (C) 2008 by Frank Tetzel <hide@address.com>
// +----------------------------------------------------------------------
// |
// | OSADS is free software; you can redistribute it and/or modify
// | it under the terms of the GNU General Public License as published by
// | the Free Software Foundation; either version 2 of the License, or
// | (at your option) any later version.
// |
// | OSADS is distributed in the hope that it will be useful,
// | but WITHOUT ANY WARRANTY; without even the implied warranty of
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// | GNU General Public License for more details.
// |
// | You should have received a copy of the GNU General Public License
// | along with OSADS. If not, write to the Free Software Foundation, Inc.,
// | 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// |
// +----------------------------------------------------------------------
*/

	// Direktzugriff abwehren
	if (!defined('INDEX'))
		die('not allowed');

	//language file
	include "./langs/". $member_lang ."/includes_spalten.php";

	function spaltenordnung($arg_spalten){
		echo
'<script language="javascript" type="text/javascript">
<!--
';

		echo "\n\tvar spalten = new Array(";
		for($i=0; $i<18; $i++){
			echo "'". $arg_spalten[2*$i].$arg_spalten[2*$i+1] ."',";
		}
		echo "'" . $arg_spalten[36].$arg_spalten[37] . "');\n\n";

		echo
'	function getrest(str){
		var i=1;
		var result=\'\';
		while(str[i]){
			result = result + str[i];
			i++;
		}
		return result;
	}
	function changecheck(ele_check, wechseln){
		if(ele_check.checked){
			document.getElementById(ele_check.id+"_text").style.textDecoration = "none";
			document.getElementById(ele_check.id+"_text").style.color = "#000000";
			//in form aenderung durchfuehren
			if(wechseln){
				spalten[getrest(ele_check.id)] = "1" + spalten[getrest(ele_check.id)][1];
			}
		}else{
			document.getElementById(ele_check.id+"_text").style.textDecoration = "line-through";
			document.getElementById(ele_check.id+"_text").style.color = "#999999";
			//in form aenderung durchfuehren
			if(wechseln){
				spalten[getrest(ele_check.id)] = "0" + spalten[getrest(ele_check.id)][1];
			}
		}
	}
	function tauschen(ele1, ele2){
		var temp = document.getElementById(ele1+"_text").innerHTML;
		document.getElementById(ele1+"_text").innerHTML = document.getElementById(ele2+"_text").innerHTML;
		document.getElementById(ele2+"_text").innerHTML = temp;
		if(document.getElementById(ele1).checked != document.getElementById(ele2).checked){
			temp = document.getElementById(ele1).checked;
			document.getElementById(ele1).checked = document.getElementById(ele2).checked;
			document.getElementById(ele2).checked = temp;
			changecheck(document.getElementById(ele1), false);
			changecheck(document.getElementById(ele2), false);
		}
		temp = spalten[getrest(ele1)];
		spalten[getrest(ele1)] = spalten[getrest(ele2)];
		spalten[getrest(ele2)] = temp;
	}
	function getspalten(){
		var temp = "";
		for(var i=0; i<19; i++){
			temp = temp + spalten[i];
		}
		document.getElementsByName("spalten")[0].value = temp;
	}
//-->
</script>

<table class="bc">
';
		for($i=0; $i<19; $i++){
			if($arg_spalten[2*$i] == '1'){
				$check[$i] = " checked";
				$span[$i] = "";
			}else{
				$check[$i] = "";
				$span[$i] = " style=\"text-decoration: line-through; color: #999999;\"";
			}
			$spalten[$i] = $arg_spalten[2*$i+1];
		}
		//echo $arg_spalten ."<br>\n";
		for($i=0; $i<19; $i++){
			echo
'	<tr>
		<td><input id="z' . $i . '" type="checkbox" onChange="changecheck(this, true)"' . $check[$i] . '></td>
		<td style="text-align:left;" class="bg_hellblau">
			&nbsp;
			<a id="z' . $i . '_oben" href="javascript: tauschen(\'z' . ($i-1) . '\', \'z' . $i . '\');" title="'. L_UP .'">
				<img src="./bilder/top.png" alt="'. L_UP .'">
			</a>
			&nbsp;
			<a id="z' . $i . '_unten" href="javascript: tauschen(\'z' . $i . '\', \'z' . ($i+1) . '\');" title="'. L_DOWN .'">
				<img src="./bilder/down.png" alt="'. L_DOWN .'">
			</a>
			&nbsp;&nbsp;&nbsp;
			<span id="z' . $i . '_text"' . $span[$i] . '>';
			switch($arg_spalten[2*$i+1]){
				//tf gesamt
				case '1': echo L_TF .": ". L_TOTAL; break;
				//tf met
				case '2': echo L_TF .": ". L_METAL; break;
				//tf kris
				case '3': echo L_TF .": ". L_CRYSTAL; break;
				//planetenname
				case '4': echo L_PLANETNAME; break;
				//spielername
				case '5': echo L_PLAYERNAME; break;
				//zusatz
				case '6': echo L_STATUS; break;
				//kopfgeld gesamt
				case '7': echo L_BOUNTY .": ". L_TOTAL; break;
				//k met
				case '8': echo L_BOUNTY .": ". L_METAL; break;
				//k kris
				case '9': echo L_BOUNTY .": ". L_CRYSTAL; break;
				//k trit
				case 'A': echo L_BOUNTY .": ". L_TRITIUM; break;
				//allianz
				case 'B': echo L_ALLY; break;
				//punkte gesamt
				case 'C': echo L_POINTS .": ". L_TOTAL; break;
				//platz gesamt
				case 'D': echo L_PLACE .": ". L_TOTAL; break;
				//konstr punkte
				case 'E': echo L_POINTS .": ". L_CONSTRUCTION; break;
				//konstr platz
				case 'F': echo L_PLACE .": ". L_CONSTRUCTION; break;
				//forsch punkte
				case 'G': echo L_POINTS .": ". L_RESEARCH; break;
				//forsch platz
				case 'H': echo L_PLACE .": ". L_RESEARCH; break;
				//flotte punkte
				case 'I': echo L_POINTS .": ". L_FLEET; break;
				//flotte platz
				case 'J': echo L_PLACE .": ". L_FLEET; break;

				default: echo "Fehler: Spaltenzuordnung! _" . $arg_spalten[2*$i+1] . "_";
			}
			echo
'</span>
		</td>
	</tr>
';
	//table is open -> must be closed
		}
	}

?>
Return current item: OSADS Alliance Database