include_once('omdb.inc.php');
include_once('ocdparse.inc.php');
//Debug options:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$omdb = new OMDB();
/* TESTING THE INSERTION OF CDS */
function test_insert() {
$p = new OCDParse();
$r = $p->parse_file('plangeo1.ocd');
if (!$r) {
echo "Something went awry parsing the ocd.
";
echo $p->errmsg;
die();
}
$cd_id = $omdb->CreateOrGetCDID($p->cdname, $p->cddescription);
if (!$cd_id) {
echo "Something went awry inserting the CD.
";
die();
}
$cd_def_ids = $omdb->SetDefs($cd_id, $p->cddefs);
}
/* TESTING ADDING SUPPORT */
function test_add_support() {
global $omdb;
$cd_id = $omdb->CreateOrGetCDID('plangeo1', '');
$omdb->AddCDCas($cd_id, 2);
$omdb->SetDefCasSupport(13, 2, true, true);
$omdb->SetCDCasSupport($cd_id, 2, true, true);
}
/* TESTING SHOWING THE CDS */
function test_show() {
global $omdb;
$cds = $omdb->GetCDs();
echo "CDs
";
echo "\n";
foreach($cds as $cd) {
echo "- ".$cd['cd_name']."
\n";
$defs = $omdb->GetDefs($cd['cd_id']);
echo "\n";
foreach($defs as $df) {
echo "- ".$df['def_name']."
\n";
}
echo "
\n";
}
echo "
\n";
}
function test_show2() {
global $omdb;
echo $omdb->PrintCdsWithSupport();
}
/* do */
//test_insert();
//test_add_support();
//test_show();
test_show2();
?>