/[phpcompta]/phpcompta/include/preference.php
ViewVC logotype

Diff of /phpcompta/include/preference.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by stanpinte, Sun Jul 31 10:37:17 2005 UTC revision 1.10 by sparkyx, Sun Oct 23 18:54:53 2005 UTC
# Line 111  function FormPeriode($p_cn,$l_default=0, Line 111  function FormPeriode($p_cn,$l_default=0,
111    $ret.="</SELECT>";    $ret.="</SELECT>";
112    return $ret;    return $ret;
113  }  }
 /* function SetUserPeriode  
  * Purpose : Set the selected periode in the user's preferences  
  *  
  * parm :  
  *      - $p_cn connexion  
  *      - $p_periode  
  *      - $p_user  
  * gen :  
  *      - none  
  * return:  
  *      - none  
  *  
  */  
 function SetUserPeriode($p_cn,$p_periode,$p_user) {  
   $sql="update user_pref set pref_periode=$p_periode where pref_user='$p_user'";  
   $Res=ExecSql($p_cn,$sql);  
 }  
 /* function GetUserPeriode  
  * Purpose : Get the default periode from the user's preferences  
  *  
  * parm :  
  *      - $p_cn connexion  
  *      - $p_user  
  * gen :  
  *      - none  
  * return:  
  *      - the default periode  
  *  
  */  
   
 function GetUserPeriode($p_cn,$p_user) {  
   $array=GetUserPreferences($p_cn,$p_user);  
   return $array['active_periode'];  
 }  
 /* function SetUserPreferences  
  * Purpose : Get the default user's preferences  
  *  
  * parm :  
  *      - $p_cn connexion  
  *      - $p_user  
  * gen :  
  *      - none  
  * return:  
  *      - none  
  *  
  */  
 function GetUserPreferences ($p_cn,$p_user)  
 {  
   // si preference n'existe pas, les créer  
   $sql="select pref_periode as active_periode from user_pref where pref_user='".$p_user."'";  
   $Res=ExecSql($p_cn,$sql);  
   if (pg_NumRows($Res) == 0 ) {  
     $sql=sprintf("insert into user_pref (pref_periode,pref_user) values  
                  ( %d , '%s')" ,  
                  1, $p_user);  
     $Res=ExecSql($p_cn,$sql);  
   
     $l_array=GetUserPreferences($p_cn,$p_user);  
   } else {  
     $l_array= pg_fetch_array($Res,0);  
   }  
   return $l_array;  
 }  
114  /* function GetPeriode  /* function GetPeriode
115   * Purpose :Give the start & end date of a periode   * Purpose :Give the start & end date of a periode
116   *   *

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26