391 Notification refactorings (#441)
* Refactor notifications to allow easier plugins * Notification refactoring * Formatting * Move news to NewsService; cleanup of events * More refactoring; added send email out for news item and the template * Formatting * Formatting
This commit is contained in:
1
modules/.gitignore
vendored
1
modules/.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
/*
|
||||
/*/
|
||||
!.gitignore
|
||||
!/Awards
|
||||
!/Installer
|
||||
!/Sample
|
||||
!/Vacentral
|
||||
|
||||
52
modules/Awards/Awards/PilotFlightAwards.php
Normal file
52
modules/Awards/Awards/PilotFlightAwards.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Awards\Awards;
|
||||
|
||||
use App\Contracts\Award;
|
||||
|
||||
/**
|
||||
* Simple example of an awards class, where you can apply an award when a user
|
||||
* has 100 flights. All award classes need to extend Award and implement the check() method
|
||||
*
|
||||
* See: http://docs.phpvms.net/customizing/awards
|
||||
*/
|
||||
class PilotFlightAwards extends Award
|
||||
{
|
||||
/**
|
||||
* Set the name of this award class to make it easier to see when
|
||||
* assigning to a specific award
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'Pilot Flights';
|
||||
|
||||
/**
|
||||
* The description to show under the parameters field, so the admin knows
|
||||
* what the parameter actually controls. You can leave this blank if there
|
||||
* isn't a parameter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $param_description = 'The number of flights at which to give this award';
|
||||
|
||||
/**
|
||||
* If the user has over N flights, then we can give them this award. This method
|
||||
* only needs to return a true or false of whether it should be awarded or not.
|
||||
*
|
||||
* If no parameter is passed in, just default it to 100. You should check if there
|
||||
* is a parameter or not. You can call it whatever you want, since that would make
|
||||
* sense with the $param_description.
|
||||
*
|
||||
* @param int|null $number_of_flights The parameters passed in from the UI
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check($number_of_flights = null): bool
|
||||
{
|
||||
if (!$number_of_flights) {
|
||||
$number_of_flights = 100;
|
||||
}
|
||||
|
||||
return $this->user->flights >= $number_of_flights;
|
||||
}
|
||||
}
|
||||
12
modules/Awards/module.json
Normal file
12
modules/Awards/module.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Awards",
|
||||
"alias": "awards",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
Reference in New Issue
Block a user