Ejemplo n.º 1
0
function myeasydb_add_pages()
{
    #
    #	settings submenu
    #
    add_options_page(__('myEASYdb', MED_LOCALE), __('myEASYdb', MED_LOCALE), 'administrator', 'med_options', 'myeasydb_options_page');
    #
    #	tools submenu
    #
    add_management_page(__('myEASYdb', MED_LOCALE), __('myEASYdb', MED_LOCALE), 'administrator', 'med_tools', 'myeasydb_manage_page');
    #
    #	top level menu
    #
    add_menu_page(__('myEASYdb', MED_LOCALE), __('myEASYdb', MED_LOCALE), 'administrator', 'med_admin', 'myeasydb_toplevel_page', PLUGIN_LINK . 'img/myEASYdb-16.png');
    //$page_ref = add_menu_page( '', 'Menu Test', 10, 'menu-test', 'menu_test_index' );
    //add_action( 'load-' . $page_ref, 'menu_test_set_title' );
    //	$page_ref =  add_menu_page('', __( 'MySQL Admin', MED_LOCALE ), 'administrator', 'med_adminAAA', 'myeasydb_toplevel_page', PLUGIN_LINK.'img/mysql.png');
    //	add_action( 'load-' . $page_ref, 'set_title' );
    //    function set_title() {
    //        global $title;
    //        $title = 'Menu Test';
    //    }
    //add_submenu_page( 'my-top-level-handle', 'Page title', 'Sub-menu title', 'administrator', 'my-submenu-handle', 'my_magic_function');
    //add_submenu_page('med_admin', __( 'Sublevel', MED_LOCALE ), __( 'Sublevel', MED_LOCALE ), 'administrator', 'med_sub-page', 'myeasydb_toplevel_page');
    //add_menu_page(__( 'MySQL Admin', MED_LOCALE ), '', 'administrator', 'med_admin', 'myeasydb_toplevel_page', PLUGIN_LINK.'img/mysql.png');
    //add_menu_page(__( 'Start Here', MED_LOCALE ), 'myeasydb', 'administrator', 'med_admin', 'myeasydb_toplevel_page', PLUGIN_LINK.'img/mysql.png');
    //$this->_pageRef = add_menu_page( 'Start Here', $wp_theme_name, 'edit_themes', $this->_page, array( &$this, 'index' ) );
    //add_submenu_page( $this->_page, 'Start Here', 'Start Here', 'edit_themes', $this->_page, array( &$this, 'index' ) );
    #
    #	edit page
    #
    add_pages_page(__('myEASYdb Edit', MED_LOCALE), '', 'administrator', 'med_edit', 'myeasydb_edit_page');
    //// Add a submenu to the custom top-level menu:
    //add_submenu_page('med_admin', __( 'Sublevel', MED_LOCALE ), __( 'Sublevel', MED_LOCALE ), 'administrator', 'med_sub-page', 'myeasydb_sublevel_page');
    //
    //// Add a second submenu to the custom top-level menu:
    //add_submenu_page('med_admin', __( 'Sublevel 2', MED_LOCALE ), __( 'Sublevel 2', MED_LOCALE ), 'administrator', 'med_sub-page2', 'myeasydb_sublevel_page2');
    #
    #	available tables
    #
    if (defined('MAINSITE_DB') && MAINSITE_DB != '') {
        $rows = table_get_tables(MAINSITE_DB);
        $t = count($rows);
        for ($i = 0; $i < $t; $i++) {
            //var_dump($rows[$i]);echo '<hr>';
            if ($rows[$i]['Comment'] != '' && substr($rows[$i]['Comment'], 0, 8) != '*PRIVATE') {
                //echo $rows[$i]['Name'].' => '.$rows[$i]['Comment'].'<br>';
                //echo '<a href="'.PLUGIN_LINK.'table_editor_adm.php?table='.$rows[$i]['Name'].'">'.$rows[$i]['Name'].' => '.$rows[$i]['Comment'].'</a><br>';
                add_submenu_page('med_admin', $rows[$i]['Comment'], $rows[$i]['Comment'], 'administrator', $rows[$i]['Name'], 'myeasydb_table_handler_page');
            } else {
                add_submenu_page('med_admin', $rows[$i]['Name'], $rows[$i]['Name'], 'administrator', $rows[$i]['Name'], 'myeasydb_table_handler_page');
            }
        }
        /*
        	#	0.0.6
        
        		//if(!isset($_SESSION['myeasydbVersion']) && (!defined('AJAX_CALLER') || AJAX_CALLER==false))
        		//{
        		//	#	check the myEASYdb version only once per session
        		//	#
        		//	?><script type="text/javascript">function get_med_information() {
        		//		sndReq('get_med_information','med','<?php echo 'username' . AJAX_PARMS_SPLITTER . 'pwd'; ?>');
        		//		}
        		//		setTimeout('get_med_information()', 500);
        		//	</script><?php
        		//}
        */
    }
}
Ejemplo n.º 2
0
 #
 #	0: database name
 #	1: 'check_med_tables' to check if the med own tables are present
 #	2: 'table name' to avoid including it in the output
 #	3: number of columns to use
 #	4: 'link2fields' to create a link that will open a list of fields for the table
 #	5: field name to use for the identifier if p4 is passed
 #	6: referenced table
 #	7: referenced id field
 #	8: number of the input/hidden field
 #	9: referenced description field
 #
 if ($parms[0] == '') {
     exit;
 }
 $tables = table_get_tables($parms[0]);
 $t = count($tables);
 //var_dump($tables);
 //echo $parms[0].'|'.$parms[1].'|'.$parms[2].'|'.$parms[3].'|'.$parms[4].'|'.$parms[5].'|'.$parms[6].'|'.$parms[7].'|'.$parms[8];
 //exit();
 if ((int) $parms[3] == 0) {
     $maxCols = 3;
     #	0.0.5
 } else {
     $maxCols = (int) $parms[3] - 1;
 }
 if ($t == 0 && $parms[1] == '') {
     echo '<div class="error"><p>' . __('No tables found in this database', MED_LOCALE) . '</p></div>';
 } else {
     echo '<div class="updated">' . '<table width="100%" style="border:1px;" cellspacing="4">' . '<tr>';
     $c = 0;