Browse code

Erster Entwurf einer UI für Kundendaten

Bernd Wurst authored on01/12/2017 11:27:59
Showing3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,82 @@
1
+<?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6
+  Bernd Wurst <bernd@schokokeks.org>
7
+  Hanno Böck <hanno@schokokeks.org>
8
+
9
+To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10
+
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12
+http://creativecommons.org/publicdomain/zero/1.0/
13
+
14
+Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15
+*/
16
+
17
+require_once('kundendaten.php');
18
+
19
+require_role(ROLE_CUSTOMER);
20
+
21
+title("Adressen ändern");
22
+
23
+output('<p>Die nachfolgende Adresse ist bei uns für Ihre Kundendaten gespeichert. Wenn Sie weitere Informationen ändern möchten, z.B. Name oder Firmierung, wenden Sie sich bitte per E-Mail <a href="mailto:'.config('adminmail').'">an unseren Support</a>. Die Angabe bzw. Änderung einer separaten Rechnungsanschrift ist hier leider nicht möglich, dies bitte auch über unseren Support veranlassen.</p>');
24
+
25
+
26
+$c = lese_kundendaten();
27
+
28
+$odd = false;
29
+$html = '<table>
30
+    <tr class="'.($odd == true ? 'odd' : 'even').'"><td>Kundennummer:</td><td><strong>'.$c['id'].'</strong></td></tr>';
31
+    $odd = !$odd;
32
+if ($c['firma']) {
33
+    $html .= '    <tr class="'.($odd == true ? 'odd' : 'even').'"><td>Firmenname:</td><td><strong>'.$c['firma'].'</strong></td></tr>';
34
+    $odd = !$odd;
35
+    if ($c['nachname']) {
36
+        $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td>Verwalter:</td><td><strong>'.$c['vorname'].' '.$c['nachname'].'</strong></td></tr>';
37
+        $odd = !$odd;
38
+    }
39
+} else {
40
+    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td>Name:</td><td><strong>'.$c['vorname'].' '.$c['nachname'].'</strong></td></tr>';
41
+    $odd = !$odd;
42
+}
43
+
44
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse">Adresse:</label></td><td><input type="text" name="adresse" id="adresse" value="'.$c['adresse'].'"></td></tr>';
45
+$odd = !$odd;
46
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse2">Adresse:</label></td><td><input type="text" name="adresse2" id="adresse2" value="'.$c['adresse2'].'"></td></tr>';
47
+$odd = !$odd;
48
+if ($c['adresszusatz']) {
49
+    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse">Adresszusatz:</label></td><td><input type="text" name="adresszusatz" id="adresszusatz" value="'.$c['adresszusatz'].'"></td></tr>';
50
+    $odd = !$odd;
51
+}
52
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="plz">PLZ:</label></td><td><strong>'.$c['land'].'-</strong><input type="text" name="plz" id="plz" value="'.$c['plz'].'"></td></tr>';
53
+$odd = !$odd;
54
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="ort">Ort:</label></td><td><input type="text" name="ort" id="ort" value="'.$c['ort'].'"></td></tr>';
55
+$odd = !$odd;
56
+
57
+
58
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email">E-Mail-Adresse:</label></td><td><input type="text" name="email" id="email" value="'.$c['email'].'"></td></tr>';
59
+$odd = !$odd;
60
+if (have_module('newsletter')) {
61
+    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_newsletter">E-Mail-Adresse (Newsletter):</label></td><td><strong>'.$c['email_newsletter'].'</strong> (Änderung '.internal_link('../newsletter/newsletter', 'hier').')</td></tr>';
62
+    $odd = !$odd;
63
+}
64
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_extern">E-Mail-Adresse (extern):</label></td><td><input type="text" name="email_extern" id="email_extern" value="'.$c['email_extern'].'"></td></tr>';
65
+$odd = !$odd;
66
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_rechnung">E-Mail-Adresse (Rechnungen):</label></td><td><input type="text" name="email_rechnung" id="email_rechnung" value="'.$c['email_rechnung'].'"></td></tr>';
67
+$odd = !$odd;
68
+
69
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefonnummer:</label></td><td><input type="text" name="telefon" id="telefon" value="'.$c['telefon'].'"></td></tr>';
70
+$odd = !$odd;
71
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Mobil:</label></td><td><input type="text" name="mobile" id="mobile" value="'.$c['mobile'].'"></td></tr>';
72
+$odd = !$odd;
73
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefax:</label></td><td><input type="text" name="telefax" id="telefax" value="'.$c['telefax'].'"></td></tr>';
74
+$odd = !$odd;
75
+
76
+$html .= '</table>';
77
+
78
+
79
+output(html_form('chdetails_all', 'chdetails_save', '', $html));
80
+
81
+
82
+?>
... ...
@@ -62,3 +62,12 @@ function update_mailaddress($daten)
62 62
 }
63 63
 
64 64
 
65
+function lese_kundendaten()
66
+{
67
+    require_role(ROLE_CUSTOMER);
68
+    $customerno = $_SESSION['customerinfo']['customerno'];
69
+    $result = db_query("SELECT id, anrede, firma, vorname, nachname, adresse, adresse2, adresszusatz, land, plz, ort, email, email_newsletter, email_rechnung, email_extern, telefon, mobile, telefax FROM kundendaten.kunden WHERE id=?", array($customerno));
70
+    return $result->fetch();    
71
+}
72
+
73
+
... ...
@@ -25,6 +25,9 @@ if ($role == ROLE_ANONYMOUS) {
25 25
   if ($role & (ROLE_SYSTEMUSER | ROLE_CUSTOMER)) {
26 26
     $menu["index_chpass"] = array("label" => "Passwort ändern", "file" => "chpass", "weight" => 98);
27 27
   }
28
+  if ($role & ROLE_CUSTOMER) {
29
+    $menu["index_chdetails"] = array("label" => "Adressen ändern", "file" => "chdetails", "weight" => 1, "submenu" => "index_index");
30
+  }
28 31
 
29 32
   $menu["index_logout"] = array("label" => "Logout", "file" => "logout", "weight" => 99);
30 33
   $menu["index_index"] = array("label" => "Übersicht", "file" => "index", "weight" => 0);