Hello Everyone!
I have started following this link: How to use KoolReport in Codeigniter?. However, when I tried adding a parameter, this error occurs: "Unable to locate the specified class: Session.php"
Here is what I have successfully done:
- My Installation included the following versions of files: koolreport_4.5.1 codeigniter_1.8.0
- I have created the koolreport_assets folder in the assets folder
- I have placed my report and its view in the reports folder located inside the application folder.
- This is the code of my controller:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH."/reports/SecuritySummary.php";
class Welcome extends CI_Controller {
public function index()
{
$report = new SecuritySummary(array("whereCond"=>access::ses('whereCond')));
$report->run()->render();
}
}
- This is the code of the report:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH."libraries\koolreport\core\autoload.php";
use \koolreport\KoolReport;
use \koolreport\processes\Filter;
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Limit;
class SecuritySummary extends \koolreport\KoolReport
{
use \koolreport\codeigniter\Friendship;
use \koolreport\clients\Bootstrap;
public function settings()
{
$config = include(PATM_LIBRARIESDIR."koolreport/config.php");
return array(
"assets"=>array(
"path"=>"../../assets/koolreport_assets",
"url"=>"assets/koolreport_assets",
),
"dataSources"=>array(
"systems_db"=>$config["systemsdb"]
)
);
}
protected function setup(){
$this->src('systems_db')
->query("
SELECT
ts.sec_UserNameId AS UserId,
tul.u_Uname,
CONCAT_WS(' ', tul.u_Uname, '~', tul.u_LastName, tul.u_FirstName,
IF (tul.u_SuffixName = 'NONE' OR tul.u_SuffixName LIKE '%n/a%' OR tul.u_SuffixName LIKE '%n\\a%', '', tul.u_SuffixName),
IF (tul.u_MiddleName = 'NONE' OR tul.u_MiddleName LIKE '%n/a%' OR tul.u_SuffixName LIKE '%n\\a%', '', tul.u_MiddleName)
) AS `User`,
Count(tul.u_Uname) AS Ilan,
ts.sec_In,
ts.sec_Out
FROM
tblsec AS ts
INNER JOIN
tbluserlist AS tul ON tul.u_Id = ts.sec_UserNameId
WHERE
@whereCond
GROUP BY
ts.sec_UserNameId
ORDER BY
tul.u_LastName ASC
")
->params(array(
"@whereCond"=>$this->params["whereCond"]
))
->pipe($this->dataStore('column_chart'));
}
}?>
- This is the code of the view of the report:
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\ColumnChart;
?>
<?php
ColumnChart::create(array(
"dataStore"=>$this->dataStore('column_chart'),
"columns"=>array(
"User"=>array(
"type"=>"string",
),
"Ilan"=>array(
"label"=>"Frequency",
"type"=>"number",
)
),
"width"=>"100%",
));
echo '<br>';
Table::create(array(
"dataStore"=>$this->dataStore('column_chart'),
"columns"=>array(
"User"=>array(
"type"=>"string",
),
"Ilan"=>array(
"label"=>"Frequency",
"type"=>"number",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
Thank you in advance for your help and assistance!