CSV export plugin


#1

I’m working on a CSV export plugin that provides export options in Omeka’s dashboard. It currently works for the following options:

  • export all items in the repository
  • export a subset of items, after limiting by collection, item type, tag, featured or not, or any combination of these in the advanced search.

But it is not exporting accurately after “narrowing by a specific field” in advanced search. In this case, the entire repository exports instead of the subset/search results.

In my controller, I’m building an array of filters and then passing them as $params:
$itemTable = $this->_helper->db->getTable(‘Item’);
$items = $itemTable->findBy($params);

The advanced search filter looks like this when added to findBy()
array(1) {
[“advanced_search”]=>array(1) {
[0]=>array(3) {
[“element_id”]=>string(3) “111”[“type”]=>string(8) “contains”[“terms”]=>string(12) “conservation”
}}}

I’m so close!! But for the moment, I’m stuck. Because the advanced search filter is an array instead of a key/value pair, I think my problem is related to the array structure. Any suggestions are much appreciated!!


#2

Got it!

I replaced the code I was using with the below, and it’s now working:
$itemTable = $this->_helper->db->getTable(‘Item’);
if (isset($_GET[‘search’])) {
$items = $itemTable->findBy($_GET);
return $items;
}

J.Flatness’s code for the reports plugin helped me resolve this (thanks John!). But I saw his note (below) and I’m wondering which parts of the advanced search use $_REQUEST. Wondering if I should account for those in my code. Do y’all know which parts use $_REQUEST?

// Some parts of the advanced search check $_GET, others check
// $_REQUEST, so we set both to be able to edit a previous query.

Thanks!


#3

We are having a problem exporting all records at once, right now it only exports 200 items (which are the by page results max number) regardless of having selected all 14k+ items. Any idea of how we can accomplish this?


#4

Are you using the University of Toronto’s plugin or this one?


#5

The TOronto U, one. Would you suggest better use this one? Where can we download it? Reached this site through the forum, we didn’t know there were 2 kinds.


#6

I’ve downloaded your plugin and installed it although it says is not a valid plugin, could it be a version issue? we are running on OMEKA 2.5.1

UPDATE:
Changed the name of the directory and was able to install, but export crashed.

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /admin/csv-export/export/csv.

Reason: Error reading from remote server


#7

I haven’t used Toronto’s plugin yet, so I’m not sure which is better.

After uploading and extracting the zip file, the plugin directory is named “CSVExport-master” by default. If you rename the plugin directory to “CSVExport”, then Omeka should consider the plugin valid. It may be slow to export 14k records. I haven’t tested export of that many records so I’ll be interested in how it works for you!