File: person.php

package info (click to toggle)
zoph 0.6-2.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,716 kB
  • ctags: 2,283
  • sloc: php: 8,560; perl: 1,601; sh: 760; sql: 382; python: 338; makefile: 71
file content (163 lines) | stat: -rw-r--r-- 5,409 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/*
 * This file is part of Zoph.
 *
 * Zoph is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * Zoph is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with Zoph; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
    require_once("include.inc.php");

    if (!$user->is_admin()) {
        $_action = "display";
    }
    if (!$user->get("browse_people") && !$user->is_admin()) {
        header("Location: " . add_sid("zoph.php"));
    }
    $name = getvar("person");
    if ($name) {
        list($last_name, $first_name) = explode(',', $name);
        $people = get_person_by_name($first_name, $last_name);
        if ($people && count($people) == 1) {
            $person = array_shift($people);
        }
        else {
            $person = new person();
        }
    }
    else {
        $person_id = getvar("person_id");
        $person = new person($person_id);
    }

    $obj = &$person;
    $redirect = "people.php";
    require_once("actions.inc.php");

    if ($action != "insert") {
        $person->lookup();
        $title = $person->get_name();
    }
    else {
        $title = translate("New Person");
    }

    require_once("header.inc.php");
    if ($action == "display") {

        $ignore; // don't need the thumbnails, only get 1

        $vars["person_id"] = $person->get("person_id");
        $photos_of = get_photos($vars, 0, 1, $ignore, $user);

        $vars = null;
        $vars["photographer_id"] = $person->get("person_id");
        $photos_by = get_photos($vars, 0, 1, $ignore, $user);
?>
      <h1>
<?php
        if ($user->is_admin()) {
?>
          <span class="actionlink">
            <a href="person.php?_action=edit&amp;person_id=<?php echo $person->get("person_id") ?>"><?php echo translate("edit") ?></a> |
            <a href="person.php?_action=delete&amp;person_id=<?php echo $person->get("person_id") ?>"><?php echo translate("delete") ?></a> |
            <a href="person.php?_action=new"><?php echo translate("new") ?></a>
          </span>
<?php
        }
?>
        <?php echo translate("person") ?>
     </h1>
      <div class="main">
          <span class="actionlink">
            <a href="photos.php?person_id=<?php echo $person->get("person_id") ?>"><?php echo "$photos_of " . translate("photos of") ?></a> |
            <a href="photos.php?photographer_id=<?php echo $person->get("person_id") ?>"><?php echo "$photos_by " . translate("photos by") ?></a>
          </span>
          <h2>
            <?php echo $person->get("first_name") ?>
            <?php echo $person->get("middle_name") ?>
            <?php echo $person->get("last_name") ?>
          </h2>
          <table id="person">
<?php
    if ($user->get("detailed_people")) {
?>
<?php echo create_field_html($person->get_display_array(), 3) ?>
<?php
        if ($person->get_email()) {
?>
        <tr>
          <td class="fieldtitle"><?php echo translate("email") ?></td>
          <td class="field"><a href="mailto:<?php echo $person->get_email() ?>"><?php echo $person->get_email() ?></a></td>
        </tr>
<?php
        }
        if ($person->home) {
?>
        <tr>
          <td class="fieldtitle"><?php echo translate("home") ?></td>
          <td class="field">
          <span class="actionlink"><a href="place.php?place_id=<?php echo $person->get("home_id") ?>"><?php echo translate("view") ?></a></span>
          <?php echo $person->home->get_address() ?></td>
        </tr>
<?php
        }

        if ($person->work) {
?>
        <tr>
          <td class="fieldtitle"><?php echo translate("work") ?></td>
          <td class="field">
          <span class="actionlink"><a href="place.php?place_id=<?php echo $person->get("work_id") ?>"><?php echo translate("view") ?></a></span>
             <?php echo $person->work->get("title") ? $person->work->get("title") . "<br>" : "" ?>
             <?php echo $person->work->get_address() ?>
          </td>
        </tr>
<?php
        }

        if ($person->get("notes")) {
?>
        <tr>
          <td class="fieldtitle">notes</td>
          <td colspan="2" class="field"><?php echo $person->get("notes") ?></td>
        </tr>
<?php
        }

    } // detailed_people

?>
</table>
<?php

    } // display
    else if ($action == "confirm") {
?>
          <h1>
            <?php echo translate("delete person") ?>
          </h1>
      <div class="main">
          <span class="actionlink">
            <a href="person.php?_action=confirm&amp;person_id=<?php echo $person->get("person_id") ?>"><?php echo translate("delete") ?></a> |
            <a href="person.php?_action=display&amp;person_id=<?php echo $person->get("person_id") ?>"><?php echo translate("cancel") ?></a>
          </span>
            <?php echo sprintf(translate("Confirm deletion of '%s'"), $person->get_name()) ?>:
<?php
    }
    else {
require_once("edit_person.inc.php");
    }
?>
</div>

<?php require_once("footer.inc.php"); ?>