Commit 65392c74 authored by Christian Wach's avatar Christian Wach
Browse files

Format dashlet data to display table

parent d631b383
......@@ -42,11 +42,25 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
$contacts = self::get_contacts();
if ($contacts) {
// Get config.
$config = CRM_Core_Config::singleton();
// Init Contacts list.
$myContacts = [];
// Open list.
$callNext .= '<ol><li>';
// Open table.
$callNext .= '<table class="callnext-table">';
// Define header row.
$callNext .= '<tr>' .
'<th>' . ts('Name') . '</th>' .
'<th>' . ts('Subject') . '</th>' .
'<th>' . ts('Date') . '</th>'.
'<th>' . ts('Time') . '</th>' .
'</tr>';
// Open row.
$callNext .= '<tr><td>';
// Path is common to all Contacts.
$path = 'civicrm/contact/view';
......@@ -79,16 +93,29 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
// Build anchor tag.
$contactLink = sprintf( '<a href="%1$s">%2$s</a>', $contactURL, array_shift( $contact['target_contact_name'] ) );
// Build date.
$date = CRM_Utils_Date::customFormat($contact['activity_date_time'], $config->dateformatFull);
$time = CRM_Utils_Date::customFormat($contact['activity_date_time'], $config->dateformatTime);
// Build data.
$data = $contactLink . '</td>' .
'<td>' . $contact['subject'] . '</td>' .
'<td>' . $date . '</td>' .
'<td>' . $time;
// Add to list.
$myContacts[] = $contactLink;
$myContacts[] = $data;
}
// Wrap items in <li> tags.
$callNext .= implode( '</li><li>', $myContacts );
// Wrap data in <td> tags.
$callNext .= implode( '</td></tr><tr><td>', $myContacts );
// Close row.
$callNext .= '</td></tr>';
// Close list.
$callNext .= '</li></ol>';
// Close table.
$callNext .= '</table>';
}
......@@ -208,6 +235,13 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
$activities = array_slice($activities, 0, 10);
}
/*
error_log( print_r( array(
'method' => __METHOD__,
'activities' => $activities,
), true ) );
*/
// --<
return $activities;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment