PageRenderTime 25ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/admin_add_edit_contact_5.php

http://swifttide.googlecode.com/
PHP | 278 lines | 235 code | 21 blank | 22 comment | 9 complexity | 400ab34a0e5f15390124de600117d909 MD5 | raw file
  1. <?php
  2. //*
  3. // admin_add_edit_contact_5.php
  4. // Admin Section
  5. // Edit contact
  6. //v1.5 12-07-05 true multiyear feature
  7. //*
  8. //Check if admin is logged in
  9. session_start();
  10. if(!session_is_registered('UserId') || $_SESSION['UserType'] != "A")
  11. {
  12. header ("Location: index.php?action=notauth");
  13. exit;
  14. }
  15. //Include global functions
  16. include_once "common.php";
  17. //Initiate database functions
  18. include_once "ez_sql.php";
  19. // config
  20. include_once "configuration.php";
  21. $action=get_param("action");
  22. $contactid=get_param("contactid");
  23. $studentid=get_param("studentid");
  24. $type=get_param("type");
  25. $contacttostudentsid=get_param("contacttostudentsid");
  26. //Set variable for menu
  27. $menustudent=1;
  28. //Get current year
  29. $current_year=$_SESSION['CurrentYear'];
  30. $sSQL="SELECT studentcontact.*,
  31. contact_to_students.contact_to_students_internet,
  32. contact_to_students.contact_to_students_relation,
  33. contact_to_students.contact_to_students_residence
  34. FROM studentcontact
  35. INNER JOIN contact_to_students ON studentcontact.studentcontact_id = contact_to_students.contact_to_students_contact
  36. WHERE contact_to_students.contact_to_students_id='".$contacttostudentsid."'";
  37. $contact=$db->get_row($sSQL); $set_state=$contact->studentcontact_state;
  38. $set_title=$contact->studentcontact_title;
  39. $set_relation=$contact->contact_to_students_relation;
  40. //Doug fix so titles are displayed and stored correctly.
  41. $sSQL="SELECT title_desc FROM tbl_titles WHERE title_id='".$set_title."'";
  42. $set_title=$db->get_var($sSQL);
  43. //end of fix
  44. //Get list of states
  45. $states=$db->get_results("SELECT * FROM tbl_states ORDER BY state_code");
  46. //Get list of Salutations
  47. $titles=$db->get_results("SELECT * FROM tbl_titles ORDER BY title_id");
  48. //Get list of relations
  49. $relations=$db->get_results("SELECT * FROM relations_codes ORDER BY relation_codes_desc");
  50. //Get student first and last name
  51. $student=$db->get_row("SELECT studentbio_fname, studentbio_lname FROM studentbio WHERE studentbio_id='". $studentid ."'");
  52. $sfname=$student->studentbio_fname;
  53. $slname=$student->studentbio_lname;
  54. ?>
  55. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  56. <html xmlns="http://www.w3.org/1999/xhtml">
  57. <head>
  58. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  59. <title><?php echo _BROWSER_TITLE?></title>
  60. <style type="text/css" media="all">@import "student-admin.css";</style>
  61. <SCRIPT language="JavaScript">
  62. /* Javascript function to submit form and check if field is empty */
  63. function submitform(fldName)
  64. {
  65. var f = document.forms[0];
  66. var t = f.elements[fldName];
  67. if (t.value!="")
  68. return true;
  69. else
  70. alert("<?php echo _ENTER_VALUE?>");
  71. return false;
  72. }
  73. </script>
  74. <link rel="icon" href="favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  75. <script type="text/javascript" language="JavaScript" src="sms.js"></script>
  76. </head>
  77. <body><img src="images/<?php echo _LOGO?>" border="0">
  78. <div id="Header">
  79. <table width="100%">
  80. <tr>
  81. <td width="50%" align="left"><font size="2">&nbsp;&nbsp;<?php echo date(_DATE_FORMAT); ?></font></td>
  82. <td width="50%"><?php echo _ADMIN_ADD_EDIT_CONTACT_5_UPPER?></td>
  83. </tr>
  84. </table>
  85. </div>
  86. <div id="Content">
  87. <h1><?php echo _ADMIN_ADD_EDIT_CONTACT_5_EDIT?> <?php echo $type;?> <?php echo _ADMIN_ADD_EDIT_CONTACT_5_CFS?></h1>
  88. <br>
  89. <h2><?php echo $sfname." ".$slname; ?></h2>
  90. <br>
  91. <table border="0" cellpadding="1" cellspacing="1" width="100%">
  92. <tr>
  93. <form name="addcontact" method="POST" action="admin_add_edit_contact_6.php">
  94. <td width="100%">
  95. <table border="1" cellpadding="0" cellspacing="0" width="100%">
  96. <tr class="trform">
  97. <td width="15%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_P_TITLE?></td>
  98. <td width="35%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_FIRST?></td>
  99. <td width="35%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_LAST?></td>
  100. <td width="15%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_RESIDENCE?></td>
  101. </tr>
  102. <tr>
  103. <td width="15%" class="tdinput">
  104. <select name="title">
  105. <?php
  106. //Display titles from table
  107. foreach($titles as $title){
  108. ?>
  109. <option value="<?php echo $title->title_desc; ?>" <?php if ($title->title_desc==$set_title){echo "selected=selected";};?>><?php echo $title->title_desc; ?></option>
  110. <?php
  111. };
  112. ?>
  113. </select>
  114. </td>
  115. <td width="35%" class="tdinput">
  116. <input type="text" onChange="capitalizeMe(this)" name="cfname" size="25" <?php echo " value=\"".strip($contact->studentcontact_fname)."\""; ?>>
  117. </td>
  118. <td width="35%" class="tdinput">
  119. <input type="text" onChange="capitalizeMe(this)" name="clname" size="25" <?php echo " value=\"".strip($contact->studentcontact_lname)."\""; ?>>
  120. </td>
  121. <td width="15%" class="tdinput" align="center">
  122. <input type="checkbox" name="residence" value="1" <?php if($contact->contact_to_students_residence==1){echo "checked=checked";};?>>
  123. </td>
  124. </tr>
  125. </table>
  126. </td>
  127. </tr>
  128. <tr>
  129. <td width="100%">
  130. <table border="1" cellpadding="0" cellspacing="0" width="100%">
  131. <tr class="trform">
  132. <td width="20%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_RELATION?></td>
  133. <td width="40%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_ADDRESS?></td>
  134. <td width="40%">&nbsp;</td>
  135. </tr>
  136. <tr>
  137. <td width="20%" class="tdinput">
  138. <select name="relation">
  139. <?php
  140. //Display relations from table
  141. foreach($relations as $relation){
  142. ?>
  143. <option value="<?php echo $relation->relation_codes_id; ?>" <?php if ($relation->relation_codes_id==$set_relation){echo "selected=selected";};?>><?php echo $relation->relation_codes_desc; ?></option>
  144. <?php
  145. };
  146. ?>
  147. </select>
  148. </td>
  149. <td width="40%" class="tdinput">
  150. <input type="text" onChange="capitalizeMe(this)" name="address1" size="40" <?php echo " value=\"".strip($contact->studentcontact_address1)."\""; ?>>
  151. </td>
  152. <td width="40%" class="tdinput">
  153. <input type="text" onChange="capitalizeMe(this)" name="address2" size="40" <?php echo " value=\"".strip($contact->studentcontact_address2)."\""; ?>>
  154. </td>
  155. </tr>
  156. </table>
  157. </td>
  158. </tr>
  159. <tr>
  160. <td width="100%">
  161. <table border="1" cellpadding="0" cellspacing="0" width="100%">
  162. <tr class="trform">
  163. <td width="35%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_CITY?></td>
  164. <td width="10%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_STATE?></td>
  165. <td width="10%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_ZIP?></td>
  166. <td width="45%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_EMAIL?></td>
  167. </tr>
  168. <tr>
  169. <td width="35%" class="tdinput">
  170. <input type="text" onChange="capitalizeMe(this)" name="city" size="20" <?php echo " value=\"".strip($contact->studentcontact_city)."\""; ?>>
  171. </td>
  172. <td width="10%" class="tdinput">
  173. <select name="state">
  174. <?php
  175. //Display states from table
  176. foreach($states as $state){
  177. ?>
  178. <option value="<?php echo $state->state_code; ?>" <?php if ($state->state_code==$set_state){echo "selected=selected";};?>><?php echo $state->state_name; ?></option>
  179. <?php
  180. };
  181. ?>
  182. </select>
  183. </td>
  184. <td width="10%" class="tdinput">
  185. <input type="text" onChange="capitalizeMe(this)" name="zip" size="10" <?php echo " value=\"".strip($contact->studentcontact_zip)."\""; ?>>
  186. </td>
  187. <td width="45%" class="tdinput">
  188. <input type="text" onchange="this.value=this.value.toLowerCase();" name="email" size="50" <?php echo " value=\"".strip($contact->studentcontact_email)."\""; ?>>
  189. </td>
  190. </tr>
  191. </table>
  192. </td>
  193. </tr>
  194. <tr>
  195. <td width="100%">
  196. <table border="1" cellpadding="0" cellspacing="0" width="100%">
  197. <tr class="trform">
  198. <td width="30%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_PHONE1?></td>
  199. <td width="30%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_PHONE2?></td>
  200. <td width="30%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_PHONE3?></td>
  201. <td width="10%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_MAILINGS?></td>
  202. </tr>
  203. <tr>
  204. <td width="30%" class="tdinput">
  205. <input type="text" onChange="capitalizeMe(this)" name="phone1" size="20" <?php echo " value=\"".strip($contact->studentcontact_phone1)."\""; ?>>
  206. </td>
  207. <td width="30%" class="tdinput">
  208. <input type="text" onChange="capitalizeMe(this)" name="phone2" size="20" <?php echo " value=\"".strip($contact->studentcontact_phone2)."\""; ?>>
  209. </td>
  210. <td width="30%" class="tdinput">
  211. <input type="text" onChange="capitalizeMe(this)" name="phone3" size="20" <?php echo " value=\"".strip($contact->studentcontact_phone3)."\""; ?>>
  212. </td>
  213. <td width="10%" class="tdinput">
  214. <input type="checkbox" name="mailings" value="1" <?php if($contact->studentcontact_mailings==1){echo "checked=checked";}; ?>>
  215. </td>
  216. </tr>
  217. </table>
  218. </td>
  219. </tr>
  220. <tr>
  221. <td width="100%">
  222. <table border="1" cellpadding="0" cellspacing="0" width="100%">
  223. <tr class="trform">
  224. <td width="100%">&nbsp;<?php echo _ADMIN_ADD_EDIT_CONTACT_5_OTHER?></td>
  225. </tr>
  226. <tr>
  227. <td width="30%" class="tdinput" align="center">
  228. <textarea name="other" cols="40" rows="5"><?php echo strip($contact->studentcontact_other); ?></textarea>
  229. </td>
  230. </tr>
  231. </table>
  232. </td>
  233. </tr>
  234. </td>
  235. </tr>
  236. <tr>
  237. <td width="100%">
  238. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  239. <tr>
  240. <td width="50%"><a href="admin_edit_student_1.php?studentid=<?php echo $studentid; ?>" class="aform"><?php echo _ADMIN_ADD_EDIT_CONTACT_5_BACK?></a>
  241. </td>
  242. <td width="50%" align="right">
  243. <input type="submit" name="sumbit" value="<?php echo _ADMIN_ADD_EDIT_CONTACT_5_UPDATE?>" class="frmbut">
  244. </td>
  245. </tr>
  246. </table>
  247. <input type="hidden" name="contactid" value="<?php echo $contactid; ?>">
  248. <input type="hidden" name="studentid" value="<?php echo $studentid; ?>">
  249. <input type="hidden" name="contacttostudentsid" value="<?php echo $contacttostudentsid ?>">
  250. </td>
  251. </tr>
  252. </form>
  253. </table>
  254. </div>
  255. <?php include "admin_menu.inc.php"; ?>
  256. </body>
  257. </html>