<commit_before><?php
namespace Search\Widgets\Reports;

use Cake\Log\LogTrait;
use Cake\Utility\Inflector;
use Search\Widgets\Reports\BaseReportGraphs;

class TableReportWidget extends BaseReportGraphs
{
    use LogTrait;

    public $type = 'table';

    public $requiredFields = ['query'];

    /**
     * getChartData method
     *
     * Assembles graphs data from the reports config and data.
     *
     * @param array $data containing report configs and data.
     * @return array $chartData with defined chart information.
     */
    public function getChartData(array $data = [])
    {
        $labels = [];
        $report = $this->config;

        $chartData = [
            'chart' => $this->type,
            'options' => [
                'element' => $this->getContainerId(),
                'resize' => true,
            ],
        ];

        $options = [
            'data' => $data,
        ];

        $chartData['options'] = array_merge($chartData['options'], $options);

        if (!empty($data)) {
            $this->setData($chartData);
        }

        return $chartData;
    }

    /**
     * prepareChartOptions method
     *
     * Specifies JS/CSS libs for the content loading
     *
     * @param array $data passed from the widgetHandler.
     * @return array $content with the libs.
     */
    public function getScripts(array $data = [])
    {
        return [
            'post' => [
                'css' => [
                    'type' => 'css',
                    'content' => [
                        'AdminLTE./plugins/datatables/dataTables.bootstrap',
                        'https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css'
                    ],
                    'block' => 'css',
                ],
                'javascript' => [
                    'type' => 'script',
                    'content' => [
                        'AdminLTE./plugins/datatables/jquery.dataTables.min',
                        'AdminLTE./plugins/datatables/dataTables.bootstrap.min',
                        'https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js',
                        'https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js',
                        'https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js',
                        'https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js',
                        'https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js',
                        'https://cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js',
                        'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js',
                    ],
                    'block' => 'scriptBotton',
                ],
            ]
        ];
    }
}<commit_msg>Changed links to CSS and JS extenstions for datatable export (task #3832)<commit_after><?php
namespace Search\Widgets\Reports;

use Cake\Log\LogTrait;
use Cake\Utility\Inflector;
use Search\Widgets\Reports\BaseReportGraphs;

class TableReportWidget extends BaseReportGraphs
{
    use LogTrait;

    public $type = 'table';

    public $requiredFields = ['query'];

    /**
     * getChartData method
     *
     * Assembles graphs data from the reports config and data.
     *
     * @param array $data containing report configs and data.
     * @return array $chartData with defined chart information.
     */
    public function getChartData(array $data = [])
    {
        $labels = [];
        $report = $this->config;

        $chartData = [
            'chart' => $this->type,
            'options' => [
                'element' => $this->getContainerId(),
                'resize' => true,
            ],
        ];

        $options = [
            'data' => $data,
        ];

        $chartData['options'] = array_merge($chartData['options'], $options);

        if (!empty($data)) {
            $this->setData($chartData);
        }

        return $chartData;
    }

    /**
     * prepareChartOptions method
     *
     * Specifies JS/CSS libs for the content loading
     *
     * @param array $data passed from the widgetHandler.
     * @return array $content with the libs.
     */
    public function getScripts(array $data = [])
    {
        return [
            'post' => [
                'css' => [
                    'type' => 'css',
                    'content' => [
                        'AdminLTE./plugins/datatables/dataTables.bootstrap',
                        'Qobo/Utils.buttons.dataTables.min'
                    ],
                    'block' => 'css',
                ],
                'javascript' => [
                    'type' => 'script',
                    'content' => [
                        'AdminLTE./plugins/datatables/jquery.dataTables.min',
                        'Qobo/Utils.dataTables.bootstrap.min',
                        'Qobo/Utils.dataTables.buttons.min.js',
                        'Qobo/Utils.buttons.flash.min.js',
                        'Qobo/Utils.buttons.print.min.js',
                        'Qobo/Utils.pdfmake.min.js',
                        'Qobo/Utils.buttons.html5.min.js',
                        'Qobo/Utils.vfs_fonts.js',
                        'Qobo/Utils.jszip.min.js',
                    ],
                    'block' => 'scriptBotton',
                ],
            ]
        ];
    }
}
{'fraction_non_alphanumeric': 0.13406065088757396, 'fraction_numerical': 0.005917159763313609, 'mean_word_length': 1.393362831858407, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '964682', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1497, 'n_words': 259}