GithubHelp home page GithubHelp logo

gravitykit / gravityexport-lite Goto Github PK

View Code? Open in Web Editor NEW
12.0 11.0 8.0 9.04 MB

GravityExport Lite. Export all Gravity Forms entries to Excel (.xlsx) via a secret (shareable) url.

Home Page: https://gfexcel.com

License: GNU General Public License v2.0

PHP 96.20% CSS 1.53% JavaScript 2.27%
excel csv gravityforms wordpress gravity-forms gravity-forms-addon gravityforms-addon

gravityexport-lite's Introduction

GravityExport

by GravityKit

Get realtime entries from your forms using a unique and secure URL. No need to login, or create a user account for that one person who needs the results. Just copy the URL, and give it to the person who needs it. It's that simple.

You can export to .xlsx or .csv.

Export Gravity Forms entries to Excel

Using Gravity Forms you can always export a CSV file, and import it to Excel. But an admin always needs to be involved and using Excel to import a CSV is a pain.

The plugin also has a few plugin hooks to make your excel output exactly how you want it. Check out the FAQ to find out more.

Requirements

  • PHP 7.2 or higher
  • php-xml and php-zip libraries
  • Gravity Forms 2.5 or higher

Docs

Check out our full documentation site for you developers out there!

Credits

gravityexport-lite's People

Contributors

doekenorg avatar mircobabini avatar mrcasual avatar rafaehlers avatar sgregori avatar squidmedia avatar tobifjellner avatar zackkatz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gravityexport-lite's Issues

Select fields to export only

By default all fields are exported. It would be nice to have a list of fields, and select those we want to export.

Add way to format prices without currency

We have to be able to revert the product price to a number using

return GFCommon::to_number($value, rgar($entry, 'currency'));

But I want users to be able to easily fix this. Probably need another hook on separable field.

Able to prepend the title to (merged) columns

This is the title of the document. And it could be placed before the actual content.

To add this we need to hook more into the phpspreadsheet. Not sure if this is a normal feature to add, or if we just need to add the hooks / actions to build a custom implementation.

Sort results by subfields

You can only sort on single value fields. We need to be able to select a subfield for the sorting of the result, like the last name of a name field.

Auto column width toggle

The column width is stretched to the full width needed by default. We should be able to turn this off for a specific column if we want. Maybe even set a predefined width.

Add actions for for example the downloads-counter.

Implement Wordpress actions system to make code less coupled, and more extendable.
The counter is now hardcoded and fixed in the code. This can be extracted to some sort of plugin style. This way this 'plugin' can contain it's own code and variables. This cleans up the code a lot.

Add linter checks

with the development for multiple php versions,
I want to confirm all code is valid for that php version
so i can deploy with more certainty that things will not break.

Add a SectionField to filter out empty cells

When a form is divided up in to sections, a section column is added to the output.
By adding a field for this type we can avoid these by default. Of course there needs to be a hook for people who like the empty column as a spacer.

Bug: Only returns 20 entries

Need to add paging with the right amount of results.

$total_entries = GFAPI::count_entries($this->form_id, $search_criteria);
$paging = array("offset" => 0, "page_size" => $total_entries);
$this->entries = GFAPI::get_entries($this->form_id, $search_criteria, $sorting, $paging);

//or something

Add more info to the ValueObjects

We need info like the field name, label, etc. Stuff that is found on the GF_Field instance. If we add that field to the BaseValue, and add a getField method, the users can more easily find the correct value to filter against.

GF Repeater Add-On + GF Entries in Excel

Hey Doeke! Hope you're doing well.

I'm exporting a form containing a repeater field in Excel, the code is not really generic because into the repeater field I make some decisions, based on the input of the user. It's not just some data to explode into an excel.

By the way I'd love to discuss it with you, maybe you are interested into making it generic and integrated.

Actually, a repeater field is automatically rendered like this (not so useful into an excel):
Brand: A, Percentuale: 20, Brand: B, Percentuale: 10, Brand: Altro, Percentuale: 30, Altro brand: Nome del brand

Instead, I need something more excel-style.
This is the current (working) code: https://gist.github.com/mircobabini/dd2d47f7cc928f869d84ab1b32296a4b

As you can see I'm instancing the class on the form + (repeater) field.
Then, I'm working on rows and columns in order to transform this: https://snag.gy/mopGbS.jpg (or this: https://snag.gy/XDx8FU.jpg) to that: https://snag.gy/cCpo2v.jpg

Please note that I'm NOT parsing the serialization of the repeater; the script uses the original field data from get_field( ... )->getValue().

What do you think? :)

Disable fields

We now only have an implemntation for gfexcel_field_fileuploads_enabled, but it would be nice to have gfexcel_field_disable to disable all fields we'd like to.

Download url not working anymore

In fact it partially works; but the downloaded file is empty because of the $search_criteria in GFExcelOutput.php.

Solved this way:

if( ! $search_criteria['start_date'] ){
    unset( $search_criteria['start_date'] );
}
if( ! $search_criteria['end_date'] ){
    unset( $search_criteria['end_date'] );
}

Add capabilities to the download

There should be an option to make the url extra secure. So that only logged in people (with the correct capabilities export can download the file. Otherwise receive a 404 or 403.

The problem with a 403 is that you know the URL is correct. Not sure if that's really a security issue when it is behind a login, but still.

Also, to enable security for EVERY form, and not being able to override it via form-settings hooks, we introduce a GFEXCEL_SECURED_DOWNLOADS constant. When it is set, every form should be considered secured.

Notification of missing dependencies

The plugin should "throw" some backend notifications to let users know they are missing some dependancies (php-zip for instance, or the minimal php version).

DateField.php

Sorry for opening a new issue. Was trying to understand why the Date transformer is missing.
I'd love to help, but my time is no-time, so if you mind to implement it, I can assure you I will donate (well, I will even if you say "do it yourself!" 😂).

By the way, the date format is specified in the field: https://snag.gy/Og6pPL.jpg
So correct me if I'm wrong but all the info to implement it should be there.

Thanks

Catch errors, and give nice feedback

If the plugin fails at the download level, we get the generic 500 page, and no feedback.
This should be placed in a try/catch (pokémon style), and returned to the user in a readable style, with some additional info to get support.

Translation functions to the standard translation functions.

Hello,
I need to add translations for the plugin. I'm using Poedit to scanning the translations. The plugin is using custom functions translate() to populate translation functions. I can scan translate() function strings if string is inside function by adding custom source keyword translate to the Poedit.

But this line 878 isn't possible to scan with Poedit. I would recommend to use standard WordPress functions __(), _x() to translate the strings. Or can you tell me how you are maintaining the translations, thanks!

https://github.com/doekenorg/gf-entries-in-excel/blob/cdbd9da0fac41052940eca3531cb2f8877533dc6/src/GFExcelAdmin.php#L878

Add `created_by` meta field

Should add the possibility of opting for:

  1. The user id
  2. A (dropdown selection of) name type (Full name, first name. normal stuff).

Regenerate download slug

For security reasons we need to be able to change the download slug / hash for a form. Although the hash is generated via the NONCE_SALT in the wp-config.php, this means that to invalidate the url, we'd be invalidating every url; which isn't ideal.

A better solution would be to add a form specific salt, which can be updated / regenerated.

add `[gfexcel_download_url]` shortcode

Or even maybe something like [gfexcel_download_url form=2] to use in a page. We've have at least one user who used the url inside his site.

And also we can use this to attach the download link to a notification, so when we get the notification, we can immediately download the file.

Also add a type option for csv or xlsx.

Duplicating a form copies the download url

The download url should not be duplicated. Perhaps there is a hook we can use to

a) generate a new one
b) just zero it out, and let a new one be generated by the user.

Add currency formatting to numeric fields

In response to this ticket we should add a currency formatting for NumericValue.

PhpSpreadSheet has support for this by adding a NumberFormat::FORMAT_* to

$cell->getStyle()->getNumberFormat()->setNumberFormat()

But the predefined options are minimal; only containing dollar and euro. It should be easy to format as "currency" and provide some options like:

  • placing of currency symbol (start or end)
  • formatting of the numeric value (comma's or periods)
  • Overwriting the currency symbol (and automatically fill it from currency fields)

Opt-in for the download url

As part of the next release, the url should be opt-in. Add an enable/disable button for the url. Disabling will unset the hash, and enabling will set it. This means more security, as forms will have to actively enable the urls.

Take a look at `openspout/openspout`

Seems to have a lot less memory usage and it provides almost everything the plugin requires at this point.

Setting a max cell width could be a problem. And maybe autosize.

Download single entry from entry page

It would be nice to have a download button on the entry page that renders the excel from that spot. Needs research on how this action can be added and triggered. Some custom action hook?

Add filters to the url

Since we use the default search filters from Gravity Forms, it would be cool if we could add those filters via POST and GET.

We need to come up with some url structure that is easy to read and write, since there are so many operators <, >, =, >=, <=, <>, contains, like, is, is not, in, not in

?filter=1:value;2.4:contains:value;3:>:5

Something like that, where we explode on ; to get all filters, and then explode those on :.
Then we can make some assumptions like:

  • 1 array item is field isset
  • 2 array items means key[0] equals value[1]
  • 3 array items means key[0] operator[1] value[2]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.