Seite 1 von 3

Statistik für Point-System

Verfasst: 13.05.2003 09:25
von Mandy
Kann mir jemand sagen, was ich tun muss, damit in der Statistikanzeige für das Pointsystem nicht nur die erreichten Punkte sehe, sondern auch die schöne Balkenanzeige, wie beim Quiz oder den anderen Statistiken? Wäre das möglich?

Mandy

Verfasst: 13.05.2003 20:16
von Mandy
Hochschieb.

Verfasst: 14.05.2003 16:31
von saerdnaer
man muss einfach das modul etwas abändern ;-)

[size=0]aber diese ausage dürfte dir wenig helfen ;-)[/size]

also zeig uns doch einfach mal die entsprechenden dateien dieses moduls...

ah

Verfasst: 14.05.2003 17:01
von Mandy
das ist die module.tpl vom reg_act_points-mod

Code: Alles auswählen

<table border="0" width="100%" cellspacing="2">
  <tr>
    <td width="33%" valign="top" align="center">
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="forumline">
	  <tr>
        <td class="catHead" colspan="2" align="center"><span class="cattitle">{L_MOD_POINTS}</span></td>
      </tr>
      <tr>
        <th colspan="1" class="thCornerL" align="center"><strong>{L_USERNAME}</strong></th>
        <th width="50%" class="thTop" align="center"><strong>{L_POINTS}</strong></th>
      </tr>
<!-- BEGIN most_points -->
      <tr>
        <td class="{most_points.CLASS}" height="20" width="50%">{most_points.USER}&nbsp;</td>
        <td class="{most_points.CLASS}" align="center" nowrap="nowrap" width="50%" height="20"><span class="genmed">{most_points.POINTS}</span></td>
      </tr>
<!-- END most_points -->
    </table>
    </td>
  </tr>
</table>

Verfasst: 14.05.2003 17:42
von saerdnaer
suchen:

Code: Alles auswählen

        <th colspan="1" class="thCornerL" align="center"><strong>{L_USERNAME}</strong></th> 
        <th width="50%" class="thTop" align="center"><strong>{L_POINTS}</strong></th> 
ersetzen durch

Code: Alles auswählen

        <th width="30%" class="thCornerL" align="center"><strong>{L_USERNAME}</strong></th> 
        <th width="10%" class="thTop" align="center"><strong>{L_POINTS}</strong></th>
    <th width="10%" class="thTop" align="center"><strong>{L_PERCENTAGE}</strong></th> 
    <th width="50%" class="thCornerR" align="center"><strong>{L_GRAPH}</strong></th> 
 
suchen:

Code: Alles auswählen

        <td class="{most_points.CLASS}" height="20" width="50%">{most_points.USER}&nbsp;</td> 
        <td class="{most_points.CLASS}" align="center" nowrap="nowrap" width="50%" height="20"><span class="genmed">{most_points.POINTS}</span></td> 
      </tr>
ersetzen durch

Code: Alles auswählen

        <td class="{most_points.CLASS}" height="20" width="30%">{most_points.USER}&nbsp;</td> 
        <td class="{most_points.CLASS}" align="center" nowrap="nowrap" width="10%" height="20"><span class="genmed">{most_points.POINTS}</span></td> 
        <td class="{most_points.CLASS}" align="center" nowrap="nowrap" width="10%" height="20"><span class="genmed">{most_points. PERCENTAGE}</span></td> 
        <td class="{most_points.CLASS}" align="right" nowrap="nowrap" width="50%" height="20">   <table cellspacing="0" cellpadding="0" border="0" align="left"> 
     <tr> 
       <td align="right"><img src="{LEFT_GRAPH_IMAGE}" width="4" height="12" /></td> 
     </tr> 
   </table> 
   <table cellspacing="0" cellpadding="0" border="0" align="left" width="{most_points.BAR}%"> 
     <tr> 
       <td><img src="{GRAPH_IMAGE}" width="100%" height="12" /></td> 
     </tr> 
   </table> 
   <table cellspacing="0" cellpadding="0" border="0" align="left"> 
     <tr> 
       <td align="left"><img src="{RIGHT_GRAPH_IMAGE}" width="4" height="12" /></td> 
     </tr> 
   </table> </td> 
      </tr>
und dann bräuchte ich noch die php datei

ah

Verfasst: 14.05.2003 17:54
von Mandy
der Inhalt der module.php

Code: Alles auswählen

<?php

//
// Authorization SQL - forum-based
//
$auth_data_sql = '';

$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

//
// User with most Points SQL
//
$sql = "SELECT user_id, username, user_points
        FROM " . USERS_TABLE . "
        WHERE user_id <> " . ANONYMOUS . "
        ORDER BY user_points DESC LIMIT " . $return_limit;

    if ( !($result = $db->sql_query($sql)) ) 
    { 
            message_die(GENERAL_ERROR, 'Could not obtain user information', '', __LINE__, __FILE__, $sql); 
    } 

    while ($row = $db->sql_fetchrow($result)) 
    { 
	if($row['user_points']>0){
        $user_id=$row['user_id']; 
		if($row['username']=='Name geändert'){
            $user = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '" class="genmed">Peggy</a>';
		} else {
            $user = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id") . '" class="genmed">' . $row['username'] . '</a>';
        }
            $template->assign_block_vars("most_points", array( 
                    'CLASS' => ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'],
                    'USER' => $user,
                    'POINTS' => $row['user_points']) 
            );
		} 
    } 

$template->assign_vars(array(
	'L_USERNAME' => $lang['Username'],
	'L_POINTS' => $lang['Points'],
	'L_MOD_POINTS' => $lang['Points_title'])
);

?>
Danke Saerdner

Verfasst: 14.05.2003 18:33
von saerdnaer
bitteschön:

Code: Alles auswählen

<?php

$template->assign_vars(array(
	'L_POINTS' => $lang['Points'],
	'L_PERCENTAGE' => $lang['Percent'],
	'L_USERNAME' => $lang['Username'],
	'L_GRAPH' => $lang['Graph'],
	'MODULE_NAME' => $lang['module_name'],
	'L_MOD_POINTS' => $lang['Points_title'])
);

$statistics->init_bars();

$sql = "SELECT SUM(user_points) as total_points FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS;

if ( !($result = $stat_db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Couldn\'t retrieve users data', '', __LINE__, __FILE__, $sql);
}

$row = $stat_db->sql_fetchrow($result);
$total_points = $row['total_points'];

$sql = 'SELECT user_id, username, user_points
FROM ' . USERS_TABLE . '
WHERE user_id <> ' . ANONYMOUS . ' AND user_points > 0
ORDER BY user_points DESC
LIMIT ' . $return_limit;

if ( !($result = $stat_db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Couldn\'t retrieve users data', '', __LINE__, __FILE__, $sql);
}

$user_count = $stat_db->sql_numrows($result);
$user_data = $stat_db->sql_fetchrowset($result);

$firstcount = $user_data[0]['user_points'];


for ($i = 0; $i < $user_count; $i++)
{
	$class = ( !($i+1 % 2) ) ? $theme['td_class2'] : $theme['td_class1'];
	$statistics->do_math($firstcount, $user_data[$i]['user_points'], $total_points);
	$user = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $user_data[$i]['user_id']) . '" class="genmed">' . ( ( $user_data[$i]['username'] == 'Name geändert' ) ? 'Peggy' : $user_data[$i]['username'] ) . '</a>'; 

	$template->assign_block_vars('most_points', array(
		'CLASS' => $class,
		'USERNAME' => $user,
		'PERCENTAGE' => $statistics->percentage,
		'BAR' => $statistics->bar_percent,
		'POINTS' => $user_data[$i]['user_points'])
	);
}

?>
sollte funktionieren... ist fast kommplett neu geschrieben

ah

Verfasst: 14.05.2003 19:43
von Gast
An Stelle der Statistik steht jetzt folgendes:

Fatal error: Call to a member function on a non-object in /www/htdocs/stat_modules/reg_act_points/module.php on line 12

Verfasst: 15.05.2003 07:43
von Mandy
ups, war mal wieder nicht eingeloggt.

Verfasst: 18.05.2003 10:50
von Mandy
bin schon ganz ganz weit nach hinten gerutscht, muss mich mal hochschieben. :o

Mandy