Skip to content

Instantly share code, notes, and snippets.

@sevein
Created December 5, 2012 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevein/4219562 to your computer and use it in GitHub Desktop.
Save sevein/4219562 to your computer and use it in GitHub Desktop.
AtoM #4320
<?php
/*
* This file is part of the AccesstoMemory (AtoM) software.
*
* AccesstoMemory (AtoM) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AccesstoMemory (AtoM) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AccesstoMemory (AtoM). If not, see <http://www.gnu.org/licenses/>.
*/
class InformationObjectBoxLabelCsvAction extends sfAction
{
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
if (!isset($this->resource))
{
$this->forward404();
}
// Disable layout
$this->setLayout(false);
// All linked physical storage objects for current description and all descendants, containing the listed fields (Reference code, Container name, Title, Creation Dates). A good example to iterate over an inforamtion objects and its ancestors is apps/qubit/modules/digitalobject/actions/imageflowComponent.class.php
foreach ($physicalObject as $item)
{
$data .= $field1 . "," . $field2 . "," . $field3 ."\n";
}
// Radda, we may need this but I am not sure
// http://www.symfony-project.org/api/1_4/sfWebResponse#method_clearhttpheaders
$this->getResponse()->clearHttpHeaders();
$this->getResponse()->setHttpHeader('Content-Type', 'text/csv');
// Put the $data contents into the body part of the HTTP response
$this->getResponse()->setContent($data);
return sfView::NONE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment