Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
// Report.php <?php
require_once "../../../load.koolreport.php";
use \koolreport\KoolReport; use \koolreport\processes\Group; require_once "Json.php";
class Report extends KoolReport {
public function settings()
{
return array(
"dataSources"=>array(
"data"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"data"=>$result,
"dataFormat"=>"table",
)
)
);
}
protected function setup()
{
$this->src('data')
->pipe($this->dataStore('data'));
}
}
//ReportBoard.View.php <div class="report-content">
<div class="text-center">
<h1>Reportes</h1>
<p class="lead">
<?php \koolreport\inputs\Select::create(array(
"name"=>"data",
"dataStore"=>$this->dataStore("NomSSSbre"),
"dataBind"=>"Nombre",
"value"=>"Id",
)); ?>
</p>
</div>
</div>
//JSON API <?php
$user = $this->board()->app()->user();
$userInfo = ConnectDB::table("users")->where("id",$user->id())->run()->get(0);
$tkos = $userInfo["token"];
// TRAER TODOS LOS PROYECTOS
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'url',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: '.$token
),
));
$response = curl_exec($curl);
curl_close($curl);
$arr = json_decode($response, true);
$result = [];
foreach($arr['projects'] as $project) {
array_push($result, [
"Nombre"=>$project["name"],
"Id"=>$project["id"],
]);
}
print_r($result)
Array ( [0] => Array ( [Name] => Project1 [Id] => 8 ) [1] => Array ( [Name] => Project2 [Id] => 12 ) [2] => Array ( [Name] => Project3 [Id] => 7 ) [3] => Array ( [Name] => Project4 [Id] => 13 ) [4] => Array ( [Name] => Project5 [Id] => 9 ) [5] => Array ( [Name] => Project6 [Id] => 11 ) [6] => Array ( [Name] => Project7 [Id] => 15 ) [7] => Array ( [Name] => Project8 [Id] => 1 ) [8] => Array ( [Name] => Project9 [Id] => 10 ) [9] => Array ( [Name] => Project10 [Id] => 14 ) )
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo