Menu

Quick Start

Leonid Martynov

Let's see as in example how quickly you can develop easy report

0.Include class

include 'repdesigner.php';

1.We create instance

$rd = new RepDesigner();

  1. We select some data, data is array of associative array values
    example
    $row['A'] = 'Field value';
    $row['B'] = '1';
    $row['C'] = '2';
    $data[]=$row;
    ....
    $data[]=$row;
    ans so on

  2. We setting this array to a source

$rd->SetSourceData($data);

!Important noe! You can use Cache! Or select each time data again, cache saved as post data on the web page of user
turn on cache
$rd->cache_on = true;

if(!$rd->ValidateCache())
{
\Then selkect data again , cache_ttl is regulating minutes to live
$rd->SetSourceData($data);
}

  1. We assign key table rows

$rd->SetHorizontal(["month","city"]);

  1. We assign key table cols

$rd->SetVertical(["salesman","product"]);

  1. We assign data cells

$rd->SetData(["qty","sum"]);

  1. Labels for data cells

$rd->labels['qty'] = 'pcs';
$rd->labels['sum'] = 'usd';

  1. title and Description

$rd->title = 'PHP reportDesigner Demo';
$rd->description = 'Demo report';

  1. Call operation controller (you must provide css file and path to mpdf lib to download pdf reports)

$rd->PerformIfAction('./reporter.css','','','./pdf/mpdf.php');

  1. Transforming data

$rd->TransformData();

  1. Now write html , do not forget prerequisites (JQUERY,JS for repdesigner,CSS file)

    <link rel="stylesheet" href="./css/reporter.css"/>
    <script type="text/javascript" src="./js/jq.js"></script>
    <script type="text/javascript" src="./js/repdesigner.js"></script>
    12. Just out the table

<?php
echo $rd->DrawTb();
?>

DONE!