I tried this :
$items = ($report->http_response_body->items );
$this->view->assign('items', $items);
$this->view->assign('page', $report->http_response_body->paging);
{item.timestamp} <f:format.date format="d.m.Y - H:i:s">@{item.timestamp}</f:format.date>
but it renders different tiamstamps like so(either it fails completely or renders incorrectly):
1435146156.574 "@1435146156.574" could not be parsed by DateTime constructor.
1435146154.602 "@1435146154.602" could not be parsed by DateTime constructor.
1435141273.1495 24.06.1540 - 05:21:13
The items are from a mailgun response https://documentation.mailgun.com/api-events.html#examples
Also this is for a backend module, so how would I handle the paging? I have this so far
<f:link.action class="button show" action="list" arguments="{page : page.first}">First</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.previous}">Previous</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.next}">Next</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.last}">Last</f:link.action>
but when you click a link it gives the error:
Oops, an error occured! The endpoint you've tried to access does not exist. Check your URL.
Thanks (Sorry for such a newbie Q but I've never written a backend module before) PS in order to even get this far I had to copyu the Backend templates up a folder to be found so now my backend module is using the default templates found under Resources/Private/Templates instead of Resources/Backend/Private/Templates, here is my list template:
<f:layout name="Default" />
This Template is responsible for creating a table of domain objects.
If you modify this template, do not forget to change the overwrite settings
in /Configuration/ExtensionBuilder/settings.yaml:
Resources:
Private:
Templates:
List.html: keep
Otherwise your changes will be overwritten the next time you save the extension in the extension builder
<f:section name="content">
<h1>Listing for MailgunLog</h1>
<f:flashMessages />
<table class="tx_mailgunlog" >
<tr>
<th> Date</th>
<th> Summary</th>
</tr>
<f:for each="{items}" as="item">
<tr>
<td>{item.timestamp} <f:format.date format="d.m.Y - H:i:s">@{item.timestamp}</f:format.date> </td>
<td> {item.event} {item.recipient} {item.message.headers.subject} </td>
</tr>
</f:for>
</table>
<f:link.action class="button show" action="list" arguments="{page : page.first}">First</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.previous}">Previous</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.next}">Next</f:link.action>
<f:link.action class="button show" action="list" arguments="{page : page.last}">Last</f:link.action>
</f:section>
Thanks!
PS: Thanks to mtness I added this code to controller to fix date issue:
foreach($report->http_response_body->items as $item){
if(strpos($item->timestamp, ".")!==FALSE){
$item->timestamp = strstr($item->timestamp, '.', TRUE);
}
}
now to figure out the link issue.
Since the action is all in the listAction I thought I'd post the function sig:
/**
* action list
* @param string emailaddress to search for
* @param string PAGE IF THERE IS PAGING TO BE DONE
* @return void
*/
public function listAction($email ='', $page='') {
for now I've had to add a quick hack like so:
and just append the paging url to the links like so:
and the search by email looks like this:
An ugly shameless hack but I needed to get it done quick.