I got Tutorial to work on my own AFTER making several syntax corrections (noted with "rwh" below).
<?php
//index.php
require_once "SaleReport.php"; // added line rwh
$report = new SaleReport;
$report->run()->render();
<?php
//SaleReport.php
require "../koolreport/core/autoload.php";
class SaleReport extends \koolreport\KoolReport
{
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
"year"=>date("Y") // remove "," rwh
);
}
protected function bindParamsToInputs()
{
return array(
"year"=>"yearInput" // remove "," rwh
);
}
function settings()
{
return array(
"dataSources"=>array(
"mydata"=>array(
"connectionString"=>
"mysql:host=localhost;dbname=test_sales",
"username"=>"rwh",
"password"=>"1234",
"charset"=>"utf8"
)
)
); // add ";" rwh
}
function setup()
{
$this->src("mydata")
->query("select * from orders where year=:year")
->params(array(
":year"=>$this->params["year"]
))
->pipe($this->dataStore("orders_in_year")); // add ";" rwh
}
}
<?php
//SaleReport.view.php
use \koolreport\widgets\koolphp\Table;
use \koolreport\inputs\TextBox;
?>
<h1ml>
<head>
<title>SaleReport</title>
</head>
<body>
<form method="post">
<label>Year</label>
<?php TextBox::create(array(
"name"=>"yearInput" // remove "," rwh
));?>
<button>Submit</button>
</form>
<?php
Table::create(array(
"dataStore"=>$this->dataStore("orders_in_year")
));
?>
</body>
</html>