[TYPO3-project-formidable] Renderlet:Lister - Export as CSV, RSS, XML ...
Benjamin Fischer
mailbox at typedown.com
Tue Apr 29 09:45:20 CEST 2008
Salut Luc,
Thanks for your reply - you are right it, is a bit like opening the
pandora's box and being overwhelmed what comes out of it. Starting to
work with formidable was already like this for me ;-)
I will try your special export code and keep you updated how it works
out. I got the idea and it shows once again the flexibility and power
of formidable, great - thank you.
All the best, Benjamin
On Mon, Apr 28, 2008 at 5:06 PM, Luc Muller <l.mul-nospam-ler at ameos.com> wrote:
> Ho ho ho...
>
> well.... hmmm.... we already think about this...
>
> it's true that being able to chose the output format of formidable would
> be cool...
> in another hand, those kind of ideas sounds like "ooopsss I think I've
> just openend the pandora's box....".
>
> Well, especially for you... (and all the other Formidable users)
>
> here's something I've made a few days ago.
>
> assuming you got a datasource "mydatasource"
>
> you can create a button like this :
>
> <renderlet:BUTTON name="getcsv" label="Download CSV DATA">
> <onclick runat="server" when="end" >
> <userobj>
> <php><![CDATA[
>
> $aData =
> $this->aODataSources["liste_contact"]->_fetchData();
>
> $aBodyContent = array();
> foreach($aData["results"] as $key=>$val){
> $aHeader = array();
> $aBodyContent[$key] = array();
> foreach($val as $key=>$val){
> $aHeader[] = $cle;
> $valeur = str_replace(";","",$valeur);
> $aBodyContent[$key][$cle] = $valeur;
> }
> $aBodyContent[$key] =
> implode(";",$aBodyContent[$key]);
> }
>
> // debug($aHeader,"Header");
> // debug($aBodyContent,"Content");
>
> $sHeader = implode(";",$aHeader)."\n";
> $sBodyContent = implode("\n",$aBodyContent);
>
> // debug($sHeader,"header");
> // debug($sBodyContent,"Content");
>
> $sCsv = $sHeader.$sBodyContent;
>
> $sCsv = utf8_decode($sCsv);
>
> //debug($sCsv,"Csv");
>
> $sFileName = md5($sCsv).".csv";
>
>
> t3lib_div::writeFileToTypo3tempDir(PATH_site."typo3temp/csv/".$sFileName,$sCsv);
>
>
> $this->forceDownload(PATH_site."typo3temp/csv/".$sFileName,"liste.csv");
>
> return false;
>
> ]]></php>
> </userobj>
> </onclick>
> </renderlet:BUTTON>
>
> This SHOULD create a csv download button to download all the data from
> the datasource in the current state of search.
> as I removed some piece of code (formatting and so on...) right in my
> mailer, the script may not work from scratch, but the idea is here.
>
> Hope this will help you.
>
> Luc Muller
>
> Benjamin Fischer a écrit :
>
>
> > Hello again at formidable,
> >
> > I am currently working on a formidable frontend to display tracking
> > data of user interaction on an image database. Actions like Login,
> > Upload, Download, Preview, Zip and other actions are logged in MySQL
> > and later formated and displayed with a formidable Renderlet:Lister
> > bound to a searchform. This works very well and the feature ist used
> > frequently by the administrators of the image database.
> >
> > To have an even more powerful system it would be great if the users
> > could export the current searchresult of the Renderlet:Lister in
> > another format like CSV to save it on their local disks. Another much
> > asked for feature would be the generation of RSS Feeds from
> > Renderlet:Lister results. These feeds might have their params send via
> > get params i.e. ?action=upload&user=664&type=rss to have an RSS Feed
> > of all recent uploads of user 664.
> >
> > Do you think this could be possible with formidable - or maybe would
> > it be possible using special "templates" for other datatypes like CSV,
> > RSS, XML or even others like ICS oder TXT.
> >
> > Thank you again for formidable, all the best,
> >
> > Benjamin
> >
> >
>
>
> --
>
> *Luc Muller*
> /Web Developper/
> /Formidable - Rapid Application Developpement Framework for Typo3
> <http://formidable.typo3.ug>/
> /Typo3 Ameos <http://www.ameos.com>/
More information about the TYPO3-project-formidable
mailing list