Example #1
0
/**
 * show the module
 * @global $g_user
 * @param $module the $_REQUEST['ac'] exploded into an array
 * @param  $idx the index of the array : the AD code is splitted into an array thanks the slash
 */
function show_menu($module)
{
    if ($module == 0) {
        return;
    }
    static $level = 0;
    global $g_user;
    $cn = Dossier::connect();
    /**
     * Show the submenus
     */
    $amenu = $cn->get_array("\n        select \n            pm_id,\n            me_code,\n            pm_id_dep,\n            me_file,\n            me_javascript,\n            me_url,\n            me_menu,\n            me_description,\n            me_description_etendue\n            from profile_menu \n            join menu_ref using (me_code) \n            where pm_id_dep=\$1 and p_id=\$2\n\t order by p_order", array($module, $g_user->get_profile()));
    // There are submenuS, so show them
    if (!empty($amenu) && count($amenu) > 1) {
        $a_style_menu = array('topmenu', 'menu2', 'menu3');
        if ($level > count($a_style_menu)) {
            $style_menu = 'menu3';
        } else {
            $style_menu = $a_style_menu[$level];
        }
        require 'template/menu.php';
    } elseif (count($amenu) == 1) {
        if (trim($amenu[0]['me_url']) != "" || trim($amenu[0]['me_file']) != "" || trim($amenu[0]['me_javascript']) != "") {
            echo '<div class="topmenu">';
            echo h2info(_($amenu[0]['me_menu']));
            echo '</div>';
            $module = $amenu[0]['pm_id'];
        } else {
            $url = $_REQUEST['ac'] . '/' . $amenu[0]['me_code'];
            echo '<a href="do.php?gDossier=' . Dossier::id() . '&ac=' . $url . '">';
            echo _($amenu[0]['me_menu']);
            echo '</a>';
            $level++;
            return;
        }
    }
    // There is no submenu or only one
    if (empty($amenu) || count($amenu) == 1) {
        $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type\n\t\tfrom menu_ref\n\t\tjoin profile_menu using (me_code)\n\t\tjoin profile_user using (p_id)\n\t\twhere\n\t\tpm_id=\$1 and\n\t\tuser_name=\$2 and\n\t\t(me_file is not null or trim(me_file) <>'' or\n\t\tme_javascript is not null or trim (me_javascript) <> '')", array($module, $g_user->login));
        if (count($file) == 0) {
            return;
        }
        if ($file[0]['me_file'] != "") {
            if ($file[0]['me_parameter'] !== "") {
                // if there are paramter put them in superglobal
                $array = compute_variable($file[0]['me_parameter']);
                put_global($array);
            }
            if (DEBUG) {
                echo $file[0]['me_file'], " param : ", $file[0]['me_parameter'];
            }
            /*
             * Log the file we input to put in the folder test-noalyss for replaying it
             */
            if (LOGINPUT) {
                $file_loginput = fopen($_ENV['TMP'] . '/scenario-' . $_SERVER['REQUEST_TIME'] . '.php', 'a+');
                fwrite($file_loginput, "include '" . $file[0]['me_file'] . "';");
                fwrite($file_loginput, "\n");
                fclose($file_loginput);
            }
            // if file is not a plugin, include the file, otherwise
            // include the plugin launcher
            if ($file[0]['me_type'] != 'PL') {
                require_once $file[0]['me_file'];
            } else {
                require 'extension_get.inc.php';
            }
            exit;
        }
        if ($file[0]['me_javascript'] != '') {
            $js = str_replace('<DOSSIER>', dossier::id(), $file[0]['me_javascript']);
            echo create_script($js);
        }
    }
    $level++;
}
 *
 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
 * \brief show all the operation for a customer
 * the variable inherited are
 * - $cn database connexion
 * - $_REQUEST['f_id'] the f_id of the card
 * - $p_action
 * - $sub_action
 * - $ss_action
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
$f = new Fiche($cn, $_REQUEST['f_id']);
$qcode = $f->get_quick_code();
$_GET['qcode'] = $qcode;
$_REQUEST['qcode'] = $qcode;
$var_array = compute_variable('ledger_type=ALL');
put_global($var_array);
require_once NOALYSS_INCLUDE . '/history_operation.inc.php';