Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Not yet, but you can query directly to database of CI with simple line of settings code, please download new version of KoolReport (2.75.0) from here and get the CodeIgniter package. You can directly put query to database, if you want to use querybuilder, you can get QueryBuilder package. It is very convenient to use and those packages are free.
Yes, sure, you do this:
In the controller, suppose you have an array of associate array name $myarray
$report = new MyReport(array(
"myarray"=>$myarray
));
$report->run();
In the MyReport.php
class MyReport extends \koolreport\KoolReport
{
public function settings()
{
return array(
"dataSources"=>array(
"myarray_source"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"associate",
"data"=>$this->params["myarray"]
),
)
);
}
function setup()
{
$this->src("myarray_source")
->pipe(...)
...
}
}
hi , i have some error... data not showing. please help
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH."/reports/MyReport.php";
class Welcome extends CI_Controller {
public function index()
{
$myarray = ["ketoprak","lengko","ayam"];
$report = new MyReport(array(
"myarray"=>$myarray
));
$report->run();
}
}
<?php
//MyReport.php
require APPPATH."/libraries/koolreport/autoload.php";
class MyReport extends \koolreport\KoolReport
{
use \koolreport\clients\Bootstrap;
public function settings()
{
return array(
"dataSources"=>array(
"myarray_source"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"table",
"data"=>[$this->params["myarray"]
),
)
);
}
function setup()
{
$this->src("myarray_source")
->pipe(
$this->dataStore("data")
);
}
}
<?php
//MyReport.view.php
use \koolreport\widgets\koolphp\Table;
?>
<html>
<head>
<title>MyReport</title></title>
</head>
<body>
<h1>MyReport</h1>
<h3>List all offices</h3>
<?php
Table::create(array(
"dataStore"=>$this->dataStore("data"),
"class"=>array(
"table"=>"table table-hover"
)
));
?>
</body>
</html>
Hi all, I am trying to make module with controllers and views by using this example: https://www.koolreport.com/forum/topics/31
I am having problem that my data does not load at all. Looks like that view isn't getting any data for dataStore
My controller:
<?php
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');
require MODULES_PATH."/reporting/libraries/MyReport.php";
class Dashboard extends Fuel_base_controller {
function __construct()
{
parent::__construct();
$this->load->config('reporting');
$config = $this->config->item('reporting');
$this->_validate_user($config['permission']);
$this->load->vars($config);
}
function index()
{
$report = new MyReport;
// $report->run()->render();
// $report->run();
$this->load->view('reporting_dashboard');
}
}
View:
<?php
//reporting_dashboard.php view
use \koolreport\widgets\koolphp\Table;
?>
<h1>Report</h1>
<h3>Detailed chart table</h3>
<?php
$data = array(
array("category"=>"Books","sale"=>32000,"cost"=>20000,"profit"=>12000),
array("category"=>"Accessories","sale"=>43000,"cost"=>36000,"profit"=>7000),
array("category"=>"Phones","sale"=>54000,"cost"=>39000,"profit"=>15000),
array("category"=>"Movies","sale"=>23000,"cost"=>18000,"profit"=>5000),
array("category"=>"Others","sale"=>12000,"cost"=>6000,"profit"=>6000)
);
Table::create(array(
// "dataStore"=>$data,
"dataStore"=>$this->dataStore("korisnici"),
"class"=>array(
"table"=>"table table-hover"
)
));
?>
When local array $data is used, table is displayed properly. But dataStore not. I wand to load view by using __$this->load->view('reporting_dashboard'); __ if possible. I had to comment line //$report->run()->render(); because it does render data and show in some strange way with Heading on top " "
Does anyone knows what could be wrong and how can I check is dataStore passed to view?
Update: I have discovered error pointing to dataStore
I do not know why and how to resolve this.
Thanks!
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo