Export table as CSV

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 20
Joined: Tue Nov 12, 2013 11:11 am

Export table as CSV

Postby jjgitties » Tue Jul 29, 2014 1:32 pm

Hello, I am trying to implement a simple action where the user clicks on a link and it exports the current data into a CSV file in browser. Similar to the link below.

http://snipplr.com/view/2234/export-mys ... ts-to-csv/

Is there a built into plugin or function I am use? We are using a very old version of OJS. I can see that there is a function in the new one

http://$sitename/index.php/journal/mana ... portPlugin

Can one copy and paste those plugins and use them in an older version?

My code in the DAO so far is:

Code: Select all

   function &exportToCSV() {
                $sql = 'SELECT * FROM table';
                $result = &$this->retrieve($sql);
                $out = '';
                $returner = &$this->_returnTableDataFromRow($result->GetRowAssoc(false));
      //$returner = new DAOResultFactory($result, $this, '_returnTableDataFromRow');

                print_r( $returner );
      return $returner;

Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Export table as CSV

Postby asmecher » Tue Jul 29, 2014 1:39 pm

Hi jjgitties,

Back-porting code to an old release will cost you a lot of time -- potentially more than just upgrading. I'd suggest investing some time in an upgrade and you'll solve the CSV export problem in the bargain.

Alec Smecher
Public Knowledge Project Team

Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 2 guests