cazzerson/Suma — pull request #26 by kenirwin (2014-12-10 01:58:11+00:00)
Title: Location based reports 

The code is currently in the witt_reports branch of my fork of the code:
https://github.com/kenirwin/Suma/tree/witt_reports/analysis/reports/lib/php
the changes are to:
nightlyEmail.php
nightly.php
NightlyData.php

You can see samples of the two kinds of output at:
http://www6.wittenberg.edu/dev/suma/analysis/reports/lib/php/nightly-demo.php?loc=true
http://www6.wittenberg.edu/dev/suma/analysis/reports/lib/php/nightly-demo.php?loc=false

As Bret suggested, I’ve configured the code so that the instruction to do location-based reporting instead of summary reporting occurs on the command line. If you add the word “locations” as an argument to either nightlyEmail.php or nightly.php, it will invoke the location-based reporting. When that’s in play on nightlyEmail.php, it will also trigger a MIME and Content-type: text/html declaration so the html table will render via email. (It would be possible to do some fance ASCII formatting, but I have not pursued that approach.

Some known issues with the current code:
* Since the emailFrom configuration isn’t part of canonical Suma code, it currently includes my hard-coded header that sends emails from my address; likewise, I’ve changed the text of the email subject line. That’s all hard-coded in nightlyEmail right now; I’d move both to the config file, but I didn’t want to step on misilot’s toes if s/he is currently working on the fromEmail fix.
* The HTML formatting of the tabular output currently happens as a method in NightlyData.php – I suspect that that violates MVC principals (defining the view inside the model). I’d be open to other ways of arranging that, although it sure is handy having access to the class variables. I wonder what you all think of that.