Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
This is Report.php controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once FCPATH . "application/reports/MyReport.php";
class Report extends MY_Controller {
public function index()
{
$report = new MyReport;
$report->run()->render();
}
}
?>
This is MyReport.php file
<?php //MyReport.php require FCPATH ."application/libraries/koolreport/autoload.php";
use \koolreport\processes\Group; use \koolreport\processes\Sort; use \koolreport\processes\Limit;
class MyReport extends \koolreport\KoolReport {
use \koolreport\clients\Bootstrap;
function settings()
{
return array(
"assets"=>array(
"path"=>"../../assets",
"url"=>"assets",
),
"dataSources"=>array(
"automaker"=>array(
"connectionString"=>"mysql:host=localhost;dbname=robot_ogp",
"username"=>"root",
"password"=>"zorica",
"charset"=>"utf8"
)
)
);
}
function setup()
{
$ymd = date("2018-12-11");
$this->src('automaker')
->query("SELECT partner,SUM(CASE WHEN status<=2 AND `type`=3 THEN instance END) AS active, SUM(CASE WHEN status>2 THEN instance END) AS created FROM player WHERE instance=1 AND created_date>='{$ymd}' GROUP BY partner")
->pipe($this->dataStore('player'));
}
}
?>
And here is MyReport_view.php file
<?php
use \koolreport\widgets\koolphp\Table;
?> <div class="report-content">
<div class="text-center">
<h1>Active Players</h1>
<p class="lead">Player Table</p>
</div>
<?php
Table::create(array(
"dataSource"=>$this->dataStore('player'),
"columns"=>array(
"partner",
"active",
"created"
)
));
?>
</div>
Hi Zorica,
Please try using our CodeIgniter package with your report and let us know if it solves your problem:
https://www.koolreport.com/packages/codeigniter
Thanks!
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo