<commit_before><?php
require_once "../config.php";

use \Tsugi\Core\LTIX;
use \Tsugi\UI\Analytics;

// Sanity checks
$LAUNCH = LTIX::requireData();

if ( ! $USER->instructor ) die('Must be instructor');

// View
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->topNav();
?>
<p>
<input type=submit name=doCancel onclick="location='<?php echo(addSession('index.php'));?>'; return false;" value="Back"></p>
<?php
echo(Analytics::graphBody());
$analytics_url = $CFG->wwwroot."/api/analytics";

$OUTPUT->footerStart();
echo(Analytics::graphScript(addSession($analytics_url)));
$OUTPUT->footerEnd();<commit_msg>Switch to web components<commit_after><?php
require_once "../config.php";

use \Tsugi\Core\LTIX;
use \Tsugi\UI\Analytics;

// Sanity checks
$LAUNCH = LTIX::requireData();

if ( ! $USER->instructor ) die('Must be instructor');

// View
$OUTPUT->header();
echo('<link rel=import href="'.$CFG->staticroot.'/webcomponents/tsugi/tsugi-analytics-chart.html">'."\n");
echo('<link rel=import href="'.$CFG->staticroot.'/webcomponents/tsugi/tsugi-analytics-script.html">'."\n");
$OUTPUT->bodyStart();
$OUTPUT->topNav();
?>
<p>
<input type=submit name=doCancel onclick="location='<?php echo(addSession('index.php'));?>'; return false;" value="Back"></p>
<tsugi-analytics-chart chartid="chart_div"></tsugi-analytics-chart>
<?php
$analytics_url = addSession($CFG->wwwroot."/api/analytics");

$OUTPUT->footerStart();
echo('<tsugi-analytics-script chartid="chart_div" chartdata="'.$analytics_url.'"></tsugi-analytics-script>'."\n");
$OUTPUT->footerEnd();
{'fraction_non_alphanumeric': 0.229126213592233, 'fraction_numerical': 0.0, 'mean_word_length': 6.847715736040609, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2428601', 'n_tokens_mistral': 547, 'n_tokens_neox': 541, 'n_words': 83}