Simple help with customising Reports

I’m trying to create a new Report format but have failed at the first hurdle.

I duplicated /Reports/models/Reports/Generator/Html.php to Html_2, and edited line 15 to:

class Reports_Generator_Html_2

(The following lines remain: extends Reports_Generator and implements Reports_GeneratorInterface).

No more changes, but when I try to load the Reports page in the back end I get:

InvalidArgumentException: Invalid report type: Html_2. in /home/reephama/public_html/omeka/plugins/Reports/models/Reports/Generator.php:234
Stack trace:
#0 /home/reephama/public_html/omeka/plugins/Reports/helpers/ReportsFunctions.php(16): Reports_Generator::getFormats(‘/home/reephama/…’)
#1 /home/reephama/public_html/omeka/plugins/Reports/controllers/IndexController.php(52): reports_get_output_formats()
#2 /home/reephama/public_html/omeka/application/libraries/Zend/Controller/Action.php(516): Reports_IndexController->browseAction()
#3 /home/reephama/public_html/omeka/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(‘browseAction’)
#4 /home/reephama/public_html/omeka/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 /home/reephama/public_html/omeka/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#6 /home/reephama/public_html/omeka/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#7 /home/reephama/public_html/omeka/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#8 /home/reephama/public_html/omeka/admin/index.php(28): Omeka_Application->run()
#9 {main}

What am I doing wrong? I’m absolutely not a programmer. I just hoped to add a bit of CSS and one or two extra bits of metadata.

On a wider note, is there any other way to print summary sheets that can be filed with individual items in the physical collection? My users just used to print from the screen, but with Omeka 3 they reckon this has become less elegant.

If you could elaborate on the issues with version 3.0 and this workflow, that would be great. I don’t think this is a use case we really planned for but depending on the issue we may be able to do something about it.

As for Reports: I think the issue here is just going to be your usage of an underscore. In the autoloading system (called PSR-0) used by Omeka Classic, an underscore in a class name represents a level in the directory structure for the file. So when you call the class “Html_2,” it’s expecting the file to be inside a folder “Html” and called just “2.php.” Probably the better move is just to call the class and file “Html2” without the underscore.

Many thanks John. It works fine without the underscore. I did have to tweak the function getReadableName() so that the new template shows up with a unique name – I don’t think that’s in the existing documentation.

Now I just need to add in some metadata that isn’t in the default template – basically most of the things in the right-hand column of the Item view. I’m guessing this would include Item::$public, Item::getCollection(), Item::getFiles() and so on. I’m sure this is pretty basic, but if some kind person has time to scribble a few lines of code for the _outputSetElements function I would be very grateful.

The reason this seemed to me a good idea is that our archivists want to print a ‘cover sheet’ to file along with each physical document. This way, anyone looking through the boxes can immediately see the Omeka reference, description, and other useful metadata for each item. I can image adding thumbnails and QR codes, too.

Up till now the team (all two of them) have made the cover sheets by simply printing the screen for each item as they record it in Omeka. This isn’t ideal, because it seems the Seasons theme, at any rate, doesn’t include CSS for print, but so far it’s worked well enough.

As I understand it, the printed result in the updated version of Seasons that ships with Omeka 3 is less elegant. It’s probably just the way the fields are positioned (and for a proper report we’d want to truncate the item’s description so that everything fits on one page).

Does the ‘cover sheet’ idea make sense, and if so, would you use Reports for this, or is there a better way?

As a quick fix I made a print stylesheet for the admin theme and added:

<?php queue_css_file(array('iconfonts', 'skeleton', 'jquery-ui', 'style', 'print'));

to admin/themes/default/common/header.php. It seems to work. Is that the correct approach?

I’d still value advice on adding specific metadata to a report, because that seems to me the most elegant way.

This topic was automatically closed after 250 days. New replies are no longer allowed.