Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -89,6 +89,10 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('acp_notification_nexus_config_error_paymethod');
|
||||
}
|
||||
elseif( mb_substr( $this->extra, 0, 2 ) === 'po' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'acp_notification_nexus_config_error_payoutmethod' );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusBACancelErrors', FALSE, array( 'pluralize' => array( \count( json_decode( $this->extra, TRUE ) ) ) ) );
|
||||
@@ -111,6 +115,11 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
elseif( mb_substr( $this->extra, 0, 2 ) === 'po' )
|
||||
{
|
||||
$gateway = mb_substr( $this->extra, 2 );
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'acp_notification_nexus_config_error_payoutmethod_desc', FALSE, array( 'sprintf' => array( $gateway ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
@@ -136,6 +145,11 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
return '';
|
||||
}
|
||||
}
|
||||
elseif( mb_substr( $this->extra, 0, 2 ) === 'po' )
|
||||
{
|
||||
$gateway = mb_substr( $this->extra, 2 );
|
||||
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus', 'admin' )->payoutSettingsError( $gateway );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus', 'admin' )->baCancellationError( json_decode( $this->extra, TRUE ) );
|
||||
@@ -149,7 +163,7 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function severity()
|
||||
{
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::SEVERITY_CRITICAL : static::SEVERITY_OPTIONAL;
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' OR mb_substr( $this->extra, 0, 2 ) === 'po' ) ? static::SEVERITY_CRITICAL : static::SEVERITY_OPTIONAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +173,7 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function dismissible()
|
||||
{
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::DISMISSIBLE_NO : static::DISMISSIBLE_PERMANENT;
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' OR mb_substr( $this->extra, 0, 2 ) === 'po' ) ? static::DISMISSIBLE_NO : static::DISMISSIBLE_PERMANENT;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +209,7 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function style()
|
||||
{
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::STYLE_ERROR : static::STYLE_WARNING;
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' OR mb_substr( $this->extra, 0, 2 ) === 'po' ) ? static::STYLE_ERROR : static::STYLE_WARNING;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,6 +219,15 @@ class _ConfigurationError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function link()
|
||||
{
|
||||
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? \IPS\Http\Url::internal( 'app=nexus&module=payments&controller=paymentsettings&tab=gateways&do=form&id=' . \substr( $this->extra, 2 ) ) : parent::link();
|
||||
if( mb_substr( $this->extra, 0, 2 ) === 'pm' )
|
||||
{
|
||||
return \IPS\Http\Url::internal( 'app=nexus&module=payments&controller=paymentsettings&tab=gateways&do=form&id=' . \substr( $this->extra, 2 ) );
|
||||
}
|
||||
elseif( mb_substr( $this->extra, 0, 2 ) === 'po' )
|
||||
{
|
||||
return \IPS\Http\Url::internal( 'app=nexus&module=payments&controller=payouts&do=settings' );
|
||||
}
|
||||
|
||||
parent::link();
|
||||
}
|
||||
}
|
||||
+39
-79
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief ACP Notification: Hosting Errors
|
||||
* @brief ACP Notification Extension
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 27 Jul 2018
|
||||
* @subpackage Commerce
|
||||
* @since 18 Jan 2023
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\AdminNotifications;
|
||||
@@ -18,9 +18,9 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
}
|
||||
|
||||
/**
|
||||
* ACP Notification: Pending Shipping Orders
|
||||
* ACP Notification Extension
|
||||
*/
|
||||
class _HostingError extends \IPS\core\AdminNotification
|
||||
class _Maxmind extends \IPS\core\AdminNotification
|
||||
{
|
||||
/**
|
||||
* @brief Identifier for what to group this notification type with on the settings form
|
||||
@@ -30,12 +30,12 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
/**
|
||||
* @brief Priority 1-5 (1 being highest) for this group compared to others
|
||||
*/
|
||||
public static $groupPriority = 4;
|
||||
public static $groupPriority = 3;
|
||||
|
||||
/**
|
||||
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
|
||||
*/
|
||||
public static $itemPriority = 5;
|
||||
public static $itemPriority = 1;
|
||||
|
||||
/**
|
||||
* Title for settings
|
||||
@@ -44,46 +44,7 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public static function settingsTitle()
|
||||
{
|
||||
return 'acp_notification_HostingError';
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this type of notification ever optional (controls if it will be selectable as "viewable" in settings)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function mayBeOptional()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this type of notification might recur (controls what options will be available for the email setting)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function mayRecur()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Current count
|
||||
*/
|
||||
protected $count = NULL;
|
||||
|
||||
/**
|
||||
* Get count
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
if ( $this->count === NULL )
|
||||
{
|
||||
$this->count = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_errors' )->first();
|
||||
}
|
||||
return $this->count;
|
||||
return 'acp_notification_Maxmind';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,19 +55,39 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public static function permissionCheck( \IPS\Member $member )
|
||||
{
|
||||
return $member->hasAcpRestriction( 'nexus', 'hosting', 'errors_manage' ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_servers' )->first();
|
||||
return true;// $member->hasAcpRestriction( ... );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this type of notification ever optional (controls if it will be selectable as "viewable" in settings)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function mayBeOptional()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this type of notification might recur (controls what options will be available for the email setting)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function mayRecur()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification Title (full HTML, must be escaped where necessary)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function title()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusHostingErrors', FALSE, array( 'pluralize' => array( $this->count() ) ) );
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('acp_notification_nexus_maxmind');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notification Subtitle (no HTML)
|
||||
*
|
||||
@@ -114,14 +95,7 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function subtitle()
|
||||
{
|
||||
try
|
||||
{
|
||||
return \IPS\DateTime::ts( \IPS\Db::i()->select( 'e_time', 'nexus_hosting_errors', NULL, 'e_time asc', 1 )->first() )->relative();
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'acp_notification_nexus_maxmind_sub', FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,10 +105,7 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function body()
|
||||
{
|
||||
$table = \IPS\nexus\modules\admin\hosting\errors::table( \IPS\Http\Url::internal('app=core&module=overview&controller=notifications&_table=nexus_HostingError') );
|
||||
$table->limit = 10;
|
||||
|
||||
return $table;
|
||||
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus', 'admin' )->maxmind();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +115,7 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function severity()
|
||||
{
|
||||
return static::SEVERITY_OPTIONAL;
|
||||
return static::SEVERITY_HIGH;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,8 +124,8 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
* @return string
|
||||
*/
|
||||
public function dismissible()
|
||||
{
|
||||
return static::DISMISSIBLE_NO;
|
||||
{
|
||||
return static::DISMISSIBLE_TEMPORARY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,21 +141,10 @@ class _HostingError extends \IPS\core\AdminNotification
|
||||
/**
|
||||
* Quick link from popup menu
|
||||
*
|
||||
* @return bool
|
||||
* @return \IPS\Http\Url
|
||||
*/
|
||||
public function link()
|
||||
{
|
||||
return \IPS\Http\Url::internal('app=nexus&module=hosting&controller=errors');
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this notification dismiss itself?
|
||||
*
|
||||
* @note This is checked every time the notification shows. Should be lightweight.
|
||||
* @return bool
|
||||
*/
|
||||
public function selfDismiss()
|
||||
{
|
||||
return !$this->count();
|
||||
return parent::link(); // \IPS\Http\Url::internal( '...' );
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Community Enhancements: eNom
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Nexus
|
||||
* @since 08 Aug 2014
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\CommunityEnhancements;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Community Enhancement
|
||||
*/
|
||||
class _Enom
|
||||
{
|
||||
/**
|
||||
* @brief Enhancement is enabled?
|
||||
*/
|
||||
public $enabled = FALSE;
|
||||
|
||||
/**
|
||||
* @brief IPS-provided enhancement?
|
||||
*/
|
||||
public $ips = FALSE;
|
||||
|
||||
/**
|
||||
* @brief Enhancement has configuration options?
|
||||
*/
|
||||
public $hasOptions = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Icon data
|
||||
*/
|
||||
public $icon = "enom.gif";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->enabled = (bool) \IPS\Settings::i()->nexus_enom_un;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'nexus_enom_un', \IPS\Settings::i()->nexus_enom_un, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'nexus_enom_pw', \IPS\Settings::i()->nexus_enom_pw, TRUE ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
try
|
||||
{
|
||||
$enom = new \IPS\nexus\DomainRegistrar\Enom( $values['nexus_enom_un'], $values['nexus_enom_pw'] );
|
||||
$enom->check( 'example', 'com' );
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved');
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$form->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'help' => array(
|
||||
'title' => 'learn_more',
|
||||
'icon' => 'question-circle',
|
||||
'link' => \IPS\Http\Url::ips( 'docs/enom' ),
|
||||
'target' => '_blank'
|
||||
),
|
||||
);
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable
|
||||
*
|
||||
* @param $enabled bool Enable/Disable
|
||||
* @return void
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function toggle( $enabled )
|
||||
{
|
||||
if ( $enabled )
|
||||
{
|
||||
throw new \LogicException;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Settings::i()->changeValues( array( 'nexus_enom_un' => '', 'nexus_enom_pw' => '' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,9 +62,12 @@ class _MaxMind
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'maxmind_enable', (bool) \IPS\Settings::i()->maxmind_key, FALSE, array( 'togglesOn' => array( 'maxmind_key', 'maxmind_gateways', 'maxmind_error' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'maxmind_id', \IPS\Settings::i()->maxmind_id, FALSE, array(), NULL, NULL, NULL, 'maxmind_id' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'maxmind_key', \IPS\Settings::i()->maxmind_key, FALSE, array(), NULL, NULL, NULL, 'maxmind_key' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'maxmind_gateways', ( !\IPS\Settings::i()->maxmind_gateways or \IPS\Settings::i()->maxmind_gateways === '*' ) ? 0 : explode( ',', \IPS\Settings::i()->maxmind_gateways ), FALSE, array( 'class' => 'IPS\nexus\Gateway', 'multiple' => TRUE, 'zeroVal' => 'all' ), NULL, NULL, NULL, 'maxmind_gateways' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'maxmind_error', \IPS\Settings::i()->maxmind_error, FALSE, array( 'options' => array( 'okay' => 'maxmind_error_okay', 'hold' => 'maxmind_error_hold' ) ), NULL, NULL, NULL, 'maxmind_error' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'maxmind_tracking_code', (bool) \IPS\Settings::i()->maxmind_tracking_code, FALSE, array(), NULL, NULL, NULL, 'maxmind_tracking_code' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
try
|
||||
@@ -72,7 +75,7 @@ class _MaxMind
|
||||
if ( $values['maxmind_enable'] )
|
||||
{
|
||||
unset( $values['maxmind_enable'] );
|
||||
$this->testSettings( $values['maxmind_key'] );
|
||||
$this->testSettings( $values['maxmind_key'], $values['maxmind_id'] );
|
||||
$values['maxmind_gateways'] = \is_array( $values['maxmind_gateways'] ) ? implode( ',', array_keys( $values['maxmind_gateways'] ) ) : '*';
|
||||
$form->saveAsSettings( $values );
|
||||
}
|
||||
@@ -80,10 +83,12 @@ class _MaxMind
|
||||
{
|
||||
unset( $values['maxmind_enable'] );
|
||||
$values['maxmind_key'] = '';
|
||||
$values['maxmind_id'] = '';
|
||||
$values['maxmind_gateways'] = '*';
|
||||
$form->saveAsSettings( $values );
|
||||
}
|
||||
|
||||
|
||||
\IPS\core\AdminNotification::remove( 'nexus', 'Maxmind' );
|
||||
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved');
|
||||
}
|
||||
catch ( \LogicException $e )
|
||||
@@ -119,7 +124,8 @@ class _MaxMind
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Settings::i()->changeValues( array( 'maxmind_key' => '' ) );
|
||||
\IPS\Settings::i()->changeValues( array( 'maxmind_key' => '', 'maxmind_id' => '' ) );
|
||||
\IPS\core\AdminNotification::remove( 'nexus', 'Maxmind' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +133,11 @@ class _MaxMind
|
||||
* Test Settings
|
||||
*
|
||||
* @param string|NULL $key Key to check
|
||||
* @param string|NULL $id ID to check
|
||||
* @return void
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function testSettings( $key=NULL )
|
||||
protected function testSettings( $key=NULL, $id=NULL )
|
||||
{
|
||||
$testAddress = new \IPS\GeoLocation;
|
||||
$testAddress->addressLines = array( 'Invision Power Services, Inc.', 'PO Box 2365' );
|
||||
@@ -139,13 +146,14 @@ class _MaxMind
|
||||
$testAddress->country = 'US';
|
||||
$testAddress->postalCode = '24551';
|
||||
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request( FALSE, $key );
|
||||
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request( FALSE, $key, $id );
|
||||
$maxMind->setIpAddress( \IPS\Request::i()->ipAddress() );
|
||||
$maxMind->setBillingAddress( $testAddress );
|
||||
$maxMind = $maxMind->request();
|
||||
if ( $maxMind->err )
|
||||
|
||||
if ( $maxMind->error )
|
||||
{
|
||||
throw new \LogicException( $maxMind->err );
|
||||
throw new \LogicException( $maxMind->error );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,6 @@ class _PendingActions
|
||||
or
|
||||
\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'promotion', 'advertisements_manage' )
|
||||
or
|
||||
\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'hosting', 'errors_manage' )
|
||||
or
|
||||
\IPS\Settings::i()->nexus_payout and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'payouts_manage' ) );
|
||||
}
|
||||
|
||||
@@ -81,17 +79,6 @@ class _PendingActions
|
||||
}
|
||||
}
|
||||
|
||||
/* And hosting errors */
|
||||
$hostingErrors = NULL;
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'hosting', 'errors_manage' ) )
|
||||
{
|
||||
$hostingErrors = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_errors' )->first();
|
||||
if ( !$hostingErrors and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_servers' )->first() )
|
||||
{
|
||||
$hostingErrors = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Withdrawals will only be if enabled */
|
||||
$pendingWithdrawals = NULL;
|
||||
if ( \IPS\Settings::i()->nexus_payout and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'payouts_manage' ) )
|
||||
@@ -109,7 +96,7 @@ class _PendingActions
|
||||
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'widgets.css', 'nexus', 'front' ) );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'dashboard', 'nexus' )->pendingActions( $pendingTransactions, $pendingShipments, $pendingWithdrawals, $openSupportRequests, $pendingAdvertisements, $hostingErrors );
|
||||
return \IPS\Theme::i()->getTemplate( 'dashboard', 'nexus' )->pendingActions( $pendingTransactions, $pendingShipments, $pendingWithdrawals, $openSupportRequests, $pendingAdvertisements );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,9 +144,6 @@ class _Admin
|
||||
case 'invoice-header';
|
||||
case 'invoice-footer':
|
||||
return \IPS\Http\Url::internal( 'app=nexus&module=payments&controller=invoices&do=settings', 'admin' );
|
||||
|
||||
case 'network_status_text':
|
||||
return \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=networkStatus', 'front', 'nexus_network_status' );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Front Navigation Extension: Network Status
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Nexus
|
||||
* @since 08 Apr 2014
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\FrontNavigation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Front Navigation Extension: Network Status
|
||||
*/
|
||||
class _NetworkStatus extends \IPS\core\FrontNavigation\FrontNavigationAbstract
|
||||
{
|
||||
/**
|
||||
* Get Type Title which will display in the AdminCP Menu Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function typeTitle()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('network_status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this item be used at all?
|
||||
* For example, if this will link to a particular feature which has been diabled, it should
|
||||
* not be available, even if the user has permission
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEnabled()
|
||||
{
|
||||
return \IPS\Settings::i()->network_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the currently logged in user access the content this item links to?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessContent()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function title()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('network_status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link
|
||||
*
|
||||
* @return \IPS\Http\Url
|
||||
*/
|
||||
public function link()
|
||||
{
|
||||
return \IPS\Http\Url::internal( "app=nexus&module=clients&controller=networkStatus", 'front', 'nexus_network_status' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Active?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function active()
|
||||
{
|
||||
return \IPS\Dispatcher::i()->application->directory === 'nexus' and \IPS\Dispatcher::i()->module and \IPS\Dispatcher::i()->module->key === 'clients' and \IPS\Dispatcher::i()->controller == 'networkStatus';
|
||||
}
|
||||
}
|
||||
@@ -478,7 +478,7 @@ class _Support
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( preg_match( '/From:.+?(\b[A-Z0-9._%+-\']+@[A-Z0-9.-]+\.[A-Z]{2,9}\b)/i', $email->quote, $_matches ) )
|
||||
if ( preg_match( '/From:.+?(\b[A-Z0-9\._%+\-\']+@[A-Z0-9\.\-]+\.[A-Z]{2,9}\b)/i', $email->quote, $_matches ) )
|
||||
{
|
||||
$originallyFrom = $_matches[1];
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class _Payouts
|
||||
* @return bool
|
||||
* @note If the method does not exist in an extension, the result is presumed to be TRUE
|
||||
*/
|
||||
public function supportedInModCp()
|
||||
public function supportedInModCp(): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class _Support
|
||||
* @return bool
|
||||
* @note If the method does not exist in an extension, the result is presumed to be TRUE
|
||||
*/
|
||||
public function supportedInModCp()
|
||||
public function supportedInModCp(): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class _Transactions
|
||||
* @return bool
|
||||
* @note If the method does not exist in an extension, the result is presumed to be TRUE
|
||||
*/
|
||||
public function supportedInModCp()
|
||||
public function supportedInModCp(): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -123,24 +123,6 @@ class _Nexus
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
/* Hosting Accounts */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'customers', 'purchases_view' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$account = \IPS\nexus\Hosting\Account::constructFromData( \IPS\Db::i()->select( '*', 'nexus_hosting_accounts', array( 'LOWER(account_domain)=?', mb_strtolower( $searchTerm ) ) )->first() );
|
||||
$results[] = \IPS\Theme::i()->getTemplate('livesearch', 'nexus')->hosting( $account );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
|
||||
try
|
||||
{
|
||||
$account = \IPS\nexus\Hosting\Account::constructFromData( \IPS\Db::i()->select( '*', 'nexus_hosting_accounts', array( 'LOWER(account_username)=?', mb_strtolower( $searchTerm ) ) )->first() );
|
||||
$results[] = \IPS\Theme::i()->getTemplate('livesearch', 'nexus')->hosting( $account );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
/* Customers */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'customers', 'customers_view' ) )
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Length
|
||||
*
|
||||
* @param string $data The initial data from the tag
|
||||
* @param array $options Array of options
|
||||
* @return array array( 'pre' => Code to eval before 'return', 'return' => Code to eval to return desired value )
|
||||
* @return array|string array( 'pre' => Code to eval before 'return', 'return' => Code to eval to return desired value )
|
||||
*/
|
||||
public static function runPlugin( $data, $options )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Statistics Chart Extension
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @subpackage Commerce
|
||||
* @since 26 Jan 2023
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\Statistics;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistics Chart Extension
|
||||
*/
|
||||
class _Income extends \IPS\core\Statistics\Chart
|
||||
{
|
||||
/**
|
||||
* @brief Controller
|
||||
*/
|
||||
public $controller = 'nexus_reports_income_totals';
|
||||
|
||||
/**
|
||||
* @brief Identifier
|
||||
*/
|
||||
protected $_identifier = 'totals';
|
||||
|
||||
/**
|
||||
* Render Chart
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL the chart is being shown on.
|
||||
* @return \IPS\Helpers\Chart
|
||||
*/
|
||||
public function getChart( \IPS\Http\Url $url ): \IPS\Helpers\Chart
|
||||
{
|
||||
$chart = new \IPS\Helpers\Chart\Database(
|
||||
$url,
|
||||
'nexus_transactions',
|
||||
't_date',
|
||||
'',
|
||||
array(
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
( \IPS\Request::i()->tab == 'members' ) ? 'PieChart' : 'AreaChart',
|
||||
'monthly',
|
||||
array( 'start' => 0, 'end' => 0 ),
|
||||
array(),
|
||||
$this->_identifier
|
||||
);
|
||||
$chart->setExtension( $this );
|
||||
$chart->where[] = array( '( t_status=? OR t_status=? ) AND t_method>0', \IPS\nexus\Transaction::STATUS_PAID, \IPS\nexus\Transaction::STATUS_PART_REFUNDED );
|
||||
|
||||
$chart->tableInclude = array( 't_id', 't_member', 't_invoice', 't_method', 't_amount', 't_date' );
|
||||
$chart->tableParsers = array(
|
||||
't_member' => function( $val ) {
|
||||
return \IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\Member::load( $val ) );
|
||||
},
|
||||
't_method' => function( $val ) {
|
||||
if ( $val )
|
||||
{
|
||||
try
|
||||
{
|
||||
return \IPS\nexus\Gateway::load( $val )->_title;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('account_credit');
|
||||
}
|
||||
},
|
||||
't_amount' => function( $val, $row )
|
||||
{
|
||||
return (string) new \IPS\nexus\Money( $val, $row['t_currency'] );
|
||||
},
|
||||
't_invoice' => function( $val )
|
||||
{
|
||||
try
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
},
|
||||
't_date' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
}
|
||||
);
|
||||
|
||||
return $chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Extra
|
||||
*
|
||||
* @param \IPS\Helpers\Chart $chart Chart
|
||||
* @param string $what What we're setting.
|
||||
*/
|
||||
public function setExtra( \IPS\Helpers\Chart &$chart, string $what )
|
||||
{
|
||||
$currencies = \IPS\nexus\Money::currencies();
|
||||
$this->controller = "nexus_reports_income_{$what}";
|
||||
$this->_identifier = $what;
|
||||
|
||||
if ( $what === 'totals' )
|
||||
{
|
||||
$chart->groupBy = 't_currency';
|
||||
|
||||
foreach ( $currencies as $currency )
|
||||
{
|
||||
$chart->addSeries( $currency, 'number', 'SUM(t_amount)-SUM(t_partial_refund)', TRUE, $currency );
|
||||
}
|
||||
}
|
||||
elseif( mb_strpos( $what, 'members' ) === 0 )
|
||||
{
|
||||
$chart->groupBy = 't_member';
|
||||
|
||||
if( \count( $currencies ) === 1 )
|
||||
{
|
||||
$chart->format = array_pop( $currencies );
|
||||
}
|
||||
else
|
||||
{
|
||||
$chart->format = mb_substr( $what, 8 );
|
||||
$chart->where[] = array( 't_currency=?', $chart->format );
|
||||
}
|
||||
|
||||
foreach ( \IPS\Db::i()->select( 't_member, SUM(t_amount)-SUM(t_partial_refund) as _amount', 'nexus_transactions', $chart->where, '_amount DESC', array( 0, 20 ), 't_member' ) as $member )
|
||||
{
|
||||
$chart->addSeries( \IPS\Member::load( $member['t_member'] )->name, 'number', 'SUM(t_amount)-SUM(t_partial_refund)', TRUE, $member['t_member'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$chart->where[] = array( 't_currency=?', $what );
|
||||
$chart->groupBy = 't_method';
|
||||
$chart->format = $what;
|
||||
|
||||
foreach ( \IPS\nexus\Gateway::roots() as $gateway )
|
||||
{
|
||||
$chart->addSeries( $gateway->_title, 'number', 'SUM(t_amount)-SUM(t_partial_refund)', TRUE, $gateway->id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Statistics Chart Extension
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @subpackage Commerce
|
||||
* @since 26 Jan 2023
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\Statistics;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistics Chart Extension
|
||||
*/
|
||||
class _Market extends \IPS\core\Statistics\Chart
|
||||
{
|
||||
/**
|
||||
* @brief Controller
|
||||
*/
|
||||
public $controller = 'nexus_reports_markets_count';
|
||||
|
||||
/**
|
||||
* @brief Identifier
|
||||
*/
|
||||
protected $_identifier = 'count';
|
||||
|
||||
/**
|
||||
* Render Chart
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL the chart is being shown on.
|
||||
* @return \IPS\Helpers\Chart
|
||||
*/
|
||||
public function getChart( \IPS\Http\Url $url ): \IPS\Helpers\Chart
|
||||
{
|
||||
$chart = new \IPS\Helpers\Chart\Database(
|
||||
$url,
|
||||
'nexus_invoices',
|
||||
'i_paid',
|
||||
'',
|
||||
array(
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#c9e2de', '#10967e' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'GeoChart',
|
||||
'monthly',
|
||||
array( 'start' => 0, 'end' => 0 ),
|
||||
array(),
|
||||
$this->_identifier
|
||||
);
|
||||
$chart->setExtension( $this );
|
||||
$chart->availableTypes[] = 'GeoChart';
|
||||
$chart->where[] = array( 'i_status=? AND i_billcountry IS NOT NULL', \IPS\nexus\Invoice::STATUS_PAID );
|
||||
$chart->groupBy = 'i_billcountry';
|
||||
|
||||
foreach ( \IPS\GeoLocation::$countries as $countryCode )
|
||||
{
|
||||
$chart->addSeries( [ 'value' => \IPS\Member::loggedIn()->language()->get( 'country-' . $countryCode ), 'key' => $countryCode ], 'number', $this->_identifier === 'count' ? 'COUNT(*)' : 'SUM(i_total)', TRUE, $countryCode );
|
||||
}
|
||||
|
||||
if ( $chart->type === 'GeoChart' )
|
||||
{
|
||||
$chart->options['height'] = 750;
|
||||
$chart->options['keepAspectRatio'] = true;
|
||||
}
|
||||
|
||||
return $chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Currency
|
||||
*
|
||||
* @param \IPS\Helpers\Chart $chart Chart
|
||||
* @param string $currency Currency
|
||||
*/
|
||||
public function setCurrency( \IPS\Helpers\Chart &$chart, string $currency )
|
||||
{
|
||||
if ( !\in_array( $currency, \IPS\nexus\Money::currencies() ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
|
||||
$this->_identifier = $currency;
|
||||
$chart->where[] = array( 'i_currency=?', $currency );
|
||||
$chart->format = $currency;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Statistics Chart Extension
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @subpackage Commerce
|
||||
* @since 26 Jan 2023
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\Statistics;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistics Chart Extension
|
||||
*/
|
||||
class _Sales extends \IPS\core\Statistics\Chart
|
||||
{
|
||||
/**
|
||||
* @brief Controller
|
||||
*/
|
||||
public $controller = 'nexus_reports_purchases';
|
||||
|
||||
/**
|
||||
* Render Chart
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL the chart is being shown on.
|
||||
* @return \IPS\Helpers\Chart
|
||||
*/
|
||||
public function getChart( \IPS\Http\Url $url ): \IPS\Helpers\Chart
|
||||
{
|
||||
$chart = new \IPS\Helpers\Chart\Database(
|
||||
$url,
|
||||
'nexus_purchases',
|
||||
'ps_start',
|
||||
'',
|
||||
array(
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
)
|
||||
);
|
||||
$chart->setExtension( $this );
|
||||
$chart->where[] = array( 'ps_app=? AND ps_type=?', 'nexus', 'package' );
|
||||
$chart->groupBy = 'ps_item_id';
|
||||
$chart->tableInclude = array( 'ps_id', 'ps_member', 'ps_name', 'ps_start', 'ps_expire' );
|
||||
$chart->tableParsers = array(
|
||||
'ps_member' => function( $val ) {
|
||||
return \IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\Member::load( $val ) );
|
||||
},
|
||||
'ps_start' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
},
|
||||
'ps_expire' => function( $val ) {
|
||||
return $val ? \IPS\DateTime::ts( $val ) : '';
|
||||
}
|
||||
);
|
||||
|
||||
$packages = array();
|
||||
foreach ( \IPS\Db::i()->select( 'p_id', 'nexus_packages' ) as $packageId )
|
||||
{
|
||||
$packages[ $packageId ] = \IPS\Member::loggedIn()->language()->get( 'nexus_package_' . $packageId );
|
||||
}
|
||||
|
||||
asort( $packages );
|
||||
foreach ( $packages as $id => $name )
|
||||
{
|
||||
$chart->addSeries( $name, 'number', 'COUNT(*)', TRUE, $id );
|
||||
}
|
||||
|
||||
return $chart;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Statistics Chart Extension
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @subpackage Commerce
|
||||
* @since 26 Jan 2023
|
||||
*/
|
||||
|
||||
namespace IPS\nexus\extensions\core\Statistics;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistics Chart Extension
|
||||
*/
|
||||
class _Support extends \IPS\core\Statistics\Chart
|
||||
{
|
||||
/**
|
||||
* @brief Controller
|
||||
*/
|
||||
public $controller = 'nexus_support_volume';
|
||||
|
||||
/**
|
||||
* Render Chart
|
||||
*
|
||||
* @param \IPS\Http\Url $url URL the chart is being shown on.
|
||||
* @return \IPS\Helpers\Chart
|
||||
*/
|
||||
public function getChart( \IPS\Http\Url $url ): \IPS\Helpers\Chart
|
||||
{
|
||||
$chart = new \IPS\Helpers\Chart\Database( $url, 'nexus_support_requests', 'r_started', '',
|
||||
array(
|
||||
'vAxis' => array( 'title' => \IPS\Member::loggedIn()->language()->addToStack('support_requests_created') ),
|
||||
'backgroundColor' => '#ffffff',
|
||||
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'AreaChart'
|
||||
);
|
||||
$chart->setExtension( $this );
|
||||
$chart->groupBy = 'r_department';
|
||||
foreach( \IPS\nexus\Support\Department::roots() as $department )
|
||||
{
|
||||
$chart->addSeries( $department->_title, 'number', 'COUNT(*)', TRUE, $department->id );
|
||||
}
|
||||
|
||||
$chart->tableInclude = array( 'r_id', 'r_title', 'r_member', 'r_department', 'r_status', 'r_started', 'r_last_reply', 'r_replies' );
|
||||
$chart->tableParsers = array(
|
||||
'r_member' => function( $val ) {
|
||||
return \IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\Member::load( $val ) );
|
||||
},
|
||||
'r_department' => function( $val ) {
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_department_' . $val );
|
||||
},
|
||||
'r_status' => function( $val, $row )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_status_' . $val . '_admin' );
|
||||
},
|
||||
'r_started' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
},
|
||||
'r_last_reply' => function( $val ) {
|
||||
return \IPS\DateTime::ts( $val );
|
||||
}
|
||||
);
|
||||
|
||||
return $chart;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user