- Регистрация
- 9 Апр 2008
- Сообщения
- 41
- Реакции
- 5
- Автор темы
- Заблокирован
- #1
Вот кусочек кода модуля который выводит всех зарегенных и последнего зарегенного:
____________________________________________________
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset;
if(file_exists('modules/mod_totalusers_language/'.$mosConfig_lang.'.php')) {
include('modules/mod_totalusers_language/'.$mosConfig_lang.'.php');
}
else {
include('modules/mod_totalusers_language/russian.php');
}
/*
* Module Configuration
* These settings can be done through the Module Parameters in the
* administration panel. All defaults to YES (1)
*/
$show_today = $params->get('show_today', 1);
$show_week = $params->get('show_week', 1);
$show_month = $params->get('show_month', 1);
$show_last = $params->get('show_last', 1);
$show_cb = $params->get('show_cb', 1);
$icon_set = $params->get('icon_set', 1);
$database->setQuery("SELECT id, username, registerDate FROM #__users");
$database->query();
$total_array = $database->loadAssocList();
$total_user = count($total_array);
$today = 0;
$thisweek = 0;
$thismonth = 0;
foreach ($total_array as $user) {
$regdate = str_replace("-", " ",$user['registerDate']);
$regdate = split(" ", $regdate);
$regyear = $regdate[0];
$regmonth = $regdate[1];
$regday = $regdate[2];
$regweek = date("W", mktime(0, 0, 0, $regmonth, $regday, $regyear));
$curdate = split(" ", date("Y m d W"));
$curyear = $curdate[0];
$curmonth = $curdate[1];
$curday = $curdate[2];
$curweek = $curdate[3];
if($show_today==1) {
if($regyear == $curyear && $regmonth == $curmonth && $regday == $curday)
$today++;
}
if($show_week==1) {
if($regweek == $curweek && $regyear == $curyear)
$thisweek++;
}
if($show_month==1) {
if($regmonth == $curmonth && $regyear == $curyear)
$thismonth++;
}
}
if($show_last==1) {
foreach($total_array as $key => $value) {
$regdate[$key] = $value['registerDate'];
}
array_multisort($regdate, SORT_DESC, $total_array);
$lastusername = $total_array[0]['username'];
$lastuser = $total_array[0]['id'];
}
switch ($icon_set) {
case 1:
$icon0 = "group02.gif";
$icon1 = "man01.gif";
$icon2 = "man02.gif";
$icon3 = "man03.gif";
$icon4 = "man05.gif";
break;
case 2:
$icon0 = "group03.gif";
$icon1 = "today.gif";
$icon2 = "week.gif";
$icon3 = "month.gif";
$icon4 = "last.gif";
break;
case 3:
$icon0 = "group01.gif";
$icon1 = "blueman.gif";
$icon2 = "pinkman.gif";
$icon3 = "redman.gif";
$icon4 = "yellowman.gif";
break;
case 4:
$icon0 = "penguin00.png";
$icon1 = "penguin01.gif";
$icon2 = "penguin01.gif";
$icon3 = "penguin01.gif";
$icon4 = "penguin02.gif";
break;
}
if ($total_user == NULL) {?>
<table>
<tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon0; ?>" width="100%" height="100%" border="0" align="left" alt="" /></td><td><?php echo " 0 " ._REG_USS;?></td></tr>
</table><?php
} else {?>
<table>
<tr><td></td><td><?php echo " $total_user "._REG_USS;?></td></tr>
<?php if($show_today==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon1; ?>" border="0" align="right" alt="" /></td><td><?php echo " $today "._REG_TDY;?></td></tr><?php }; ?>
<?php if($show_week==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon2; ?>" border="0" align="right" alt="" /></td><td><?php echo " $thisweek "._REG_WEK;?></td></tr><?php }; ?>
<?php if($show_month==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon3; ?>" border="0" align="right" alt="" /></td><td><?php echo " $thismonth "._REG_MON;?></td></tr><?php }; ?>
<?php if($show_last==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon4; ?>" border="0" align="right" alt="" /></td><td><?php echo _REG_LST;?><B><?php if($show_cb == 1) { echo "<a href='". sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$lastuser). "'>".$lastusername."</a>"; }else{ echo $lastusername;}?></B></td></tr><?php }; ?>
</table><?php
}
?>
_________________________________________________
Так вот вопрос: как сделать, чтобы он выводил 5-10 последних зарегившихся? Пока что выводит только одного.
Коммунити 1.1
Джумла 1.0.15
____________________________________________________
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset;
if(file_exists('modules/mod_totalusers_language/'.$mosConfig_lang.'.php')) {
include('modules/mod_totalusers_language/'.$mosConfig_lang.'.php');
}
else {
include('modules/mod_totalusers_language/russian.php');
}
/*
* Module Configuration
* These settings can be done through the Module Parameters in the
* administration panel. All defaults to YES (1)
*/
$show_today = $params->get('show_today', 1);
$show_week = $params->get('show_week', 1);
$show_month = $params->get('show_month', 1);
$show_last = $params->get('show_last', 1);
$show_cb = $params->get('show_cb', 1);
$icon_set = $params->get('icon_set', 1);
$database->setQuery("SELECT id, username, registerDate FROM #__users");
$database->query();
$total_array = $database->loadAssocList();
$total_user = count($total_array);
$today = 0;
$thisweek = 0;
$thismonth = 0;
foreach ($total_array as $user) {
$regdate = str_replace("-", " ",$user['registerDate']);
$regdate = split(" ", $regdate);
$regyear = $regdate[0];
$regmonth = $regdate[1];
$regday = $regdate[2];
$regweek = date("W", mktime(0, 0, 0, $regmonth, $regday, $regyear));
$curdate = split(" ", date("Y m d W"));
$curyear = $curdate[0];
$curmonth = $curdate[1];
$curday = $curdate[2];
$curweek = $curdate[3];
if($show_today==1) {
if($regyear == $curyear && $regmonth == $curmonth && $regday == $curday)
$today++;
}
if($show_week==1) {
if($regweek == $curweek && $regyear == $curyear)
$thisweek++;
}
if($show_month==1) {
if($regmonth == $curmonth && $regyear == $curyear)
$thismonth++;
}
}
if($show_last==1) {
foreach($total_array as $key => $value) {
$regdate[$key] = $value['registerDate'];
}
array_multisort($regdate, SORT_DESC, $total_array);
$lastusername = $total_array[0]['username'];
$lastuser = $total_array[0]['id'];
}
switch ($icon_set) {
case 1:
$icon0 = "group02.gif";
$icon1 = "man01.gif";
$icon2 = "man02.gif";
$icon3 = "man03.gif";
$icon4 = "man05.gif";
break;
case 2:
$icon0 = "group03.gif";
$icon1 = "today.gif";
$icon2 = "week.gif";
$icon3 = "month.gif";
$icon4 = "last.gif";
break;
case 3:
$icon0 = "group01.gif";
$icon1 = "blueman.gif";
$icon2 = "pinkman.gif";
$icon3 = "redman.gif";
$icon4 = "yellowman.gif";
break;
case 4:
$icon0 = "penguin00.png";
$icon1 = "penguin01.gif";
$icon2 = "penguin01.gif";
$icon3 = "penguin01.gif";
$icon4 = "penguin02.gif";
break;
}
if ($total_user == NULL) {?>
<table>
<tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon0; ?>" width="100%" height="100%" border="0" align="left" alt="" /></td><td><?php echo " 0 " ._REG_USS;?></td></tr>
</table><?php
} else {?>
<table>
<tr><td></td><td><?php echo " $total_user "._REG_USS;?></td></tr>
<?php if($show_today==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon1; ?>" border="0" align="right" alt="" /></td><td><?php echo " $today "._REG_TDY;?></td></tr><?php }; ?>
<?php if($show_week==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon2; ?>" border="0" align="right" alt="" /></td><td><?php echo " $thisweek "._REG_WEK;?></td></tr><?php }; ?>
<?php if($show_month==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon3; ?>" border="0" align="right" alt="" /></td><td><?php echo " $thismonth "._REG_MON;?></td></tr><?php }; ?>
<?php if($show_last==1) { ?><tr><td><img src="<?php echo $mosConfig_live_site; ?>/modules/mod_totalusers_images/<?php echo $icon4; ?>" border="0" align="right" alt="" /></td><td><?php echo _REG_LST;?><B><?php if($show_cb == 1) { echo "<a href='". sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$lastuser). "'>".$lastusername."</a>"; }else{ echo $lastusername;}?></B></td></tr><?php }; ?>
</table><?php
}
?>
_________________________________________________
Так вот вопрос: как сделать, чтобы он выводил 5-10 последних зарегившихся? Пока что выводит только одного.
Коммунити 1.1
Джумла 1.0.15