<?php
/*
*
* @copyright (c) 2009 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/usergroup.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config/settings.inc.php');
// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
/**
* use generateUserLinkByID instead
* @deprecated
*/
function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = NULL){
// backwards compat!!
return displayUserLinkByID($userid);
}
/**
* use generateUserNameByID instead
* @deprecated
*/
function displayUserNameByID($userid, $showClanTags = TRUE){
return generateUserNameByID($userid, $showClanTags);
}
function generateUserNameByID($userid, $showClanTags = TRUE){
if($userid === null){return '';}
$groups = getUserGroups($userid);
$sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid;
$user_info = mysql_fetch_assoc(mysql_query($sql));
if(isUserInGroup($groups, WERBUNG_AN)){
if(isUserInGroup($groups, ADMIN)){
$color = 'style="color:'.$GLOBALS['COLOR_GM'].'"';
} else if(isUserInGroup($groups, ENTWICKLER)){
$color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"';
} else if(isUserInGroup($groups, DESIGNER)){
$color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"';
} else {
$color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"';
}
} else{
$color = '';
}
$nickname = $user_info['nickname'];
if($user_info['clanz_pre'] !== NULL & & $user_info['clanz_pre'] != '' & & $showClanTags) {
$nickname = $user_info['clanz_pre'] . ' ' . $nickname;
}
if($user_info['clanz_suff'] !== NULL & & $user_info['clanz_suff'] != '' & & $showClanTags) {
$nickname = $nickname . ' ' . $user_info['clanz_suff'];
}
if($color == ''){
return $nickname;
} else{
return '< span ' . $ color . ' > '.$nickname.'< / span > ';
}
}
/**
* use generateUserLinkByID instead
* @deprecated
*/
function displayUserLinkByID($userid, $showClanTags = TRUE){
return generateUserLinkByID($userid, $showClanTags);
}
function generateUserLinkByID($userid, $showClanTags = TRUE){
return '< a href = "index.php?as=info&user_id='.$userid.'" > '.displayUserNameByID($userid, $showClanTags).'< / a > ';
}
function displayClanLink($clanid, $clanname = NULL){
if($clanname === NULL) {
$qry = mysql_query('SELECT clanname FROM clan WHERE id = ' . $clanid);
$row = mysql_fetch_assoc($qry);
$clanname = $row['clanname'];
}
return '< a href = "index.php?as=clan/clan_info&clan_id='.$clanid.'" > '.$clanname.'< / a > ';
}
function displayHistoryBackLink(){
return '< a href = "javascript:history.back()" id = "content" > zurü ck< / a > ';
}
function displayIndexBackLink(){
return '< a href = "index.php" > zurü ck< / a > ';
}
function displayCharLink($charid, $charname, $img = NULL, $clanpre = NULL, $clansu = NULL){
if($clanpre !== NULL & & $clansu !== NULL){
$charname = $clanpre.' '.$charname.' '.$clansu;
}
if($img === NULL){
return '< a href = "index.php?as=info&charm=1&char_id='.$charid.'" > '.$charname.'< / a > ';
} else{
return '< a href = "index.php?as=info&charm=1&char_id='.$charid.'" > '.$charname.'< br > < img src = "'.$img.'" border = "0" width = "75" height = "75" > < / a > ';
}
}
function displayItemLink($tablename, $itemid, $itemname){
if($itemname != 'Geheim!'){
return '< a href = "index.php?as=info&charm=2&group='.$tablename.'&item_id='.$itemid.'" > '.$itemname.'< / a > ';
}
return $itemname;
}
function displayAuktionsLink($kategorie,$itemnamepart,$itemname,$entriesPerSite,$pageNumber,$maxPrice){
return '< a href = "index.php?as=auktion&kategorie='.$kategorie.'&itemname='.$itemnamepart.'&entries='.$entriesPerSite.'&maxpreis='.$maxPrice.'" > Hier Klicken um Auktionen des Items '.$itemname.' anzeigen zu lassen!< / a > ';
}
// Soll die alte displayPagelinks ersetzen
function displayPagelinksNew($entriesPerPage, $totalEntries, $aktualPage, $url){
$maxPages = ceil($totalEntries/$entriesPerPage);
return displayPagelinks($aktualPage, $maxPages, $url);
}
function displayPagelinks($aktualPage, $maxPages, $url){
// Erstmal die link vorher/nachher
$vorher = '< td align = "left" width = "0" > vorherige Seite< / td > ';
$nachher = '< td align = "right" width = "0" > nä chste Seite< / td > ';
$puffer = '';
$search = array('/###PAGE###/','/###LABEL###/');
if(0 < $aktualPage){
$vorher = '< td align = "left" width = "0" > '.preg_replace($search,array($aktualPage-1,'vorherige Seite'),$url).'< / td > ';
}
if($maxPages-1 > $aktualPage){
$nachher = '< td align = "right" width = "0" > '.preg_replace($search,array($aktualPage+1,'nä chste Seite'),$url).'< / td > ';
}
$normalStep = 1;
$width=0;
if($maxPages > 50){
$normalStep = 10;
$width = 5;
} else if($maxPages > 30){
$normalStep = 5;
$width = 15;
}
$min = $aktualPage-$width+1;
$max = $aktualPage+$width+1;
for($i=1;$i< =$maxPages;$i++){
if($i == 1 || $i%$normalStep == 0 || $i >= $min & & $i < = $max){
$puffer.='< td align = "center" > '.preg_replace($search,Array($i-1,$i),$url).'< / td > ';
}
}
return '< table width = "100%" cellpadding = "0" cellspacing = "0" > < tr > '.$vorher.$puffer.$nachher.'< / tr > < / table > ';
}
function displayMoney($value){
return number_format($value,0,'','.').' ¥ ';
}
function displayCount($value){
return number_format($value,0,'','.');
}
?>