Hi,
Back to this XeroConnect module. I have found some code to generate x509 keys. However once PHP generates these keys and stores them in the modules data directory I need a way to download them. I have added a button but don't know how to connect it up within your framework to download a file from module data directory. This is what my form looks like so far.
and the code so far...
<?php
//ini_set( 'error_reporting', E_ALL );
//ini_set( 'display_errors', true );
defined("_VALID_ACCESS") || die('Direct access forbidden'); // - security feature
//require_once 'x509_keys.php';
class Custom_XeroConnect extends Module { // - notice how the class name represents its path
public function body() { // - modules main code
//print('Xero Connect');
$form = $this->init_module('Libs/QuickForm');
$form->addElement('header', 'title', __('Xero Connect'));
$form->addElement('text','consumer_key',__('Consumer Key'));
$form->addElement('text','secret_key',__('Secret Key'));
$form->addElement('header', 'subtitle1', __('Certificates'));
$form->addElement('button', 'download_btn', __('Download public certificate'), $form->get_submit_form_href());
$form->addElement('button', 'cert_btn', __('Generate Certificate'), $form->get_submit_form_href());
$form->addElement('submit', 'button', __('Save'), $form->get_submit_form_href());
//echo realpath(dirname(__FILE__));
if ($form->validate()) {
$values = $form->exportValues();
var_dump($values);
$local = $this->get_data_dir();
var_dump($local);
}
$form->display();
}
public function get_x509_keys() {
}
}
?>
Regards
Glenn