phoebusryan / rex4_custom_firedepartment

Redaxo 4 Addon - Einsatzverwaltung für Feuerwehre
3 stars 0 forks source link

Einsatz modul #7

Closed fw-thomas74 closed 8 years ago

fw-thomas74 commented 8 years ago

Wenn ich diesen modulcode einbinden bekomme ich unter Modul "Eingabe" nur eine Weiße Seite bzw. Inhalt angezeigt. Unter Ausgabe wird mir das angezeigt

Array
(
    [0] => Array
        (
            [alert] => Brandeinsatz
            [units] => Array
                (
                    [0] => FF Accum
                )

            [vehicles] => Array
                (
                    [0] => TLF
                )

            [report_short] => test
            [report_long] => tesstt
            [start_date] => 2016-03-03 17:23:57
            [end_date] => 2016-03-03 17:24:00
            [place] => Schortens
            [images] => Array
                (
                    [0] => 
                )

        )

)

Array
(
    [Brandeinsatz] => 1
)
phoebusryan commented 8 years ago

Das ist schon beabsichtigt. Die Daten kannst du so verwenden. Das Modul ist NICHT einsatzbereit so, sondern nur ein Beispiel wie du an die Daten kommst. Mit ein wenig (simplem) PHP kommst du damit problemlos zum Ziel... oder kannst du gar kein PHP?

fw-thomas74 commented 8 years ago

Nein kann ich gar nicht. Sorry

phoebusryan commented 8 years ago

Okay, ich dachte eigentlich, ich sollte nur das Addon bauen für dich.. Jedenfalls hättest du hier eine einfache Ausgabe als Liste:

https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/beispielmodul.txt

fw-thomas74 commented 8 years ago

Sorry dachte das alles über das addon läuft ...

phoebusryan commented 8 years ago

Kein Problem. Die Modulausgabe sehe ich einfach nicht im Addon. Lediglich die Datenerfassung und Datenbereitstellung (API (die PHP Klasse)) gehört aus meiner Sicht da rein. Das obige Beispielmodul sollte dir aber eben eine Tabelle mit den Daten 'generieren'.

fw-thomas commented 8 years ago

Hast ja schon mal eine gute Grundlage uns gebaut ..

und die Beispielmodul ist schon mal ein weitere anfang

Den Link zum großen bericht sollte dann nun auch kein problem werden ..

fw-thomas commented 8 years ago

vielleicht noch ein Tip von Dir .. wenn wir Bilder hochgeladen haben, werden die ja in der Images Tabelle eingetragen, was muss ich eintragen, das Wenn ein Bild hinterlegt ist, das dann in der Übersichtsliste deines Beispielmoduls ein anderes Bild .. (Männchen mit Zeitung) erscheint ??

phoebusryan commented 8 years ago

Als simpelste Variante sowas hier innerhalb der foreach:

<?php
  if (!empty($operation['images'])) {
    ?>
    <td><img src="pfad/bild_mit_zeitungsmann.jpg" alt=""></td>
    <?php
  } else {
    ?>
    &nbsp;
    <?php
  }
?>
fw-thomas commented 8 years ago

So ???

            <tbody>
                <?php
                    foreach ($operations as $operation) {
                        ?>
                        <tr>
                            <td><?=date('d.m. H:i', strtotime($operation['start_date']));?></td>
                            <td><?=$operation['report_short'];?></td>
                            <td><?=$operation['place'];?></td>
<?php
                                                         if (!empty($operation['images'])) {
    ?>
    <td><img src="pfad/bild_mit_zeitungsmann.jpg" alt=""></td>
    <?php
  } else {
    ?>
                        </tr>
                        <?php
                    }
                ?>
            </tbody>
fw-thomas commented 8 years ago

das gesamte Modul schon geändert:

<?php
    require($REX['INCLUDE_PATH'].'/addons/rex_firedepartment/classes/class.rex_firedepartment.inc.php');

    $operations = rex_firedepartment::getOperations();

    if (!empty($operations)) {
        ?>
        <table width="480">
            <thead>
                <tr>
                    <th>Alarmierung</th>
                    <th>Einsatzbeschreibung</th>
                    <th>Einsatzort</th>
                    <th>Bild</th>
                </tr>
            </head>
            <tbody>
                <?php
                    foreach ($operations as $operation) {
                        ?>
                        <tr>
                            <td><?=date('d.m. H:i', strtotime($operation['start_date']));?></td>
                            <td><?=$operation['report_short'];?></td>
                            <td><?=$operation['place'];?></td>
                            <td><?=$operation['images'];?></td>
                        </tr>
                        <?php
                    }
                ?>
            </tbody>
        </table>
        <?php
    }
?>
phoebusryan commented 8 years ago

Das obere Beispiel von dir wäre schon korrekt. Nur kommt vor dem if noch ein <?php

fw-thomas commented 8 years ago

Top das ist gelöst

phoebusryan commented 8 years ago

Ok, sehr gut. Kleiner Tipp noch zum Code einfügen: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

fw-thomas commented 8 years ago

Hast eine Idee wie ich die Liste nach Jahren trennen kann, so das ich in einer Liste nur 2015 und dann 2016 und etc.. habe ?

fw-thomas commented 8 years ago

Hallo, hast du eine Idee wie ich den Text mittig zentriert bekomme ? zentrieren

fw-thomas commented 8 years ago

das mit dem Wenn Bild hinterlegt ist .. dann soll ein Icon kommen, hat nun doch nicht geklappt .

habe jetzt einen zweiten Testeinsatz eingebaut OHNE Bild, und das Icon kommt dennoch ..

phoebusryan commented 8 years ago

Der Code bzgl. dem Bild sollte eigentlich schon stimmen. Zeig mal was du bereits hast.

Btw. Warum hast du eigentlich 2 Github-Accounts?

fw-thomas commented 8 years ago

weil ich den 1. nicht mehr wußte .. daher hatte ich über das Tablet einen neuen gemacht ..

<?php
require($REX['INCLUDE_PATH'].'/addons/rex_firedepartment/classes/class.rex_firedepartment.inc.php');

    $operations = rex_firedepartment::getOperations();

    if (!empty($operations)) {
        ?>

<table width="480">
  <thead>

    <tr align="center" valign="middle">
      <th>Alarmierung</th>

      <th>Einsatzbeschreibung</th>

      <th>Einsatzort</th>

      <th>Bild</th>
                </tr>
            <tbody>
                <?php
                    foreach ($operations as $operation) {
                        ?>

    <tr align="center" valign="middle">
      <td>
        <?=date('d.m. H:i', strtotime($operation['start_date']));?>
      </td>

      <td>
        <?=$operation['report_short'];?>
      </td>

      <td>
        <?=$operation['place'];?>
        <div align="justify"></div></td>
<?php
  if (!empty($operation['images'])) {
    ?>
      <td><img src="http://feuerwehr-schortens.de/files/logo_presse.png" alt="" width="41" height="40"></td>
    <?php
  } else {
    ?>
    &nbsp;
    <?php
  }
?>

                        </tr>
                        <?php
                    }
                ?>
            </tbody>
        </table>
        <?php
    }
?>
phoebusryan commented 8 years ago

Interessant. Dafür gäbe es eine Passwort-Vergessen-Funktion.

Bzgl. dem Code: Füge den mal wie hier ein: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

.. dann kann man ihn auch lesen.

fw-thomas commented 8 years ago
<?php
require($REX['INCLUDE_PATH'].'/addons/rex_firedepartment/classes/class.rex_firedepartment.inc.php');

    $operations = rex_firedepartment::getOperations();

    if (!empty($operations)) {
        ?>

<table width="480">
  <thead>

    <tr align="center" valign="middle">
      <th>Alarmierung</th>

      <th>Einsatzbeschreibung</th>

      <th>Einsatzort</th>

      <th>Bild</th>
                </tr>
            <tbody>
                <?php
                    foreach ($operations as $operation) {
                        ?>

    <tr align="center" valign="middle">
      <td>
        <?=date('d.m. H:i', strtotime($operation['start_date']));?>
      </td>

      <td>
        <?=$operation['report_short'];?>
      </td>

      <td>
        <?=$operation['place'];?>
        <div align="justify"></div></td>
<?php
  if (!empty($operation['images'])) {
    ?>
      <td><img src="http://feuerwehr-schortens.de/files/logo_presse.png" alt="" width="41" height="40"></td>
    <?php
  } else {
    ?>
    &nbsp;
    <?php
  }
?>

                        </tr>
                        <?php
                    }
                ?>
            </tbody>
        </table>
        <?php
    }
?>
fw-thomas commented 8 years ago

wußte nicht mal das ich den hatte .. daher zwei accounts .. sorry

fw-thomas commented 8 years ago

eine Lösung für das Zentrierung das der Text mittig zum Bild ist habe ich gefunden. es muss in der Main.css datei was nachgepflegt werden Zeile 321 vertical-align: middle;

phoebusryan commented 8 years ago

Bzgl. dem Zeitungsmann: Da war wirklich noch ein Fehler drin im Addon. Öffne das File /redaxo/include/addons/rex_firedepartment/classes/class.rex_firedepartment.inc.php und ändere folgende Zeile: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/classes/class.rex_firedepartment.inc.php#L54

Für die Sortierung musst du noch folgende Zeile ändern: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/classes/class.rex_firedepartment.inc.php#L29

Das angepasste Modul gibt es hier: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/beispielmodul.txt

fw-thomas commented 8 years ago

Bild Problem ist behoben ..

nun ist alledings 2015 und 2016 auf einer Seite .. das wollten wir nach Jahren Getrennt haben . sprich eine Seite nur 2015 und die andere 2016

fw-thomas commented 8 years ago

http://feuerwehr-schortens.de/index.php?article_id=246

phoebusryan commented 8 years ago

Okay... dann pass die Klasse nochmals an: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/classes/class.rex_firedepartment.inc.php#L20 und https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/classes/class.rex_firedepartment.inc.php#L29

...und dann nutze dieses Modul: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/beispielmodul.txt

Auf Zeile 4 kannst du dann das Jahr mitgeben: https://github.com/phoebusryan/rex4_custom_firedepartment/blob/master/beispielmodul.txt#L4

fw-thomas commented 8 years ago

hättest du für mich noch eine Idee .. wie ich aus der Listen Übersicht in den Einzelnen Einsatzbericht kommen kann ..