本文整理汇总了PHP中Piwik\Menu\MenuAdmin类的典型用法代码示例。如果您正苦于以下问题:PHP MenuAdmin类的具体用法?PHP MenuAdmin怎么用?PHP MenuAdmin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MenuAdmin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$hasSuperUserAcess = Piwik::hasUserSuperUserAccess();
$isAnonymous = Piwik::isUserIsAnonymous();
$isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled();
$pluginsUpdateMessage = '';
$themesUpdateMessage = '';
if ($hasSuperUserAcess && $isMarketplaceEnabled) {
$marketplace = new Marketplace();
$pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
$themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
if (!empty($pluginsHavingUpdate)) {
$pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
}
if (!empty($themesHavingUpdate)) {
$themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
}
}
if (!$isAnonymous) {
$menu->addPlatformItem(null, "", $order = 7);
}
if ($hasSuperUserAcess) {
$menu->addPlatformItem(Piwik::translate('General_Plugins') . $pluginsUpdateMessage, $this->urlForAction('plugins', array('activated' => '')), $order = 1);
$menu->addPlatformItem(Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, $this->urlForAction('themes', array('activated' => '')), $order = 3);
}
if ($this->isAllowedToSeeMarketPlace()) {
$menu->addPlatformItem('CorePluginsAdmin_Marketplace', $this->urlForAction('extend', array('activated' => '')), $order = 5);
}
}
示例2: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$menu->addManageItem('UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), $order = 2);
$menu->addManageItem('UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), $order = 3);
}
}
示例3: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$menu->addPlatformItem('General_API', $this->urlForAction('listAllAPI', array('segment' => false)), 7, Piwik::translate('API_TopLinkTooltip'));
if (Piwik::isUserIsAnonymous()) {
$menu->addPlatformItem('API_Glossary', $this->urlForAction('glossary', array('segment' => false)), 50);
}
}
示例4: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$hasSuperUserAcess = Piwik::hasUserSuperUserAccess();
$isAnonymous = Piwik::isUserIsAnonymous();
$isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled();
$pluginsUpdateMessage = '';
$themesUpdateMessage = '';
if ($hasSuperUserAcess && $isMarketplaceEnabled) {
$marketplace = new Marketplace();
$pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
$themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
if (!empty($pluginsHavingUpdate)) {
$pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
}
if (!empty($themesHavingUpdate)) {
$themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
}
}
$menu->add('CorePluginsAdmin_MenuPlatform', null, "", !$isAnonymous, $order = 7);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), $hasSuperUserAcess, $order = 1);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), $hasSuperUserAcess, $order = 3);
if ($isMarketplaceEnabled) {
$menu->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !$isAnonymous, $order = 5);
}
}
示例5: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$menu->addManageItem('UsersManager_MenuUsers', $this->urlForAction('index'), $order = 2);
}
if (Piwik::hasUserSuperUserAccess() && API::getInstance()->getSitesAccessFromUser('anonymous')) {
$menu->addSettingsItem('UsersManager_AnonymousUser', $this->urlForAction('anonymousSettings'), $order = 20);
}
}
示例6: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
if (Piwik::isUserHasSomeAdminAccess()) {
$type = $this->getFirstTypeIfOnlyOneIsInUse();
$menuName = 'General_Measurables';
if ($type) {
$menuName = $type->getNamePlural();
}
$menu->addManageItem($menuName, $this->urlForAction('index'), $order = 1);
}
}
示例7: addMenu
function addMenu()
{
MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1);
MenuAdmin::getInstance()->add('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 10);
MenuAdmin::getInstance()->add('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5);
MenuAdmin::getInstance()->add('General_Settings', 'CoreAdminHome_MenuGeneralSettings', array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), Piwik::isUserHasSomeAdminAccess(), $order = 6);
MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'CoreAdminHome_TrackingCode', array('module' => 'CoreAdminHome', 'action' => 'trackingCodeGenerator'), Piwik::isUserHasSomeAdminAccess(), $order = 4);
MenuAdmin::getInstance()->add('General_Settings', 'CoreAdminHome_PluginSettings', array('module' => 'CoreAdminHome', 'action' => 'pluginSettings'), SettingsManager::hasPluginsSettingsForCurrentUser(), $order = 7);
}
示例8: index
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@IP2Location/index');
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
$view->adminMenu = MenuAdmin::getInstance()->getMenu();
$view->topMenu = MenuTop::getInstance()->getMenu();
$view->notifications = NotificationManager::getAllNotificationsToDisplay();
$view->userMenu = MenuUser::getInstance()->getMenu();
$view->phpVersion = phpversion();
$view->phpIsNewEnough = version_compare($view->phpVersion, '5.3.0', '>=');
$view->assign('userMenu', 'IP2Location');
$view->assign('dbNotFound', false);
$view->assign('dbOutDated', false);
$view->assign('showResults', false);
$view->assign('fileName', '-');
$view->assign('date', '-');
$view->assign('country', '');
$view->assign('regionName', '');
$view->assign('cityName', '');
$view->assign('position', '');
$ipAddress = trim(Common::getRequestVar('ipAddress', $_SERVER['REMOTE_ADDR']));
$view->assign('ipAddress', $ipAddress);
$dbPath = PIWIK_INCLUDE_PATH . '/plugins/IP2Location/data/';
$dbFile = '';
if ($handle = opendir($dbPath)) {
while (false !== ($file = readdir($handle))) {
if (strtoupper(substr($file, -4)) == '.BIN') {
$dbFile = $dbPath . $file;
break;
}
}
closedir($handle);
}
if (!$dbFile) {
$view->assign('dbNotFound', true);
}
if ($dbFile) {
$view->assign('fileName', $file);
if (filemtime($dbFile) < strtotime('-2 months')) {
$view->assign('dbOutDated', true);
} else {
$view->assign('date', date('d M, Y', filemtime($dbFile)));
}
if (!empty($_POST)) {
$view->assign('showResults', true);
$result = IP2LocationAPI::lookup($ipAddress, $dbFile);
$view->assign('country', $result['countryCode'] != '-' ? $result['countryName'] . ' (' . $result['countryCode'] . ')' : '-');
$view->assign('regionName', !preg_match('/not supported/', $result['regionName']) ? $result['regionName'] : '-');
$view->assign('cityName', !preg_match('/not supported/', $result['cityName']) ? $result['cityName'] : '-');
$view->assign('position', !preg_match('/not supported/', $result['latitude']) && $result['latitude'] != '-' ? $result['latitude'] . ', ' . $result['longitude'] : '-');
}
}
echo $view->render();
}
示例9: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$menu->registerMenuIcon('CoreAdminHome_MenuDevelopment', 'icon-admin-development');
$menu->registerMenuIcon('CoreAdminHome_MenuDiagnostic', 'icon-admin-diagnostic');
$menu->registerMenuIcon('CorePluginsAdmin_MenuPlatform', 'icon-admin-platform');
$menu->registerMenuIcon('General_Settings', 'icon-admin-settings');
$menu->registerMenuIcon('CoreAdminHome_Administration', 'icon-admin-administration');
if (Development::isEnabled() && Piwik::isUserHasSomeAdminAccess()) {
$menu->addDevelopmentItem('UI Demo', $this->urlForAction('demo'));
}
}
示例10: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$hasAdminAccess = Piwik::isUserHasSomeAdminAccess();
if ($hasAdminAccess) {
$menu->addManageItem(null, array(), $order = 1);
$menu->addSettingsItem(null, array(), $order = 5);
$menu->addDiagnosticItem(null, array(), $order = 10);
$menu->addDevelopmentItem(null, array(), $order = 15);
if (Piwik::hasUserSuperUserAccess()) {
$menu->addSettingsItem('General_General', $this->urlForAction('generalSettings'), $order = 6);
}
}
if (Piwik::hasUserSuperUserAccess() && SettingsManager::hasSystemPluginsSettingsForCurrentUser()) {
$menu->addSettingsItem('CoreAdminHome_PluginSettings', $this->urlForAction('adminPluginSettings'), $order = 7);
}
}
示例11: addMenu
function addMenu()
{
$pluginsUpdateMessage = '';
$themesUpdateMessage = '';
if (Piwik::isUserIsSuperUser() && static::isMarketplaceEnabled()) {
$marketplace = new Marketplace();
$pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
$themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
if (!empty($pluginsHavingUpdate)) {
$pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
}
if (!empty($themesHavingUpdate)) {
$themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
}
}
MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', null, "", !Piwik::isUserIsAnonymous(), $order = 7);
MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 1);
MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 3);
if (static::isMarketplaceEnabled()) {
MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !Piwik::isUserIsAnonymous(), $order = 5);
}
}
示例12: addConfigMenu
public function addConfigMenu()
{
if (Piwik::isUserHasSomeAdminAccess()) {
MenuAdmin::getInstance()->addItem('General_Settings', 'IP2Location', array('module' => 'IP2Location', 'action' => 'index'), $order = 9);
}
}
示例13: setBasicVariablesAdminView
/**
* Assigns view properties that would be useful to views that render admin pages.
*
* 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()`.
* - **currentAdminMenuName** - The currently selected admin menu name.
* - **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()`.
*
* @param View $view
* @api
*/
public static function setBasicVariablesAdminView(View $view)
{
self::notifyWhenTrackingStatisticsDisabled();
self::notifyIfEAcceleratorIsUsed();
$view->topMenu = MenuTop::getInstance()->getMenu();
$view->userMenu = MenuUser::getInstance()->getMenu();
$view->currentAdminMenuName = MenuAdmin::getInstance()->getCurrentAdminMenuName();
$view->isDataPurgeSettingsEnabled = self::isDataPurgeSettingsEnabled();
$view->enableFrames = PiwikConfig::getInstance()->General['enable_framed_settings'];
if (!$view->enableFrames) {
$view->setXFrameOptions('sameorigin');
}
$view->isSuperUser = Piwik::hasUserSuperUserAccess();
self::notifyAnyInvalidPlugin();
self::checkPhpVersion($view);
if (Piwik::hasUserSuperUserAccess() && self::isPhpVersion53()) {
$notification = new Notification(Piwik::translate('General_WarningPhpVersionXIsTooOld', '5.3'));
$notification->title = Piwik::translate('General_Warning');
$notification->priority = Notification::PRIORITY_LOW;
$notification->context = Notification::CONTEXT_WARNING;
$notification->type = Notification::TYPE_TRANSIENT;
$notification->flags = Notification::FLAG_NO_CLEAR;
NotificationManager::notify('PHP53VersionCheck', $notification);
}
$adminMenu = MenuAdmin::getInstance()->getMenu();
$view->adminMenu = $adminMenu;
$notifications = $view->notifications;
if (empty($notifications)) {
$view->notifications = NotificationManager::getAllNotificationsToDisplay();
NotificationManager::cancelAllNonPersistent();
}
}
示例14: setBasicVariablesAdminView
/**
* Assigns view properties that would be useful to views that render admin pages.
*
* 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()`.
* - **currentAdminMenuName** - The currently selected admin menu name.
* - **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()`.
*
* @param View $view
* @api
*/
public static function setBasicVariablesAdminView(View $view)
{
self::notifyWhenTrackingStatisticsDisabled();
$view->topMenu = MenuTop::getInstance()->getMenu();
$view->currentAdminMenuName = MenuAdmin::getInstance()->getCurrentAdminMenuName();
$view->isDataPurgeSettingsEnabled = self::isDataPurgeSettingsEnabled();
$view->enableFrames = PiwikConfig::getInstance()->General['enable_framed_settings'];
if (!$view->enableFrames) {
$view->setXFrameOptions('sameorigin');
}
$view->isSuperUser = Piwik::isUserIsSuperUser();
self::notifyAnyInvalidPlugin();
self::checkPhpVersion($view);
$adminMenu = MenuAdmin::getInstance()->getMenu();
$view->adminMenu = $adminMenu;
$view->notifications = NotificationManager::getAllNotificationsToDisplay();
NotificationManager::cancelAllNonPersistent();
}
示例15: addAdminMenu
/**
* Event handler. Adds menu items to the MenuAdmin menu.
*/
public function addAdminMenu()
{
if ($this->isGeoLocationAdminEnabled()) {
MenuAdmin::getInstance()->add('General_Settings', 'UserCountry_Geolocation', array('module' => 'UserCountry', 'action' => 'adminIndex'), Piwik::isUserIsSuperUser(), $order = 8);
}
}