MP_Addon_CalculatorsCallRail_Settings::get_callrail( string $post )
Get Table with call rail data.
Contents
Parameters Parameters
- $post
-
(string) (Required) Callrail Post ID
Return Return
(string) HTML table
Source Source
File: calculator-callrail-add-on/inc/MP_Addon_CalculatorsCallRail_Settings.php
protected function get_callrail($post){
$callrail = get_post_meta( $post, MortgagePlatform::$prefix . 'callrail', true );
$calls = array_reverse(get_post_meta( $post, MortgagePlatform::$prefix . 'callrail_calls', false ));
$callrail = array(
array(
'name'=>__( 'Name', 'CalculatorsCallRailAddon' ),
'value'=> $callrail['formatted_customer_name']
),
array(
'name'=>__( 'Phone', 'CalculatorsCallRailAddon' ),
'value'=>$callrail['customer_phone_number']
),
array(
'name'=>__( 'Location', 'CalculatorsCallRailAddon' ),
'value'=>$callrail['formatted_customer_location']
),
array(
'name'=>__( 'IP', 'CalculatorsCallRailAddon' ),
'value'=>$callrail['ip']
),
array(
'name'=>__( 'Total calls', 'CalculatorsCallRailAddon' ),
'value'=>$callrail['total_calls']
),
);
$table = '<table class="lead_table" cellpadding="0" cellspacing="0">';
foreach ( $callrail as $key=>$data ) {
$value = (0 === $key) ? '<a href="'.esc_url(get_edit_post_link( $post )).'">' . $data['value'].'</a>' : esc_attr( $data['value']);
$table .= '<tr class="lead_table_row">
<td class="lead_table_label">' . esc_attr( $data['name']). '</td>
<td style="padding: 0;" class="lead_table_value">'. $value .'</td>
</tr>';
}
foreach ( $calls as $call ) {
$table .= '<tr class="lead_table_row lead_table_heading" border="1">
<td class="lead_table_label">' . esc_attr__( 'Start time', 'CalculatorsCallRailAddon' ) . '</td>
<td class="lead_table_value">' . date_i18n('j F Y H:i',strtotime(esc_attr($call['start_time']))) . '</td>
</tr>';
if (!empty($call['recording'])){
$call_value = '<audio controls>
<source src="'.esc_url($call['recording']).'" type="audio/mp3">
Your browser does not support the audio tag.
</audio>';
} else {
$call_value = '';
}
$table .= '<tr class="lead_table_row">
<td class="lead_table_label">' . esc_attr__( 'Recording', 'CalculatorsCallRailAddon' ) . '</td>
<td style="padding: 0;" class="lead_table_value">'. $call_value .'</td>
</tr>';
}
$table .= '</table>';
return $table;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |