/*
* This file is part of PhpCompta.
*
* PhpCompta 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.
*
* PhpCompta 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 PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author 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);
if ( $p_array == 0 ) return " * Aucun dossier *";
$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);
if ( $max == 0 ) return 0;
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_jrn.php?JRN_TYPE=VEN" ,"Vente"),
array("user_jrn.php?JRN_TYPE=ACH","Achat"),
array("user_jrn.php?JRN_TYPE=FIN","Banque"),
array("user_jrn.php?JRN_TYPE=OD","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 '';
}
/* function u_ShowMenuJrn
* Purpose : Show the menu of the jrn depending of its type
*
* parm :
* - p_cn database connection
* - p_dossier
* - p_UserProperty
* - p_jrn_type
* - p_jrn
* gen :
* - none
* return:
* - string containing the menu
*/
function u_ShowMenuJrn($p_cn,$p_jrn_type)
{
$Res=ExecSql($p_cn,"select ja_name,ja_url,ja_action from jrn_action where ja_jrn_type='$p_jrn_type'
order by ja_id");
$num=pg_NumRows($Res);
if ($num==0) return "";
// Retrieve in the database the menu
$ret="";
for ($i=0;$i<$num;$i++) {
$action=pg_fetch_array($Res,$i);
$ret.=sprintf('| %s |
',
$action['ja_url'],$action['ja_action'],$action['ja_name']);
}
$ret.='
';
return $ret;
}
?>