Whats special about module_exec.inc
Prev | Chapter 18. Adding a module to moregroupware | Next

## Whats special about module_exec.inc

first we take a look at module_exec.inc:

    // Authentication of User according his session (its not the main auth)
            if($myEnv["auth"] !== false) checkLogin();

            // Connect to database and return $db object
            if($myEnv["connectdb"] !== false) $db = connect_database();

            // do module translation and give back a hashmap with all keys and values
            if($myEnv["translate"] !== false) $hashmap = setLocaledText($MGW->spkz, $myEnv["module"]);

            // get user settingw and return them in $settings hashmap
            if($myEnv["getsettings"] !== false) $settings = get_settings($myEnv["module"]);

            // call standard module submenu (smenu.php) and integrate it
            if($myEnv["stdsmenu"] !== false)
            if(file_exists(ROOTPATH . "/" . $myEnv["module"]. "/inc/smenu.php"))
            include(ROOTPATH . "/" . $myEnv["module"] . "/inc/smenu.php");
            else
            echo "<b>Error: </b>Program cannot find Submenu-Definition File (smenu.php) in module \"inc\" folder. Please create this file or set \$myEnv[stdsmenu] to false in your program and define it there.";

As you can see, this include does 5 important tasks

- Check the user login (and reject him to login if something is wrong)

- Connect to the database and return object $db

- translate the current module and gives back a hashmap $hashmap

- get settings for actual module for actual user (not implemented yet)

- create the submenu

TO BE CONTINUED....

Prev | Up | Next
What does container.inc do exactly? | Home | Chapter 19. Handling common coding tasks