Example #1
0
 /**
  * {@inheritdoc}
  */
 public function render(ReportInterface $report, Data $data)
 {
     if (null !== $data->getData()) {
         $rendererData = array('report' => $report, 'values' => $data->getData(), 'labels' => array_keys($data->getData()));
         $rendererConfiguration = $report->getRendererConfiguration();
         return $this->templating->render($rendererConfiguration["template"], array('data' => $rendererData, 'configuration' => $rendererConfiguration));
     }
     return $this->templating->render("SyliusReportBundle::noDataTemplate.html.twig", array('report' => $report));
 }
Example #2
0
 function it_renders_data_with_given_configuration(ReportInterface $report, Data $reportData, $templating)
 {
     $reportData->getData()->willReturn(array('month1' => '50', 'month2' => '40'));
     $renderData = array('report' => $report, 'values' => array('month1' => '50', 'month2' => '40'), 'labels' => array('month1', 'month2'));
     $report->getRendererConfiguration()->willReturn(array('template' => 'SyliusReportBundle:Chart:default.html.twig'));
     $templating->render('SyliusReportBundle:Chart:default.html.twig', array('data' => $renderData, 'configuration' => array('template' => 'SyliusReportBundle:Chart:default.html.twig')))->willReturn('<div>Chart Report</div>');
     $this->render($report, $reportData)->shouldReturn('<div>Chart Report</div>');
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function render(ReportInterface $report, Data $data)
 {
     if (null !== $data->getData()) {
         $data = ['report' => $report, 'values' => $data->getData(), 'labels' => $data->getLabels(), 'fields' => array_keys($data->getData())];
         $rendererConfiguration = $report->getRendererConfiguration();
         return $this->templating->render($rendererConfiguration['template'], ['data' => $data, 'configuration' => $rendererConfiguration]);
     }
     return $this->templating->render('SyliusReportBundle::noDataTemplate.html.twig', ['report' => $report]);
 }
 function it_renders_data_with_given_configuration(ReportInterface $report, Response $response, Data $reportData, $templating)
 {
     $reportData->getLabels()->willReturn(array('month', 'user_total'));
     $reportData->getData()->willReturn(array('month1' => '50', 'month2' => '40'));
     $renderData = array('report' => $report, 'values' => array('month1' => '50', 'month2' => '40'), 'labels' => array('month', 'user_total'), 'fields' => array('month1', 'month2'));
     $report->getRendererConfiguration()->willReturn(array('template' => 'SyliusReportBundle:Table:default.html.twig'));
     $templating->renderResponse('SyliusReportBundle:Table:default.html.twig', array('data' => $renderData, 'configuration' => array('template' => 'SyliusReportBundle:Table:default.html.twig')))->willReturn($response);
     $this->render($report, $reportData)->shouldReturn($response);
 }
Example #5
0
 function it_renders_data_with_given_configuration(ReportInterface $report, Data $reportData, $templating)
 {
     $reportData->getLabels()->willReturn(['month', 'user_total']);
     $reportData->getData()->willReturn(['month1' => '50', 'month2' => '40']);
     $renderData = ['report' => $report, 'values' => ['month1' => '50', 'month2' => '40'], 'labels' => ['month', 'user_total'], 'fields' => ['month1', 'month2']];
     $report->getRendererConfiguration()->willReturn(['template' => 'SyliusReportBundle:Table:default.html.twig']);
     $templating->render('SyliusReportBundle:Table:default.html.twig', ['data' => $renderData, 'configuration' => ['template' => 'SyliusReportBundle:Table:default.html.twig']])->willReturn('<div>Table Report</div>');
     $this->render($report, $reportData)->shouldReturn('<div>Table Report</div>');
 }