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 { ...@@ -42,11 +42,25 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
$contacts = self::get_contacts(); $contacts = self::get_contacts();
if ($contacts) { if ($contacts) {
// Get config.
$config = CRM_Core_Config::singleton();
// Init Contacts list. // Init Contacts list.
$myContacts = []; $myContacts = [];
// Open list. // Open table.
$callNext .= '<ol><li>'; $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 is common to all Contacts.
$path = 'civicrm/contact/view'; $path = 'civicrm/contact/view';
...@@ -79,16 +93,29 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page { ...@@ -79,16 +93,29 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
// Build anchor tag. // Build anchor tag.
$contactLink = sprintf( '<a href="%1$s">%2$s</a>', $contactURL, array_shift( $contact['target_contact_name'] ) ); $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. // Add to list.
$myContacts[] = $contactLink; $myContacts[] = $data;
} }
// Wrap items in <li> tags. // Wrap data in <td> tags.
$callNext .= implode( '</li><li>', $myContacts ); $callNext .= implode( '</td></tr><tr><td>', $myContacts );
// Close row.
$callNext .= '</td></tr>';
// Close list. // Close table.
$callNext .= '</li></ol>'; $callNext .= '</table>';
} }
...@@ -208,6 +235,13 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page { ...@@ -208,6 +235,13 @@ class CRM_CallNext_Page_CallNext extends CRM_Core_Page {
$activities = array_slice($activities, 0, 10); $activities = array_slice($activities, 0, 10);
} }
/*
error_log( print_r( array(
'method' => __METHOD__,
'activities' => $activities,
), true ) );
*/
// --< // --<
return $activities; 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