本文整理汇总了PHP中SugarView::getMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarView::getMenu方法的具体用法?PHP SugarView::getMenu怎么用?PHP SugarView::getMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarView
的用法示例。
在下文中一共展示了SugarView::getMenu方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenu
/**
* @see SugarView::getMenu()
*/
public function getMenu($module = null)
{
global $mod_strings, $current_language;
if (empty($module)) {
$module = $_REQUEST['import_module'];
}
$old_mod_strings = $mod_strings;
$mod_strings = return_module_language($current_language, $module);
$returnMenu = parent::getMenu($module);
$mod_strings = $old_mod_strings;
return $returnMenu;
}
示例2: testMenuExistsCanFindModuleMenuAndModuleExtMenu
/**
* @ticket 43497
*/
public function testMenuExistsCanFindModuleMenuAndModuleExtMenu()
{
// Create module menu
if ($fh = @fopen("modules/{$this->_moduleName}/Menu.php", 'w+')) {
$string = <<<EOQ
<?php
\$module_menu[]=Array("index.php?module=Import&action=foo&import_module=Accounts&return_module=Accounts&return_action=index","Foo","Foo", 'Accounts');
?>
EOQ;
fputs($fh, $string);
fclose($fh);
}
// Create module ext menu
sugar_mkdir("custom/modules/{$this->_moduleName}/Ext/Menus/", null, true);
if ($fh = @fopen("custom/modules/{$this->_moduleName}/Ext/Menus/menu.ext.php", 'w+')) {
$string = <<<EOQ
<?php
\$module_menu[]=Array("index.php?module=Import&action=bar&import_module=Accounts&return_module=Accounts&return_action=index","Foo","Foo", 'Accounts');
?>
EOQ;
fputs($fh, $string);
fclose($fh);
}
$view = new SugarView();
$module_menu = $view->getMenu($this->_moduleName);
$found_custom_menu = false;
$found_custom_menu_twice = false;
$found_menu = false;
$found_menu_twice = false;
foreach ($module_menu as $key => $menu_entry) {
foreach ($menu_entry as $id => $menu_item) {
if (preg_match('/action=foo/', $menu_item)) {
if ($found_menu) {
$found_menu_twice = true;
}
$found_menu = true;
}
if (preg_match('/action=bar/', $menu_item)) {
if ($found_custom_menu) {
$found_custom_menu_twice = true;
}
$found_custom_menu = true;
}
}
}
$this->assertTrue($found_menu, "Assert that menu was detected");
$this->assertFalse($found_menu_twice, "Assert that menu item wasn't duplicated");
$this->assertTrue($found_custom_menu, "Assert that custom menu was detected");
$this->assertFalse($found_custom_menu_twice, "Assert that custom menu item wasn't duplicated");
}
示例3: testgetMenu
public function testgetMenu()
{
//error_reporting(E_ALL);
$SugarView = new SugarView();
//execute the method and check if it works and throws an exception if no module is provided
//it creates memory Fatal errors which causes PHPunit to crash so we will skip this scenario
/*
try {
//check first with invalid value and test if it throws an exception
$menu = $SugarView->getMenu();
//$this->assertTrue(is_array($menu));
} catch (Exception $e) {
$this->assertTrue(TRUE);
//$this->fail();
} */
//check with valid value and check if it returns an array.
$menu = $SugarView->getMenu('Users');
$this->assertTrue(is_array($menu));
}