Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

@@ -0,0 +1,194 @@
<?php
/**
* @brief ACP Notification: Advertisements Requiring Approval
* @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
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Advertisements Requiring Approval
*/
class _Advertisement extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 4;
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_Advertisement';
}
/**
* 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(*)', 'core_advertisements', array( 'ad_active=-1' ) )->first();
}
return $this->count;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'core', 'promotion', 'advertisements_manage' ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_packages_ads' )->first();
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusAdvertisements', FALSE, array( 'pluralize' => array( $this->count() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
try
{
return \IPS\DateTime::ts( \IPS\Db::i()->select( 'ad_start', 'core_advertisements', array( 'ad_active=-1' ), 'ad_start asc', 1 )->first() )->relative();
}
catch ( \UnderflowException $e )
{
return NULL;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
$table = \IPS\core\modules\admin\promotion\advertisements::table( \IPS\Http\Url::internal('app=core&module=overview&controller=notifications&_table=nexus_Advertisement') );
$table->limit = 10;
$table->filters = array();
$table->quickSearch = NULL;
$table->advancedSearch = NULL;
$table->where[] = array( 'ad_active=-1' );
return (string) $table;
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
return static::STYLE_INFORMATION;
}
/**
* Quick link from popup menu
*
* @return bool
*/
public function link()
{
return \IPS\Http\Url::internal('app=core&module=promotion&controller=advertisements&filter=ad_filters_pending');
}
/**
* 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();
}
}
@@ -0,0 +1,210 @@
<?php
/**
* @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/
* @subpackage Commerce
* @since 29 Oct 2019
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification Extension
*/
class _ConfigurationError extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 5;
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_ConfigurationError';
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'nexus', 'payments', 'gateways_manage' );
}
/**
* 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;
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
if( mb_substr( $this->extra, 0, 2 ) === 'pm' )
{
return \IPS\Member::loggedIn()->language()->addToStack('acp_notification_nexus_config_error_paymethod');
}
else
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusBACancelErrors', FALSE, array( 'pluralize' => array( \count( json_decode( $this->extra, TRUE ) ) ) ) );
}
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
if( mb_substr( $this->extra, 0, 2 ) === 'pm' )
{
try
{
$method = \IPS\nexus\Gateway::load( \substr( $this->extra, 2 ) );
return \IPS\Member::loggedIn()->language()->addToStack( 'acp_notification_nexus_config_error_paymethod_desc', FALSE, array( 'sprintf' => array( $method->_title ) ) );
}
catch ( \OutOfRangeException $e ) { }
}
else
{
return '';
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
if( mb_substr( $this->extra, 0, 2 ) === 'pm' )
{
try
{
$method = \IPS\nexus\Gateway::load( \substr( $this->extra, 2 ) );
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus', 'admin' )->paymentMethodError( $method );
}
catch ( \OutOfRangeException $e )
{
return '';
}
}
else
{
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus', 'admin' )->baCancellationError( json_decode( $this->extra, TRUE ) );
}
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::SEVERITY_CRITICAL : static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::DISMISSIBLE_NO : static::DISMISSIBLE_PERMANENT;
}
/**
* Should this notification dismiss itself?
*
* @note This is checked every time the notification shows. Should be lightweight.
* @return bool
*/
public function selfDismiss()
{
if( mb_substr( $this->extra, 0, 2 ) === 'pm' )
{
try
{
\IPS\nexus\Gateway::load( \substr( $this->extra, 2 ) );
return FALSE;
}
catch( \OutOfRangeException $e )
{
return TRUE;
}
}
else
{
return parent::selfDismiss();
}
}
/**
* Style
*
* @return bool
*/
public function style()
{
return ( mb_substr( $this->extra, 0, 2 ) === 'pm' ) ? static::STYLE_ERROR : static::STYLE_WARNING;
}
/**
* Quick link from popup menu
*
* @return \IPS\Http\Url
*/
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();
}
}
@@ -0,0 +1,190 @@
<?php
/**
* @brief ACP Notification: Hosting Errors
* @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
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Pending Shipping Orders
*/
class _HostingError extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 5;
/**
* Title for settings
*
* @return string
*/
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;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'nexus', 'hosting', 'errors_manage' ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_servers' )->first();
}
/**
* 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() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
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;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
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;
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
return static::STYLE_ERROR;
}
/**
* Quick link from popup menu
*
* @return bool
*/
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();
}
}
@@ -0,0 +1,194 @@
<?php
/**
* @brief ACP Notification: Pending Shipping Orders
* @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 26 Jul 2018
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Pending Shipping Orders
*/
class _Shipment extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 3;
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_Shipments';
}
/**
* 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_ship_orders', array( 'o_status=?', 'pend' ) )->first();
}
return $this->count;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'nexus', 'payments', 'shiporders_manage' ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_shipping' )->first();
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusShipments', FALSE, array( 'pluralize' => array( $this->count() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
try
{
return \IPS\DateTime::ts( \IPS\Db::i()->select( 'o_date', 'nexus_ship_orders', array( 'o_status=?', 'pend' ), 'o_date asc', 1 )->first() )->relative();
}
catch ( \UnderflowException $e )
{
return NULL;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
$table = \IPS\nexus\Shipping\Order::table( \IPS\Http\Url::internal('app=core&module=overview&controller=notifications&_table=nexus_Shipment') );
$table->limit = 10;
$table->filters = array();
$table->quickSearch = NULL;
$table->advancedSearch = NULL;
$table->where[] = array( 'o_status=?', 'pend' );
return $table;
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
return static::STYLE_INFORMATION;
}
/**
* Quick link from popup menu
*
* @return bool
*/
public function link()
{
return \IPS\Http\Url::internal('app=nexus&module=payments&controller=shipping');
}
/**
* 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();
}
}
@@ -0,0 +1,268 @@
<?php
/**
* @brief ACP Notification: Open Support Requests
* @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 26 Jul 2018
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Open Support Requests
*/
class _Support extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 1;
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_Support';
}
/**
* 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 (that this admin can see)
*/
protected $count = NULL;
/**
* Get count
*
* @param \IPS\Member $member The member
* @return bool
*/
public function count( \IPS\Member $member = NULL )
{
if ( $this->count === NULL )
{
$member = $member ?: \IPS\Member::loggedIn();
$where = array();
$openStatuses = array();
foreach ( \IPS\nexus\Support\Status::roots() as $status )
{
if ( $status->open )
{
$openStatuses[] = $status->_id;
}
}
$where[] = array( \IPS\Db::i()->in( 'r_status', $openStatuses ) );
$departments = array_keys( iterator_to_array( \IPS\nexus\Support\Department::departmentsWithPermission( $member ) ) );
if ( $departments )
{
$where[] = array( \IPS\Db::i()->in( 'r_department', $departments ) );
}
$this->count = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_requests', $where )->first();
}
return $this->count;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'nexus', 'support', 'requests_manage' ) and \count( \IPS\nexus\Support\Department::departmentsWithPermission( $member ) );
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusSupport', FALSE, array( 'pluralize' => array( $this->count() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
try
{
$where = array();
$openStatuses = array();
foreach ( \IPS\nexus\Support\Status::roots() as $status )
{
if ( $status->open )
{
$openStatuses[] = $status->_id;
}
}
$where[] = array( \IPS\Db::i()->in( 'r_status', $openStatuses ) );
$departments = array_keys( iterator_to_array( \IPS\nexus\Support\Department::departmentsWithPermission( \IPS\Member::loggedIn() ) ) );
if ( $departments )
{
$where[] = array( \IPS\Db::i()->in( 'r_department', $departments ) );
}
return \IPS\DateTime::ts( \IPS\Db::i()->select( 'r_started', 'nexus_support_requests', $where, 'r_started asc', 1 )->first() )->relative();
}
catch ( \UnderflowException $e )
{
return NULL;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
$sortBy = ( isset( \IPS\Request::i()->cookie['support_sort'] ) and \in_array( \IPS\Request::i()->cookie['support_sort'], array( 'r_started', 'r_last_new_reply', 'r_last_reply', 'r_last_staff_reply' ) ) ) ? \IPS\Request::i()->cookie['support_sort'] : 'r_last_new_reply';
$sortDir = ( isset( \IPS\Request::i()->cookie['support_order'] ) and \in_array( \IPS\Request::i()->cookie['support_order'], array( 'ASC', 'DESC' ) ) ) ? \IPS\Request::i()->cookie['support_order'] : 'ASC';
$i = 0;
$results = array();
$allIds = array();
foreach ( \IPS\nexus\Support\Stream::myStreams( \IPS\Member::loggedIn() ) as $stream )
{
$results[ $stream->id ] = $stream->results( \IPS\Member::loggedIn(), "{$sortBy} {$sortDir}", 1, 3 );
$allIds += array_keys( iterator_to_array( $results[ $stream->id ] ) );
$i++;
if ( $i >= 3 )
{
break;
}
}
$tracked = iterator_to_array( \IPS\Db::i()->select( array( 'request_id', 'notify' ), 'nexus_support_tracker', array( array( 'member_id=?', \IPS\Member::loggedIn()->member_id ), array( \IPS\Db::i()->in( 'request_id', $allIds ) ) ) )->setKeyField( 'request_id' )->setValueField( 'notify' ) );
$participatedIn = iterator_to_array( \IPS\Db::i()->select( 'DISTINCT reply_request', 'nexus_support_replies', array( array( 'reply_member=?', \IPS\Member::loggedIn()->member_id ), array( \IPS\Db::i()->in( 'reply_request', $allIds ) ) ) ) );
$resultsHtml = array();
foreach ( $results as $streamId => $resultSet )
{
$resultsHtml[ $streamId ] = \IPS\Theme::i()->getTemplate( 'support', 'nexus' )->requestsTableResults( $resultSet, NULL, FALSE, $tracked, $participatedIn, FALSE );
}
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'support.css', 'nexus', 'admin' ) );
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus' )->support( $resultsHtml );
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_DYNAMIC;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
return static::STYLE_INFORMATION;
}
/**
* Quick link from popup menu
*
* @return bool
*/
public function link()
{
return \IPS\Http\Url::internal('app=nexus&module=support&controller=requests');
}
/**
* For dynamic notifications: should this show for this member?
*
* @note This is checked every time the notification shows. Should be lightweight.
* @param \IPS\Member $member The member
* @return bool
*/
public function dynamicShow( \IPS\Member $member )
{
return (bool) $this->count( $member );
}
/**
* Custom per-admin setting for if email shoild be sent for this notification
*
* @param string $key Setting field key
* @param mixed $value Current value
* @return \IPS\Helpers\Form\FormAbstract|NULL
*/
public static function customEmailConfigurationSetting( $key, $value )
{
return new \IPS\Helpers\Form\Custom( $key, NULL, FALSE, array( 'getHtml' => function() {
return \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->basicUrl( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests&do=preferences'), TRUE, \IPS\Member::loggedIn()->language()->addToStack('acp_notifications_email_configure') );
} ) );
}
}
@@ -0,0 +1,216 @@
<?php
/**
* @brief ACP Notification: Transactions Requiring Attention
* @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 25 Jul 2018
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Transactions Requiring Attention
*/
class _Transaction extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 2;
/**
* Get queue HTML
*
* @param string $status Status to show
* @return string
*/
public static function queueHtml( $status )
{
$select = \IPS\Db::i()->select( '*', 'nexus_transactions', array( 't_status=?', $status ), 't_date ASC', array( 0, 12 ) );
if ( \count( $select ) )
{
return \IPS\Theme::i()->getTemplate( 'notifications', 'nexus' )->transactions( new \IPS\Patterns\ActiveRecordIterator( $select, 'IPS\nexus\Transaction' ) );
}
else
{
return '';
}
}
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_Transaction';
}
/**
* 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_transactions', array( 't_status=?', $this->extra ) )->first();
}
return $this->count;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return $member->hasAcpRestriction( 'nexus', 'payments', 'transactions_manage' );
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusTransaction_' . $this->extra, FALSE, array( 'pluralize' => array( $this->count() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
try
{
return \IPS\DateTime::ts( \IPS\Db::i()->select( 't_date', 'nexus_transactions', array( 't_status=?', $this->extra ), 't_date asc', 1 )->first() )->relative();
}
catch ( \UnderflowException $e )
{
return NULL;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_notifications.js', 'nexus') );
return static::queueHtml( $this->extra );
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
if ( $this->extra === \IPS\nexus\Transaction::STATUS_DISPUTED )
{
return static::STYLE_WARNING;
}
else
{
return static::STYLE_INFORMATION;
}
}
/**
* Quick link from popup menu
*
* @return bool
*/
public function link()
{
return \IPS\Http\Url::internal('app=nexus&module=payments&controller=transactions&attn=1');
}
/**
* 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();
}
}
@@ -0,0 +1,193 @@
<?php
/**
* @brief ACP Notification: Pending Credit Withdrawals
* @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 26 Jul 2018
*/
namespace IPS\nexus\extensions\core\AdminNotifications;
/* 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;
}
/**
* ACP Notification: Pending Credit Withdrawals
*/
class _Withdrawal extends \IPS\core\AdminNotification
{
/**
* @brief Identifier for what to group this notification type with on the settings form
*/
public static $group = 'commerce';
/**
* @brief Priority 1-5 (1 being highest) for this group compared to others
*/
public static $groupPriority = 4;
/**
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
*/
public static $itemPriority = 4;
/**
* Title for settings
*
* @return string
*/
public static function settingsTitle()
{
return 'acp_notification_Withdrawals';
}
/**
* 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_payouts', array( 'po_status=?', \IPS\nexus\Payout::STATUS_PENDING ) )->first();
}
return $this->count;
}
/**
* Can a member access this type of notification?
*
* @param \IPS\Member $member The member
* @return bool
*/
public static function permissionCheck( \IPS\Member $member )
{
return \IPS\Settings::i()->nexus_payout and $member->hasAcpRestriction( 'nexus', 'payments', 'payouts_manage' );
}
/**
* Notification Title (full HTML, must be escaped where necessary)
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack( 'acpNotification_nexusWithdrawals', FALSE, array( 'pluralize' => array( $this->count() ) ) );
}
/**
* Notification Subtitle (no HTML)
*
* @return string
*/
public function subtitle()
{
try
{
return \IPS\DateTime::ts( \IPS\Db::i()->select( 'po_date', 'nexus_payouts', array( 'po_status=?', \IPS\nexus\Payout::STATUS_PENDING ), 'po_date asc', 1 )->first() )->relative();
}
catch ( \UnderflowException $e )
{
return NULL;
}
}
/**
* Notification Body (full HTML, must be escaped where necessary)
*
* @return string
*/
public function body()
{
$table = \IPS\nexus\Payout::table( array( 'po_status=?', 'pend' ), \IPS\Http\Url::internal('app=nexus&module=payments&controller=payouts&filter=postatus_pend') );
$table->limit = 10;
$table->filters = array();
$table->quickSearch = NULL;
$table->advancedSearch = NULL;
return $table;
}
/**
* Severity
*
* @return string
*/
public function severity()
{
return static::SEVERITY_OPTIONAL;
}
/**
* Dismissible?
*
* @return string
*/
public function dismissible()
{
return static::DISMISSIBLE_NO;
}
/**
* Style
*
* @return bool
*/
public function style()
{
return static::STYLE_INFORMATION;
}
/**
* Quick link from popup menu
*
* @return bool
*/
public function link()
{
return \IPS\Http\Url::internal('app=nexus&module=payments&controller=payouts&filter=postatus_pend');
}
/**
* 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();
}
}