bug 1138: added function get_user_agreement
authorINOPIAE <inopiae@cacert.org>
Sun, 8 Dec 2013 13:49:56 +0000 (14:49 +0100)
committerINOPIAE <inopiae@cacert.org>
Sun, 8 Dec 2013 13:49:56 +0000 (14:49 +0100)
includes/notary.inc.php
pages/account/59.php

index 54c3f60..da70820 100644 (file)
                return $rec;
        }
 
+function get_user_agreement($memid){
+       $query="(SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 1 as `active` FROM user_agreements u WHERE u.`document` = 'CCA' AND (u.`memid`=".$memid." ) order by u.`date` )
+                       union
+                       (SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 0 as `active` FROM user_agreements u WHERE u.`document` = 'CCA' AND ( u.`secmemid`=".$memid.") order by u.`date`)
+                       union
+                       (SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 0 as `active` FROM user_agreements u WHERE u.`document` != 'CCA' AND ( u.`memid`=".$memid.") order by u.u.`document`, u.`date`) " ;
+       $res = mysql_query($query);
+
+       return mysql_query($query);
+}
+
        function delete_user_agreement($memid, $type="CCA"){
        //deletes all entries to an user for the given type of user agreements
                mysql_query("delete from `user_agreements` where `memid`='".$memid."'");
@@ -1215,9 +1226,9 @@ function get_domains($userid, $deleted=0){
 function output_log_email_header(){
        ?>
        <tr
-               <td>_("Email, primary bold")</td>
-               <td>_("Created")</td>
-               <td>_("Deleted")</td>
+               <td><?= _("Email, primary bold") ?></td>
+               <td><?= _("Created") ?></td>
+               <td><?= _("Deleted") ?></td>
        </tr>
 
        <?
@@ -1231,20 +1242,21 @@ function output_log_email($row,$primary){
        if ($primary==$row['email']) {
                $bold= 'bold ';
        }
-
+       ?>
        <tr>
-       <td class="<? $bold . $italic ?>">$row['email']</td>
-       <td class="<? $bold . $italic ?>">$row['created']</td>
-       <td class="<? $bold . $italic ?>">$row['deleted']</td>
+               <td class="<? $bold . $italic ?>"><?=$row['email']?></td>
+               <td class="<? $bold . $italic ?>"><?=$row['created']?></td>
+               <td class="<? $bold . $italic ?>"><?=$row['deleted']?></td>
        </tr>
+       <?
 }
 
 function output_log_domains_header(){
        ?>
        <tr
-               <td>_("Domain")</td>
-               <td>_("Created")</td>
-               <td>_("Deleted")</td>
+               <td><?= _("Domain") ?></td>
+               <td><?= _("Created") ?></td>
+               <td><?= _("Deleted") ?></td>
        </tr>
 
        <?
@@ -1254,9 +1266,32 @@ function output_log_domains($row){
        if (0==$row['deleted']) {
                $italic='italic ';
        }
+       ?>
+       <tr>
+               <td class="<? $italic ?>"><?=$row['domain']?></td>
+               <td class="<? $italic ?>"><?=$row['created']?></td>
+               <td class="<? $italic ?>"><?=$row['deleted']?></td>
+       </tr>
+       <?
+}
+
+function output_log_agreement_header(){
+       ?>
+       <tr
+               <td><?= _("Agreement") ?></td>
+               <td><?= _("Date") ?></td>
+               <td><?= _("Method") ?></td>
+               <td><?= _("Comment") ?></td>
+       </tr>
+       <?
+}
+function output_log_agreement($row){
+       ?>
        <tr>
-       <td class="<? $italic ?>">$row['domain']</td>
-       <td class="<? $italic ?>">$row['created']</td>
-       <td class="<? $italic ?>">$row['deleted']</td>
+               <td class="<? $italic ?>"><?=$row['document']?></td>
+               <td class="<? $italic ?>"><?=$row['date']?></td>
+               <td class="<? $italic ?>"><?=$row['method']?></td>
+               <td class="<? $italic ?>"><?= ($row['active']==0)? _('No'):_('Yes')?></td>
        </tr>
+       <?
 }
\ No newline at end of file
index e794e97..d499d35 100644 (file)
@@ -117,18 +117,21 @@ while($drow = mysql_fetch_assoc($dres))
 <br/>
 <?
 $dres = get_domains($userid,'',1);
-if(mysql_num_rows($dres) > 0) {
 ?>
 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
     <td colspan="3" class="title"><?=_('Domains')?></td>
   </tr>
 <?
-output_log_domain_header();
-while($drow = mysql_fetch_assoc($dres))
-{
-       output_log_domain($drow,$email);
-} ?>
+if(mysql_num_rows($dres) > 0) {
+  output_log_domain_header();
+  while($drow = mysql_fetch_assoc($dres))
+  {
+    output_log_domain($drow,$email);
+  }ELSE{?>
+    <td colspan="3" ><?=_('no entry avialable')?></td>
+  <?}
+}?>
 </table>
 <br/>
 
@@ -136,9 +139,28 @@ while($drow = mysql_fetch_assoc($dres))
   <tr>
     <td colspan="<? $colspandefault ?>" class="title"><?=_('CATS')?></td>
   </tr>
+
+<?
+$dres = get_user_agreement($userid,'',1);
+?>
+<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
   <tr>
-    <td colspan="<? $colspandefault ?>" class="title"><?=_('CCA')?></td>
+    <td colspan="4" class="title"><?=_('User agreements')?></td>
   </tr>
+<?
+if(mysql_num_rows($dres) > 0) {
+  output_log_agreement_header();
+  while($drow = mysql_fetch_assoc($dres))
+  {
+    output_log_agreement($drow);
+  }ELSE{
+    ?><td colspan="4" ><?=_('no entry avialable')?></td><?
+  }
+}?>
+</table>
+<br/>
+
+<table>
   <tr>
     <td colspan="<? $colspandefault ?>" class="title"><?=_('Support Engineer actions')?></td>
   </tr>