/** * Add to dashboard menu. * @param DashboardNavModule $sender */ public function dashboardNavModule_init_handler($sender) { $sender->addLinkToSectionIf('Garden.Settings.Manage', 'Moderation', t('Community Reporting'), 'plugin/reporting', 'moderation.community-reporting'); }
/** * Adds items to Dashboard menu. * * @since 2.0.0 * @package Vanilla * * @param DashboardNavModule $sender */ public function dashboardNavModule_init_handler($sender) { $sort = -1; // Ensure these items go before any plugin items. $sender->addLinkIf('Garden.Community.Manage', t('Categories'), '/vanilla/settings/categories', 'forum.manage-categories', 'nav-manage-categories', $sort)->addLinkIf('Garden.Settings.Manage', t('Advanced'), '/vanilla/settings/advanced', 'forum.advanced', 'nav-forum-advanced', $sort)->addLinkIf(c('Vanilla.Archive.Date', false) && Gdn::session()->checkPermission('Garden.Settings.Manage'), t('Archive Discussions'), '/vanilla/settings/archive', 'forum.archive', 'nav-forum-archive', $sort)->addLinkIf('Garden.Settings.Manage', t('Embed'), 'embed/forum', 'forum.embed-site', 'nav-embed nav-embed-site', $sort)->addLinkToSectionIf('Garden.Settings.Manage', 'Moderation', t('Flood Control'), '/vanilla/settings/floodcontrol', 'moderation.flood-control', 'nav-flood-control', $sort); }
/** * Main dashboard. * * You can override this method with a method in your plugin named * SettingsController_Index_Create. You can hook into it with methods named * SettingsController_Index_Before and SettingsController_Index_After. * * @since 2.0.0 * @access public */ public function index() { // Confirm that the user has at least one of the many admin preferences. $this->permission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage', 'Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete', 'Garden.Users.Approve'], false); // Send the user to the last section they navigated to in the dashboard. $section = Gdn::session()->getPreference('DashboardNav.DashboardLandingPage', 'DashboardHome'); if ($section) { $sections = DashboardNavModule::getDashboardNav()->getSectionsInfo(); $url = val('url', val($section, $sections)); if ($url) { redirect($url); } } // Resolve our default landing page redirection based on permissions. if (!Gdn::session()->checkPermission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'], false)) { // We don't have permission to see the dashboard/home. redirect(DashboardNavModule::getDashboardNav()->getUrlForSection('Moderation')); } // Still here? redirect('dashboard/settings/home'); }
/** * Fire before every page render. * * @param Gdn_Controller $Sender */ public function base_render_before($Sender) { $Session = Gdn::session(); if ($Sender->MasterView == 'admin') { if (val('Form', $Sender)) { $Sender->Form->setStyles('bootstrap'); } $Sender->CssClass = htmlspecialchars($Sender->CssClass); $Sections = Gdn_Theme::section(null, 'get'); if (is_array($Sections)) { foreach ($Sections as $Section) { $Sender->CssClass .= ' Section-' . $Section; } } // Get our plugin nav items. $navAdapter = new NestedCollectionAdapter(DashboardNavModule::getDashboardNav()); $Sender->EventArguments['SideMenu'] = $navAdapter; $Sender->fireEvent('GetAppSettingsMenuItems'); $Sender->removeJsFile('jquery.popup.js'); $Sender->addJsFile('vendors/jquery.checkall.min.js', 'dashboard'); $Sender->addJsFile('dashboard.js', 'dashboard'); $Sender->addJsFile('jquery.expander.js'); $Sender->addJsFile('settings.js', 'dashboard'); $Sender->addJsFile('vendors/tether.min.js', 'dashboard'); $Sender->addJsFile('vendors/bootstrap/util.js', 'dashboard'); $Sender->addJsFile('vendors/drop.min.js', 'dashboard'); $Sender->addJsFile('vendors/moment.min.js', 'dashboard'); $Sender->addJsFile('vendors/daterangepicker.js', 'dashboard'); $Sender->addJsFile('vendors/bootstrap/tooltip.js', 'dashboard'); $Sender->addJsFile('vendors/clipboard.min.js', 'dashboard'); $Sender->addJsFile('vendors/bootstrap/dropdown.js', 'dashboard'); $Sender->addJsFile('vendors/bootstrap/collapse.js', 'dashboard'); $Sender->addJsFile('vendors/bootstrap/modal.js', 'dashboard'); $Sender->addJsFile('vendors/icheck.min.js', 'dashboard'); $Sender->addJsFile('jquery.tablejenga.js', 'dashboard'); $Sender->addJsFile('jquery.fluidfixed.js', 'dashboard'); $Sender->addJsFile('vendors/prettify/prettify.js', 'dashboard'); $Sender->addJsFile('vendors/ace/ace.js', 'dashboard'); $Sender->addJsFile('vendors/ace/ext-searchbox.js', 'dashboard'); $Sender->addCssFile('vendors/tomorrow.css', 'dashboard'); } // Check the statistics. if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) { Gdn::statistics()->check(); } // Inform user of theme previewing if ($Session->isValid()) { $PreviewThemeFolder = htmlspecialchars($Session->getPreference('PreviewThemeFolder', '')); $PreviewMobileThemeFolder = htmlspecialchars($Session->getPreference('PreviewMobileThemeFolder', '')); $PreviewThemeName = htmlspecialchars($Session->getPreference('PreviewThemeName', $PreviewThemeFolder)); $PreviewMobileThemeName = htmlspecialchars($Session->getPreference('PreviewMobileThemeName', $PreviewMobileThemeFolder)); if ($PreviewThemeFolder != '') { $Sender->informMessage(sprintf(t('You are previewing the %s desktop theme.'), wrap($PreviewThemeName, 'em')) . '<div class="PreviewThemeButtons">' . anchor(t('Apply'), 'settings/themes/' . $PreviewThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . ' ' . anchor(t('Cancel'), 'settings/cancelpreview/' . $PreviewThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . '</div>', 'DoNotDismiss'); } if ($PreviewMobileThemeFolder != '') { $Sender->informMessage(sprintf(t('You are previewing the %s mobile theme.'), wrap($PreviewMobileThemeName, 'em')) . '<div class="PreviewThemeButtons">' . anchor(t('Apply'), 'settings/mobilethemes/' . $PreviewMobileThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . ' ' . anchor(t('Cancel'), 'settings/cancelpreview/' . $PreviewMobileThemeFolder . '/' . $Session->transientKey(), 'PreviewThemeButton') . '</div>', 'DoNotDismiss'); } } if ($Session->isValid()) { $Confirmed = val('Confirmed', Gdn::session()->User, true); if (UserModel::requireConfirmEmail() && !$Confirmed) { $Message = formatString(t('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.')); $Sender->informMessage($Message, ''); } } // Add Message Modules (if necessary) $MessageCache = Gdn::config('Garden.Messages.Cache', array()); $Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod; $Exceptions = array('[Base]'); if (in_array($Sender->MasterView, array('', 'default'))) { $Exceptions[] = '[NonAdmin]'; } // SignIn popup is a special case $SignInOnly = $Sender->deliveryType() == DELIVERY_TYPE_VIEW && $Location == 'Dashboard/entry/signin'; if ($SignInOnly) { $Exceptions = array(); } if ($Sender->MasterView != 'admin' && !$Sender->data('_NoMessages') && (val('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, false) || InArrayI($Location, $MessageCache))) { $MessageModel = new MessageModel(); $MessageData = $MessageModel->getMessagesForLocation($Location, $Exceptions, $Sender->data('Category.CategoryID')); foreach ($MessageData as $Message) { $MessageModule = new MessageModule($Sender, $Message); if ($SignInOnly) { // Insert special messages even in SignIn popup echo $MessageModule; } elseif ($Sender->deliveryType() == DELIVERY_TYPE_ALL) { $Sender->addModule($MessageModule); } } $Sender->MessagesLoaded = '1'; // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly. } if ($Sender->deliveryType() == DELIVERY_TYPE_ALL) { $Gdn_Statistics = Gdn::factory('Statistics'); $Gdn_Statistics->check($Sender); } // Allow forum embedding if ($Embed = c('Garden.Embed.Allow')) { // Record the remote url where the forum is being embedded. $RemoteUrl = c('Garden.Embed.RemoteUrl'); if (!$RemoteUrl) { $RemoteUrl = GetIncomingValue('remote'); if ($RemoteUrl) { saveToConfig('Garden.Embed.RemoteUrl', $RemoteUrl); } } if ($RemoteUrl) { $Sender->addDefinition('RemoteUrl', $RemoteUrl); } if ($remoteUrlFormat = c('Garden.Embed.RemoteUrlFormat')) { $Sender->addDefinition('RemoteUrlFormat', $remoteUrlFormat); } // Force embedding? if (!IsSearchEngine() && strtolower($Sender->ControllerName) != 'entry') { if (IsMobile()) { $forceEmbedForum = c('Garden.Embed.ForceMobile') ? '1' : '0'; } else { $forceEmbedForum = c('Garden.Embed.ForceForum') ? '1' : '0'; } $Sender->addDefinition('ForceEmbedForum', $forceEmbedForum); $Sender->addDefinition('ForceEmbedDashboard', c('Garden.Embed.ForceDashboard') ? '1' : '0'); } $Sender->addDefinition('Path', Gdn::request()->path()); $get = Gdn::request()->get(); unset($get['p']); // kludge for old index.php?p=/path $Sender->addDefinition('Query', http_build_query($get)); // $Sender->addDefinition('MasterView', $Sender->MasterView); $Sender->addDefinition('InDashboard', $Sender->MasterView == 'admin' ? '1' : '0'); if ($Embed === 2) { $Sender->addJsFile('vanilla.embed.local.js'); } else { $Sender->addJsFile('embed_local.js'); } } else { $Sender->setHeader('X-Frame-Options', 'SAMEORIGIN'); } // Allow return to mobile site $ForceNoMobile = val('X-UA-Device-Force', $_COOKIE); if ($ForceNoMobile === 'desktop') { $Sender->addAsset('Foot', wrap(Anchor(t('Back to Mobile Site'), '/profile/nomobile/1'), 'div'), 'MobileLink'); } // Allow global translation of TagHint $Sender->addDefinition("TagHint", t("TagHint", "Start to type...")); // Add symbols. if ($Sender->deliveryMethod() === DELIVERY_METHOD_XHTML) { $Sender->addAsset('Symbols', $Sender->fetchView('symbols', '', 'Dashboard')); } }
public function toString() { if (!self::$initStaticFired) { self::$initStaticFired = true; $this->fireEvent('init'); } $this->fireAs(get_called_class())->fireEvent('render'); return parent::toString(); }
/** * @param string $currentUrl */ public function setHighlightRoute($currentUrl = '') { if ($currentUrl) { DashboardNavModule::getDashboardNav()->setHighlightRoute($currentUrl); } }
</button> <div class="navbar-brand"> <?php $title = c('Garden.Title'); ?> <div class="navbar-image logo"><?php echo wrap('Vanilla Forums', 'span', ['class' => 'vanilla-logo vanilla-logo-white']); ?> </div> <?php echo anchor(t('Visit Site') . ' ' . dashboardSymbol('external-link', 'icon-11'), '/', 'btn btn-navbar padded-left'); ?> </div> <?php /** @var DashboardNavModule $dashboardNav */ $dashboardNav = DashboardNavModule::getDashboardNav(); ?> <nav class="nav nav-pills"> <?php foreach ($dashboardNav->getSectionsInfo() as $section) { ?> <div class="nav-item"> <a class="nav-link js-save-pref-dashboard-landing-page <?php echo val('active', $section); ?> " href="<?php echo url(val('url', $section)); ?> " data-section="<?php echo val('section', $section); ?>