| File was renamed from inc/managers/ApprovalManager.php |
| | |
| | | |
| | | use DateTime; |
| | | use JVBase\base\Site; |
| | | use JVBase\Instance; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\rest\Rest; |
| | | use JVBase\rest\routes\ApprovalRoutes; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | | |
| | | class ApprovalManager { |
| | | class Approvals { |
| | | use Instance; |
| | | protected array $tables =[]; |
| | | protected int $expiresAt = 21; //days for request |
| | | protected int $requiredVotes = 3; //Number of votes before a term is approved |
| | | protected bool $hasApproval = false; |
| | | public function __construct() |
| | | protected Rest $route; |
| | | private function __construct() |
| | | { |
| | | $this->route = ApprovalRoutes::getInstance(); |
| | | $this->defineTables(); |
| | | if (empty($this->tables)) { |
| | | return; |
| | |
| | | ]); |
| | | |
| | | |
| | | JVB()->notification()->notify($request['user_id'], $type.'approved', null, 'Your suggestion "'.$request['name'].'" was denied.'); |
| | | NotificationManager::getInstance()->notify($request['user_id'], $type.'approved', null, 'Your suggestion "'.$request['name'].'" was denied.'); |
| | | } |
| | | public function finalizeDenial(int $request_id, string $type):void |
| | | { |
| | |
| | | 'request_id' => $request_id |
| | | ]); |
| | | |
| | | JVB()->notification()->notify($request['user_id'], $type.'denied', null, 'Your suggestion "'.$request['name'].'" was denied.'); |
| | | NotificationManager::getInstance()->notify($request['user_id'], $type.'denied', null, 'Your suggestion "'.$request['name'].'" was denied.'); |
| | | } |
| | | |
| | | public function getApprovalRequests(int $userID, ?string $type = null):array |