| [ 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 : PropertyEditor.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 //Get the PropertyID 37 $iPropertyID = FilterInput($_GET["PropertyID"],'int'); 38 39 //Get the Type 40 $sType = FilterInput($_GET["Type"],'char',1); 41 42 //Based on the type, set the TypeName 43 switch($sType) 44 { 45 case "p": 46 $sTypeName = gettext("Person"); 47 break; 48 49 case "f": 50 $sTypeName = gettext("Family"); 51 break; 52 53 case "g": 54 $sTypeName = gettext("Group"); 55 break; 56 57 default: 58 Redirect("Menu.php"); 59 exit; 60 break; 61 } 62 63 //Set the page title 64 $sPageTitle = $sTypeName . ' ' . gettext("Property Editor"); 65 66 //Was the form submitted? 67 if (isset($_POST["Submit"])) 68 { 69 $sName = FilterInput($_POST["Name"]); 70 $sDescription = FilterInput($_POST["Description"]); 71 $iClass = FilterInput($_POST["Class"],'int'); 72 $sPrompt = FilterInput($_POST["Prompt"]); 73 74 //Did they enter a name? 75 if (strlen($sName) < 1 ) 76 { 77 $sNameError = "<br><font color=\"red\">" . gettext("You must enter a Name") . "</font>"; 78 $bError = True; 79 } 80 81 //Did they select a Type 82 if (strlen($iClass) < 1) 83 { 84 $sClassError = "<br><font color=\"red\">" . gettext("You must select a Type") . "</font>"; 85 $bError = True; 86 } 87 88 //If no errors, let's update 89 if (!$bError) 90 { 91 92 //Vary the SQL depending on if we're adding or editing 93 if ($iPropertyID == "") 94 { 95 $sSQL = "INSERT INTO property_pro (pro_Class,pro_prt_ID,pro_Name,pro_Description,pro_Prompt, chu_Church_ID) VALUES ('" . $sType . "'," . $iClass . ",'" . $sName . "','" . $sDescription . "','" . $sPrompt . "'," . $_SESSION['iChurchID'] . ")"; 96 } 97 else 98 { 99 $sSQL = "UPDATE property_pro SET pro_prt_ID = " . $iClass . ", pro_Name = '" . $sName . "', pro_Description = '" . $sDescription . "', pro_Prompt = '" . $sPrompt . "' WHERE pro_ID = " . $iPropertyID . " AND chu_Church_ID=" . $_SESSION['iChurchID'] ; 100 } 101 102 //Execute the SQL 103 RunQuery($sSQL); 104 105 //Route back to the list 106 Redirect("PropertyList.php?Type=" . $sType); 107 108 } 109 110 } 111 else 112 { 113 114 if (strlen($iPropertyID) != 0) 115 { 116 //Get the data on this property 117 $sSQL = "SELECT * FROM property_pro WHERE pro_ID = " . $iPropertyID . " AND chu_Church_ID=" . $_SESSION['iChurchID']; 118 $rsProperty = mysql_fetch_array(RunQuery($sSQL)); 119 extract($rsProperty); 120 121 //Assign values locally 122 $sName = $pro_Name; 123 $sDescription = $pro_Description; 124 $iType = $pro_prt_ID; 125 $sPrompt = $pro_Prompt; 126 } 127 128 } 129 130 //Get the Property Types 131 $sSQL = "SELECT * FROM propertytype_prt WHERE prt_Class = '" . $sType . "' AND chu_Church_ID=" . $_SESSION['iChurchID'] . " ORDER BY prt_Name"; 132 $rsPropertyTypes = RunQuery($sSQL); 133 134 require "Include/Header.php"; 135 136 ?> 137 138 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?PropertyID=<?php echo $iPropertyID; ?>&Type=<?php echo $sType; ?>"> 139 140 <table cellpadding="4"> 141 <tr> 142 <td valign="top" align="right"><b><?php echo gettext("Type:"); ?></b></td> 143 <td> 144 <select name="Class"> 145 <option value=""><?php echo gettext("Select Property Type"); ?></option> 146 <?php 147 while ($aRow = mysql_fetch_array($rsPropertyTypes)) 148 { 149 extract($aRow); 150 151 echo "<option value=\"" . $prt_ID . "\""; 152 if ($iType == $prt_ID) { echo "selected"; } 153 echo ">" . $prt_Name . "</option>"; 154 } 155 ?> 156 </select> 157 <?php echo $sClassError ?> 158 </td> 159 </tr> 160 <tr> 161 <td valign="top" align="right"><b><?php echo gettext("Name:"); ?></b></td> 162 <td> 163 <input type="text" name="Name" value="<?php echo htmlentities(stripslashes($sName)); ?>" size="50"> 164 <?php echo $sNameError ?> 165 </td> 166 </tr> 167 <tr> 168 <td align="right" valign="top"><b>"<?php echo gettext("A"); ?> <?php echo $sTypeName ?><BR><?php echo gettext("with this property.."); ?>":</b></td> 169 <td><textarea name="Description" cols="60" rows="3"><?php echo htmlentities(stripslashes($sDescription)); ?></textarea></td> 170 </tr> 171 <tr> 172 <td align="right" valign="top"><b><?php echo gettext("Prompt:"); ?></b></td> 173 <td valign="top"> 174 <input type="text" name="Prompt" value="<?php echo htmlentities(stripslashes($sPrompt)) ?>" size="50"> 175 <br> 176 <span class="SmallText"><?php echo gettext("Entering a Prompt value will allow the association of a free-form value."); ?></span> 177 </td> 178 </tr> 179 <tr> 180 <td colspan="2" align="center"> 181 <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='PropertyList.php?Type=<?php echo $sType; ?>';"> 182 </td> 183 </tr> 184 </table> 185 186 </form> 187 188 <?php 189 require "Include/Footer.php"; 190 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |