3.6. Navigation

The style and location of navigational links is a combined setting. The generated form will have various buttons, such as Next, Prev, Save, Cancel, etc. Their location relative to the table can be changed. Button positions are:

  U -- up / above table
  D -- down / below table (default)

Button possitions should be combined with navigation styles. The style of navigational links may be text, buttons, or graphic images (icons):

  B -- buttons (default)
  T -- text links
  G -- graphic links

Possible combinations include:

Example 3-16. Navigation possibilities

$opts['navigation'] = 'DB'; // buttons below table 
$opts['navigation'] = 'DT'; // text links below table 
$opts['navigation'] = 'DG'; // graphics below table 
$opts['navigation'] = 'UB'; // buttons above table 
$opts['navigation'] = 'UT'; // text links above table 
$opts['navigation'] = 'UG'; // graphics above table  
$opts['navigation'] = 'UDBTG' // all navigations styles

As you can see from the last example in box above, all navigation styles can be mixed up together to fit your needs. There is no functionality difference between navigation with graphic/text links and navigation using radio buttons selection.

If you are not satisfied with order of buttons, or you want to remove certain buttons, you can use $opts['buttons'] option. In this option, you can specify exact buttons to be displayed, even with custom ones. There are several common reasons to remove some buttons: when having huge amount of pages, dropdown box creation is too long, display save button only at the bottom of the page to force users to scroll through screeen before adding a new record, and so on.

Buttons on phpMyEdit pages can be divided into several groups. These groups then specify keywords which are used when declaring a button in $opts['buttons']. If an element in $opts['buttons'] is not matching a keyword, it is translated using language files. If an element is an array, it is outputed as a custom button, as shown below.

navigation   first, <<, prev, <, next, >, last, >>
go to   goto, goto_combo, goto_text
operation   add, view, change, delete, copy
confirmation   save, more, cancel
statistics   current_page, total_pages, total_recs

Navigation and go to group can be used in list or filter mode to jump several pages ahead or back. Operation group moves user to another mode, namely one of ACPDV. Confirmation buttons are used to confirm actions in ACPDV. While cancel is self explanatory, save and more might be confusing. Save is used to confirm action and return to L mode. More means confirming action and return to current mode. Save button is usually displayed as Save, however in D mode it is as Delete and in A mode as Add. More is displayed as either More or Apply. Keywords in the statistics group display numbers as their names suggest.

Example 3-17. Default buttons

$opts['buttons']['L']['up'] = array('<<','<','add','view','change','copy','delete', '>','>>','goto','goto_combo'); 
$opts['buttons']['L']['down'] = $opts['buttons']['L']['up'];  
$opts['buttons']['F']['up'] = array('<<','<','add','view','change','copy','delete', '>','>>','goto','goto_combo'); 
$opts['buttons']['F']['down'] = $opts['buttons']['F']['up'];  
$opts['buttons']['A']['up'] = array('save','more','cancel'); 
$opts['buttons']['A']['down'] = $opts['buttons']['A']['up'];  
$opts['buttons']['C']['up'] = array('save','more','cancel'); 
$opts['buttons']['C']['down'] = $opts['buttons']['C']['up'];  
$opts['buttons']['P']['up'] = array('save', 'cancel'); 
$opts['buttons']['P']['down'] = $opts['buttons']['P']['up'];  
$opts['buttons']['D']['up'] = array('save','cancel'); 
$opts['buttons']['D']['down'] = $opts['buttons']['D']['up'];  
$opts['buttons']['V']['up'] = array('change','cancel'); 
$opts['buttons']['V']['down'] = $opts['buttons']['V']['up'];

A button can be disabled for two reasons. A navigation button when there are no next or previous pages or an operation button if certain operation is not permitted to the user. By default, all disabled buttons are displayed and marked as disabled. If you do not want to show disabled buttons at all, prepend '-' to keyword. If you want a disabled button to show as enabled, prepend '+'. This will allow users to successfully push this button, however no meaningfull action will be taken.

  next -- show next button and mark disabled if appropriate
  -next -- do not show next button if disabled

You may also specify custom buttons, which values can be used outside of phpMyEdit. The first way to specify a custom button is to use phpMyEdit htmlSubmit method. In this way, value of this submit button is translated using language files into user specified language. Possible configuration is name, value, css class name, java script and disabled.

  name -- name of the submit button
  value -- value of submit button
  css -- css class name
  js -- any other string place within button tags, mostly java script
  disabled -- 1 button is disabled, 0 button is not disabled

Second way of declaring custom buttons, is to declare actuall html code of the button. Note that using this method, any html entity can be outputted.

Example 3-18. Custom buttons

$opts['buttons']['V']['up'] = array('change', 'cancel', 
   array('name' => 'pme_back', 'value' => 'Back to main menu', 'css' => 'pme-backtomenu', 'disabled' => false),
   'Go to:', array('code' => '<SELECT><OPTION>....</OPTION></SELECT>'), 
$opts['buttons']['V']['down'] = $opts['buttons']['V']['up'];

Example 3-19. Buttons with large number of pages

$opts['buttons']['L']['up'] = array( '-<<', '-<', 'Page', 'goto_text', 'of', 'total_pages', '->', '->>'); ); 
$opts['buttons']['L']['down'] = $opts['buttons']['L']['up']; 
$opts['display']['num_pages'] = false; 
$opts['display']['num_records'] = false;

Bootstrap phpMyEdit PHP Form Generator