Jump to content

Custom reports for custom modules


yrochon

Recommended Posts

Where can I find complete in-depth documentation about writing custom reports? I have amodule where I need to generate reports and, while I can generate text-only reports quite easily, I find myself struggling at how I can customize the graph reports; for example, I need to pass some parameters to the image being generated.

 

Also, is there any way graph reports can display some HTML in the footer? The reports are monthly based and, instead of going back or entering the parameters directly in the URL, I'd like to add a "Previous" and "Next" button (for the graph report).

 

Thanks!

Link to comment
Share on other sites

Well, unless there is a better option, I hacked a solution :

 

 

if ($statsonly) { 

   $prevMonth = $month - 1;
   $nextMonth = $month + 1;

   echo <<< END_OF_HTML
<script type="text/javascript">
   $(function() {
       var img = $('img[src*="reports.php"]');
       var src = img.attr('src');
       src += "&month={$month}&view={$view}";
       img.attr('src', src);
       $('#monthControls').appendTo(img.parent()).show();
   });
</script>
<div id="monthControls" style="display:none;">
<table width="100%"><tr>
 <td style="text-align:left;"><a href="reports.php?graph=graph_asterisk_server_load&sid={$sid}&year={$year}&month={$prevMonth}"><< Previous Month</a></td>
 <td style="text-align:right;"><a href="reports.php?graph=graph_asterisk_server_load&sid={$sid}&year={$year}&month={$nextMonth}">Next Month >></a></td>
</tr></table>
</div>
END_OF_HTML;
   return false;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated