You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
agng/ag/include/designfunctions.inc.php

152 lines
5.0 KiB

14 years ago
<?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');
14 years ago
// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
/**
* use displayUserLinkByID instead
* @deprecated
*/
function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = NULL){
// backwards compat!!
return displayUserLinkByID($userid);
}
function displayUserNameByID($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;
14 years ago
} else{
return '<span '.$color.'>'.$nickname.'</span>';
14 years ago
}
}
// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
function displayUserLinkByID($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'];
}
14 years ago
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&uuml;ck</a>';
}
function displayIndexBackLink(){
return '<a href="index.php">zur&uuml;ck</a>';
}
function displayCharLink($charid, $charname, $img = NULL, $clanpre = NULL, $clansu = NULL){
14 years ago
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&auml;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&auml;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,'','.').' &#165;';
}
function displayCount($value){
return number_format($value,0,'','.');
}
?>