mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
optional column in addressbook list to show the last and next date for a contact, eg. last and next visit
This commit is contained in:
parent
4a77931db0
commit
2676cb4a5c
@ -831,13 +831,16 @@ class uicontacts extends bocontacts
|
||||
// do we need to read the custom fields, depends on the column is enabled and customfields exist
|
||||
$columselection = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows'];
|
||||
if ($columselection) $columselection = explode(',',$columselection);
|
||||
if (!$id_only && (!$columselection || in_array('customfields',$columselection)) && $rows && $this->customfields)
|
||||
if (!$id_only && $rows && (
|
||||
($show_custom_fields = (!$columselection || in_array('customfields',$columselection)) && $this->customfields) ||
|
||||
($show_calendar = !$columselection || in_array('calendar',$columselection))))
|
||||
{
|
||||
foreach((array) $rows as $n => $val)
|
||||
{
|
||||
if ($val && (int)$val['id']) $ids[] = $val['id'];
|
||||
}
|
||||
if ($ids) $customfields = $this->read_customfields($ids);
|
||||
if ($ids && $show_custom_fields) $customfields = $this->read_customfields($ids);
|
||||
if ($ids && $show_calendar) $calendar = $this->read_calendar($ids);
|
||||
}
|
||||
}
|
||||
if (!$rows) $rows = array();
|
||||
@ -931,6 +934,13 @@ class uicontacts extends bocontacts
|
||||
$row['#'.$name] = $customfields[$row['id']][$name];
|
||||
}
|
||||
}
|
||||
if (isset($calendar[$row['id']]))
|
||||
{
|
||||
foreach($calendar[$row['id']] as $name => $data)
|
||||
{
|
||||
$row[$name] = $data;
|
||||
}
|
||||
}
|
||||
if ($this->prefs['home_column'] != 'never' && !$homeaddress)
|
||||
{
|
||||
foreach(array('adr_two_countryname','adr_two_locality','adr_two_postalcode','adr_two_street','adr_two_street2') as $name)
|
||||
@ -1922,6 +1932,73 @@ $readonlys['button[vcard]'] = true;
|
||||
}
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the next and last event of given contacts
|
||||
*
|
||||
* @param array $ids contact_id's
|
||||
* @return array
|
||||
*/
|
||||
function read_calendar($ids)
|
||||
{
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['calendar']) return null;
|
||||
|
||||
$uids = array();
|
||||
foreach($ids as $id)
|
||||
{
|
||||
$uids[] = 'c'.$id;
|
||||
}
|
||||
include_once(EGW_INCLUDE_ROOT.'/calendar/inc/class.bocal.inc.php');
|
||||
$bocal = new bocal;
|
||||
$events = $bocal->search(array(
|
||||
'users' => $uids,
|
||||
'enum_recuring' => true,
|
||||
));
|
||||
if (!$events) return array();
|
||||
|
||||
//_debug_array($events);
|
||||
$calendars = array();
|
||||
foreach($events as $event)
|
||||
{
|
||||
foreach($event['participants'] as $uid => $status)
|
||||
{
|
||||
if ($uid{0} != 'c' || ($status == 'R' && !$GLOBALS['egw_info']['user']['preferences']['calendar']['show_rejected']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$id = (int)substr($uid,1);
|
||||
|
||||
if ($event['start'] < $this->now_su) // past event --> check for last event
|
||||
{
|
||||
if (!isset($calendars[$id]['last_event']) || $event['start'] > $calendars[$id]['last_event'])
|
||||
{
|
||||
$calendars[$id]['last_event'] = $event['start'];
|
||||
$calendars[$id]['last_link'] = array(
|
||||
'id' => $event['id'],
|
||||
'app' => 'calendar',
|
||||
'title' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],$event['start']),
|
||||
'extra_title' => $bocal->link_title($event),
|
||||
);
|
||||
}
|
||||
}
|
||||
else // future event --> check for next event
|
||||
{
|
||||
if (!isset($calendars[$id]['next_event']) || $event['start'] < $calendars[$id]['next_event'])
|
||||
{
|
||||
$calendars[$id]['next_event'] = $event['start'];
|
||||
$calendars[$id]['next_link'] = array(
|
||||
'id' => $event['id'],
|
||||
'app' => 'calendar',
|
||||
'title' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],$event['start']),
|
||||
'extra_title' => $bocal->link_title($event),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//_debug_array($calendars);
|
||||
return $calendars;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('array_intersect_key')) // php5.1 function
|
||||
|
File diff suppressed because one or more lines are too long
@ -65,6 +65,7 @@ calendar uri addressbook de Kalender URI
|
||||
can be changed via setup >> configuration admin de Kann über Setup >> Konfiguration geändert werden
|
||||
car phone addressbook de Autotelefon
|
||||
categories, notes, ... addressbook de Kategorien, Notizen, ...
|
||||
category tree admin de Kategoriebaum
|
||||
cell phone addressbook de Mobiltelefon
|
||||
change all organisation members addressbook de Alle Mitglieder der Organisation ändern
|
||||
charset for the csv export addressbook de Zeichensatz für den CSV Export
|
||||
@ -210,6 +211,7 @@ insert in document addressbook de Einf
|
||||
insufficent rights to delete this list! addressbook de Keine Rechte diese Liste zu löschen!
|
||||
international addressbook de International
|
||||
label addressbook de Adressetikett
|
||||
last date addressbook de Letzter Termin
|
||||
last modified addressbook de Letzte Änderung
|
||||
last modified by addressbook de Letzte Änderung durch
|
||||
ldap context for contacts admin de LDAP Kontext für Kontakte
|
||||
@ -247,6 +249,7 @@ name for the distribution list addressbook de Name f
|
||||
name of current user, all other contact fields are valid too addressbook de Name des aktuellen Benutzers, auch alle anderen Kontaktfelder sind erlaubt
|
||||
name, address addressbook de Name, Adresse
|
||||
new contact submitted by %1 at %2 addressbook de Neuer Kontakt eingetragen von %1 am %2
|
||||
next date addressbook de Nächster Termin
|
||||
no vcard addressbook de Keine VCard
|
||||
number addressbook de Nummer
|
||||
number of records to read (%1) addressbook de Anzahl der einzulesenden Datensätze (%1)
|
||||
|
@ -65,6 +65,7 @@ calendar uri addressbook en Calendar URI
|
||||
can be changed via setup >> configuration admin en Can be changed via Setup >> Configuration
|
||||
car phone addressbook en Car Phone
|
||||
categories, notes, ... addressbook en Categories, Notes, ...
|
||||
category tree admin en Category tree
|
||||
cell phone addressbook en Mobile phone
|
||||
change all organisation members addressbook en change all organisation members
|
||||
charset for the csv export addressbook en Charset for the CSV export
|
||||
@ -107,7 +108,6 @@ custom addressbook en Custom
|
||||
custom etemplate for the contactform addressbook en Custom eTemplate for the contactform
|
||||
custom fields addressbook en Custom Fields
|
||||
debug output in browser addressbook en Debug output in browser
|
||||
default addressbook en default
|
||||
default address format addressbook en Default address format
|
||||
default addressbook for adding contacts addressbook en Default addressbook for adding contacts
|
||||
default document to insert contacts addressbook en Default document to insert contacts
|
||||
@ -211,6 +211,7 @@ insert in document addressbook en Insert in document
|
||||
insufficent rights to delete this list! addressbook en Insufficent rights to delete this list!
|
||||
international addressbook en International
|
||||
label addressbook en Label
|
||||
last date addressbook en Last date
|
||||
last modified addressbook en last modified
|
||||
last modified by addressbook en last modified by
|
||||
ldap context for contacts admin en LDAP context for contacts
|
||||
@ -248,6 +249,7 @@ name for the distribution list addressbook en Name for the distribution list
|
||||
name of current user, all other contact fields are valid too addressbook en Name of current user, all other contact fields are valid too
|
||||
name, address addressbook en Name, Address
|
||||
new contact submitted by %1 at %2 addressbook en New contact submitted by %1 at %2
|
||||
next date addressbook en Next date
|
||||
no vcard addressbook en No VCard
|
||||
number addressbook en Number
|
||||
number of records to read (%1) addressbook en Number of records to read (%1)
|
||||
|
@ -14,7 +14,7 @@
|
||||
</hbox>
|
||||
<styles>.rightPadAdd { width: 30px; }</styles>
|
||||
</template>
|
||||
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.4.002">
|
||||
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.5.001">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -27,6 +27,7 @@
|
||||
<column/>
|
||||
<column disabled="@no_customfields"/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column width="90"/>
|
||||
</columns>
|
||||
<rows>
|
||||
@ -92,6 +93,10 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</vbox>
|
||||
<vbox options="0,0">
|
||||
<nextmatch-header label="Last date" id="calendar"/>
|
||||
<nextmatch-header label="Next date" id="calendar"/>
|
||||
</vbox>
|
||||
<vbox options="0,0">
|
||||
<nextmatch-sortheader id="contact_created" label="Created"/>
|
||||
<nextmatch-sortheader id="contact_modified" label="Last modified"/>
|
||||
@ -146,6 +151,10 @@
|
||||
<description options=",@${row}[email_home_link],,,_blank,$row_cont[email_home_popup]" class="fixedHeight" id="${row}[email_home]" no_lang="1"/>
|
||||
</vbox>
|
||||
<customfields-list rows="1" cols="1" id="$row" class="customfields"/>
|
||||
<vbox options="0,0">
|
||||
<link id="${row}[last_link]"/>
|
||||
<link id="${row}[next_link]"/>
|
||||
</vbox>
|
||||
<vbox options="0,0">
|
||||
<date-time id="${row}[created]" readonly="true" class="noWrap"/>
|
||||
<menulist>
|
||||
|
Loading…
Reference in New Issue
Block a user