Skip to content

Instantly share code, notes, and snippets.

@GiovanniK
Created February 5, 2014 13:18
Show Gist options
  • Save GiovanniK/8823425 to your computer and use it in GitHub Desktop.
Save GiovanniK/8823425 to your computer and use it in GitHub Desktop.
Montessori college rooster
<?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">&nbsp;</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