Export Moodle report in csv file - php

Does anyone know any Moodle built in feature to export custom report into a csv file?
I've tried to find in documentation but there is nothing. There's this old book which also have no practical information on exporting report into a csv file.
I've tried to dig into the source code and also in Moodle's administration block. You can export log reports as a csv file. So I'm sure there has to be something.
If anyone can help me with this that would be great help!
Thanks,
Mac

You need a plugin to do this, try one of these:
https://moodle.org/plugins/view/report_customsql
https://moodle.org/plugins/view/block_configurable_reports
If your're wanting to write code to do this, then take a look at lib/csvlib.class.php - that is a helpful wrapper for the standard PHP csv functions.

Related

How to add header in an uploaded PDF using barryvdh/dompdf

I am using barryvdh/dompdf in my project to deal with pdfs. Yes as you are thinking with php and Laravel.
In backend, I have a form which uploads a pdf and from the frontend we can download it.
This functionality is working perfectly.
But now I want to add a header in that uploaded pdf to add my project's name.
I have worked with pdf generation by this package so I know how this package works but I can't find anything about editing a pdf.
I have been doing some research on google but can't find anything related to my problem.
I haven't done anything so far related to this so I have no more details or code to show but to clear confusion let me just show you the points you need to keep in mind and forget anything you read till now.
I am using barryvdh/dompdf to deal with pdfs.
Want to edit a pdf which is uploaded in the system and will be downloaded afterwards.
I Want to add a header.
I just have a mere idea(maybe i am wrong) that it can be done at any of the two stages-
1. At upload time
2. At download time
[Note]: Please don't close it as off-topic or duplicate or something similair. Please do read the whole post before doing anything like that. Because like I said, I have done some research and haven't found anything.
This can't be done in DOMPDF.
I guess the solution is to either use native-ish php commands, another package like FPDI or to drop the idea altogether.

working with php and python together

currently i am working on a project which is related to automation.
I am using php and mysql for my work. I have to make a code in php which can import, export and edit the excel file and the extension of excel file is .xlsm. As i have tried my best, but i didn't succeed with the .xlsm file.
so, one of my friend has suggest me that in python, you can do that.
so, is it possible, if i insert the python script(which can import, export and edit the .xlsm file) into the php code and the run the code. please let me know, will this work. if this work then how?
You can use exec() to execute an external program in PHP.

php export excel file

I am woking on exporting datas to excel file from mysql.I google some docs and finally I choose the PHPExcel,it works well and I can successfully complete my work.
but when I upload my code to the online server,it display an error which is "XMLWriter is not found",I also google for this and I know it because the installed php isn't compiled with the class "XMLWriter ",but the question is I have no privilege to recompile the php source.
so if there is other open source class that is used to export data to excel file?
I hope I describe my question clearly.
If you can avoid using PHPExcel, have a look at this tutorial for a plain and simple solution, it might help.
Since you have no control on your PHP installation, I strongly suggest you to abandon PHPExcel, as your PHP version does not include the needed libraries for this package and you don't want to go though painful hacks to make it work somehow...

Exporting and Importing .csv files using a script

Hi I have a MAMP server set up on a mac I am using and I have this displaying a calendar using the php icalendar source code. I am trying to have this display a public calendar which I can do but I need it to be up to date so I need it to import the Calendars csv file regularly. So my question is does anyone know how I could go about programmatically exporting a .csv file from a public calendar and how I could then import it into a certain location on a server again via a script or code?
Thanks a lot
There are a lot of ways to download the .csv file.
You could use fopen, cURL to download the file. For fopen you need to enable to read files from an url.
An other way, must be supported by the other party. Is to use ftp.
I think the best way for these is just look at php.net how to let them work.
Second you want to make a scheduld job. I don't know it in macs, but with linux you can make cron's you can say these need to be run every x time (1min, 1day 1 week).
In the script you do the download and update part.
Hope it helps

Open source PHP reporting tool

I am developing web based application, i need php reporting lib/class to make the job easy.
I need PDF/Excel format. The report based on related db tables(member bills, member info) Is there any advanced open source solution ?
Thanks
There are tons of reporting libraries, most of which create Xml or Csv. You would have to give more data about what kind of reporting you need for a recommendation. I haven't used PHPExcel yet, but it is the first attempt I have seen to actually create Excel documents rather than creating CSV's that will load in Excel. PDF creation is built into PHP with the PDF functions, and is fairly easy to do.
[UPDATE]
PHPExcel is archived now you can use PhpSpreadsheet instead.
A newer library that looks very promising is PHP Reports by jdorn on github.
This is unrelated to the older library by the same name hosted on Sourceforge.
A bit late, but you might want to check out RLib - works with PHP and MySQL and creates multiple different types - PDF, CSV, HTML etc.
http://rlib.sicompos.com/
Unfortunately I don't know of a decent reporting class in PHP.
Do you need a full reporting suite, or do you just need to be able to export data to the pdf and Excel file formats?
If you only need to create these kind of pages, the simplest solution would be to display the data you require and add CutePdf software which installs itself as a printer. Then you can print to pdf from the browser.
If you need to create pdf files on the server side, there is a pdf creation library in the Zend Framework. ZendFramework-1.8.1\library\Zend\Pdf

Categories