Jump to content

Export: Difference between revisions

From NusaATK
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:


== Hooks ==
== Hooks ==
The export action handler supports the following [[Hooks]]:


=== getExportAttributes ===
=== getExportAttributes ===


Default the export shows all attributes to export (except for the atkDummyAttribute, atkTabbedPaneAttribute and attributes that contains the word image). You can override this function in your own node like this:
Default the export shows all attributes to export (except for the [[atkDummyAttribute]], [[atkTabbedPaneAttribute]] and attributes that contain the word 'image'). You can override this function in your own node like this:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
  function getExportAttributes(&$handler)
public function getExportAttributes($handler)
  {
{
     $attribs = $handler->getExportAttributes();
     $attribs = $handler->getExportAttributes();
     unset($attribs['visits']);
     unset($attribs['visits']);
     return $attribs;
     return $attribs;
  }
}
</syntaxhighlight>
</syntaxhighlight>


Line 26: Line 28:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
function getExportAttributeGroup($attributename)
public function getExportAttributeGroup($attributename)
  {
{
     if (in_array($attributename, array("address", "address2", "zipcode", "city", "state", "country"))) return "organization_visitaddress";
     if (in_array($attributename, array("address", "address2", "zipcode", "city", "state", "country"))) return "organization_visitaddress";
     if (strpos($attributename, "mail_") === 0) return "organization_mailaddress";
     if (strpos($attributename, "mail_") === 0) return "organization_mailaddress";
     if (strpos($attributename, "invoice_") === 0) return "organization_invoiceaddress";
     if (strpos($attributename, "invoice_") === 0) return "organization_invoiceaddress";
  }
}


</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 10:48, 12 February 2010

ATK Action Handler: export
Implemented by the atkExportHandler class

API docs

Overview of all ATK action handlers
Alphabetical list

File:Action Export.png
export action screenshot

Export can be enabled by using the NF_EXPORT flag. This presents the user with a link to export their data to, for example, a CSV file which can then be used in Excel.


Hooks

The export action handler supports the following Hooks:

getExportAttributes

Default the export shows all attributes to export (except for the atkDummyAttribute, atkTabbedPaneAttribute and attributes that contain the word 'image'). You can override this function in your own node like this:

public function getExportAttributes($handler)
{
    $attribs = $handler->getExportAttributes();
    unset($attribs['visits']);
    return $attribs;
}


getExportAttributeGroup

Default every tab will become a group of attributes in the export screen, you can also define those groups yourself by creating an override like this:

public function getExportAttributeGroup($attributename)
{
    if (in_array($attributename, array("address", "address2", "zipcode", "city", "state", "country"))) return "organization_visitaddress";
    if (strpos($attributename, "mail_") === 0) return "organization_mailaddress";
    if (strpos($attributename, "invoice_") === 0) return "organization_invoiceaddress";
}