152 lines
5.8 KiB
PHP
152 lines
5.8 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
|
|
// Copyright (C) 2005-2019 Solomon Peachy (pizza@shaftnet.org)
|
|
|
|
// This program 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 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// This program 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 this program; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
include_once "include/config.php";
|
|
include_once "include/profile.php";
|
|
include_once "include/site.php";
|
|
include_once "include/common.php";
|
|
|
|
$type = 'film';
|
|
|
|
$database = site_prolog(PO_USER_TYPE_USER);
|
|
|
|
$manufacturer_filter = pg_escape_string($database, isset($_REQUEST['filter']) ? $_REQUEST['filter'] : "");
|
|
$film_id = pg_escape_string($database, $_REQUEST['item']);
|
|
|
|
/* Ensure the user owns it !*/
|
|
if ($po_user['type'] != PO_USER_TYPE_ADMIN) {
|
|
$result = pg_fetch_row(pg_query($database, "select count(identifier) from film where identifier=$film_id and users=$po_user[id]"));
|
|
if ($result[0] == 0) {
|
|
site_referer_error('not_owner');
|
|
site_epilog($database);
|
|
exit();
|
|
}
|
|
}
|
|
|
|
$film_current_value = pg_fetch_row(pg_query($database, "select name, model, iso, format, access_rights from view_film where identifier='$film_id'"));
|
|
$film_type_current_value = pg_fetch_row(pg_query($database, "select type from film where identifier='$film_id'"));
|
|
|
|
$manufacturer = get_generic_query_all($database, "select identifier, name from manufacturer order by name", 'manuf_all');
|
|
|
|
switch ($manufacturer_filter) {
|
|
case 'All':
|
|
case '':
|
|
$all_film_types = pg_query($database, "select identifier, name, model, iso, format, url from view_film_type");
|
|
break;
|
|
default:
|
|
$all_film_types = pg_query($database, "select identifier, name, model, iso, format, url from view_film_type where name='$manufacturer_filter' or identifier='$film_type_current_value[0]'");
|
|
}
|
|
|
|
site_header(sprintf($strings['profile_edit'], $strings['generic_'.$type]));
|
|
site_navigator(6);
|
|
site_navigator_status(emit_a(generate_link('user', ''), $strings['generic_users'])." : ".emit_a("my.profile.php", $strings['generic_my_profile'])." : ".sprintf($strings['profile_edit'], $strings['generic_'.$type]), "");
|
|
|
|
theme_display_navigator_box_top($profile_data['film']['idx'], $profile_data, "100%");
|
|
|
|
print "<form method=\"post\" action=\"film.edit.2.php\" accept-charset=\"".$strings['formats_encoding']."\">";
|
|
print "<input type=\"hidden\" name=\"item_id\" value=\"$film_id\">";
|
|
print "<table class=\"profile\">\n";
|
|
|
|
print emit_profile_manuf_combo("film.edit.php?type=$type&item=$film_id", $type, 4, $manufacturer, $manufacturer_filter);
|
|
|
|
print "<tr>\n";
|
|
print "<th width=\"4%\"></th>\n";
|
|
print emit_th($strings['profile_manufacturer']);
|
|
print emit_th($strings['profile_model']);
|
|
print emit_th($strings['generic_iso']);
|
|
print emit_th($strings['profile_format']);
|
|
print "</tr>\n";
|
|
|
|
$num_of_film_types = pg_num_rows($all_film_types);
|
|
if ($num_of_film_types > 0) {
|
|
for ($i=0; $i < $num_of_film_types; $i++) {
|
|
$film_type = pg_fetch_row($all_film_types, $i);
|
|
print "<tr>\n";
|
|
print emit_td(emit_radio_item("film_type_id", $film_type[0], false));
|
|
print "<td><a target=\"_new\" href=\"$film_type[5]\">$film_type[1]</a></td>\n";
|
|
print "<td>$film_type[2]</td>\n";
|
|
print "<td>$film_type[3]</td>\n";
|
|
print "<td>$film_type[4]</td>\n";
|
|
print "</tr>\n";
|
|
}
|
|
} else {
|
|
print "<tr><td colspan=\"4\">".sprintf($strings['profile_none_found'], $strings['generic_'.$type])." ".$strings['generic_types'] ."</td></tr>\n";
|
|
}
|
|
|
|
print "</table>\n";
|
|
|
|
print "<table class=\"profile\">\n";
|
|
print "<tr class=\"folder_top\">\n";
|
|
print "<td colspan=\"5\">".sprintf($strings['profile_edit_type'], $strings['generic_'.$type])."</td>\n";
|
|
print "</tr>\n";
|
|
print "<tr>\n";
|
|
print "<th width=\"4%\"></th>\n";
|
|
print emit_th($strings['profile_manufacturer']);
|
|
print emit_th($strings['profile_model']);
|
|
print emit_th($strings['generic_iso']);
|
|
print emit_th($strings['profile_format']);
|
|
print "</tr>\n";
|
|
|
|
print "<tr>";
|
|
print emit_td(emit_radio_item("film_type_id", "custom", true));
|
|
print "<td>";
|
|
|
|
print emit_manufacturer_combo('film_manufacturer_id', $manufacturer, $film_current_value[0]);
|
|
|
|
print "</td>";
|
|
print "<td>";
|
|
print "<input type=\"text\" name=\"film_model\" value=\"$film_current_value[1]\" />";
|
|
print "</td>\n";
|
|
print "<td>";
|
|
print "<input type=\"text\" name=\"film_iso\" value=\"$film_current_value[2]\" />";
|
|
print "</td>\n";
|
|
print "<td><select name=\"film_format_id\">\n";
|
|
$all_film_format = pg_query($database, "select identifier, value from film_format");
|
|
$num_of_film_format = pg_num_rows($all_film_format);
|
|
for ($i=0; $i < $num_of_film_format; $i++) {
|
|
$film_format = pg_fetch_row($all_film_format, $i);
|
|
print emit_option("$film_format[0]", $film_format[1], $film_current_value[3] == $film_format[1]);
|
|
}
|
|
print "</select></td>\n";
|
|
print "</tr>";
|
|
print "</table>\n";
|
|
|
|
print "<table class=\"profile\">\n";
|
|
print "<tr class=\"folder_top\"><td colspan=\"4\">".sprintf($strings['profile_specific_data'], $strings['generic_'.$type])."</td></tr>\n";
|
|
|
|
print "<tr>\n";
|
|
print emit_th($strings['generic_access']);
|
|
print "</tr>\n";
|
|
|
|
print "<tr>\n";
|
|
print "<td>\n"; print emit_access_combo("film_access_rights", $film_current_value[4], ""); print "</td>\n";
|
|
print "</tr>\n";
|
|
print "</table>\n";
|
|
|
|
print $thm_elem['button.save.changes'];
|
|
print $thm_elem['button.clear'];
|
|
print $thm_elem['button.cancel'];
|
|
print "</form>";
|
|
|
|
theme_display_navigator_box_bottom("100%");
|
|
|
|
site_footer($database);
|
|
site_epilog($database);
|
|
?>
|