protected static function makeMenuView($controller = null)
 {
     assert('$controller == null || $controller instanceof CController');
     $items = MenuUtil::resolveByCacheAndGetVisibleAndOrderedAdminTabMenuByCurrentUser();
     static::resolveForActiveMenuItem($items, $controller);
     return new MenuView($items, false, 10);
 }
Пример #2
0
 public function run()
 {
     //$sidebarMenu = $this->getController()->getSidebarMenu();
     $route = Yii::app()->getController()->getRoute();
     $identity = Yii::app()->user->getIdentity();
     $sidebarMenu = MenuUtil::getSidebarMenu($route, $identity);
     $result = true;
     //         $organ = Yii::app()->db->createCommand()
     //                 ->select('OrganID,identity')
     //                 ->from('tbl_user')
     //                 ->where('id=:id', array(':id' => Yii::app()->user->id))
     //                 ->queryRow();
     //         if(Yii::app()->user->id==$organ['OrganID'] || empty($organ['OrganID'])){
     $orginID = Yii::app()->user->getOrganID();
     if (Yii::app()->user->id == $orginID || empty($orginID)) {
         foreach ($sidebarMenu as $key => $val) {
             $Menu[$key] = $val;
             $Menu[$key]['show'] = true;
         }
     } else {
         $roles = Yii::app()->db->createCommand()->select('RoleID')->from('tbl_user_role')->where('EmployeeID=:employeeid', array(':employeeid' => Yii::app()->user->id))->queryAll();
         if (empty($roles)) {
             $result = false;
         } else {
             foreach ($roles as $val) {
                 $role[] = $val['RoleID'];
             }
             $rolemenus = Yii::app()->db->createCommand()->select('Jurisdiction')->from('tbl_role')->where(array('in', 'ID', $role))->queryAll();
             if (empty($rolemenus)) {
                 $result = false;
             } else {
                 $jurisdiction = '';
                 foreach ($rolemenus as $val) {
                     $jurisdiction .= $val['Jurisdiction'];
                 }
                 if (empty($jurisdiction)) {
                     $result = false;
                 }
             }
         }
         foreach ($sidebarMenu as $key => $val) {
             $Menu[$key] = $val;
             if ($result) {
                 $Menu[$key]['show'] = $this->if_show($jurisdiction, $key);
             } else {
                 $Menu[$key]['show'] = $result;
             }
         }
     }
     $this->render('sidebarMenuCommon', array('menu' => $Menu));
 }
 protected function getCategoryData()
 {
     $categories = array();
     $modules = Module::getModuleObjects();
     foreach ($modules as $module) {
         $moduleSubMenuItems = MenuUtil::getAccessibleConfigureSubMenuByCurrentUser(get_class($module));
         if ($module->isEnabled() && count($moduleSubMenuItems) > 0) {
             foreach ($moduleSubMenuItems as $subMenuItem) {
                 if (!empty($subMenuItem['category']) && $subMenuItem['category'] == ZurmoModule::ADMINISTRATION_CATEGORY_PLUGINS) {
                     assert('isset($subMenuItem["titleLabel"])');
                     assert('isset($subMenuItem["descriptionLabel"])');
                     assert('isset($subMenuItem["route"])');
                     $categories[$subMenuItem['category']][] = $subMenuItem;
                 }
             }
         }
     }
     return $categories;
 }
 protected function getCategoryData()
 {
     $categories = array();
     $module = new EmailMessagesModule('EmailMessagesModule', false);
     $moduleSubMenuItems = MenuUtil::getAccessibleConfigureSubMenuByCurrentUser('EmailMessagesModule');
     if ($module->isEnabled() && count($moduleSubMenuItems) > 0) {
         foreach ($moduleSubMenuItems as $subMenuItem) {
             if (!empty($subMenuItem['category'])) {
                 assert('isset($subMenuItem["titleLabel"])');
                 assert('isset($subMenuItem["descriptionLabel"])');
                 assert('isset($subMenuItem["route"])');
                 $categories[$subMenuItem['category']][] = $subMenuItem;
             } else {
                 throw new NotSupportedException();
             }
         }
     }
     return $categories;
 }
 protected function getCategoryData()
 {
     $categories = array();
     $modules = Module::getModuleObjects();
     foreach ($modules as $module) {
         $moduleMenuItems = MenuUtil::getAccessibleConfigureMenuByCurrentUser(get_class($module));
         if ($module->isEnabled() && count($moduleMenuItems) > 0) {
             foreach ($moduleMenuItems as $menuItem) {
                 if (!empty($menuItem['category'])) {
                     assert('isset($menuItem["titleLabel"])');
                     assert('isset($menuItem["descriptionLabel"])');
                     assert('isset($menuItem["route"])');
                     $categories[$menuItem['category']][] = $menuItem;
                 } else {
                     throw new NotSupportedException();
                 }
             }
         }
     }
     return $categories;
 }
Пример #6
0
<?php

require_once 'theme_functions.php';
MenuUtil::setArea(THEME_HOME);
TileSet::init("Home", "index");
include_once 'template.php';
 protected static function makeMenuView($controller = null)
 {
     assert('$controller == null || $controller instanceof CController');
     $items = MenuUtil::resolveByCacheAndGetVisibleAndOrderedTabMenuByCurrentUser();
     $useMinimalDynamicLabelMbMenu = false;
     static::resolveForMobileInterface($items, $useMinimalDynamicLabelMbMenu, $controller);
     static::resolveForActiveMenuItem($items, $controller);
     return new MenuView($items, $useMinimalDynamicLabelMbMenu);
 }
Пример #8
0
<?php

$f = $_REQUEST['f'];
if (isset($f) && $f == 'xml') {
    require_once 'theme_functions.php';
    include 'tiles/album/fetch-thumbs.php';
} else {
    require_once 'theme_functions.php';
    MenuUtil::setArea(THEME_GALLERY);
    TileSet::init(getAlbumTitle(), "album");
    include_once 'template.php';
}
 /**
  * @param $user
  * @param bool $selected
  * @return array
  */
 public static function getVisibleAndOrderedTabMenuItemsByUser($user, $selected = false)
 {
     $visibleAndOrderedTabMenuItems = array();
     $tabMenuItems = MenuUtil::getVisibleAndOrderedTabMenuByUser($user);
     foreach ($tabMenuItems as $menuItem) {
         if ($selected === true) {
             $visibleAndOrderedTabMenuItems[] = $menuItem['moduleId'];
         } else {
             $moduleId = $menuItem['moduleId'];
             $visibleAndOrderedTabMenuItems[$moduleId] = $menuItem['label'];
         }
     }
     return $visibleAndOrderedTabMenuItems;
 }
Пример #10
0
<?php

$m = SERVERPATH . "/themes/" . basename(dirname(dirname(__FILE__))) . "/menus/secondary.php";
if (file_exists($m)) {
    include $m;
}
if (getOption('simplicity2_enable_archive')) {
    MenuUtil::printSecondaryLinkItem('browse-archive', getCustomPageURL('archive'), gettext('Archives'), THEME_SEARCH);
}
if (getOption('simplicity2_print_contact_menu_item') && getOption('simplicity2_contact_is_secondary')) {
    $pageName = getOption('simplicity2_contact_page_name');
    $text = gettext("Contact");
    if (is_null($pageName) or trim($pageName) == '') {
        MenuUtil::printSecondaryLinkItem('contact-link', getCustomPageURL('contact'), $text, THEME_CONTACT);
    } else {
        MenuUtil::printSecondaryPageLinkItem('contact-link', $pageName, $text);
    }
}
?>

Пример #11
0
 public function testResolveMenuItemsForLanguageLocalizationIsRecursive()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $metadata = AccountsModule::getMetadata();
     $backupMetadata = $metadata;
     $metadata['global']['shortcutsCreateMenuItems'] = array(array('label' => "eval:Zurmo::t('AccountsModule', 'AccountsModulePluralLabel', \$translationParams)", 'url' => array('/accounts/default/create'), 'right' => AccountsModule::RIGHT_CREATE_ACCOUNTS, 'mobile' => true));
     AccountsModule::setMetadata($metadata);
     $menuItems = MenuUtil::getAccessibleShortcutsCreateMenuByCurrentUser();
     $taskMenu = $menuItems['items'][7];
     $this->assertEquals('Task', $taskMenu['label']);
     unset($menuItems['items'][7]);
     $compareData = array('label' => 'Create', 'url' => null, 'items' => array(array('label' => 'Accounts', 'url' => array('/accounts/default/create'), 'right' => AccountsModule::RIGHT_CREATE_ACCOUNTS, 'mobile' => true), array('label' => 'Contact', 'url' => array('/contacts/default/create'), 'right' => ContactsModule::RIGHT_CREATE_CONTACTS, 'mobile' => true), array('label' => 'Conversation', 'url' => array('/conversations/default/create'), 'right' => ConversationsModule::RIGHT_CREATE_CONVERSATIONS, 'mobile' => true), array('label' => 'Lead', 'url' => array('/leads/default/create'), 'right' => LeadsModule::RIGHT_CREATE_LEADS, 'mobile' => true), array('label' => 'Mission', 'url' => array('/missions/default/create'), 'right' => MissionsModule::RIGHT_CREATE_MISSIONS, 'mobile' => true), array('label' => 'Opportunity', 'url' => array('/opportunities/default/create'), 'right' => OpportunitiesModule::RIGHT_CREATE_OPPORTUNITIES, 'mobile' => true), array('label' => 'Report', 'url' => array('/reports/default/selectType'), 'right' => ReportsModule::RIGHT_CREATE_REPORTS, 'mobile' => false), array('label' => 'Project', 'url' => array('/projects/default/create'), 'right' => ProjectsModule::RIGHT_CREATE_PROJECTS, 'mobile' => true)));
     // Re keying and slice the items from main array as we just unset the index 7 menuItem and we may have
     // items that are below that e.g. index 8, 9, 10, ...
     // If we don't do this the keys will mismatch and assertEquals will fail.
     $menuItemsReKeyedItems = array_values($menuItems['items']);
     unset($menuItems['items']);
     $compareDataReKeyedItems = array_values($compareData['items']);
     unset($compareData['items']);
     $this->assertEquals($compareData, $menuItems);
     $this->assertEquals($compareDataReKeyedItems, $menuItemsReKeyedItems);
     AccountsModule::setMetadata($backupMetadata);
 }
 public function testEditTabMenuOrderByMakeFormAndSetConfigurationFromForm()
 {
     $sally = User::getByUsername('sally');
     $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($sally);
     $this->assertEquals(count($form->selectedVisibleAndOrderedTabMenuItems), count(MenuUtil::getVisibleAndOrderedTabMenuByUser($sally)));
     $defaultOrderedTabMenuItems = $form->selectedVisibleAndOrderedTabMenuItems;
     $customOrderedTabMenuItems = array_reverse($defaultOrderedTabMenuItems);
     $form->selectedVisibleAndOrderedTabMenuItems = $customOrderedTabMenuItems;
     UserConfigurationFormAdapter::setConfigurationFromForm($form, $sally);
     $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($sally);
     $this->assertEquals($form->selectedVisibleAndOrderedTabMenuItems, $customOrderedTabMenuItems);
     $billy = User::getByUsername('billy');
     $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy);
     $this->assertEquals($form->selectedVisibleAndOrderedTabMenuItems, $defaultOrderedTabMenuItems);
     $form->selectedVisibleAndOrderedTabMenuItems = $customOrderedTabMenuItems;
     UserConfigurationFormAdapter::setConfigurationFromForm($form, $billy);
     $form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($billy);
     $this->assertEquals($form->selectedVisibleAndOrderedTabMenuItems, $customOrderedTabMenuItems);
 }
Пример #13
0
<?php

require_once 'theme_functions.php';
$f = $_REQUEST['f'];
if (isset($f) && $f == 'xml') {
    include 'tiles/news/fetch-news.php';
} else {
    if (isset($_REQUEST['c']) && $_REQUEST['c'] == 1) {
        include "tiles/news/fetch-comments.php";
    } else {
        MenuUtil::setArea(THEME_NEWS);
        NewsUtil::setCurrentNewsPage();
        TileSet::init("News", "news");
        include_once 'template.php';
    }
}
Пример #14
0
<?php

require_once 'theme_functions.php';
MenuUtil::setArea(THEME_INFO);
TileSet::init("Archives", "theme-info");
include_once 'template.php';
Пример #15
0
<?php

if (getOption('simplicity2_print_home_menu_item')) {
    MenuUtil::printMenuItem(getGalleryIndexUrl(), gettext("Home"), THEME_HOME, "first");
}
MenuUtil::printMenuItem(getGalleryIndexUrl(), gettext("Gallery"), THEME_GALLERY, '', true);
if (function_exists('getNewsIndexURL')) {
    //if zenpage is enabled
    MenuUtil::printMenuItem(NewsUtil::getNewsIndexUrl(), gettext("Notes"), THEME_NEWS);
}
$m = SERVERPATH . "/themes/" . basename(dirname(dirname(__FILE__))) . "/menus/main.php";
if (file_exists($m)) {
    include $m;
}
if (getOption('simplicity2_print_contact_menu_item') && !getOption('simplicity2_contact_is_secondary')) {
    $pageName = getOption('simplicity2_contact_page_name');
    if (is_null($pageName) or trim($pageName) == '') {
        MenuUtil::printMenuItem(getCustomPageURL("contact"), gettext("Contact"), THEME_CONTACT, '', false, 'contact-link');
    } else {
        MenuUtil::printMenuPageLink($pageName, gettext('Contact'), 'contact-link');
    }
}
?>

Пример #16
0
<?php

MenuUtil::printSecondaryLinkItem('theme-info', getCustomPageURL('theme-info'), gettext('Theme'), THEME_INFO);
Пример #17
0
 static function setArea($a)
 {
     self::$area = $a;
 }
Пример #18
0
 public function testResolveMenuItemsForLanguageLocalizationIsRecursive()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $metadata = AccountsModule::getMetadata();
     $backupMetadata = $metadata;
     $metadata['global']['shortcutsCreateMenuItems'] = array(array('label' => "eval:Zurmo::t('AccountsModule', 'AccountsModulePluralLabel', \$translationParams)", 'url' => array('/accounts/default/create'), 'right' => AccountsModule::RIGHT_CREATE_ACCOUNTS, 'mobile' => true));
     AccountsModule::setMetadata($metadata);
     $menuItems = MenuUtil::getAccessibleShortcutsCreateMenuByCurrentUser();
     $compareData = array('label' => 'Create', 'url' => null, 'items' => array(array('label' => 'Accounts', 'url' => array('/accounts/default/create'), 'right' => AccountsModule::RIGHT_CREATE_ACCOUNTS, 'mobile' => true), array('label' => 'Contact', 'url' => array('/contacts/default/create'), 'right' => ContactsModule::RIGHT_CREATE_CONTACTS, 'mobile' => true), array('label' => 'Conversation', 'url' => array('/conversations/default/create'), 'right' => ConversationsModule::RIGHT_CREATE_CONVERSATIONS, 'mobile' => true), array('label' => 'Lead', 'url' => array('/leads/default/create'), 'right' => LeadsModule::RIGHT_CREATE_LEADS, 'mobile' => true), array('label' => 'Mission', 'url' => array('/missions/default/create'), 'right' => MissionsModule::RIGHT_CREATE_MISSIONS, 'mobile' => true), array('label' => 'Opportunity', 'url' => array('/opportunities/default/create'), 'right' => OpportunitiesModule::RIGHT_CREATE_OPPORTUNITIES, 'mobile' => true), array('label' => 'Report', 'url' => array('/reports/default/selectType'), 'right' => ReportsModule::RIGHT_CREATE_REPORTS, 'mobile' => false)));
     $this->assertEquals($compareData, $menuItems);
     AccountsModule::setMetadata($backupMetadata);
 }
Пример #19
0
<?php

require_once 'theme_functions.php';
MenuUtil::setArea(THEME_SEARCH);
TileSet::init("Archives", "archive");
include_once 'template.php';
Пример #20
0
 protected static function resolveItemsAsItemsForMobile(&$items, &$useMinimalDynamicLabelMbMenu, $controller = null)
 {
     $useMinimalDynamicLabelMbMenu = true;
     static::$showRecentlyViewed = false;
     $controller = $controller ? $controller : Yii::app()->request->controller;
     $shortcutsCreateMenuItems = MenuUtil::getAccessibleShortcutsCreateMenuByCurrentUser();
     static::resolveShortcutsCreateMenuItemsForMobile($shortcutsCreateMenuItems);
     $shortcutsCreateMenuView = new MobileShortcutsCreateMenuView($controller->getId(), $controller->getModule()->getId(), $shortcutsCreateMenuItems);
     $moduleNamesAndLabels = GlobalSearchUtil::getGlobalSearchScopingModuleNamesAndLabelsDataByUser(Yii::app()->user->userModel);
     $sourceUrl = Yii::app()->createUrl('zurmo/default/globalSearchAutoComplete');
     $globalSearchView = new MobileGlobalSearchView($moduleNamesAndLabels, $sourceUrl);
     $recentlyViewed = static::makeRecentlyViewedView();
     $recentlyViewedMenu = $recentlyViewed->renderMenu();
     $searchItem = array(array('label' => '', 'dynamicLabelContent' => $globalSearchView->render(), 'itemOptions' => array('id' => 'search')));
     $shortcutsItems = array(array('label' => '', 'dynamicLabelContent' => $shortcutsCreateMenuView->render(), 'itemOptions' => array('id' => 'shortcuts')));
     $recentlyViewedItems = array(array('label' => '', 'dynamicLabelContent' => MobileHtml::renderFlyoutTrigger('Recently Viewed'), 'itemOptions' => array('id' => 'recently-viewed'), 'items' => $recentlyViewedMenu ? $recentlyViewedMenu : null));
     $items = CMap::mergeArray($searchItem, $items, $shortcutsItems, $recentlyViewedItems);
 }
Пример #21
0
<?php

MenuUtil::printMenuPageLink('publi', gettext('Publications'));