Hi,
I have a SalesByCustomer class in which I set the assets folder which is at same level as codeigniter application folder.
Also using a codeigniter controller to load the koolreport report.
It seems despite setting the assets path and url, the default route (libraries/koolreport/src/clients...) is maintained by the publishAssetFolder from the RessourceManager. As such I'm unable to render the charts.
Could someone help in understanding why this behavior is happening and what options to solve it?
Thanks
//SalesByCustomer class
<?php
require APPPATH."libraries/koolreport/core/autoload.php";
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
use \koolreport\processes\StringCase;
class SalesByCustomer extends \koolreport\KoolReport
{
use \koolreport\codeigniter\Friendship;
public function settings()
{
return array(
"assets"=>array(
"path"=>"../../assets",
"url"=>"/assets"
)
);
}
//Reports codeigniter class
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH."reports/SalesByCustomer.php";
class Reports extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
}
public function index($page = 'reportHome')
{
if ( ! file_exists(APPPATH.'views/reports/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$report['report'] = new SalesByCustomer;
//$this->load->view('templates/header', $data);
$this->load->view('reports/'.$page, $report);
//$this->load->view('templates/footer');
}
}
//Reportview codeigniter
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<style>
.customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
</style>
<div class="text-center">
<h1>Sales Report</h1>
<h4>This report shows top 10 sales by customer</h4>
</div>
<hr/>
<?php
BarChart::create(array(
"dataStore"=>$report->dataStore('sales_by_customer'),
"width"=>"100%",
"height"=>"500px",
"columns"=>array(
"cod"=>array(
"label"=>"Customer"
),
"importe"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"€",
)
),
"options"=>array(
"title"=>"Sales By Customer"
)
));
?>