altocompta/doc/developper/html/classcl__user.html
2006-07-12 21:24:48 +00:00

1046 lines
59 KiB
HTML
Raw Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>phpcompta: cl_user Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>cl_user Class Reference</h1><!-- doxytag: class="cl_user" -->Data &amp; function about connected users.
<a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a0">cl_user</a> ($p_cn, $p_id=-1)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a1">Check</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if user is active and exists in therepository Automatically redirect. <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a2">getJrn</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a3">Admin</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if an user is an admin. <a href="#a3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a4">AccessJrn</a> ($p_cn, $p_jrn_id)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a5">SetPeriode</a> ($p_periode)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the selected periode in the user's preferences. <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a6">GetPeriode</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the default periode from the user's preferences. <a href="#a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a7">GetPreferences</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the default user's preferences. <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a8">CheckAction</a> ($p_cn, $p_action_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if an user is allowed to do an action. <a href="#a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a9">GetGlobalPref</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the global preferences from user_global_pref in the account_repository db. <a href="#a9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a10">insert_default_global_pref</a> ($p_type=&quot;&quot;, $<a class="el" href="poste_8inc_8php.html#a2">p_value</a>=&quot;&quot;)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">insert default pref if no parameter are given insert all the existing parameter otherwise only the requested <a href="#a10"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a11">update_global_pref</a> ($p_type, $<a class="el" href="poste_8inc_8php.html#a2">p_value</a>=&quot;&quot;)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">update default pref if value is not given then use the default value <a href="#a11"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a12">getExercice</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the year of current Periode it is the parm_periode.p_exercice col. <a href="#a12"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#a13">AccessRequest</a> ($p_cn, $p_action)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if the user can access otherwise warn and exit. <a href="#a13"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#o0">$id</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#o1">$pass</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#o2">$db</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#o3">$admin</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcl__user.html#o4">$valid</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Data &amp; function about connected users.
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00033">33</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0"></a><!-- doxytag: member="cl_user::cl_user" ref="a0" args="($p_cn, $p_id=-1)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::cl_user </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em> = <code>-1</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00040">40</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="commercial_8php-source.html#l00035">$_SESSION</a>, <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="user__update_8php-source.html#l00032">$p_id</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00044">$row</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, <a class="el" href="postgres_8php-source.html#l00072">DbConnect()</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="user__common_8php-source.html#l00831">isValid()</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.<div class="fragment"><pre class="fragment"><a name="l00040"></a>00040 {
<a name="l00041"></a>00041 <span class="comment">// if p_id is not set then check the connected user</span>
<a name="l00042"></a>00042 <span class="keywordflow">if</span> ( $p_id == -1 ) {
<a name="l00043"></a>00043 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">" g_user = "</span>.$_SESSION['g_user']);
<a name="l00044"></a>00044 $this-&gt;<span class="keywordtype">id</span>=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['g_user'];
<a name="l00045"></a>00045 $this-&gt;pass=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['g_pass'];
<a name="l00046"></a>00046 $this-&gt;valid=(isset ($_SESSION['<a class="code" href="user__common_8php.html#a15">isValid</a>']))?1:0;
<a name="l00047"></a>00047 $this-&gt;db=$p_cn;
<a name="l00048"></a>00048 <span class="keywordflow">if</span> ( isset($_SESSION['g_theme']) )
<a name="l00049"></a>00049 $this-&gt;theme=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['g_theme'];
<a name="l00050"></a>00050
<a name="l00051"></a>00051 $this-&gt;admin=( isset($_SESSION['use_admin']) )?<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_admin']:0;
<a name="l00052"></a>00052
<a name="l00053"></a>00053 <span class="keywordflow">if</span> ( isset($_SESSION['use_name']) )
<a name="l00054"></a>00054 $this-&gt;<a class="code" href="action_8inc_8php.html#a18">name</a>=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_name'];
<a name="l00055"></a>00055 <span class="keywordflow">if</span> ( isset($_SESSION['use_first_name']) )
<a name="l00056"></a>00056 $this-&gt;first_name=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_first_name'];
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 <span class="keywordflow">else</span> <span class="comment">// if p_id is set get data of another user</span>
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 $this-&gt;<span class="keywordtype">id</span>=<a class="code" href="user__update_8php.html#a1">$p_id</a>;
<a name="l00061"></a>00061 $this-&gt;db=$p_cn;
<a name="l00062"></a>00062 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select use_first_name,</span>
<a name="l00063"></a>00063 <span class="stringliteral"> use_name,</span>
<a name="l00064"></a>00064 <span class="stringliteral"> use_login,</span>
<a name="l00065"></a>00065 <span class="stringliteral"> use_active,</span>
<a name="l00066"></a>00066 <span class="stringliteral"> use_admin,</span>
<a name="l00067"></a>00067 <span class="stringliteral"> from ac_users</span>
<a name="l00068"></a>00068 <span class="stringliteral"> where use_id=$p_id"</span>;
<a name="l00069"></a>00069 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=<a class="code" href="postgres_8php.html#a1">DbConnect</a>();
<a name="l00070"></a>00070 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=pg_exec($cn,$Sql);
<a name="l00071"></a>00071 <span class="keywordflow">if</span> (($Max=pg_NumRows($Res)) == 0 ) <span class="keywordflow">return</span> -1;
<a name="l00072"></a>00072 <a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>=pg_fetch_array($Res,0);
<a name="l00073"></a>00073 $this-&gt;first_name=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['use_first_name'];
<a name="l00074"></a>00074 $this-&gt;<a class="code" href="action_8inc_8php.html#a18">name</a>=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['use_name'];
<a name="l00075"></a>00075 $this-&gt;active=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['use_active'];
<a name="l00076"></a>00076 $this-&gt;login=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['use_login'];
<a name="l00077"></a>00077 $this-&gt;admin=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['use_admin'];
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079 }
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a4"></a><!-- doxytag: member="cl_user::AccessJrn" ref="a4" args="($p_cn, $p_jrn_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::AccessJrn </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_jrn_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00158">158</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="class__user_8php-source.html#l00143">Admin()</a>, and <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00158"></a>00158 {
<a name="l00159"></a>00159 $this-&gt;<a class="code" href="classcl__user.html#a3">Admin</a>();
<a name="l00160"></a>00160 <span class="keywordflow">if</span> ( $this-&gt;admin==1) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00161"></a>00161 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select uj_id </span>
<a name="l00162"></a>00162 <span class="stringliteral"> from user_sec_jrn </span>
<a name="l00163"></a>00163 <span class="stringliteral"> where</span>
<a name="l00164"></a>00164 <span class="stringliteral"> uj_priv in ('R','W')</span>
<a name="l00165"></a>00165 <span class="stringliteral"> and uj_jrn_id="</span>.$p_jrn_id.
<a name="l00166"></a>00166 <span class="stringliteral">" and uj_login = '"</span>.$this-&gt;id.<span class="stringliteral">"'"</span>);
<a name="l00167"></a>00167 <span class="keywordflow">if</span> ( $sql != 0 ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00168"></a>00168 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00169"></a>00169
<a name="l00170"></a>00170 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a13"></a><!-- doxytag: member="cl_user::AccessRequest" ref="a13" args="($p_cn, $p_action)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::AccessRequest </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_action</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if the user can access otherwise warn and exit.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>database connx </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$action_id</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>nothing the program exits automatically</dd></dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00358">358</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00036">exit</a>.<div class="fragment"><pre class="fragment"><a name="l00359"></a>00359 {
<a name="l00360"></a>00360 <span class="keywordflow">if</span> ( $this-&gt;CheckAction($p_cn,$p_action)==0 )
<a name="l00361"></a>00361 {
<a name="l00362"></a>00362 echo <span class="stringliteral">"&lt;script&gt;"</span>;
<a name="l00363"></a>00363 echo <span class="stringliteral">"alert ('Cette action ne vous est pas autoris<69>e. Contactez votre responsable');"</span>;
<a name="l00364"></a>00364 echo <span class="stringliteral">"&lt;/script&gt;"</span>;
<a name="l00365"></a>00365 <a class="code" href="balance_8php.html#a0">exit</a>(-1);
<a name="l00366"></a>00366 }
<a name="l00367"></a>00367 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a3"></a><!-- doxytag: member="cl_user::Admin" ref="a3" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::Admin </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if an user is an admin.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>1 for yes 0 for no</dd></dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00143">143</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="admin__repo_8php-source.html#l00059">$pass5</a>, <a class="el" href="pref_8inc_8php-source.html#l00059">$res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, and <a class="el" href="postgres_8php-source.html#l00072">DbConnect()</a>.
<p>
Referenced by <a class="el" href="class__user_8php-source.html#l00158">AccessJrn()</a>.<div class="fragment"><pre class="fragment"><a name="l00143"></a>00143 {
<a name="l00144"></a>00144 <a class="code" href="pref_8inc_8php.html#a1">$res</a>=0;
<a name="l00145"></a>00145
<a name="l00146"></a>00146 <span class="keywordflow">if</span> ( $this-&gt;id != 'phpcompta') {
<a name="l00147"></a>00147 <a class="code" href="admin__repo_8php.html#a3">$pass5</a>=md5($this-&gt;pass);
<a name="l00148"></a>00148 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select use_id from ac_users where use_login='$this-&gt;id'</span>
<a name="l00149"></a>00149 <span class="stringliteral"> and use_active=1 and use_admin=1 and use_pass='$pass5'"</span>;
<a name="l00150"></a>00150
<a name="l00151"></a>00151 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=<a class="code" href="postgres_8php.html#a1">DbConnect</a>();
<a name="l00152"></a>00152
<a name="l00153"></a>00153 $this-&gt;admin=<a class="code" href="postgres_8php.html#a10">CountSql</a>($cn,$sql);
<a name="l00154"></a>00154 } <span class="keywordflow">else</span> $this-&gt;admin=1;
<a name="l00155"></a>00155
<a name="l00156"></a>00156 <span class="keywordflow">return</span> $this-&gt;admin;
<a name="l00157"></a>00157 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a1"></a><!-- doxytag: member="cl_user::Check" ref="a1" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::Check </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if user is active and exists in therepository Automatically redirect.
<p>
++
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00085">85</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="commercial_8php-source.html#l00035">$_SESSION</a>, <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="admin__repo_8php-source.html#l00059">$pass5</a>, <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="pref_8inc_8php-source.html#l00059">$res</a>, <a class="el" href="impress__bilan_8php-source.html#l00032">$ret</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00072">DbConnect()</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="balance_8php-source.html#l00036">exit</a>, <a class="el" href="class__user_8php-source.html#l00256">GetGlobalPref()</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.<div class="fragment"><pre class="fragment"><a name="l00086"></a>00086 {
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <a class="code" href="pref_8inc_8php.html#a1">$res</a>=0;
<a name="l00089"></a>00089 <a class="code" href="admin__repo_8php.html#a3">$pass5</a>=md5($this-&gt;pass);
<a name="l00090"></a>00090 <span class="keywordflow">if</span> ( $this-&gt;valid == 1 ) { <span class="keywordflow">return</span>; }
<a name="l00091"></a>00091 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=<a class="code" href="postgres_8php.html#a1">DbConnect</a>();
<a name="l00092"></a>00092 <span class="keywordflow">if</span> ( $cn != <span class="keyword">false</span> ) {
<a name="l00093"></a>00093 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select ac_users.use_login,ac_users.use_active, ac_users.use_pass,</span>
<a name="l00094"></a>00094 <span class="stringliteral"> use_admin,use_first_name,use_name</span>
<a name="l00095"></a>00095 <span class="stringliteral"> from ac_users </span>
<a name="l00096"></a>00096 <span class="stringliteral"> where ac_users.use_login='$this-&gt;id' </span>
<a name="l00097"></a>00097 <span class="stringliteral"> and ac_users.use_active=1</span>
<a name="l00098"></a>00098 <span class="stringliteral"> and ac_users.use_pass='$pass5'"</span>;
<a name="l00099"></a>00099 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">"Sql = $sql"</span>);
<a name="l00100"></a>00100 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=pg_exec($cn,$sql);
<a name="l00101"></a>00101 <a class="code" href="pref_8inc_8php.html#a1">$res</a>=pg_NumRows($ret);
<a name="l00102"></a>00102 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">"Number of found rows : $res"</span>);
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( $res &gt;0 ) {
<a name="l00104"></a>00104 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=pg_fetch_array($ret,0);
<a name="l00105"></a>00105 <a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_admin']=<a class="code" href="bank_8inc_8php.html#a29">$r</a>['use_admin'];
<a name="l00106"></a>00106 <a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_name']=<a class="code" href="bank_8inc_8php.html#a29">$r</a>['use_name'];
<a name="l00107"></a>00107 <a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_first_name']=<a class="code" href="bank_8inc_8php.html#a29">$r</a>['use_first_name'];
<a name="l00108"></a>00108
<a name="l00109"></a>00109 $this-&gt;admin=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_admin'];
<a name="l00110"></a>00110 $this-&gt;<a class="code" href="action_8inc_8php.html#a18">name</a>=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_name'];
<a name="l00111"></a>00111 $this-&gt;first_name=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['use_first_name'];
<a name="l00112"></a>00112 $this-&gt;<a class="code" href="classcl__user.html#a9">GetGlobalPref</a>();
<a name="l00113"></a>00113
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116
<a name="l00117"></a>00117 <span class="keywordflow">if</span> ( $res == 0 ) {
<a name="l00118"></a>00118 echo '&lt;META HTTP-EQUIV=<span class="stringliteral">"REFRESH"</span> content=<span class="stringliteral">"4;url=index.html"</span>&gt;';
<a name="l00119"></a>00119 echo <span class="stringliteral">"&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;"</span>;
<a name="l00120"></a>00120 echo <span class="stringliteral">"&lt;P ALIGN=center&gt;&lt;BLINK&gt;</span>
<a name="l00121"></a>00121 <span class="stringliteral"> &lt;FONT size=+12 COLOR=RED&gt;</span>
<a name="l00122"></a>00122 <span class="stringliteral"> Invalid user &lt;BR&gt; or&lt;BR&gt; Invalid password </span>
<a name="l00123"></a>00123 <span class="stringliteral"> &lt;/FONT&gt;&lt;/BLINK&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;"</span>;
<a name="l00124"></a>00124 session_unset();
<a name="l00125"></a>00125
<a name="l00126"></a>00126 <a class="code" href="balance_8php.html#a0">exit</a> -1;
<a name="l00127"></a>00127 } <span class="keywordflow">else</span> {
<a name="l00128"></a>00128 $this-&gt;valid=1;
<a name="l00129"></a>00129 }
<a name="l00130"></a>00130
<a name="l00131"></a>00131 <span class="keywordflow">return</span> <a class="code" href="impress__bilan_8php.html#a0">$ret</a>;
<a name="l00132"></a>00132
<a name="l00133"></a>00133 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a8"></a><!-- doxytag: member="cl_user::CheckAction" ref="a8" args="($p_cn, $p_action_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::CheckAction </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_action_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if an user is allowed to do an action.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>p_cn</em>&nbsp;</td><td>Database connx </td></tr>
<tr><td valign="top"></td><td valign="top"><em>p_action_id</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>0 no priv</li></ul>
</dd></dl>
<ul>
<li>1 priv granted</li></ul>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00236">236</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00237"></a>00237 {
<a name="l00238"></a>00238
<a name="l00239"></a>00239 <span class="keywordflow">if</span> ( $this-&gt;admin==1 ) <span class="keywordflow">return</span> 1;
<a name="l00240"></a>00240
<a name="l00241"></a>00241 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select * from user_sec_act where ua_login='"</span>.$this-&gt;id.<span class="stringliteral">"' and ua_act_id=$p_action_id"</span>);
<a name="l00242"></a>00242 $Count=pg_NumRows($Res);
<a name="l00243"></a>00243 <span class="keywordflow">if</span> ( $Count == 0 ) <span class="keywordflow">return</span> 0;
<a name="l00244"></a>00244 <span class="keywordflow">if</span> ( $Count == 1 ) <span class="keywordflow">return</span> 1;
<a name="l00245"></a>00245 echo <span class="stringliteral">"&lt;H2 class=\"error\"&gt; Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id &lt;/H2&gt;"</span>;
<a name="l00246"></a>00246 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a12"></a><!-- doxytag: member="cl_user::getExercice" ref="a12" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::getExercice </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Return the year of current Periode it is the parm_periode.p_exercice col.
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00345">345</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="line__update_8php-source.html#l00070">$Ret</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00346"></a>00346 {
<a name="l00347"></a>00347 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select p_exercice from parm_periode where p_id="</span>.$this-&gt;GetPeriode();
<a name="l00348"></a>00348 <a class="code" href="line__update_8php.html#a8">$Ret</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00349"></a>00349 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=pg_fetch_array($Ret,0);
<a name="l00350"></a>00350 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>['p_exercice'];
<a name="l00351"></a>00351 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a9"></a><!-- doxytag: member="cl_user::GetGlobalPref" ref="a9" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::GetGlobalPref </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get the global preferences from user_global_pref in the account_repository db.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>set</em>&nbsp;</td><td>g_variable</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00256">256</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="commercial_8php-source.html#l00035">$_SESSION</a>, <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00028">$line</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00044">$row</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="class__user_8php-source.html#l00298">insert_default_global_pref()</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.
<p>
Referenced by <a class="el" href="class__user_8php-source.html#l00085">Check()</a>.<div class="fragment"><pre class="fragment"><a name="l00257"></a>00257 {
<a name="l00258"></a>00258 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">"function GetGlobalPref"</span>);
<a name="l00259"></a>00259 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=Dbconnect();
<a name="l00260"></a>00260 <span class="comment">// Load everything in an array</span>
<a name="l00261"></a>00261 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a> ($cn,<span class="stringliteral">"select parameter_type,parameter_value from </span>
<a name="l00262"></a>00262 <span class="stringliteral"> user_global_pref</span>
<a name="l00263"></a>00263 <span class="stringliteral"> where user_id='"</span>.$this-&gt;id.<span class="stringliteral">"'"</span>);
<a name="l00264"></a>00264 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00265"></a>00265 <span class="keywordflow">if</span> ( $Max == 0 ) {
<a name="l00266"></a>00266 $this-&gt;<a class="code" href="classcl__user.html#a10">insert_default_global_pref</a>();
<a name="l00267"></a>00267 $this-&gt;<a class="code" href="classcl__user.html#a9">GetGlobalPref</a>();
<a name="l00268"></a>00268 <span class="keywordflow">return</span>;
<a name="l00269"></a>00269 }
<a name="l00270"></a>00270 <span class="comment">// Load value into array</span>
<a name="l00271"></a>00271 <a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>=array();
<a name="l00272"></a>00272 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00273"></a>00273 <a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>=pg_fetch_array($Res,$i);
<a name="l00274"></a>00274 $type=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['parameter_type'];
<a name="l00275"></a>00275 <a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>[$type]=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['parameter_value'];;
<a name="l00276"></a>00276 }
<a name="l00277"></a>00277 <span class="comment">// save array into g_ variable</span>
<a name="l00278"></a>00278 $array_pref=array ('g_theme'=&gt;'THEME<span class="charliteral">','</span>g_pagesize'=&gt;'PAGESIZE');
<a name="l00279"></a>00279 foreach ($array_pref as $<a class="code" href="action_8inc_8php.html#a18">name</a>=&gt;$parameter ) {
<a name="l00280"></a>00280 <span class="keywordflow">if</span> ( ! isset ($line[$parameter]) ) {
<a name="l00281"></a>00281 <a class="code" href="debug_8php.html#a0">echo_debug</a>(<span class="stringliteral">"Missing pref : "</span>.$parameter);
<a name="l00282"></a>00282 $this-&gt;<a class="code" href="classcl__user.html#a10">insert_default_global_pref</a>($parameter);
<a name="l00283"></a>00283 $this-&gt;<a class="code" href="classcl__user.html#a9">GetGlobalPref</a>();
<a name="l00284"></a>00284 <span class="keywordflow">return</span>;
<a name="l00285"></a>00285 }
<a name="l00286"></a>00286 <a class="code" href="commercial_8php.html#a0">$_SESSION</a>[$name]=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>[$parameter];
<a name="l00287"></a>00287 }
<a name="l00288"></a>00288 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a2"></a><!-- doxytag: member="cl_user::getJrn" ref="a2" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::getJrn </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00135">135</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.<div class="fragment"><pre class="fragment"><a name="l00135"></a>00135 {
<a name="l00136"></a>00136 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member="cl_user::GetPeriode" ref="a6" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::GetPeriode </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get the default periode from the user's preferences.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>connexion </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_user</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>the default periode</dd></dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00192">192</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, and <a class="el" href="class__user_8php-source.html#l00204">GetPreferences()</a>.<div class="fragment"><pre class="fragment"><a name="l00192"></a>00192 {
<a name="l00193"></a>00193 <a class="code" href="recherche_8php.html#a4">$array</a>=$this-&gt;<a class="code" href="classcl__user.html#a7">GetPreferences</a>();
<a name="l00194"></a>00194 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>['<a class="code" href="constant_8php.html#a13">PERIODE</a>'];
<a name="l00195"></a>00195 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a7"></a><!-- doxytag: member="cl_user::GetPreferences" ref="a7" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::GetPreferences </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get the default user's preferences.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>connexion </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_user</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>array of (parameter_type =&gt; parameter_value)</dd></dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00204">204</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00044">$row</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="class__user_8php-source.html#l00192">GetPeriode()</a>.<div class="fragment"><pre class="fragment"><a name="l00205"></a>00205 {
<a name="l00206"></a>00206 <span class="comment">// si preference n'existe pas, les cr<63>er</span>
<a name="l00207"></a>00207 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select parameter_type,parameter_value from user_local_pref where user_id='"</span>.$this-&gt;id.<span class="stringliteral">"'"</span>;
<a name="l00208"></a>00208 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00209"></a>00209 <span class="keywordflow">if</span> (pg_NumRows($Res) == 0 ) {
<a name="l00210"></a>00210 <span class="comment">// default periode</span>
<a name="l00211"></a>00211 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into user_local_pref (user_id,parameter_value,parameter_type) </span>
<a name="l00212"></a>00212 <span class="stringliteral"> select '%s',min(p_id),'PERIODE' from parm_periode where p_closed=false"</span>,
<a name="l00213"></a>00213 $this-&gt;id);
<a name="l00214"></a>00214 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00215"></a>00215
<a name="l00216"></a>00216 $l_array=$this-&gt;<a class="code" href="classcl__user.html#a7">GetPreferences</a>();
<a name="l00217"></a>00217 } <span class="keywordflow">else</span> {
<a name="l00218"></a>00218 <span class="keywordflow">for</span> ( $i =0;$i &lt; pg_NumRows($Res);$i++) {
<a name="l00219"></a>00219 <a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>= pg_fetch_array($Res,0);
<a name="l00220"></a>00220 $type=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['parameter_type'];
<a name="l00221"></a>00221 $l_array[$type]=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['parameter_value'];
<a name="l00222"></a>00222 }
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 <span class="keywordflow">return</span> $l_array;
<a name="l00225"></a>00225 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a10"></a><!-- doxytag: member="cl_user::insert_default_global_pref" ref="a10" args="($p_type=&quot;&quot;, $p_value=&quot;&quot;)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::insert_default_global_pref </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em> = <code>&quot;&quot;</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_value</em> = <code>&quot;&quot;</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
insert default pref if no parameter are given insert all the existing parameter otherwise only the requested
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>parameter's</em>&nbsp;</td><td>type or nothing</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00298">298</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="action_8inc_8php-source.html#l00240">name</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.
<p>
Referenced by <a class="el" href="class__user_8php-source.html#l00256">GetGlobalPref()</a>.<div class="fragment"><pre class="fragment"><a name="l00298"></a>00298 {
<a name="l00299"></a>00299 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">"function insert_default_global_pref"</span>);
<a name="l00300"></a>00300 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_user.php',__LINE__,<span class="stringliteral">"parameter p_type $p_type p_value $p_value"</span>);
<a name="l00301"></a>00301
<a name="l00302"></a>00302 $default_parameter= array(<span class="stringliteral">"THEME"</span>=&gt;<span class="stringliteral">"Light"</span>,
<a name="l00303"></a>00303 <span class="stringliteral">"PAGESIZE"</span>=&gt;<span class="stringliteral">"50"</span>);
<a name="l00304"></a>00304 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=Dbconnect();
<a name="l00305"></a>00305 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"insert into user_global_pref(user_id,parameter_type,parameter_value) </span>
<a name="l00306"></a>00306 <span class="stringliteral"> values ('%s','%s','%s')"</span>;
<a name="l00307"></a>00307 <span class="keywordflow">if</span> ( $p_type == <span class="stringliteral">""</span> ) {
<a name="l00308"></a>00308 foreach ( $default_parameter as $<a class="code" href="action_8inc_8php.html#a18">name</a>=&gt;$<a class="code" href="action_8inc_8php.html#a19">value</a>) {
<a name="l00309"></a>00309 $Insert=sprintf($Sql,$this-&gt;id,$<a class="code" href="action_8inc_8php.html#a18">name</a>,$<a class="code" href="action_8inc_8php.html#a19">value</a>);
<a name="l00310"></a>00310 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($cn,$Insert);
<a name="l00311"></a>00311 }
<a name="l00312"></a>00312 }
<a name="l00313"></a>00313 <span class="keywordflow">else</span> {
<a name="l00314"></a>00314 $value=($p_value==<span class="stringliteral">""</span>)?$default_parameter[$p_type]:$p_value;
<a name="l00315"></a>00315 $Insert=sprintf($Sql,$this-&gt;id,$p_type,$<a class="code" href="action_8inc_8php.html#a19">value</a>);
<a name="l00316"></a>00316 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($cn,$Insert);
<a name="l00317"></a>00317 }
<a name="l00318"></a>00318
<a name="l00319"></a>00319
<a name="l00320"></a>00320 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a5"></a><!-- doxytag: member="cl_user::SetPeriode" ref="a5" args="($p_periode)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::SetPeriode </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_periode</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Set the selected periode in the user's preferences.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_periode</em>&nbsp;</td><td>periode </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-</em>&nbsp;</td><td>$p_user</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00178">178</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00178"></a>00178 {
<a name="l00179"></a>00179 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"update user_local_pref set parameter_value='$p_periode' where user_id='$this-&gt;id' and parameter_type='PERIODE'"</span>;
<a name="l00180"></a>00180 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00181"></a>00181 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a11"></a><!-- doxytag: member="cl_user::update_global_pref" ref="a11" args="($p_type, $p_value=&quot;&quot;)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::update_global_pref </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_value</em> = <code>&quot;&quot;</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
update default pref if value is not given then use the default value
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>parameter's</em>&nbsp;</td><td>type </td></tr>
<tr><td valign="top"></td><td valign="top"><em>parameter's</em>&nbsp;</td><td>value value of the type</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00330">330</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>.
<p>
References <a class="el" href="impress__fiche_8php-source.html#l00026">$cn</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.<div class="fragment"><pre class="fragment"><a name="l00330"></a>00330 {
<a name="l00331"></a>00331 $default_parameter= array(<span class="stringliteral">"THEME"</span>=&gt;<span class="stringliteral">"Light"</span>,
<a name="l00332"></a>00332 <span class="stringliteral">"PAGESIZE"</span>=&gt;<span class="stringliteral">"50"</span>);
<a name="l00333"></a>00333 <a class="code" href="impress__fiche_8php.html#a0">$cn</a>=Dbconnect();
<a name="l00334"></a>00334 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"update user_global_pref set parameter_value='%s' </span>
<a name="l00335"></a>00335 <span class="stringliteral"> where parameter_type='%s' and </span>
<a name="l00336"></a>00336 <span class="stringliteral"> user_id='%s'"</span>;
<a name="l00337"></a>00337 $value=($p_value==<span class="stringliteral">""</span>)?$default_parameter[$p_type]:$p_value;
<a name="l00338"></a>00338 $Update=sprintf($Sql,$<a class="code" href="action_8inc_8php.html#a19">value</a>,$p_type,$this-&gt;id);
<a name="l00339"></a>00339 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($cn,$Update);
<a name="l00340"></a>00340
<a name="l00341"></a>00341 }<span class="comment">//end function</span>
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="o3"></a><!-- doxytag: member="cl_user::$admin" ref="o3" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::$admin </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00037">37</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o2"></a><!-- doxytag: member="cl_user::$db" ref="o2" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::$db </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00036">36</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o0"></a><!-- doxytag: member="cl_user::$id" ref="o0" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::$<a class="el" href="impress__fiche_8php.html#a6">id</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00034">34</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o1"></a><!-- doxytag: member="cl_user::$pass" ref="o1" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::$pass </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00035">35</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o4"></a><!-- doxytag: member="cl_user::$valid" ref="o4" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">cl_user::$valid </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__user_8php-source.html#l00038">38</a> of file <a class="el" href="class__user_8php-source.html">class_user.php</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="class__user_8php-source.html">class_user.php</a></ul>
</BODY>
</HTML>