' . "\n"); // // connect to the database // echo "Opening database\n"; $dbh=mysql_connect("$hostname","$username","$dbpassword") or die("\nCould not connect: " . mysql_errno() . ": " . mysql_error()); mysql_select_db("$db") or die("\nSelect failed: " . mysql_errno() . ": " . mysql_error()); // // Generate metadata for all the essential resources // $query="select * from essentials where status='y'"; $sth=mysql_query($query) or die("\nQuery failed: " . mysql_error() . "
SQL = " . $query); $num_rows = mysql_num_rows($sth); if ($num_rows==0) { echo "\nNo essential records found!\n"; } else { echo "\n" . $num_rows . " Essential records found!\n"; while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $title=$row['title']; $id=$row['id']; $type=$row['esstype']; if ($type==='download') { $type='downloads'; } if ($type==='website') { $type='websites'; } $desc=$row['brief_desc']; // write the XML metadata for this resource fwrite($handle, '' . "\n"); fwrite($handle, '<langstring xml:lang="en">' . $title . '</langstring>' . "\n"); fwrite($handle, 'URIhttp://essentials.e2bn.net/' . $type . '/display.php?id=' . $id . '' . "\n"); fwrite($handle, 'en' . $desc . '' . "\n"); $agglevel=''; fwrite($handle, 'LOMv1.0' . $agglevel . '' . "\n"); $cdate=$row['date_created']; $email=$row['email']; $est=$row['establishment']; fwrite($handle, 'LOMv1.0publisher BEGIN:VCARD FN:' . $est . ' EMAIL;TYPE=INTERNET:' . $email . ' END:VCARD ' . $cdate . '' . "\n"); $keystages=$row['keystages']; if (strpos($keystages,'Foundation')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKSFoundation' . "\n"); } if (strpos($keystages,'KS1')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS1' . "\n"); } if (strpos($keystages,'KS2')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS2' . "\n"); } if (strpos($keystages,'KS3')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS3' . "\n"); } if ( ((!strpos($keystages,'KS4+')) and (strpos($keystages,'KS4'))) or (strpos($keystages,'KS4 ')) ) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4' . "\n"); } if (strpos($keystages,'KS4+')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4+' . "\n"); } $subjects=explode(' ',$row['subjects']); // split into seperate subjects $size=count($subjects); // get no. of subjects for ($i=0; $i < $size; $i++) { if ($subjects[$i]!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: Teaching' . $subjects[$i] . '' . "\n"); } } // finish off the metadata fwrite($handle, "\n"); } // eof while } // eof rows check // // Generate metadata for all the news items // $query="select * from e2bnnews where status='y'"; $sth=mysql_query($query) or die("\nQuery failed: " . mysql_error() . "
SQL = " . $query); $num_rows = mysql_num_rows($sth); if ($num_rows==0) { echo "\nNo news items found!\n"; } else { echo "\n" . $num_rows . " news items found!\n"; while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $title=$row['title']; $id=$row['id']; $desc=$row['brief_desc']; // write the XML metadata for this resource fwrite($handle, '' . "\n"); fwrite($handle, '<langstring xml:lang="en">' . $title . '</langstring>' . "\n"); fwrite($handle, 'URIhttp://news.e2bn.net/display.php?nid=' . $id . '' . "\n"); fwrite($handle, 'en' . $desc . '' . "\n"); $agglevel=''; fwrite($handle, 'LOMv1.0' . $agglevel . '' . "\n"); $cdate=$row['start_date']; $email=$row['contact_email']; $est=$row['establishment']; fwrite($handle, 'LOMv1.0publisher BEGIN:VCARD FN:' . $est . ' EMAIL;TYPE=INTERNET:' . $email . ' END:VCARD ' . $cdate . '' . "\n"); /* // NO METADATA ON NEWS ITEMS CURRENTLY $keystages=$row['keystages']; if (strpos($keystages,'Foundation')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKSFoundation' . "\n"); } if (strpos($keystages,'KS1')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS1' . "\n"); } if (strpos($keystages,'KS2')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS2' . "\n"); } if (strpos($keystages,'KS3')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS3' . "\n"); } if ( ((!strpos($keystages,'KS4+')) and (strpos($keystages,'KS4'))) or (strpos($keystages,'KS4 ')) ) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4' . "\n"); } if (strpos($keystages,'KS4+')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4+' . "\n"); } $subjects=explode(' ',$row['subjects']); // split into seperate subjects $size=count($subjects); // get no. of subjects for ($i=0; $i < $size; $i++) { if ($subjects[$i]!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: Teaching' . $subjects[$i] . '' . "\n"); } } */ // finish off the metadata fwrite($handle, "\n"); } // eof while } // eof rows check // // Generate metadata for all the pathe resources // $query="select * from pathe where status='y'"; $sth=mysql_query($query) or die("\nQuery failed: " . mysql_error() . "
SQL = " . $query); $num_rows = mysql_num_rows($sth); if ($num_rows==0) { echo "\nNo pathe records found!\n"; } else { echo "\n" . $num_rows . " pathe records found!\n"; while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $title=$row['title']; $id=$row['id']; $desc=$row['resource_desc']; // write the XML metadata for this resource fwrite($handle, '' . "\n"); fwrite($handle, '<langstring xml:lang="en">' . $title . '</langstring>' . "\n"); fwrite($handle, 'URIhttp://pathelib.e2bn.net/members/search.php?search=y&sorder=id&rid=' . $id . '' . "\n"); fwrite($handle, 'en' . $desc . '' . "\n"); $agglevel=''; fwrite($handle, 'LOMv1.0' . $agglevel . '' . "\n"); $email=$row['contact_email']; $est=$row['establishment']; fwrite($handle, 'LOMv1.0publisher BEGIN:VCARD FN:' . $est . ' EMAIL;TYPE=INTERNET:' . $email . ' END:VCARD ' . "\n"); $keystages=$row['keystages']; if (strpos($keystages,'Foundation')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKSFoundation' . "\n"); } if (strpos($keystages,'KS1')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS1' . "\n"); } if (strpos($keystages,'KS2')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS2' . "\n"); } if (strpos($keystages,'KS3')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS3' . "\n"); } if ( ((!strpos($keystages,'KS4+')) and (strpos($keystages,'KS4'))) or (strpos($keystages,'KS4 ')) ) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4' . "\n"); } if (strpos($keystages,'KS4+')) { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4+' . "\n"); } $subjects=explode(' ',$row['subjects']); // split into seperate subjects $size=count($subjects); // get no. of subjects for ($i=0; $i < $size; $i++) { if ($subjects[$i]!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: Teaching' . $subjects[$i] . '' . "\n"); } } // finish off the metadata fwrite($handle, "\n"); } // eof while } // eof rows check // // Generate metadata for all the local heroes resources // $query="select * from local_heroes where approved='y'"; $sth=mysql_query($query) or die("\nQuery failed: " . mysql_error() . "
SQL = " . $query); $num_rows = mysql_num_rows($sth); if ($num_rows==0) { echo "\nNo local heroes records found!\n"; } else { echo "\n" . $num_rows . " local heroes records found!\n"; while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $title=$row['name_of_hero']; $id=$row['id']; $desc=$row['heading']; // write the XML metadata for this resource fwrite($handle, '' . "\n"); fwrite($handle, '<langstring xml:lang="en">' . $title . '</langstring>' . "\n"); fwrite($handle, 'URIhttp://heroes.e2bn.net/display.php?hid=' . $id . '' . "\n"); fwrite($handle, 'en' . $desc . '' . "\n"); $agglevel=''; fwrite($handle, 'LOMv1.0' . $agglevel . '' . "\n"); $email=$row['email']; $est=$row['school']; fwrite($handle, 'LOMv1.0publisher BEGIN:VCARD FN:' . $est . ' EMAIL;TYPE=INTERNET:' . $email . ' END:VCARD ' . "\n"); if ($row['keystagef']==='Foundation') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKSFoundation' . "\n"); } if ($row['keystage1']==='Ks1') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS1' . "\n"); } if ($row['keystage2']==='Ks2') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS2' . "\n"); } if ($row['keystage3']==='Ks3') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS3' . "\n"); } if ($row['keystage4']==='Ks4') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4' . "\n"); } if ($row['keystage4plus']==='Ks4+') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4+' . "\n"); } if ($row['teachingen']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingEn' . "\n"); } if ($row['teachingma']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMa' . "\n"); } if ($row['teachingsc']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingSc' . "\n"); } if ($row['teachingdt']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingDT' . "\n"); } if ($row['teachingict']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingICT' . "\n"); } if ($row['teachinghi']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingHi' . "\n"); } if ($row['teachinggg']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingGg' . "\n"); } if ($row['teachingmfl']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMFL' . "\n"); } if ($row['teachingad']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingAd' . "\n"); } if ($row['teachingmu']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMu' . "\n"); } if ($row['teachingpe']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingPE' . "\n"); } if ($row['teachingpshe']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingPSHE' . "\n"); } if ($row['teachingci']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingCi' . "\n"); } // finish off the metadata fwrite($handle, "\n"); } // eof while } // eof rows check // // Generate metadata for all the myths resources // $query="select * from mlm where approved='y'"; $sth=mysql_query($query) or die("\nQuery failed: " . mysql_error() . "
SQL = " . $query); $num_rows = mysql_num_rows($sth); if ($num_rows==0) { echo "\nNo myths records found!\n"; } else { echo "\n" . $num_rows . " myths records found!\n"; while ($row=mysql_fetch_array($sth, MYSQL_ASSOC)) { $title=$row['name_of_hero']; $id=$row['id']; $desc=$row['heading']; // write the XML metadata for this resource fwrite($handle, '' . "\n"); fwrite($handle, '<langstring xml:lang="en">' . $title . '</langstring>' . "\n"); fwrite($handle, 'URIhttp://myths.e2bn.net/display.php?mlmid=' . $id . '' . "\n"); fwrite($handle, 'en' . $desc . '' . "\n"); $agglevel=''; fwrite($handle, 'LOMv1.0' . $agglevel . '' . "\n"); $email=$row['email']; $est=$row['school']; fwrite($handle, 'LOMv1.0publisher BEGIN:VCARD FN:' . $est . ' EMAIL;TYPE=INTERNET:' . $email . ' END:VCARD ' . "\n"); if ($row['keystagef']==='Foundation') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKSFoundation' . "\n"); } if ($row['keystage1']==='Ks1') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS1' . "\n"); } if ($row['keystage2']==='Ks2') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS2' . "\n"); } if ($row['keystage3']==='Ks3') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS3' . "\n"); } if ($row['keystage4']==='Ks4') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4' . "\n"); } if ($row['keystage4plus']==='Ks4+') { fwrite($handle, 'LOMv1.0educational levelNC Metadata Standard: KeystageKS4+' . "\n"); } if ($row['teachingen']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingEn' . "\n"); } if ($row['teachingma']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMa' . "\n"); } if ($row['teachingsc']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingSc' . "\n"); } if ($row['teachingdt']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingDT' . "\n"); } if ($row['teachingict']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingICT' . "\n"); } if ($row['teachinghi']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingHi' . "\n"); } if ($row['teachinggg']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingGg' . "\n"); } if ($row['teachingmfl']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMFL' . "\n"); } if ($row['teachingad']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingAd' . "\n"); } if ($row['teachingmu']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingMu' . "\n"); } if ($row['teachingpe']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingPE' . "\n"); } if ($row['teachingpshe']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingPSHE' . "\n"); } if ($row['teachingci']!=='') { fwrite($handle, 'LOMv1.0disciplineNC Metadata Standard: TeachingCi' . "\n"); } // finish off the metadata fwrite($handle, "\n"); } // eof while } // eof rows check // close the database mysql_close($dbh) or die("Couldn't close db connection: " . mysql_error()); // close metadata file fclose($handle); echo "\nMetadata file written\n"; ?>