| | |
| | | public function __construct() |
| | | { |
| | | $this->cache = CacheManager::for('dashboard', WEEK_IN_SECONDS); |
| | | $this->cache->invalidate(); |
| | | add_action('init', [$this, 'registerDashboard']); |
| | | if (!$this->isRegistered()) { |
| | | add_action('init', [$this, 'buildDashboard']); |
| | | } |
| | | $this->user = wp_get_current_user(); |
| | | $this->role = jvbUserRole(); |
| | | $this->role = jvbUserRole($this->user->ID); |
| | | $this->userLink = (int)get_user_meta($this->user->ID, BASE.'link', true); |
| | | |
| | | |
| | |
| | | |
| | | // Get current page/section |
| | | $page = $this->getCurrentPage(); |
| | | $config = $this->getConfig($page); |
| | | if(!empty($config)) { |
| | | add_filter('jvbLoadingIcon', function() use ($config) { |
| | | return jvbIcon($config['icon']); |
| | | }); |
| | | } |
| | | $integrationSlugs = array_map(function($name) { |
| | | return sanitize_title(str_replace('_', '-', $name)); |
| | | }, array_keys(JVB()->getAvailableServices(false))); |
| | |
| | | // Pass along to the Integrations template handler which knows to check for subpages |
| | | $page = 'integrations'; |
| | | } |
| | | |
| | | echo $this->cache->remember( |
| | | $page, |
| | | function() use ($page) { |
| | | return $this->renderDashboard($page); |
| | | } |
| | | ); |
| | | echo $this->renderDashboard($page); |
| | | //TODO: Reenable |
| | | // echo $this->cache->remember( |
| | | // $page, |
| | | // function() use ($page) { |
| | | // return $this->renderDashboard($page); |
| | | // } |
| | | // ); |
| | | |
| | | return ''; |
| | | } |
| | |
| | | $title = ($checked == '') ? 'Toggle Dark Mode' : 'Toggle Light Mode'; |
| | | echo '<label title="'.$title.'" id="theme-switch" class="toggle-switch" for="theme-switcher"> |
| | | <input class="theme-switch row" id="theme-switcher" type="checkbox"'.$checked.' data-setting="theme" data-theme role="switch" name="dark-mode"><span class="slider">'. |
| | | jvbIcon('light', ['title'=> 'Light Mode']). |
| | | jvbIcon('dark', ['title'=>'Dark Mode']). |
| | | jvbIcon('sun-dim', ['title'=> 'Light Mode']). |
| | | jvbIcon('moon', ['title'=>'Dark Mode']). |
| | | '</span></label>'; |
| | | ?> |
| | | <p class="title"> |
| | |
| | | } |
| | | } |
| | | if ($out == '') { |
| | | $out =jvbIcon('home'); |
| | | $out =jvbIcon('house'); |
| | | } |
| | | ?><?= $out ?> |
| | | </a> |
| | |
| | | <?php |
| | | $current_page = $this->getCurrentPage(); |
| | | $pages = $this->getUserAllowedPages()?:[]; |
| | | error_log('PageS: '.print_r($pages, true)); |
| | | |
| | | echo '<ul>'; |
| | | foreach ($pages as $page) { |
| | |
| | | echo '<p>Welcome back!</p>'; |
| | | |
| | | $pages = $this->getUserAllowedPages(); |
| | | |
| | | error_log('Pages: '.print_r($pages, true)); |
| | | |
| | | echo '<h2>What would you like to do today?</h2>'; |
| | | |
| | |
| | | continue; |
| | | } |
| | | $title = $this->getTitle($page); |
| | | $url = sanitize_title($title); |
| | | |
| | | $description = $this->getDescription($page); |
| | | $icon = $page; |
| | | if (!is_numeric($slug)) { |
| | |
| | | if (array_key_exists('icon', $config)) { |
| | | $icon = $config['icon']; |
| | | } |
| | | } else { |
| | | $slug = sanitize_title($page); |
| | | } |
| | | if ($title !== '') { |
| | | echo '<li><p><a href="'.get_home_url(null, '/dash/'.$url.'/').'" |
| | | data-page="'.$url.'" data-dash>'.jvbIcon($icon).ucwords($title).'</a></p></li>'; |
| | | echo '<li><p><a href="'.get_home_url(null, '/dash/'.$slug.'/').'" |
| | | data-page="'.$slug.'" data-dash>'.jvbIcon($icon).ucwords($title).'</a></p></li>'; |
| | | } |
| | | |
| | | } |
| | |
| | | if ($content !== '') { |
| | | echo $content; |
| | | } else { |
| | | jvbRenderSections($this->user->ID, 'user', jvbUserRole()); |
| | | jvbRenderSections($this->user->ID, 'user', jvbUserRole()); |
| | | } |
| | | |
| | | } |
| | |
| | | <div class="approvals container"> |
| | | <nav class="tabs row start" role="tablist"> |
| | | <button type="button" class="tab active" data-tab="summary" role="tab" aria-selected="true"> |
| | | <h2><?= jvbIcon('all')?>All</h2> |
| | | <h2><?= jvbIcon('infinity')?>All</h2> |
| | | </button> |
| | | <button type="button" class="tab" data-tab="artists" role="tab" aria-selected="false"> |
| | | <h2><?= jvbIcon('artists')?>Artists</h2> |
| | | <h2><?= jvbIcon('users-three')?>Artists</h2> |
| | | </button> |
| | | <button type="button" class="tab" data-tab="terms" role="tab" aria-selected="false"> |
| | | <h2><?= jvbIcon('style')?>Terms</h2> |
| | | <h2><?= jvbIcon('hash')?>Terms</h2> |
| | | </button> |
| | | <button type="button" class="tab" data-tab="yours" role="tab" aria-selected="false"> |
| | | <h2><?= jvbIcon('artist')?>Yours</h2> |
| | | <h2><?= jvbIcon('user')?>Yours</h2> |
| | | </button> |
| | | </nav> |
| | | </div> |
| | |
| | | 'vertical', |
| | | 'TAB NAV:', |
| | | '', |
| | | jvbIcon('down'), |
| | | jvbIcon('right'))?> |
| | | jvbIcon('caret-double-down'), |
| | | jvbIcon('caret-double-right'))?> |
| | | |
| | | </div> |
| | | <div class="items-container"> |
| | |
| | | <template class="<?= $type ?>Row"> |
| | | <tr> |
| | | <td> |
| | | <?= jvbIcon('grab') ?> |
| | | <?= jvbIcon('dots-six-vertical') ?> |
| | | </td> |
| | | <td data-id="actions" class="col"> |
| | | <?= jvbRenderToggleTextField( |
| | | 'public', |
| | | '', |
| | | '', |
| | | jvbIcon('show'), |
| | | jvbIcon('hide')) |
| | | jvbIcon('eye'), |
| | | jvbIcon('eye-closed')) |
| | | ?> |
| | | <button type="button" data-action="edit"> |
| | | <?= jvbIcon('edit') ?> |
| | | <?= jvbIcon('pencil-simple') ?> |
| | | </button> |
| | | </td> |
| | | <?php |