import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -79,7 +79,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
private function _populateWeekData(&$labelsy, &$datay)
{
$stats = new Stats_Model_Stats();
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time());
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time(), true);
for ($i = -7; $i < 0; $i++) {
$time = strtotime("$i days");
@ -96,7 +96,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
private function _populateMonthData(&$labelsy, &$datay)
{
$stats = new Stats_Model_Stats();
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'));
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'), true);
for ($i = -30; $i < -7; $i++) {
$time = strtotime("$i days");
@ -114,7 +114,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
{
$stats = new Stats_Model_Stats();
$firstDayOfMonth = date('Y-' . date('m') . '-01');
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time(), true);
for ($i = -11; $i <= 0; $i++) {
$time = strtotime("$i months");

View File

@ -25,7 +25,7 @@ class Stats_Model_Stats
/**
* @return Array
*/
public function getNumRegisteredUsersDays($unixDateStart, $unixDateEnd)
public function getNumRegisteredUsersDays($unixDateStart, $unixDateEnd, $countUnconfirmed = false)
{
$select = $this->_db->select()->from('users', array('registration_date' => 'registration_date', 'users' => 'COUNT(registration_date)'))
->where('registration_date >= ?', strftime('%Y-%m-%d', $unixDateStart))
@ -33,13 +33,17 @@ class Stats_Model_Stats
->group('registration_date')
->order('registration_date');
if (!$countUnconfirmed) {
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
}
return $this->_db->fetchAssoc($select);
}
/**
* @return Array
*/
public function getNumRegisteredUsersYear($unixDateStart, $unixDateEnd)
public function getNumRegisteredUsersYear($unixDateStart, $unixDateEnd, $countUnconfirmed = false)
{
$select = $this->_db->select()->from('users', array('registration_date' => 'MONTH(registration_date)', 'users' => 'COUNT(MONTH(registration_date))'))
->where('registration_date >= ?', strftime('%Y-%m-%d', $unixDateStart))
@ -47,17 +51,25 @@ class Stats_Model_Stats
->group('MONTH(registration_date)')
->order('registration_date');
if (!$countUnconfirmed) {
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
}
return $this->_db->fetchAssoc($select);
}
/**
* @return int
*/
public function getNumRegisteredUsers($unixDate)
public function getNumRegisteredUsers($unixDate, $countUnconfirmed = false)
{
$select = $this->_db->select()->from('users')
->where('registration_date < ?', strftime('%Y-%m-%d', $unixDate));
if (!$countUnconfirmed) {
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
}
$statement = $this->_db->prepare($select);
$statement->execute();

View File

@ -2,9 +2,9 @@
<div>
<?php echo $this->translate('Select view') ?>:
<select name="view" onchange="COMMID.stats.loadReport('authorizations', 'statsAuths', 'type=' + this.value)">
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
</select>
</div>
<img src="<?php echo $this->base ?>/stats/authorizations/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
<img src="<?php echo $this->base ?>/stats/authorizations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />

View File

@ -2,9 +2,9 @@
<div>
<?php echo $this->translate('Select view') ?>:
<select name="view" onchange="COMMID.stats.loadReport('registrations', 'statsRegs', 'type=' + this.value)">
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
<option value="month" <?php echo $this->monthSelected ?>><?= $this->translate('Last Month') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
<option value="month" <?php echo $this->monthSelected ?>><?php echo $this->translate('Last Month') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
</select>
</div>
<img src="<?php echo $this->base ?>/stats/registrations/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
<img src="<?php echo $this->base ?>/stats/registrations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />

View File

@ -2,8 +2,8 @@
<div>
<?php echo $this->translate('Select view') ?>:
<select name="view" onchange="COMMID.stats.loadReport('sites', 'statsNumTrustedSites', 'type=' + this.value)">
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
</select>
</div>
<img src="<?php echo $this->base ?>/stats/sites/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
<img src="<?php echo $this->base ?>/stats/sites/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />