Created
February 5, 2014 13:18
-
-
Save GiovanniK/8823425 to your computer and use it in GitHub Desktop.
Montessori college rooster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://beheer.e-poc.nl/onderwijs/plugins/montessori/website/rooster_groesbeek.php'; | |
preg_match_all("/<tr>(.+)<\/tr>/siU", @file_get_contents($url), $matches); | |
preg_match_all("/<td colspan=\"5\" class=\"title\">(.+)<\/tr>/siU", @file_get_contents($url), $titles); | |
$titles_count = count($titles); | |
$changes = $matches[0]; | |
$changes = str_replace ('<td colspan="5"> </td>', '', $changes); | |
// Rewrite titles | |
if ($titles_count >= 2) | |
{ | |
for ($i = 0; $i <= $titles_count - 1; $i++) | |
{ | |
$new_title = str_replace ('</td>', '', $titles[1][$i]); | |
$new_title = '</table><h1>' . $new_title . '</h1><br><table class="table table-striped">'; | |
$changes = str_replace ($titles[0][$i], $new_title, $changes); | |
} | |
} | |
else | |
{ | |
$new_title = str_replace ('</td>', '', $titles[1][0]); | |
$new_title = '</table><h1>' . $new_title . '</h1><br><table class="table table-striped">'; | |
$changes = str_replace ($titles[0][0], $new_title, $changes); | |
} | |
?> | |
<html> | |
<head> | |
<title>Rooster wijzigingen Montessori College Groesbeek</title> | |
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> | |
</head> | |
<body> | |
<div class="container"> | |
<table class="table table-striped"> | |
<?php foreach ($changes as $change): ?> | |
<?php echo $change; ?> | |
<?php endforeach; ?> | |
</table> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment