Skip to content

Commit

Permalink
Fix filling and retrieving of oai_education table
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Dec 10, 2021
1 parent 5c5c7cb commit aaaec85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions oai-pmh/management/educational.php
Expand Up @@ -31,7 +31,7 @@ function createEducationalTable() {
global $xerte_toolkits_site;
$prefix = $xerte_toolkits_site->database_table_prefix;

$q = "CREATE TABLE IF NOT EXISTS {$prefix}oai_educational(
$q = "CREATE TABLE IF NOT EXISTS {$prefix}oai_education(
education_id INT(11) PRIMARY KEY NOT NULL,
term_id VARCHAR(63) NOT NULL,
label VARCHAR(255) NOT NULL)";
Expand All @@ -46,7 +46,7 @@ function clearEducationalTable() {
$q = "delete from {$xerte_toolkits_site->database_table_prefix}educationlevel";
db_query($q);

$q = "delete from {$xerte_toolkits_site->database_table_prefix}oai_educational";
$q = "delete from {$xerte_toolkits_site->database_table_prefix}oai_education";
db_query($q);
}

Expand All @@ -55,15 +55,15 @@ function insertEducational($termID, $label){
$prefix = $xerte_toolkits_site->database_table_prefix;

$q = "INSERT INTO {$xerte_toolkits_site->database_table_prefix}educationlevel(educationlevel_name) VALUES (?)";
db_query($q,array($label));
$res = db_query($q,array($label));

$q2 = "SELECT educationlevel_id,educationlevel_name FROM {$xerte_toolkits_site->database_table_prefix}educationlevel WHERE educationlevel_name like ?";
$result = db_query($q2,array($label));
$return_id = $result[0]['educationlevel_id'];

$q3 = "INSERT INTO {$xerte_toolkits_site->database_table_prefix}oai_educational(education_id,term_id,label) VALUES (?,?)";
$q3 = "INSERT INTO {$xerte_toolkits_site->database_table_prefix}oai_education(education_id,term_id,label) VALUES (?,?,?)";
$params = array($return_id,$termID,$label);
db_query($q3,$params);
$res = db_query($q3,$params);

}

Expand Down
4 changes: 2 additions & 2 deletions oai-pmh/xerteobjects.php
Expand Up @@ -88,7 +88,7 @@ function get_meta_data($template_id, $creator_user_name="", $template_type_name=

if (isset($xml['metaEducation'])) {
// query oai-education
$q = "select * from {$xerte_toolkits_site->datatabase_table_prefix}oai_educational where label=?";
$q = "select * from {$xerte_toolkits_site->datatabase_table_prefix}oai_education where label=?";
$params = array((string)$xml["metaEducation"]);
$cat = db_query_one($q, $params);
if ($cat !== false) {
Expand All @@ -101,7 +101,7 @@ function get_meta_data($template_id, $creator_user_name="", $template_type_name=
}
}
else
$xerteMetaObj->domain = 'unknown';
$xerteMetaObj->level = 'unknown';

$xerteMetaObj->language = (string)$xml['language'];
$xerteMetaObj->publisher = $config['institute'];
Expand Down

0 comments on commit aaaec85

Please sign in to comment.