First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Ensure that only valid user types have access to this module
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Communications Administrator');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
echo("<br>\n");
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$CurrentTable = "photo_galleries";
|
||||
$DeleteField = "gallery_title";
|
||||
$dSeparator = "";
|
||||
$FormFile = "photo_galleries.form.php";
|
||||
$TitleText = "Photo Galleries";
|
||||
$OrderBy = "gallery_title";
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<br>
|
||||
<table width='<?php echo($default_table_width) ?>' cellpadding='5' cellspacing='5' border='0' bgcolor='#eeeeee'>
|
||||
<tr>
|
||||
<td class='menu-item' align='center'><b><?php echo($TitleText) ?> Administration</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' class='menu-item'>
|
||||
<?php
|
||||
|
||||
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
|
||||
if (array_key_exists('naction',$_POST)) $naction = $_POST['naction'];
|
||||
|
||||
$school_num = $school_record['record_num'];
|
||||
|
||||
|
||||
switch (strtolower($naction)) {
|
||||
case "insert":
|
||||
extract($_POST);
|
||||
|
||||
// Validate the data entered
|
||||
if (strlen($gallery_title) == 0) {
|
||||
$error_message = getLanguageText('MSG-MISSING-GALLERY-TITLE');
|
||||
$new_naction = 'add';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Save the record
|
||||
$added_date = date("Y-m-d",time());
|
||||
|
||||
$table = new Table("$CurrentTable");
|
||||
$query = $table->BuildInsert();
|
||||
db_query($query);
|
||||
|
||||
$form_message = getLanguageText('RECORD-INSERTED-MSG');
|
||||
$naction = "list";
|
||||
header("Location: /?action=$action&naction=$naction&form_message=" . urlencode($form_message));
|
||||
exit();
|
||||
|
||||
case "update":
|
||||
extract($_POST);
|
||||
|
||||
// Validate the data entered
|
||||
if (strlen($gallery_title) == 0) {
|
||||
$error_message = getLanguageText('MSG-MISSING-GALLERY-TITLE');
|
||||
$new_naction = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$table = new Table("$CurrentTable");
|
||||
$query = $table->BuildUpdate();
|
||||
db_query($query);
|
||||
|
||||
$form_message = getLanguageText('RECORD-UPDATED-MSG');
|
||||
$naction = "list";
|
||||
header("Location: /?action=$action&naction=$naction&form_message=" . urlencode($form_message));
|
||||
exit();
|
||||
|
||||
case "delete-confirmed":
|
||||
$record_num = intval($_GET['record_num']);
|
||||
|
||||
// Delete the current record
|
||||
$query = "delete from $CurrentTable " .
|
||||
"where school_num = $school_num " .
|
||||
"and record_num = $record_num";
|
||||
db_query($query);
|
||||
|
||||
$form_message = getLanguageText('RECORD-DELETED-MSG');
|
||||
$naction = "list";
|
||||
header("Location: /?action=$action&naction=$naction&form_message=" . urlencode($form_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user