Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* @brief Income Report
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
@@ -12,35 +14,49 @@
|
||||
namespace IPS\nexus\modules\admin\reports;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\core\Statistics\Chart;
|
||||
use IPS\Helpers\Chart\Dynamic;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Money;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use function count;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Income Report
|
||||
*/
|
||||
class _income extends \IPS\Dispatcher\Controller
|
||||
class income extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
public static bool $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'income_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'income_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -49,13 +65,13 @@ class _income extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
$currencies = \IPS\nexus\Money::currencies();
|
||||
$currencies = Money::currencies();
|
||||
|
||||
$tabs = array( 'totals' => 'nexus_report_income_totals' );
|
||||
|
||||
if( \count( $currencies ) == 1 )
|
||||
if( count( $currencies ) == 1 )
|
||||
{
|
||||
$tabs['members'] = 'nexus_report_income_members';
|
||||
}
|
||||
@@ -63,30 +79,31 @@ class _income extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
foreach ( $currencies as $currency )
|
||||
{
|
||||
$tabs[ 'members_' . $currency ] = \IPS\Member::loggedIn()->language()->addToStack( 'nexus_report_income_by_member', FALSE, array( 'sprintf' => array( $currency ) ) );
|
||||
$tabs[ 'members_' . $currency ] = Member::loggedIn()->language()->addToStack( 'nexus_report_income_by_member', FALSE, array( 'sprintf' => array( $currency ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $currencies as $currency )
|
||||
{
|
||||
$tabs[ $currency ] = \IPS\Member::loggedIn()->language()->addToStack( 'nexus_report_income_by_method', FALSE, array( 'sprintf' => array( $currency ) ) );
|
||||
$tabs[ $currency ] = Member::loggedIn()->language()->addToStack( 'nexus_report_income_by_method', FALSE, array( 'sprintf' => array( $currency ) ) );
|
||||
}
|
||||
|
||||
\IPS\Request::i()->tab ??= 'totals';
|
||||
$activeTab = ( array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'totals';
|
||||
|
||||
$extension = \IPS\core\Statistics\Chart::loadFromExtension( 'nexus', 'Income' );
|
||||
$chart = $extension->getChart( \IPS\Http\Url::internal( 'app=nexus&module=reports&controller=income&tab=' . $activeTab ) );
|
||||
Request::i()->tab ??= 'totals';
|
||||
$activeTab = ( array_key_exists( Request::i()->tab, $tabs ) ) ? Request::i()->tab : 'totals';
|
||||
|
||||
$extension = Chart::loadFromExtension( 'nexus', 'Income' );
|
||||
$chart = $extension->getChart( Url::internal( 'app=nexus&module=reports&controller=income&tab=' . $activeTab ) );
|
||||
$extension->setExtra( $chart, $activeTab );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
|
||||
/* @var Dynamic $chart */
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
Output::i()->output = (string) $chart;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__nexus_reports_income');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $chart, \IPS\Http\Url::internal( "app=nexus&module=reports&controller=income" ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('menu__nexus_reports_income');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $chart, Url::internal( "app=nexus&module=reports&controller=income" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user