Piwik\Plugin\ControllerAdmin::setBasicVariablesAdminView PHP Метод

setBasicVariablesAdminView() публичный статический Метод

Assigns the following variables: - **statisticsNotRecorded** - Set to true if the [Tracker] record_statistics INI config is 0. If not 0, this variable will not be defined. - **topMenu** - The result of MenuTop::getInstance()->getMenu(). - **enableFrames** - The value of the [General] enable_framed_pages INI config option. If true, {@link Piwik\View::setXFrameOptions()} is called on the view. - **isSuperUser** - Whether the current user is a superuser or not. - **usingOldGeoIPPlugin** - Whether this Piwik install is currently using the old GeoIP plugin or not. - **invalidPluginsWarning** - Set if some of the plugins to load (determined by INI configuration) are invalid or missing. - **phpVersion** - The current PHP version. - **phpIsNewEnough** - Whether the current PHP version is new enough to run Piwik. - **adminMenu** - The result of MenuAdmin::getInstance()->getMenu().
public static setBasicVariablesAdminView ( View $view )
$view Piwik\View
    public static function setBasicVariablesAdminView(View $view)
    {
        self::notifyWhenTrackingStatisticsDisabled();
        self::notifyIfEAcceleratorIsUsed();
        self::notifyIfURLIsNotSecure();
        $view->topMenu = MenuTop::getInstance()->getMenu();
        $view->isDataPurgeSettingsEnabled = self::isDataPurgeSettingsEnabled();
        $enableFrames = PiwikConfig::getInstance()->General['enable_framed_settings'];
        $view->enableFrames = $enableFrames;
        if (!$enableFrames) {
            $view->setXFrameOptions('sameorigin');
        }
        $view->isSuperUser = Piwik::hasUserSuperUserAccess();
        self::notifyAnyInvalidLicense();
        self::notifyAnyInvalidPlugin();
        self::notifyWhenPhpVersionIsEOL();
        self::notifyWhenPhpVersionIsNotCompatibleWithNextMajorPiwik();
        self::notifyWhenDebugOnDemandIsEnabled('debug');
        self::notifyWhenDebugOnDemandIsEnabled('debug_on_demand');
        $view->adminMenu = MenuAdmin::getInstance()->getMenu();
        $notifications = $view->notifications;
        if (empty($notifications)) {
            $view->notifications = NotificationManager::getAllNotificationsToDisplay();
            NotificationManager::cancelAllNonPersistent();
        }
    }

Usage Example

Пример #1
0
 public function detection()
 {
     Piwik::checkUserHasSomeAdminAccess();
     $view = new View('@DevicesDetection/detection');
     $this->setBasicVariablesView($view);
     ControllerAdmin::setBasicVariablesAdminView($view);
     $userAgent = Common::getRequestVar('ua', $_SERVER['HTTP_USER_AGENT'], 'string');
     $uaParser = new DeviceDetector($userAgent);
     $uaParser->parse();
     $view->userAgent = $userAgent;
     $view->browser_name = $uaParser->getClient('name');
     $view->browser_short_name = $uaParser->getClient('short_name');
     $view->browser_version = $uaParser->getClient('version');
     $view->browser_logo = getBrowserLogo($uaParser->getClient('short_name'));
     $view->browser_family = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($uaParser->getClient('short_name'));
     $view->browser_family_logo = getBrowserFamilyLogo($view->browser_family);
     $view->os_name = $uaParser->getOs('name');
     $view->os_logo = getOsLogo($uaParser->getOs('short_name'));
     $view->os_short_name = $uaParser->getOs('short_name');
     $view->os_family = \DeviceDetector\Parser\OperatingSystem::getOsFamily($uaParser->getOs('short_name'));
     $view->os_family_logo = getOsFamilyLogo($view->os_family);
     $view->os_version = $uaParser->getOs('version');
     $view->device_type = getDeviceTypeLabel($uaParser->getDeviceName());
     $view->device_type_logo = getDeviceTypeLogo($uaParser->getDeviceName());
     $view->device_model = $uaParser->getModel();
     $view->device_brand = getDeviceBrandLabel($uaParser->getBrand());
     $view->device_brand_logo = getBrandLogo($uaParser->getBrand());
     return $view->render();
 }
All Usage Examples Of Piwik\Plugin\ControllerAdmin::setBasicVariablesAdminView