diff --git a/html/compta.php b/html/compta.php
index c4b8384b0..651720cf0 100644
--- a/html/compta.php
+++ b/html/compta.php
@@ -49,25 +49,14 @@ if ( $g_UserProperty['use_admin'] == 0 ) {
}
SyncRight($g_dossier,$g_user);
-$g_UserType=GetUserType($g_user);
-session_register($g_UserType);
-switch ($g_UserType) {
- case 'compta':
- include ("top_menu_compta.php");
- break;
- case 'developper':
- include ("top_menu_compta.php");
- break;
- case 'user':
- include ("top_menu_compta.php");
- break;
- default:
- echo_error("Error type doesn't exist");
- break;
-}
-ShowMenuCompta($g_dossier);
-ShowMenuComptaRight($g_dossier);
+include ("top_menu_compta.php");
+
+// Show Top Menu
+ShowMenuCompta($g_dossier,$g_UserProperty);
+
+// Show Menu on the right side
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
html_page_stop();
diff --git a/html/dossier_prefs.php b/html/dossier_prefs.php
index 0d2601d78..37369435c 100644
--- a/html/dossier_prefs.php
+++ b/html/dossier_prefs.php
@@ -31,10 +31,11 @@ include_once ("postgres.php");
CheckUser();
include("preference.php");
-
include_once ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
-ShowMenuComptaRight($g_dossier);
+
+
+ShowMenuCompta($g_dossier,$g_UserProperty);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
include_once ("check_priv.php");
if ( $g_UserProperty['use_admin'] == 0 ) {
diff --git a/html/enc_jrn.php b/html/enc_jrn.php
index 6aa6ef8a4..2b87456e3 100644
--- a/html/enc_jrn.php
+++ b/html/enc_jrn.php
@@ -46,8 +46,8 @@ echo '';
/* Get MaxLine */
include_once("poste.php");
include_once ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
-ShowMenuComptaRight($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,ENCJRN);
if ($r == 0 ){
@@ -65,7 +65,7 @@ if ( $g_UserProperty['use_admin'] == 0 ) {
}
-ShowMenuJrnUser($g_dossier,$g_user);
+ShowMenuJrnUser($g_dossier,$g_UserProperty);
if ( isset ( $_GET["action"] )) {
if ( $_GET["action"] == "view" ) {
diff --git a/html/facturation.php b/html/facturation.php
index e5dcfba88..af42a8030 100644
--- a/html/facturation.php
+++ b/html/facturation.php
@@ -29,7 +29,7 @@ include_once ("postgres.php");
/* CheckUser */
CheckUser();
include ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin']==0 ) {
$r=CheckAction($g_dossier,$g_user,FACT);
@@ -43,7 +43,7 @@ include_once("facture_inc.php");
$l_dossier=sprintf("dossier%d",$g_dossier);
$cn=DbConnect($l_dossier);
ShowMenuComptaLeft($g_dossier,MENU_FACT);
-ShowMenuComptaRight($g_dossier);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $_GET["action"] ) {
if ($_GET["fact"] == "all" ) {
ViewFactAll($cn);
diff --git a/html/fiche.php b/html/fiche.php
index e335c5c34..4fa945615 100644
--- a/html/fiche.php
+++ b/html/fiche.php
@@ -32,7 +32,7 @@ include_once ("top_menu_compta.php");
echo '';
CheckUser();
include ("check_priv.php");
-ShowMenuCompta($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
if ( isset($_POST["PHPSESSID"] )) {
@@ -54,7 +54,7 @@ if ( isset($_POST['add_modele']) ) {
-ShowMenuComptaRight($g_dossier);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,FICHE);
if ($r == 0 ){
diff --git a/html/form.php b/html/form.php
index cfb52e5f5..c249e8611 100644
--- a/html/form.php
+++ b/html/form.php
@@ -34,10 +34,10 @@ CheckUser();
include_once("form_inc.php");
include_once ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
include ("check_priv.php");
-ShowMenuComptaRight($g_dossier);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,FORM);
diff --git a/html/impress.php b/html/impress.php
index a2748fa9e..4acd9e887 100644
--- a/html/impress.php
+++ b/html/impress.php
@@ -29,11 +29,11 @@ include_once ("postgres.php");
CheckUser();
include ("check_priv.php");
include_once ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
include_once("impress_inc.php");
-ShowMenuComptaRight($g_dossier);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,IMP);
if ($r == 0 ){
diff --git a/html/index.html b/html/index.html
index e79a44e17..8537cfb08 100644
--- a/html/index.html
+++ b/html/index.html
@@ -1,28 +1 @@
-
-
-
';
diff --git a/html/login.php b/html/login.php
index 5081a644a..11e8898d7 100644
--- a/html/login.php
+++ b/html/login.php
@@ -19,8 +19,6 @@
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
include_once ("ac_common.php");
-
-
/* $Revision$ */
include ("postgres.php");
@@ -39,97 +37,25 @@ if ( isset ($_POST["p_user"] ) ) {
CheckUser();
$g_UserProperty=GetUserProperty($cn,$g_user);
session_register("g_UserProperty");
-
- html_page_start($g_UserProperty['use_theme']);
+ if ( isset ( $_GET["PHPSESSID"]) )
+ $p_sessid= $_GET["PHPSESSID"];
+ else
+ $p_sessid= $_POST["PHPSESSID"];
+
+
+ Redirect($g_UserProperty['use_usertype'],$p_sessid);
} else
{
- if ( strlen($g_user) != 0 ) {
- echo_debug("user is not null");
- html_page_start($g_UserProperty['use_theme']);
- } else
- {
- html_page_start("classic");
+ if (isset ($g_UserProperty['use_usertype'])) {
+ if ( isset ( $_GET["PHPSESSID"]) )
+ $p_sessid= $_GET["PHPSESSID"];
+ else
+ $p_sessid= $_POST["PHPSESSID"];
+
+ Redirect($g_UserProperty['use_usertype'],$p_sessid);
}
}
-if ( isset ($db_page) ) {
- echo_debug("db_page is set ".$db_page);
-} else
-{
- echo_debug("db_page is NOT set");
- $db_page=0;
-
-}
-
-
-echo_debug("USER=$g_user - ");
-echo_debug("PAGE = $db_page");
-
-echo_debug("theme =".$g_UserProperty['use_theme']);
-
-include("top_menu_compta.php");
-// Show the first menu
-ShowMenu($g_UserProperty['use_admin']);
-if ( $g_UserProperty['use_admin'] != 0 || $g_user=='webcompta' ) {
- /* Administrator */
- $l_MaxLine=0;
- $r_database=ShowDossier('all',$db_page,$db_page+15,&$l_MaxLine);
- $action="Encoder";
- $priv="Administrateur";
- } else {
- /* User */
- $l_MaxLine=0;
- $r_database=ShowDossier('lim',$db_page,$db_page+15,&$l_MaxLine);
- $priv="Utilisateur";
- }
-
-echo '
Dossier ';
-echo "
";
-
-if ( $r_database != null ) {
- $row=0;
- foreach ( $r_database as $l_db ) {
- $row++;
- if ( $l_db['priv_priv'] == "W") {
- $action="Encoder";
- } else {
- $action="Lire";
- }
-
- if ( $row %2 == 0 ) {
- $tr='';
- $td='';
- } else {
- $tr=' ';
- $td='';
- }
- printf("%s $td %s $td %s %s %s ",
- $tr,
- $l_db['dos_name'],
- $l_db['dos_description'],
- $priv,
- $l_db['dos_id'],
- $action);
-
-
- }
-
- echo "
";
- $db_debut=15+$db_page;
- if ($db_debut < $l_MaxLine) {
- printf ("
Suivant ",$db_debut);
- }
- if ( $db_page !=0 ) {
- $db_debut=$db_page-15;
- printf ("
Précédent ",$db_debut);
- }
-
-}
-?>
-
-
-
-
html_page_stop();
?>
diff --git a/html/pcmn_update.php b/html/pcmn_update.php
index ba17415b0..a49822661 100644
--- a/html/pcmn_update.php
+++ b/html/pcmn_update.php
@@ -33,8 +33,8 @@ CheckUser();
include_once ("top_menu_compta.php");
include_once ("check_priv.php");
-ShowMenuCompta($g_dossier);
-ShowMenuComptaRight($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,MPCMN);
if ($r == 0 ){
diff --git a/html/user_pref.php b/html/user_pref.php
index 692bc19a8..9932a3ed2 100644
--- a/html/user_pref.php
+++ b/html/user_pref.php
@@ -32,20 +32,29 @@ if ( isset ( $_POST['style_user']) ) {
$g_UserProperty['use_theme']=$_POST['style_user'];
}
+// Met à jour le profil
+if ( isset ( $_POST['profile_user']) ) {
+ $g_UserProperty['use_usertype']=$_POST['profile_user'];
+}
html_page_start($g_UserProperty['use_theme']);
/* Admin. Dossier */
CheckUser();
+// show the top menu depending of the use_style
+// comta style
+
include_once ("top_menu_compta.php");
if ( isset ($g_dossier) ) {
- if ( $g_dossier != 0 ) ShowMenuCompta($g_dossier);
- ShowMenuComptaRight($g_dossier);
-} else {
- ShowMenuComptaRight();
-}
+ if ( $g_dossier != 0 ) ShowMenuCompta($g_dossier,$g_UserProperty);
+ ShowMenuComptaRight($g_dossier,$g_UserProperty);
+ } else {
+ ShowMenuComptaRight(0,$g_UserProperty);
+ }
+
+
echo '
';
if ( isset ($spass) ) {
@@ -74,6 +83,16 @@ if ( isset ( $_POST['style_user']) ) {
$g_UserProperty['use_theme']=$_POST['style_user'];
}
+// Met à jour le profil
+if ( isset ( $_POST['profile_user']) ) {
+ $CnRepo=DbConnect();
+ $Res=ExecSql($CnRepo,
+ "update ac_users set use_usertype='".$_POST['profile_user'].
+ "' where use_login='$g_user'");
+ $g_UserProperty['use_usertype']=$_POST['profile_user'];
+
+}
+
?>
Password
+
+// charge tous les profiles
+ $aprofile=array("compta","user");
+$disp_pro="
";
+foreach ($aprofile as $st){
+ if ( $st == $g_UserProperty['use_usertype'] ) {
+ $disp_pro.=''.$st;
+ } else {
+ $disp_pro.=' '.$st;
+ }
+}
+$disp_pro.=" ";
+?>
+
Profile
+
@@ -144,6 +188,7 @@ if ( isset ($g_dossier) ) {
+
}
diff --git a/html/user_sec.php b/html/user_sec.php
index b396eb7c2..a01192047 100644
--- a/html/user_sec.php
+++ b/html/user_sec.php
@@ -31,8 +31,8 @@ include_once ("postgres.php");
CheckUser();
include_once ("top_menu_compta.php");
-ShowMenuCompta($g_dossier);
-ShowMenuComptaRight($g_dossier);
+ShowMenuCompta($g_dossier,$g_UserProperty);
+ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin']== 0 ) {
$r=CheckAction($g_dossier,$g_user,SECU);
if ($r == 0 ){
@@ -50,7 +50,7 @@ $User=ExecSql($cn,"select use_id,use_first_name,use_name,use_login from ac_user
$MaxUser=pg_NumRows($User);
- ShowMenuComptaRight($g_dossier);
+ ShowMenuComptaRight($g_dossier,$g_UserProperty['use_admin']);
echo '
';
echo '
Sécurité ';
@@ -129,7 +129,7 @@ and use_active=1");
$Res=ExecSql($cn_dossier,"select jrn_def_id,jrn_def_name from jrn_def ");
$admin=CheckIsAdmin($l2_line['use_login']);
- echo '
';
+ echo '';
$MaxJrn=pg_NumRows($Res);
for ( $i =0 ; $i < $MaxJrn; $i++ ) {
$l_line=pg_fetch_array($Res,$i);
@@ -153,7 +153,7 @@ and use_active=1");
if ( $right == 1 ) {
echo ' Pas d\'accès ';
echo "";
- echo "Lecture accordée";
+ echo "Lecture ";
echo " ";
echo ' Ecriture ';
}
@@ -162,7 +162,7 @@ and use_active=1");
echo ' Lecture ';
echo "";
- echo "Ecriture accordée";
+ echo "Ecriture ";
echo " ";
}
@@ -171,7 +171,7 @@ and use_active=1");
echo ' Lecture ';
echo "";
- echo "Ecriture accordée";
+ echo "Ecriture ";
echo " ";
}
@@ -209,7 +209,7 @@ and use_active=1");
$l_change=$l_change."&access=0";
echo ' Pas d\'accès ';
echo "";
- echo "Accès accordé";
+ echo "Accès ";
echo " ";
}
@@ -217,7 +217,7 @@ and use_active=1");
echo ' Change ';
echo "";
- echo "Accès accordé";
+ echo "Accès ";
echo " ";
}
diff --git a/include/ac_common.php b/include/ac_common.php
index b71888292..739d88bd6 100644
--- a/include/ac_common.php
+++ b/include/ac_common.php
@@ -232,4 +232,60 @@ function GetUserType($p_user)
$Ret=pg_fetch_row($Res,0);
return $Ret[0];
}
+/* function Redirect
+ * Purpose : redirect following the user's profile
+ *
+ * parm :
+ * - p_profile (ac_users.use_usertype)
+ * - php_session PHPSESSID
+ * gen :
+ * - none
+ * return: none
+ */
+
+
+function Redirect($p_profile,$php_session) {
+ include_once("debug.php");
+ echo_debug("Session is $php_session");
+
+ if ( $p_profile =="compta" ) {
+ $URL="compta_login.php";
+ } else if ( $p_profile == "user") {
+ $URL="user_login.php";
+ }
+ else {
+ echo_error ("Undefined profile");
+ exit (-1);
+ }
+ echo " ";
+
+}
+/* function ShowItem($p_array) */
+/* purpose : store the string which print */
+/* the content of p_array in a table */
+/* used to display the menu */
+/* parameter : array */
+/* return : string */
+function ShowItem($p_array,$p_dir='V')
+{
+ $ret="";
+ // direction Vertical
+ if ( $p_dir == 'V') {
+ foreach ($p_array as $all=>$href){
+ $ret.=''.$href[1].' ';
+ }
+ }
+ //direction Horizontal
+ else if ( $p_dir == 'H' ) {
+ $ret.="";
+ foreach ($p_array as $all=>$href){
+
+ $ret.=''.$href[1].' ';
+ }
+ $ret.=" ";
+ }
+ $ret.="
";
+ return $ret;
+}
+
?>
diff --git a/include/check_priv.php b/include/check_priv.php
index ba34f3020..03da17bb9 100644
--- a/include/check_priv.php
+++ b/include/check_priv.php
@@ -124,7 +124,7 @@ function CheckAction ( $p_dossier,$p_login,$p_action_id)
$Count=pg_NumRows($Res);
if ( $Count == 0 ) return 0;
if ( $Count == 1 ) return 1;
- echo " Invalid action !!! ";
+ echo " Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id ";
}
/* function CheckIsAdmin
* Purpose : Check if an user is an administrator
diff --git a/include/compta_menu.php b/include/compta_menu.php
new file mode 100644
index 000000000..0d07774ff
--- /dev/null
+++ b/include/compta_menu.php
@@ -0,0 +1,160 @@
+
+
+/*
+ * This file is part of WCOMPTA.
+ *
+ * WCOMPTA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * WCOMPTA 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 WCOMPTA; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+// Auteur Dany De Bontridder ddebontridder@yahoo.fr
+/* $Revision$ */
+
+/* function c_ShowMenuComptaRight
+ * Purpose : Display menu on the Right
+ * (preference, logout and admin)
+ * parm :
+ * - $p_dossier the current dossier
+ * - $p_admin $g_UserProperty['use_admin'] 1 if admin
+ * - $p_more code
+ * gen :
+ * - none
+ * return:
+ * - none
+ *
+ */
+function c_ShowMenuComptaRight($p_dossier=0,$p_admin,$p_more="")
+{
+ include_once("ac_common.php");
+ echo '';
+}
+/* function ShowMenuCompta
+ * Purpose : Montre le menu du haut
+ *
+ * parm :
+ * - dossier
+ * - $p_user array ($g_UserProperty)
+ * gen :
+ * - none
+ * return:
+ * - none
+ *
+ */
+
+function c_ShowMenuCompta($p_dossier)
+{
+ include_once("postgres.php");
+ $l_name=GetDossierName($p_dossier);
+ echo "
$l_name ";
+ echo '';
+ }
+/* function c_ShowMenuJrnUser($p_dossier,$p_user)
+ * Purpose : Show the Menu from the jrn encode
+ * page
+ *
+ * parm :
+ * - $p_dossier
+ * - $p_user
+ * gen :
+ * - none
+ * return:
+ * - none
+ *
+ */
+
+function c_ShowMenuJrnUser($p_dossier,$p_user)
+{
+
+ echo '';
+
+}
+
+?>
diff --git a/include/constant.php b/include/constant.php
index a0143cb0f..537b2e3b7 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -34,7 +34,10 @@ define ("GJRN",7);
define ("PARM",8);
define ("SECU",9);
define ("CENTRALIZE",10);
-
+define ("VEN",11);
+define ("BQE",12);
+define ("ODS",13);
+define ("ACH",14);
// Erreur
define ("NOERROR",0);
diff --git a/include/postgres.php b/include/postgres.php
index 70c099a13..47e346801 100644
--- a/include/postgres.php
+++ b/include/postgres.php
@@ -347,19 +347,44 @@ function SyncRight($p_dossier,$p_user) {
* gen :
* -
* return: an array
+ * containing use_admin
+ * use_usertype
+ * use_theme
+ * use_name
+ * use_login
*/
function GetUserProperty($p_cn,$p_user)
{
- $sql="select use_admin,use_usertype,use_theme
+ $sql="select use_login,use_first_name,use_name,use_admin,use_usertype,use_theme
from ac_users where use_login='$p_user'";
$Ret=ExecSql($p_cn,$sql);
if ( pg_NumRows($Ret) == 0)
- return array('use_admin'=>0,
+ return array('use_first_name'=>'?',
+ 'use_name'=>'Unknown',
+ 'use_admin'=>0,
'use_usertype'=>'user',
- 'use_theme'=>'classic');
+ 'use_theme'=>'classic',
+ 'use_login'=>$p_user);
$a=pg_fetch_array($Ret,0);
return $a;
}
+/* function GetModeleId
+ * Purpose : Give the mod_id from modeledef
+ *
+ * parm :
+ * - p_cn database connection (repository)
+ * - p_modname template name
+ * gen :
+ * - none
+ * return:
+ * template id or 0 if not found
+ */
+function GetModeleId($p_cn,$p_modname) {
+ $Res=ExecSql($p_cn,"select mod_id from modeledef where mod_name='$p_modname'");
+ if (pg_NumRows($Res) == 0) return 0;
+ $name=pg_fetch_array($Res,0);
+ return $name['mod_id'];
+}
?>
diff --git a/include/top_menu_compta.php b/include/top_menu_compta.php
index d54eac064..a25445892 100644
--- a/include/top_menu_compta.php
+++ b/include/top_menu_compta.php
@@ -61,6 +61,7 @@
*
* parm :
* - dossier
+ * - $p_user array ($g_UserProperty)
* gen :
* - none
* return:
@@ -68,27 +69,19 @@
*
*/
-function ShowMenuCompta($p_dossier)
+function ShowMenuCompta($p_dossier,$pa_user)
{
- include_once("postgres.php");
- $l_name=GetDossierName($p_dossier);
- echo "
$l_name ";
- echo '';
+ if ( ! isset ( $pa_user ) ) {
+ exit (1);
+ }
+ if ( $pa_user['use_usertype'] == 'compta' ) {
+ include_once ("compta_menu.php");
+ c_ShowMenuCompta($p_dossier);
+ } else
+ if ( $pa_user['use_usertype']=='user') {
+ include_once ("user_menu.php");
+ u_ShowMenuCompta($p_dossier);
+ }
}
/* function
* Purpose :
@@ -157,6 +150,7 @@ function ShowMenuComptaLeft($p_dossier,$p_item)
* (preference, logout and admin)
* parm :
* - $p_dossier the current dossier
+ * - $p_auser array $g_UserProperty
* - $p_more code
* gen :
* - none
@@ -164,24 +158,20 @@ function ShowMenuComptaLeft($p_dossier,$p_item)
* - none
*
*/
-function ShowMenuComptaRight($p_dossier=0,$p_more="")
+function ShowMenuComptaRight($p_dossier=0,$p_auser,$p_more="")
{
- include_once("ac_common.php");
- echo '';
+ else
+ if ( $p_auser['use_usertype']=='user') {
+ include_once("user_menu.php");
+ u_ShowMenuComptaRight($p_dossier,$p_auser['use_admin'],$p_more);
+ }
}
/* function ShowMenuAdminGlobalRight($p_dossier=0)
* Purpose :
@@ -274,12 +264,14 @@ function ShowMenuJrn($p_dossier)
}
/* function ShowMenuJrnUser($p_dossier,$p_user)
- * Purpose : Show the Menu from the jrn encode
- * page
+ * Purpose : Display and Show the Menu from the jrn encode
+ * page following the use_usertype (compta,user,...)
*
* parm :
* - $p_dossier
- * - $p_user
+ * - $p_auser
+ * - $p_type (ACH, BQE, VEN)
+ * - $p_jrn what journal
* gen :
* - none
* return:
@@ -287,57 +279,17 @@ function ShowMenuJrn($p_dossier)
*
*/
-function ShowMenuJrnUser($p_dossier,$p_user)
+function ShowMenuJrnUser($p_dossier,$p_auser,$p_type=-1,$p_jrn=-1)
{
- echo '';
+ if ( ! isset ($p_auser['use_usertype'] ) ) exit (-1);
+ if ($p_auser['use_usertype'] == 'compta' ) {
+ include_once("compta_menu.php");
+ c_ShowMenuJrnUser($p_dossier,$p_auser['use_login']);
+ }
+ if ($p_auser['use_usertype'] == 'user' ) {
+ include_once("user_menu.php");
+ u_ShowMenuJrnUser($p_dossier,$p_auser['use_login'],$p_type,$p_jrn);
+ }
}
/* function ShowMenuRecherche
@@ -563,27 +515,13 @@ function ShowMenuJrnUserImp($p_cn,$p_user,$p_dossier)
/* return : none */
function ShowMenuAdminGlobal()
{
- $item[0]=array("admin_repo.php?action=user_mgt","Gestion utilisateurs");
- $item[1]=array("admin_repo.php?action=dossier_mgt","Gestion Dossiers");
+ include_once("ac_common.php");
+ $item[0]=array("admin_repo.php?action=user_mgt","Utilisateurs");
+ $item[1]=array("admin_repo.php?action=dossier_mgt","Dossiers");
+ $item[2]=array("admin_repo.php?action=modele_mgt","Modèles");
$menu=ShowItem($item);
echo '';
}
-/* function ShowItem($p_array) */
-/* purpose : store the string which print */
-/* the content of p_array in a table */
-/* used to display the menu */
-/* parameter : array */
-/* return : string */
-function ShowItem($p_array)
-{
- $ret="";
- foreach ($p_array as $all=>$href){
- $ret.=''.$href[1].' ';
- echo_debug($ret);
- }
- $ret.="
";
- return $ret;
-}
?>
diff --git a/include/user_menu.php b/include/user_menu.php
new file mode 100644
index 000000000..ad51fe1ee
--- /dev/null
+++ b/include/user_menu.php
@@ -0,0 +1,293 @@
+
+
+/*
+ * This file is part of WCOMPTA.
+ *
+ * WCOMPTA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * WCOMPTA 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 WCOMPTA; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+// Auteur Dany De Bontridder ddebontridder@yahoo.fr
+/* $Revision$ */
+
+/* function u_ShowDossier
+ * Purpose : Show all the available folder
+ * for the users
+ * parm :
+ * - $p_user user login
+ * - $p_admin 1 if admin
+ * gen :
+ * - none
+ * return:
+ * - nothing
+ *
+ */
+function u_ShowDossier($p_user,$p_admin)
+{
+ $p_array=GetAvailableFolder($p_user,$p_admin);
+ $result="";
+ for ($i=0;$i";
+ $result.="$name ";
+ $result.=" ";
+ $result.=$desc;
+ $result.=" ";
+ $result.="Encoder ";
+ $result.=" ";
+ }
+ return $result;
+}
+/* function u_ShowDossier
+ * Purpose : Get all the available folders
+ * for the users
+ * parm :
+ * - $p_user user login
+ * - $p_admin 1 if admin
+ * gen :
+ * - none
+ * return:
+ * - array containing ac_dossier.dos_id
+ * ac_dossier.dos_name
+ * ac_dossier.dos_description
+ *
+ */
+function GetAvailableFolder($p_user,$p_admin)
+{
+ $filter="";
+ if ($p_admin==0) {
+ // show only available folders
+ // if user is not an admin
+ $filter="and use_login='$p_user' ";
+
+ }
+ $sql="select dos_id,dos_name,dos_description from ac_users
+ natural join jnt_use_dos
+ natural join ac_dossier
+ where use_active=1 ".$filter;
+ include_once("postgres.php");
+ $cn=DbConnect();
+ $Res=ExecSql($cn,$sql);
+ $max=pg_numRows($Res);
+ for ($i=0;$i<$max;$i++) {
+ $array[]=pg_fetch_array($Res,$i);
+ }
+ return $array;
+}
+/* function u_ShowMenu
+ * Purpose : Show The login menu
+ *
+ * parm :
+ * - $p_admin 1 if admin
+ * - $p_item item to add
+ * gen :
+ * - none
+ * return:
+ * - nothing
+ *
+ */
+ function u_ShowMenu($p_admin,$p_check = 1,$p_item="")
+{
+ /* $p_check == 1 si test sur Admin */
+ include_once("postgres.php");
+ echo '';
+ echo "
";
+ if ( $p_admin !=0 ) {
+ /* Administrator Menu */
+ echo 'Administrator Menu ';
+ }
+
+ if (strlen ( $p_item ) != 0 ) {
+ echo ''.$p_item.' ';
+ }
+
+ echo ' Préférence ';
+
+ echo "";
+ html_button_logout();
+ echo " ";
+ echo "
";
+ echo "
";
+}
+/* function u_ShowMenuCompta
+ * purpose : show the top menu for
+ * the user profile
+ * parm : p_dossier
+ *
+ * return: none
+ *
+ * gen : none
+ */
+function u_ShowMenuCompta($p_dossier)
+{
+ include_once("postgres.php");
+ $l_name=GetDossierName($p_dossier);
+ echo "
$l_name ";
+
+ $p_array=array(array("user_facture.php" ,"Vente"),
+ array("user_achat.php","Achat"),
+ array("user_banque.php","Banque"),
+ array("user_od.php","Op. Diverses"),
+ array("fiche.php?p_dossier=$p_dossier","Fiche"),
+ array("not_implemented.php","Avancé"),
+ array("dossier_prefs.php","Paramètre")
+ );
+
+ $result=ShowItem($p_array,'H');
+ echo "";
+
+
+
+
+}
+/* function ShowMenuComptaRight
+ * Purpose : Display menu on the Right
+ * (preference, logout and admin)
+ * parm :
+ * - $p_dossier the current dossier
+ * - $p_admin $g_UserProperty['use_admin'] 1 if admin
+ * - $p_more code
+ * gen :
+ * - none
+ * return:
+ * - string containing the html menu
+ *
+ */
+function u_ShowMenuComptaRight($p_dossier=0,$p_admin,$p_more="")
+{
+ include_once("ac_common.php");
+ $i=0;
+ if ( $p_admin != 0 && $p_dossier != 0) {
+ $p_array[$i++]=array("admin_repo.php","Admin");
+ }
+ $p_array[$i++]=array('login.php','Accueil');
+ $p_array[$i++]=array('user_pref.php','Preference');
+ $p_array[$i]=array('logout.php','logout');
+ $menu=ShowItem($p_array);
+ echo '';
+
+}
+/* function u_ShowMenuJrnUser($p_dossier,$p_user)
+ * Purpose : Show the Menu from the jrn encode
+ * page
+ *
+ * parm :
+ * - $p_dossier
+ * - $p_user
+ * - $p_type type of journal (VEN,ACH,BQE,ODS)
+ * - $p_jrn journal
+ * gen :
+ * - none
+ * return:
+ * - none
+ *
+ */
+
+function u_ShowMenuJrnUser($p_dossier,$p_user,$p_type,$p_jrn)
+{
+ include_once ("debug.php");
+ include_once("constant.php");
+ echo_debug("U_SHOWMENUJRNUSER PTYPE=$p_type");
+ echo '';
+
+}
+
+?>