Ejemplo n.º 1
0
<?php

// Ajax
// Echo the content of a bayesian document
if (isset($_POST['id']) && filter_var($_POST['id'], FILTER_VALIDATE_INT)) {
    require_once dirname(__FILE__) . '/../../config.php';
    require_once dirname(__FILE__) . '/../../initialize.php';
    $nb = new suxNaiveBayesian();
    $doc = $nb->getDocument($_POST['id']);
    if ($doc) {
        $text = suxFunct::gtext('bayes');
        $tmp = null;
        $link = new suxLink();
        foreach ($link->getLinkTables('bayes_documents') as $table) {
            $links = $link->getLinks($table, 'bayes_documents', $_POST['id']);
            if ($links && count($links)) {
                $table = str_replace('link__', '', $table);
                $table = str_replace('bayes_documents', '', $table);
                $table = str_replace('__', '', $table);
                $tmp .= "[ {$text['to']} {$table}_id -&gt; ";
                foreach ($links as $val) {
                    $tmp .= " {$val},";
                }
                $tmp = rtrim($tmp, ', ');
                $tmp .= ' ]';
            }
        }
        echo '<em>bayes_document_id: ', $_POST['id'], '</em><br />';
        if ($tmp) {
            echo "<em><strong>{$text['is_linked']}</strong></em> ";
            echo $tmp;