Пример #1
0
 $dbconfig = $config->Database;
 $db = new Database($dbconfig['host'], $dbconfig['user'], $dbconfig['pass'], $dbconfig['name']);
 if (!$db) {
     throw new Exception("Couldn't connect to the database.");
 }
 $subjects = $db->listSubjects();
 foreach ($subjects as $subject) {
     //Skip subjects that don't match $label, if necessary
     if (!empty($label) && $subject['subjectLabel'] !== $label) {
         continue;
     }
     //skip unlocked subjects
     if ((int) $subject['locked'] == 0) {
         continue;
     }
     $xml = getSubjectDataAsXml($subject['subjectLabel'], $db);
     //        header('Content-type: application/xml');
     //        print $xml->saveXML();die;
     //get /final/data
     $xpath = new DOMXPath($xml);
     $result = $xpath->query('/result/final/data');
     if (!$result || !$result->length) {
         die;
     }
     $finalxml = $result->item(0);
     $hasEDU_OCCU = xmlHasValuesForFields($finalxml, $EDU_OCCU);
     $hasHI = xmlHasValuesForFields($finalxml, $HI);
     if ($hasEDU_OCCU && $hasHI) {
         $found[] = $subject['subjectLabel'];
     }
 }
Пример #2
0
    $format = strtolower(trim($_GET['format']));
}
$subjectLabel = trim(strtoupper($_GET['label']));
$xml = "";
try {
    $config = new \NRG\Configuration("../config.ini.php");
    $dbconfig = $config->Database;
    $db = new Database($dbconfig['host'], $dbconfig['user'], $dbconfig['pass'], $dbconfig['name']);
    if (!$db) {
        throw new Exception("Couldn't connect to the database.");
    }
    $xml = NULL;
    if ($final) {
        $xml = getSubjectFinalDataAsXML($subjectLabel, $db);
    } else {
        $xml = getSubjectDataAsXml($subjectLabel, $db);
        /** WARNING: This function caches the XSL file. */
        $result = applyXSLtoXML($xml, XSL_SUBJECT_DATA);
        //    header('Content-type: application/xml');
        //    print $xml->saveXML();die;
        $xml = new DomDocument();
        $xml->loadXML($result);
        //    header('Content-type: application/xml');
        //    print $xml->saveXML();die;
        $rows = $xml->getElementsByTagName('rows')->item(0);
        $hasDiff = diffRows($rows);
    }
} catch (Exception $e) {
    ajax_error($e->getMessage());
}
$content_type = 'application/xml';