{"id":144,"date":"2011-01-25T14:45:29","date_gmt":"2011-01-25T19:45:29","guid":{"rendered":"http:\/\/xlinesoft.com\/blog\/?p=144"},"modified":"2011-04-08T12:13:08","modified_gmt":"2011-04-08T17:13:08","slug":"how-to-use-menu-builder-in-phprunnerasprunnerpro","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2011\/01\/25\/how-to-use-menu-builder-in-phprunnerasprunnerpro\/","title":{"rendered":"How to use Menu Builder in PHPRunner\/ASPRunnerPro"},"content":{"rendered":"<p>The Menu Builder lets you organize your tables and views into multi-level cascading menu for quicker navigation. This feature is particularly useful if you have a large number of tables. Depending on the selected layout the menu will appear vertically or horizontally.<\/p>\n<p><a href=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3.png\" alt=\"\" title=\"menu_builder3\" width=\"591\" height=\"408\" class=\"alignnone size-full wp-image-158\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3.png 591w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3-300x207.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3-150x103.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder3-400x276.png 400w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/a><br \/>\n<!--more--><br \/>\nThe menu builder is accessible from the Visual Editor tool bar. The first thing you will notice is that the menu list consists of all tables and views selected for your current project.\u00a0 You can modify the properties of each individual menu item by double-clicking it.<\/p>\n<p>In the properties dialog you can set the item type to be either a hyperlink or a group. If the item is a link you can set the link type to either an internal application page or external page.<\/p>\n<p>If Link type is set to External page, then you can add the link to any web page. If Link type is set to PHPRunner or ASPRunner page, you need to select the table within your project and then one of the core pages such as list, add, print or search.<\/p>\n<p>You can also change the name of the menu item as it will be appear in your application.<br \/>\nIf you are in the mood for changing the look and feel of the menu item beyond the default style you can do so by using custom css. Multiple css descriptions can be added using semicolon between them.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-154\" style=\"border: 0pt none;\" title=\"menu_builder1\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder1.png\" alt=\"\" width=\"642\" height=\"254\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder1.png 642w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder1-300x118.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder1-150x59.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder1-400x158.png 400w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/p>\n<p>You can also set the link parameters for each menu item. For example, if I want to display the Country Sales Report order by the Sales figures you can set the parameter to <strong>orderby=dSales<\/strong> . If you have more complex parameters the best way to proceed would be to copy the parameter string from the application URL and paste it into the parameter dialog.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-156\" style=\"border: 0pt none;\" title=\"menu_builder2\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder2.png\" alt=\"\" width=\"536\" height=\"383\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder2.png 536w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder2-300x214.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder2-150x107.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder2-400x285.png 400w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/p>\n<p>As I mentioned earlier, if you have a large number of menu items you might want to consider grouping them creating a cascading menu. For example I will group all of the sales views into the Sales Reports group. I will create a new group called &#8220;Sales Reports&#8221; and drag-n-drop the sales views under this category. Once I build my application this is how it will look like.<\/p>\n<p>You will also be able to create a new links within the Menu Builder by clicking the Add Link button and setting the link properties. For example I will add an external Link within the Sales Reports group pointing to Yahoo Finance: <a href=\"http:\/\/finance.yahoo.com\">http:\/\/finance.yahoo.com<\/a><\/p>\n<p>Now let\u2019s talk about the menu items permissions. Depending on your business application you might want to hide some of the menu items based on the application users. Perhaps we would like to hide all menu items within the Sales Reports menu if the user is not a manager. If the menu item is the link to internal application page, in our case we have three of them, you can simply assign the table permissions on the permissions step. Please refer to the <a href=\"http:\/\/xlinesoft.com\/phprunner\/php-database.htm#\" target=\"_blank\">Security tutorial<\/a> or related help articles for more details on how to set the table permissions.<br \/>\nHowever, if the menu item is an external link like Yahoo Finance the permissions will have to be set using events. So in the ModifyMenuItem event I will enter the following code.<\/p>\n<p><strong>PHP code<\/strong><\/p>\n<pre lang=\"php\">if ($_SESSION[\"GroupID\"]!=\"manager\")\r\n{\r\n$title = $menuItem->getTitle();\r\nif ($title==\"Yahoo Finance\")\r\nreturn false;\r\n}\r\nreturn true;\r\n<\/pre>\n<p><strong>ASP code<\/strong><\/p>\n<pre lang=\"asp\">if Session(\"GroupID\")<>\"manager\" then\r\n   title = menuItem.getTitle()\r\n   if title=\"Yahoo Finance\" then\r\n      ModifyMenuItem = false\r\n      exit function\r\n   end if\r\nend if\r\nModifyMenuItem = true\r\n<\/pre>\n<p>The code will validate if the user is not a manager and will hide Yahoo Finance menu item. As you can see after hiding all the menu items in the Sales Reports group the entire groups is no longer displayed for the user. But if I login as the manager I will see all the menu items in the Sales Reports group.<\/p>\n<p>You can also use the <a href=\"http:\/\/xlinesoft.com\/phprunner\/docs\/menu_item_modify.htm\">ModifyMenuItem<\/a> event to display the record counter for each menu item. To accomplish this you will need to add the following code to the event in the events editor.<\/p>\n<p><strong>PHP code<\/strong><\/p>\n<pre lang=\"php\">if($menuItem->getLinkType() == 'Internal')\r\n{\r\n   global $tables_data;\r\n   $table=$menuItem->getTable();\r\n   include_once(getabspath(\"include\/\".GetTableURL($table).\"_settings.php\"));\r\n   $table=GetOriginalTableName($table);\r\n   $rs=CustomQuery(\"select count(*) as c from \" . AddTableWrappers($table));\r\n   $data = db_fetch_array($rs);\r\n   $menuItem->setTitle($menuItem->getTitle() . \" (\". $data[\"c\"] . \")\");\r\n}\r\nreturn true;\r\n<\/pre>\n<p><strong>ASP code<\/strong><\/p>\n<pre lang=\"asp\">if menuItem.getLinkType() = \"Internal\" then\r\n   table=menuItem.getTable()\r\n   asp_include \"include\/\" & GetTableURL(table) & \"_settings.asp\", true\r\n   table=GetOriginalTableName(table)\r\n   set rs=CustomQuery(\"select count(*) as c from \" & AddTableWrappers(table))\r\n   menuItem.setTitle_p1(menuItem.getTitle() & \" (\" & rs(\"c\") & \")\")\r\nend if\r\n\r\nModifyMenuItem = true\r\n<\/pre>\n<p>The code will validate if the menu item is an internal table or view and will concatenate the number of records with the menu item name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder4.png\" alt=\"\" title=\"menu_builder4\" width=\"476\" height=\"355\" class=\"alignnone size-full wp-image-161\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder4.png 476w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder4-300x223.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder4-150x111.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2011\/01\/menu_builder4-400x298.png 400w\" sizes=\"(max-width: 476px) 100vw, 476px\" \/><\/p>\n<p><a href=\"http:\/\/xlinesoft.com\/tutorials\/MenuBuilder.html\" target=\"_blank\">Watch &#8216;How to use Menu Builder&#8217; video tutorial<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Menu Builder lets you organize your tables and views into multi-level cascading menu for quicker navigation. This feature is particularly useful if you have a large number of tables. Depending on the selected layout the menu will appear vertically or horizontally.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[14,15],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/144"}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":20,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/144\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}