| File was renamed from inc/managers/Dashboard/DashboardManager.php |
| | |
| | | <?php |
| | | namespace JVBase\managers\Dashboard; |
| | | |
| | | use JetBrains\PhpStorm\NoReturn;use JVBase\base\Site;use JVBase\forms\TaxonomySelector;use JVBase\managers\Cache;use JVBase\managers\IconsManager;use JVBase\managers\LoginManager;use JVBase\managers\RoleManager;use JVBase\meta\Form;use JVBase\meta\Meta;use JVBase\registrar\Fields;use JVBase\registrar\Registrar;use JVBase\ui\Navigation;use JVBase\ui\Tabs; |
| | | use JetBrains\PhpStorm\NoReturn;use JVBase\base\Site;use JVBase\forms\TaxonomySelector;use JVBase\Instance;use JVBase\integrations\ServiceMap;use JVBase\managers\Cache;use JVBase\managers\IconsManager;use JVBase\managers\Login;use JVBase\managers\Roles;use JVBase\meta\Form;use JVBase\meta\Meta;use JVBase\registrar\Fields;use JVBase\registrar\Registrar;use JVBase\ui\Navigation;use JVBase\ui\Tabs; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | | class DashboardManager { |
| | | class Dashboard { |
| | | use Instance, ServiceMap; |
| | | public static string $based; |
| | | protected string $slug = 'dash'; |
| | | protected string $baseURl; |
| | |
| | | protected array $pages = []; |
| | | protected array $sections = []; |
| | | protected Cache $cache; |
| | | public function __construct() { |
| | | |
| | | private function __construct() { |
| | | self::$based = BASE.$this->slug; |
| | | $this->cache = Cache::for('dashboard')->connect('post'); |
| | | $this->cache = Cache::for('dashboard', 'post'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | } |
| | |
| | | return; |
| | | } |
| | | //Redirect to custom dashboard |
| | | if (is_user_logged_in() && isOurPeople()) { |
| | | if (is_admin() && isOurPeople()) { |
| | | $this->redirectToDashboard(); |
| | | } |
| | | } |
| | |
| | | foreach ($content as $c) { |
| | | $registrar = Registrar::getInstance($c); |
| | | $page = $this->addPage($registrar->getPlural(), $c, $registrar->getIcon()); |
| | | $page->setPermission(RoleManager::getPermissionName('edit', $c)); |
| | | $page->setPermission(Roles::getPermissionName('edit', $c)); |
| | | $page->setSection('content'); |
| | | $page->setScripts(['jvb-crud', 'jvb-creator']); |
| | | $this->sections[$c] = new Section($registrar->getPlural(), $c, $registrar->getIcon(), 'content'); |
| | | $this->sections[$c]->setPermission(RoleManager::getPermissionName('edit', $c)); |
| | | $this->sections[$c]->setPermission(Roles::getPermissionName('edit', $c)); |
| | | $this->sections[$c]->setIsLink(true); |
| | | |
| | | $taxonomies = $registrar->registrar->taxonomies; |
| | |
| | | $taxReg = Registrar::getInstance($tax); |
| | | if ($taxReg) { |
| | | $taxPage = $this->addPage($taxReg->getPlural(), $tax, $registrar->getIcon(), $page->getID()); |
| | | $taxPage->setPermission(RoleManager::getPermissionName('edit', $c)); |
| | | $taxPage->setPermission(Roles::getPermissionName('edit', $c)); |
| | | $taxPage->setSection($c); |
| | | |
| | | $taxPage->setScripts(['jvb-crud', 'jvb-creator']); |
| | |
| | | foreach ($contentTax as $c) { |
| | | $registrar = Registrar::getInstance($c); |
| | | $page = $this->addPage($registrar->getPlural(), $c, $registrar->getIcon()); |
| | | $page->setPermission(RoleManager::getPermissionName('edit', $c)); |
| | | $page->setPermission(Roles::getPermissionName('edit', $c)); |
| | | $page->setSection($c); |
| | | //TODO: add artist management and invitations, if applicable |
| | | } |
| | |
| | | $this->sections['integrations']->setIsLink(true); |
| | | |
| | | foreach (array_keys(Site::getIntegrations()) as $integration) { |
| | | $integration = match($integration) { |
| | | 'maps' => 'JVBase\integrations\services\GoogleMaps', |
| | | 'square' => 'JVBase\integrations\services\Square', |
| | | 'facebook' => 'JVBase\integrations\services\Facebook', |
| | | 'helcim' => 'JVBase\integrations\services\Helcim', |
| | | 'instagram' => 'JVBase\integrations\services\Instagram', |
| | | 'bluesky' => 'JVBase\integrations\services\BlueSky', |
| | | 'gmb' => 'JVBase\integrations\services\GoogleMyBusiness', |
| | | 'cloudflare' => 'JVBase\integrations\services\Cloudflare', |
| | | 'umami' => 'JVBase\integrations\services\Umami', |
| | | 'postmark' => 'JVBase\integrations\services\PostMark', |
| | | }; |
| | | $integration = $this->getService($integration); |
| | | $title = $integration::title(); |
| | | $icon = $integration::icon(); |
| | | if ($integration::hasExtraOptions()) { |
| | |
| | | echo '<p>Alternatively, you can always login using the magic link, which sets a temporary password for 15 minutes.</p>'; |
| | | } |
| | | ?> |
| | | <?= LoginManager::getInstance()->renderLoginForm('resetpass'); ?> |
| | | <?= Login::getInstance()->renderLoginForm('resetpass'); ?> |
| | | |
| | | <?php |
| | | } |