'.$p_string.''; } function hi($p_string) { return ''.htmlspecialchars($p_string).''; } function hb($p_string) { return ''.htmlspecialchars($p_string).''; } function th($p_string,$p_extra='') { return '
| '.$href[1].' | |
| '.$href[1].' | |
| '.$href[1].' | '; } else { $ret.=''.$href[1].' | '; } } $ret.="
$html
EOF;
exit();
}
}
/**
*
* @param int $selected module selected
*/
function show_module($selected)
{
global $g_user;
$cn=Dossier::connect();
$amodule=$cn->get_array("select
me_code,me_menu,me_url
from v_all_menu
where
user_name=$1
and p_type_display='M'
order by p_order",array($g_user->login));
if ( $selected != -1 )
{
require_once('template/module.php');
$file=$cn->get_value("select me_file from v_all_menu where me_code=$1",array($selected));
if ($file != '')
{
require_once $file;
exit();
}
}
else
{
}
}
function find_default_module()
{
global $g_user;
$cn=Dossier::connect();
$default_module = $cn->get_array("select me_code
from profile_menu join profile_user using (p_id)
where
p_type_display='M' and
user_name=$1 and pm_default=1", array($g_user->login));
if (empty($default_module))
{
$default_module = $cn->get_array("select me_code
from profile_menu join profile_user using (p_id)
where
user_name=$1 and p_order=(select min(p_order) from profile_menu
where user_name=$2) limit 1", array($g_user->login,$g_user->login));
return $default_module[0]['me_code'];
}
if (count($default_module) > 1)
{
echo_error("Plusieurs modules sont le module par défaut", __LINE__, __FILE__);
}
elseif (count($default_module) == 1)
{
return $default_module[0]['me_code'];
}
}
/**
*
*/
function show_menu($module,$idx)
{
global $g_user;
$cn=Dossier::connect();
$amenu=$cn->get_array("select
me_menu,me_code
from v_all_menu
where
me_code_dep=$1 order by p_order",array($module[$idx]));
if (! empty ($amenu))
{
require 'template/menu.php';
}
else
{
/**
* @todo add security
* check if user can access this module
*/
$file=$cn->get_value("select me_file
from menu_ref
where
me_code=$1 and
(me_file is not null or trim(me_file) <>'')",
array($module[$idx]));
if ( $file != "" )
{
echo '