| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:12:48 2008 ] | [ OSC 2.0.5 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /******************************************************************************* 3 * 4 * filename : PropertyTypeEditor.php 5 * last change : 2003-01-07 6 * 7 * http://osc.sourceforge.net 8 * 9 * This product is based upon work previously done by Infocentral (infocentral.org) 10 * on their PHP version Church Management Software that they discontinued 11 * and we have taken over. We continue to improve and build upon this product 12 * in the direction of excellence. 13 * 14 * OpenSourceChurch (OSC) is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of the License, or 17 * (at your option) any later version. 18 * 19 * Any changes to the software must be submitted back to the OpenSourceChurch project 20 * for review and possible inclusion. 21 * 22 * Copyright 2001, 2002 Deane Barker 23 ******************************************************************************/ 24 25 //Include the function library 26 require "Include/Config.php"; 27 require "Include/Functions.php"; 28 29 // Security: User must have property and classification editing permission 30 if (!$_SESSION['bMenuOptions']) 31 { 32 Redirect("Menu.php"); 33 exit; 34 } 35 36 //Set the page title 37 $sPageTitle = gettext("Property Type Editor"); 38 39 //Get the PropertyID 40 $iPropertyTypeID = FilterInput($_GET["PropertyTypeID"],'int'); 41 42 //Was the form submitted? 43 if (isset($_POST["Submit"])) 44 { 45 $sName = FilterInput($_POST["Name"]); 46 $sDescription = FilterInput($_POST["Description"]); 47 $sClass = FilterInput($_POST["Class"],'char',1); 48 49 //Did they enter a name? 50 if (strlen($sName) < 1 ) 51 { 52 $sNameError = "<font color=\"red\">" . gettext("You must enter a name") . "</font>"; 53 $bError = True; 54 } 55 56 //If no errors, let's update 57 if (!$bError) 58 { 59 //Vary the SQL depending on if we're adding or editing 60 if ($iPropertyTypeID == "") 61 { 62 $sSQL = "INSERT INTO propertytype_prt (prt_Class,prt_Name,prt_Description, chu_Church_ID) VALUES ('" . $sClass . "','" . $sName . "','" . $sDescription . "'," . $_SESSION['iChurchID'] . ")"; 63 } 64 else 65 { 66 $sSQL = "UPDATE propertytype_prt SET prt_Class = '" . $sClass . "', prt_Name = '" . $sName . "', prt_Description = '" . $sDescription . "' WHERE prt_ID = " . $iPropertyTypeID . " AND chu_Church_ID=" . $_SESSION['iChurchID']; 67 } 68 69 //Execute the SQL 70 RunQuery($sSQL); 71 72 //Route back to the list 73 Redirect("PropertyTypeList.php"); 74 } 75 } 76 elseif (strlen($iPropertyTypeID) > 0) 77 { 78 //Get the data on this property 79 $sSQL = "SELECT * FROM propertytype_prt WHERE prt_ID = " . $iPropertyTypeID . " AND chu_Church_ID=" . $_SESSION['iChurchID']; 80 $rsProperty = mysql_fetch_array(RunQuery($sSQL)); 81 extract($rsProperty); 82 83 //Assign values locally 84 $sName = $prt_Name; 85 $sDescription = $prt_Description; 86 $sClass = $prt_Class; 87 } 88 89 require "Include/Header.php"; 90 91 ?> 92 93 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?PropertyTypeID=<?php echo $iPropertyTypeID; ?>"> 94 95 <table cellpadding="4"> 96 <tr> 97 <td align="right"><b><?php echo gettext("Class:"); ?></b></td> 98 <td> 99 <select name="Class"> 100 <option value="p" <?php if($sClass == "p") {echo "selected";} ?>><?php echo gettext("Person"); ?></option> 101 <option value="f" <?php if($sClass == "f") {echo "selected";} ?>><?php echo gettext("Family"); ?></option> 102 <option value="g" <?php if($sClass == "g") {echo "selected";} ?>><?php echo gettext("Group"); ?></option> 103 </select> 104 </td> 105 </tr> 106 <tr> 107 <td align="right"><b><?php echo gettext("Name:"); ?></b></td> 108 <td><input type="text" name="Name" value="<?php echo htmlentities(stripslashes($sName)); ?>" size="40"> <?php echo $sNameError; ?> 109 </td> 110 </tr> 111 <tr> 112 <td align="right" valign="top"><b><?php echo gettext("Description:"); ?></b></td> 113 <td><textarea name="Description" cols="60" rows="10"><?php echo htmlentities(stripslashes($sDescription)); ?></textarea></td> 114 </tr> 115 <tr> 116 <td colspan="2" align="center"> 117 <input type="submit" class="icButton" name="Submit" <?php echo 'value="' . gettext("Save") . '"'; ?>> <input type="button" class="icButton" name="Cancel" <?php echo 'value="' . gettext("Cancel") . '"'; ?> onclick="document.location='PropertyTypeList.php';"> 118 </td> 119 </tr> 120 </table> 121 122 </form> 123 124 <?php 125 require "Include/Footer.php"; 126 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |