Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -50,6 +50,14 @@ class _membersactivity extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
$tabs = array(
'overview' => 'stats_activity_overview',
'inactive' => 'stats_activity_inactive',
);
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'overview';
$count = NULL;
$table = NULL;
$start = NULL;
@@ -72,7 +80,7 @@ class _membersactivity extends \IPS\Dispatcher\Controller
{
$defaultGroups = array_keys( $groupOptions );
}
$form = new \IPS\Helpers\Form( 'posts', 'continue' );
$form->add( new \IPS\Helpers\Form\DateRange( 'date', $defaults, TRUE ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'groups', $defaultGroups, FALSE, array( 'options' => $groupOptions ), NULL, NULL, NULL, 'group_filters' ) );
@@ -104,7 +112,15 @@ class _membersactivity extends \IPS\Dispatcher\Controller
if( $start AND $end )
{
/* Build our where clause */
$where = array( array( 'member_last_post BETWEEN ? AND ?', $startTime, $endTime ) );
if( $activeTab == 'overview' )
{
$where = array( array( 'member_last_post BETWEEN ? AND ?', $startTime, $endTime ) );
}
else
{
$where = array( array( 'joined BETWEEN ? AND ?', $startTime, $endTime ) );
$where[] = array( 'last_activity = 0' );
}
if( $groups !== NULL )
{
@@ -113,7 +129,7 @@ class _membersactivity extends \IPS\Dispatcher\Controller
/* Get the count */
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', $where )->first();
/* And now build the table */
$table = new \IPS\Helpers\Table\Db( 'core_members', \IPS\Request::i()->url()->setQueryString( array( 'postDateStart' => $startTime, 'postDateEnd' => $endTime, 'postGroups' => \is_array( $groups ) ? implode( ',', $groups ) : NULL ) ), $where );
@@ -126,7 +142,7 @@ class _membersactivity extends \IPS\Dispatcher\Controller
/* Default sort options */
$table->sortBy = $table->sortBy ?: 'member_last_post';
$table->sortDirection = $table->sortDirection ?: 'desc';
/* Custom parsers */
$table->parsers = array(
'name' => function( $val, $row )
@@ -140,12 +156,12 @@ class _membersactivity extends \IPS\Dispatcher\Controller
},
'member_last_post' => function( $val, $row )
{
return \IPS\DateTime::ts( $val )->html();
return ( $val ) ? \IPS\DateTime::ts( $val )->html() : \IPS\Member::loggedIn()->language()->addToStack('never');
},
'group_name' => function( $val, $row )
{
$secondary = \IPS\Member::constructFromData( $row )->groups;
foreach( $secondary as $k => $v )
{
if( $v == $row['member_group_id'] or $v == 0 )
@@ -153,7 +169,7 @@ class _membersactivity extends \IPS\Dispatcher\Controller
unset( $secondary[ $k ] );
continue;
}
$secondary[ $k ] = \IPS\Member\Group::load( $v );
}
@@ -169,13 +185,27 @@ class _membersactivity extends \IPS\Dispatcher\Controller
},
);
$table->extraHtml = \IPS\Theme::i()->getTemplate( 'stats' )->tableheader( $start, $end, $count, "member_activity_results" );
$table->extraHtml = \IPS\Theme::i()->getTemplate( 'stats' )->tableheader( $start, $end, $count, ( $activeTab == "overview" ) ? "member_activity_results" : 'member_activity_results_inactive' );
}
$formHtml = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'stats' ), 'filtersFormTemplate' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_stats.js', 'core' ) );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_membersactivity');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'stats' )->memberactivity( $formHtml, $count, $table );
$chart = \IPS\Theme::i()->getTemplate( 'stats' )->memberactivity( $formHtml, $count, $table, $activeTab );
if ( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->output = (string) $chart;
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $chart, \IPS\Http\Url::internal( "app=core&module=stats&controller=membersactivity" ), 'tab', '', 'ipsPad' );
}
}
}