<?PHP
// Contacts list
//
// Version: $Revision: 1.2 $
// Date: $Date: 2007/09/17 03:16:40 $
//
// Copyright (c) 2006 - 2007 Benjamin Oshrin
// License restrictions apply, see LICENSE for details.
$auth_required = 1;
include "../lib/mrsbs.inc";
$pgtitle = $tx['ct.cts.edit'];
$pgtype = "admin";
if(!authorize("admin", "contacts"))
mexit($tx['op.err.perm'], 1);
?>
<HTML>
<HEAD>
<TITLE><?PHP print $pgtitle;?></TITLE>
</HEAD>
<BODY>
<TABLE CLASS="main">
<?PHP include "../lib/titlebar.php";?>
<TR>
<TD CLASS="main">
<TABLE CLASS="form">
<TR>
<TD CLASS="infofield">
<P>
<?PHP print $tx['ct.cts.select']; ?>
</P>
<?PHP
$cts = get_contacts();
if($cts)
{
// Build list of contacts to be rendered
$l = array();
$l['column']['count'] = 3;
$l['column'][0]['title'] = $tx['ct.ctid'];
$l['column'][0]['sortable'] = 'A';
$l['column'][1]['title'] = $tx['ct.name'];
$l['column'][1]['sortable'] = 'A';
$l['column'][2]['title'] = $tx['ct.mail'];
$l['column'][2]['sortable'] = 'A';
$l['row']['count'] = $cts['count'];
for($i = 0;$i < $cts['count'];$i++)
{
$l['row'][$i][0]['value'] = $cts[$i]['contactid'];
$l['row'][$i][0]['sortval'] = $cts[$i]['contactid'];
$l['row'][$i][1]['value'] = '<A HREF="contact.php?contactid=' .
$cts[$i]['contactid'] . '">' . render_name("compact",
$cts[$i]['givenname'],
$cts[$i]['sn'],
$cts[$i]['mail']) .
'</A>';
$l['row'][$i][1]['sortval'] = $cts[$i]['sn'];
$l['row'][$i][2]['value'] = '<A HREF="contact.php?contactid=' .
$cts[$i]['contactid'] . '">' . $cts[$i]['mail'] . '</A>';
$l['row'][$i][2]['sortval'] = $cts[$i]['mail'];
}
// Prep standard values to render the list
$sortkey = 1;
$sortorder = 'asc';
$showpage = 1;
$perpage = -1;
if(isset($rvar_sortkey) && $rvar_sortkey > -1)
{
$sortkey = $rvar_sortkey;
$sortorder = $rvar_sortorder;
}
if(isset($rvar_showpage) && $rvar_showpage > -1)
$showpage = $rvar_showpage;
if(isset($rvar_perpage) && $rvar_perpage > -1)
$perpage = $rvar_perpage;
render_list($l, $tx['ct.cts.none'], $sortkey, $sortorder, $showpage,
$perpage);
}
?>
<P>
<A HREF="contact.php?contactid=new">[+]
<?PHP print $tx['ct.ct.new'];?></A>
</P>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>