public function actionStadtrechtDokument($id) { /** @var Rechtsdokument $dok */ $dok = Rechtsdokument::model()->findByPk($id); if (!$dok) { $this->render('../index/error', ["code" => 404, "message" => "Das Dokument wurde nicht gefunden"]); Yii::app()->end(); } $this->render("stadtrecht_dokument", ["dokument" => $dok]); }
public function parseByURL($url_base, $titel, $id) { echo "Lese ein: " . $titel . "\n"; $index = ris_download_string($url_base . "/css/" . $id . "_index.htm"); preg_match("/gLastPage = (?<seiten>[0-9]+);/siu", $index, $matches); $seiten = $matches["seiten"]; if (!$seiten || $seiten < 1) { throw new Exception("Konnte Seitenzahl nicht auslesen"); } $texte = ""; $css = ""; for ($seite = 1; $seite <= $seiten; $seite++) { $document = ris_download_string($url_base . "/css/" . $id . "_" . $seite . ".htm"); // workaround for https://bugs.php.net/bug.php?id=61484 ini_set('mbstring.substitute_character', "none"); $document = mb_convert_encoding($document, 'UTF-8', 'UTF-8'); $x = explode('<!-- text starts here -->', $document); $x = explode('</BODY>', $x[1]); $text = $x[0]; $html = str_replace(["<NOBR>", "</NOBR>", "<SPAN", "</SPAN"], ["", "", "<DIV", "</DIV"], $text); preg_match("/text positioning information \\*\\/\\n(?<css>.*)<\\/STYLE/siu", $document, $matches); $x = explode('* text positioning information */', $document); $x = explode('/* bitmap image information */', $x[1]); $css_src = $x[0]; $x = explode("\n", $css_src); foreach ($x as $y) { if (substr($y, 0, 3) != ".ps" && substr($y, 0, 3) != ".ft") { continue; } $css .= ".seite" . $seite . " " . $y . "\n"; } $texte .= '<section class="seite seite' . $seite . '">' . $html . '</section>' . "\n\n\n"; } $titel = html_entity_decode($titel, ENT_COMPAT, "UTF-8"); /** @var Rechtsdokument $rechtsdokument */ if ($id > 0) { $rechtsdokument = Rechtsdokument::model()->findByAttributes(["id" => $id]); } else { $rechtsdokument = Rechtsdokument::model()->findByAttributes(["titel" => $titel]); } if (!$rechtsdokument) { $rechtsdokument = new Rechtsdokument(); } $rechtsdokument->url_base = $url_base; $rechtsdokument->url_html = $url_base . "/css/" . $id . ".htm"; $rechtsdokument->url_pdf = $url_base . ".pdf"; $rechtsdokument->id = $id > 0 ? $id : rand(100000, 999999); $rechtsdokument->titel = $titel; $rechtsdokument->html = $texte; $rechtsdokument->css = $css; $rechtsdokument->save(); }
<li><a href="<?php echo CHtml::encode(Yii::app()->createUrl("infos/soFunktioniertStadtpolitik")); ?> ">Stadtpolitik</a><br></li> </ul> <h1>Stadtrecht</h1> <p style="font-size: 18px;">Hier finden Sie alle Satzungen, Verordnungen und Regelungen vom offiziellen <a href="http://www.muenchen.info/dir/recht/num_portal.html">Portal für Stadtrecht</a> der Stadt München übersichtlich aufbereitet.</p> <div class="such-liste"> <input class="search" placeholder="Filtern"/> <ul class="list list-unstyled"> <?php /** @var Rechtsdokument[] $dokumente */ $dokumente = Rechtsdokument::model()->alle_sortiert(); foreach ($dokumente as $dok) { echo '<li><span class="list-name">' . CHtml::link($dok->titel_lang(), Yii::app()->createUrl("infos/stadtrechtDokument", array("id" => $dok->id))) . '<span style="display: none;">' . CHtml::encode($dok->titel) . '</span></span></li>' . "\n"; } ?> </ul> </div> </section> <script src="/bower/list.js/dist/list.min.js"></script> <script> var options = { valueNames: [ 'list-name' ] };