KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

KoolReport is not defined #836

Open Zorica Chestojanova opened this topic on on Apr 27, 2019 - 7 comments

Zorica Chestojanova commented on Apr 27, 2019

Hello, I'm pretty new in koolreport, so i start with my first report and when run i got this error "KoolReport is not defined" in this line KoolReport.widget.init({"js":["assets...

David Winterburn commented on Apr 27, 2019

Hi Zorica,

Would you please let us know your environment setup (OS, server, directory project, etc) and post your report file's php code so we could check the problem for you. Thanks!

Zorica Chestojanova commented on Apr 28, 2019

Yes, OS is windows and here i use koolreport in codeingniter project so my report has Report.php file, and reports folder with MyReport.php and MyReport_view.php files

Zorica Chestojanova commented on Apr 28, 2019

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();
}

}

?>

Zorica Chestojanova commented on Apr 28, 2019

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'));
}

}

?>

Zorica Chestojanova commented on Apr 28, 2019

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>

David Winterburn commented on Apr 30, 2019

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!

Zorica Chestojanova commented on Apr 30, 2019

Ok thanks but i solved it, it was only renaming my view, the view files should be called MyReport.view.php if file with database setup is called MyReport.php

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

None