Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.30 KB | None | 0 0
  1. <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  2. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  3. <script src="/scripts/jquery.timepicker.min.js"></script>
  4. <link rel="stylesheet" href="/scripts/jquery.timepicker.css">
  5.  
  6. <script>
  7. $(function() {
  8. $( "#startDate" ).datepicker({
  9. dateFormat: 'yy-mm-dd',
  10. altField: '#endDate',
  11. altFormat: 'yy-mm-dd'
  12. });
  13. $( "#endDate" ).datepicker({
  14. dateFormat: 'yy-mm-dd'
  15. });
  16. });
  17. $(document).ready(function(){
  18. $('#startTime').timepicker({
  19. 'step': 15,
  20. 'timeFormat': 'h:i A',
  21. 'scrollDefault': '4:00 PM'
  22. });
  23. $('#endTime').timepicker({
  24. 'step': 15,
  25. 'timeFormat': 'h:i A',
  26. 'scrollDefault': '4:00 PM'
  27. });
  28.  
  29. });
  30.  
  31. </script>
  32.  
  33. <?php
  34. include '/var/www/vhosts/tamuphysics.com/dbauth/auth.php';
  35. include '/var/www/vhosts/tamuphysics.com/dbauth/cst-library.php';
  36. $con=mysqli_connect("localhost","directoryreader",$directoryreader,"directory");
  37. // Check connection
  38. if (mysqli_connect_errno())
  39. {
  40. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  41. }
  42. function runSQL($con, $sql){
  43. if (!mysqli_query($con, $sql)) {
  44. die('Error: ' . mysqli_error($con));
  45. }
  46. else{
  47. return "Query successfully submitted!";
  48. }
  49. }
  50.  
  51.  
  52.  
  53. // GET USER ID FROM PERSON VIEWING
  54. $current_user = wp_get_current_user();
  55. $userid = $current_user->user_login;
  56. //$userid = "hezhe2110509010";
  57.  
  58. //GET ldapID
  59. $lookupresult1 = mysqli_query($con,"SELECT ldapID FROM deptFaculty WHERE isActive=1 AND `UID`='$userid'");
  60. while($row = mysqli_fetch_array($lookupresult1))
  61. {
  62. $ldapID = $row['ldapID'];
  63. }
  64. $lookupresult2 = mysqli_query($con,"SELECT ldapID FROM deptResearcher WHERE isActive=1 AND `UID`='$userid'");
  65. while($row = mysqli_fetch_array($lookupresult2))
  66. {
  67. $ldapID = $row['ldapID'];
  68. }
  69. $lookupresult3 = mysqli_query($con,"SELECT ldapID FROM deptGraduate WHERE isActive=1 AND `UID`='$userid'");
  70. while($row = mysqli_fetch_array($lookupresult3))
  71. {
  72. $ldapID = $row['ldapID'];
  73. }
  74. //echo $ldapID;
  75. if(!empty($ldapID) OR in_array($userid, $groupmiadmins))
  76. {
  77. $con=mysqli_connect("localhost","calendarreader",$calendarreader,"calendars");
  78. //SECTION FOR BUTTON
  79. if(isset($_POST['submit']))
  80. {
  81. //echo '<script type="text/javascript">alert("inside submit"); </script>';
  82. if(empty($_POST['title']) or empty($_POST['location']) or empty($_POST['startDate']))
  83. {
  84. echo "<div class='row' ><div class='alert-box alert centered' >One or more of the fields were left blank. Please try again.</div></div>";
  85. }
  86. else
  87. {
  88. //get proper count variable for each userid to we can call the correct dropdown and get the value
  89. if($userid=="tim" OR $userid=="kbon080" OR $userid=="timmah" OR $userid=="allen" OR $userid="jonathan.perry.9" OR $userid="hwalker" OR $userid="aetaylor")
  90. {
  91. $count=0;
  92. }
  93. elseif(in_array($userid, $groupmiadmins))
  94. {
  95. $count=1;
  96. }
  97. elseif(in_array($userid,$groupphysadmins) OR $userid=="msylvester")
  98. {
  99. $count=2;
  100. }
  101. elseif($userid=="etanya")
  102. {
  103. $count=3;
  104. }
  105. elseif($userid=="tony_shutov" OR $userid=="sashaa")
  106. {
  107. $count=4;
  108. }
  109. elseif($userid=="rapp" OR $userid=="rjfries")
  110. {
  111. $count=5;
  112. }
  113. elseif($userid=="abanov")
  114. {
  115. $count=6;
  116. $abstract = $_POST['abstract'];
  117. $hostedBy = $_POST['hostedBy'];
  118. }
  119. elseif($userid=="test")
  120. {
  121. $count=7;
  122. }
  123. elseif($userid=="welch")
  124. {
  125. $count=8;
  126. }
  127.  
  128.  
  129. //get values from form
  130. $event = $_POST[$count];
  131. $eventTitle = sanitizeUserInput($_POST['title']);
  132. $startDate = $_POST['startDate'];
  133. $endDate = $_POST['endDate'];
  134. $description = $_POST['description'];
  135. $startTime = $_POST['startTime'];
  136. $endTime = $_POST['endTime'];
  137. $description = sanitizeUserInput($_POST['description']);
  138. $location = sanitizeUserInput($_POST['location']);
  139.  
  140. if($event == "Theory Seminars") {
  141. $event = "HET Seminars";
  142. }
  143.  
  144. echo $event;
  145.  
  146. //CHECK IF DUPLICATE ENTRY
  147. $checkDuplicate = mysqli_query($con,"SELECT * FROM `$event` WHERE `eventTitle`='$eventTitle' AND `startDate`='$startDate' AND `startTime`='$startTimeFormat'");
  148. $checkDuplicateCount = mysqli_num_rows($checkDuplicate);
  149. if($checkDuplicateCount != 0)
  150. {
  151. //POPUP BOX showing duplicate entry
  152. echo "<div class='row'>"; //start of div row
  153. echo "<div class='alert-box alert' >"; //start of popup box upon duplicate entry
  154. echo "There already exists an entry with that information. Thank you!";
  155. echo "</div>"; //close popup box
  156. echo "</div>"; //close div row
  157.  
  158. }
  159. else
  160. {
  161. //find the next incriment of index and assign variable
  162. $findNextIndex = mysqli_query($con,"SELECT calendarIndex FROM `$event` ORDER BY calendarIndex DESC LIMIT 1");
  163. while($row = mysqli_fetch_array($findNextIndex))
  164. {
  165. $nextIndex = $row['calendarIndex'] + 1;
  166. }
  167.  
  168. //POPUP BOX ASKING TO CONFIRM SUBMISSION
  169. echo "<div class='row'>"; //start of div row
  170. echo "<div class='alert-box success' >"; //start of popup box upon successfull sql input
  171. echo "Please confirm your submission: <ul class='nobull'>"; //popout box content
  172. echo "<li>Title: $eventTitle </li>";//popout box content
  173. echo "<li>Description: $description </li>";//popout box content
  174. echo "<li>Calendar: $event </li>";
  175. echo "<li>Start date / End date: " . $startDate . " / " . $endDate . "</li>";//popout box content
  176. echo "<li>Start time / End time: " . $startTime . " / " . $endTime . "</li>";//popout box content
  177. echo "<li>Location: $location </li>";//popout box content
  178. if($abstract AND $hostedBy)
  179. {
  180. echo "<li>Abstract: $abstract </li>";//popout box content
  181. echo "<li>Host: $hostedBy </li>";//popout box content
  182. }
  183. echo "</ul>";
  184.  
  185. //section for submit button
  186. echo "<form method='POST' action='' class='' name='confirmation'>"; //create new form for submit button
  187. echo "<div class='row'>";
  188. echo "<div class='medium-2 medium-offset-3 columns'>"; //position the button
  189. echo "<input type='submit' class='button' value='Cancel' name='cancel' >"; //cancel button
  190. echo "</div>";
  191. echo "<div class='medium-2 columns end'>"; //position the button
  192. echo "<input type='submit' class='button' value='Modify' name='modify' >"; //modify button
  193. echo "</div>";
  194. echo "<div class='medium-2 columns end'>"; //position the button
  195. echo "<input type='submit' class='button' value='Confirm' name='confirm' >"; //confirm button
  196.  
  197.  
  198. //section of hidden variables that we will use to assign variables inside of the second if(issset($_POST))
  199. echo "<input type='hidden' name='organization' value='$event'>";
  200. echo "<input type='hidden' name='eventTitle' value='$eventTitle'>";
  201. echo "<input type='hidden' name='startDate' value='$startDate'>";
  202. echo "<input type='hidden' name='endDate' value='$endDate'>";
  203. echo "<input type='hidden' name='startTime' value='$startTime'>";
  204. echo "<input type='hidden' name='endTime' value='$endTime'>";
  205. echo "<input type='hidden' name='description' value='$description'>";
  206. echo "<input type='hidden' name='location' value='$location'>";
  207. echo "<input type='hidden' name='index' value='$nextIndex'>";
  208. echo "<input type='hidden' name='host' value='$host'>";
  209. echo "<input type='hidden' name='hostedBy' value='$hostedBy'>";
  210. echo "<input type='hidden' name='abstract' value='$abstract'>";
  211.  
  212. echo "</div>"; //close position
  213. echo "</div>"; //close row
  214. echo "</form>"; //close form
  215.  
  216. echo "</div>"; //close popup box
  217. echo "</div>"; //close div row
  218. $onlyoneform =1; //variable to make sure that only one version of the form shows up
  219. }
  220.  
  221. }
  222. }
  223.  
  224. if(isset($_POST['confirm'])) //after they hit confirm or cancel from popup box
  225. {
  226. //assign varaibles from the hidden section above
  227. $event = $_POST['organization'];
  228. $eventTitle = $_POST['eventTitle'];
  229. $startDate = $_POST['startDate'];
  230. $endDate = $_POST['endDate'];
  231. $description = $_POST['description'];
  232. $location = $_POST['location'];
  233. $nextIndex = $_POST['index'];
  234. $host = $_POST['host'];
  235. $hostedBy = $_POST['hostedBy'];
  236. $abstract = $_POST['abstract'];
  237. $startTimeFormat = date_format(date_create($_POST['startTime']), 'G:i:s'); //reformat start time to 24 hr
  238. $endTimeFormat = date_format(date_create($_POST['endTime']), 'G:i:s'); //reformat end time to 24 hr
  239.  
  240.  
  241.  
  242. if($event=="Colloquium")
  243. {
  244. $inputEvent = "INSERT INTO `$event` (`calendarIndex`,`eventTitle`,`startDate`,`endDate`,`startTime`,`endTime`,`description`,`location`,`poster`,`hostedBy`) VALUES ('$nextIndex','$eventTitle','$startDate','$endDate','$startTimeFormat','$endTimeFormat','$description','$location','','$host')";
  245. $con=mysqli_connect("localhost","calendarwriter",$calendarwriter,"calendars");
  246.  
  247. runSQL($con,$inputEvent);
  248. }
  249. elseif($event=="Condensed Matter")
  250. {
  251. $inputEvent = "INSERT INTO `$event` (`calendarIndex`,`eventTitle`,`startDate`,`endDate`,`startTime`,`endTime`,`description`,`location`,`abstract`,`hostedBy`) VALUES ('$nextIndex','$eventTitle','$startDate','$endDate','$startTimeFormat','$endTimeFormat','$description','$location','$abstract','$hostedBy')";
  252. $con=mysqli_connect("localhost","calendarwriter",$calendarwriter,"calendars");
  253.  
  254. runSQL($con,$inputEvent);
  255. }
  256. else
  257. {
  258. $inputEvent = "INSERT INTO `$event` (`calendarIndex`,`eventTitle`,`startDate`,`endDate`,`startTime`,`endTime`,`description`,`location`) VALUES ('$nextIndex','$eventTitle','$startDate','$endDate','$startTimeFormat','$endTimeFormat','$description','$location')";
  259. $con=mysqli_connect("localhost","calendarwriter",$calendarwriter,"calendars");
  260.  
  261. runSQL($con,$inputEvent);
  262. }
  263.  
  264. //popup boxing telling user the submission was successfully submitted
  265. echo "<div class='row'>"; //start of div row
  266. echo "<div class='alert-box success' >"; //start of popup box upon successfull sql input
  267. echo "Thank you for your submission!";
  268. echo "</div>"; //close alert box
  269. echo "</div>"; //close div row
  270.  
  271. }
  272.  
  273. elseif(isset($_POST['modify'])) //if modify is selected, want to reproduce the form but with the values that were put in the first time.
  274. {
  275. //assign variable from hidden field inside of "confirmation box"
  276. $event = $_POST['organization'];
  277. $eventTitle = $_POST['eventTitle'];
  278. $startDate = $_POST['startDate'];
  279. $endDate = $_POST['endDate'];
  280. $description = $_POST['description'];
  281. $location = $_POST['location'];
  282. $startTime = $_POST['startTime'];
  283. $endTime = $_POST['endTime'];
  284. $host = $_POST['host'];
  285. $hostedBy = $_POST['hostedBy'];
  286. $abstract = $_POST['abstract'];
  287.  
  288. echo "<form method='POST' action='' class='' name='form'>";
  289. echo "<div class='row'>";
  290.  
  291. //SECTION FOR Title
  292. echo "<div class='medium-12 columns'>";
  293. echo "<label>Title of Event: \n";
  294. echo "<input type='text' name='title' value='$eventTitle' />";
  295. echo "</label></div>";
  296.  
  297. echo "</div>";
  298. echo "<div class='row'>";
  299.  
  300. //SECTION FOR DESCRIPTION
  301. echo "<div class='medium-12 columns'>";
  302. echo "<label>Description: \n";
  303. echo "<input type='text' name='description' value='$description' />";
  304. echo "</label></div>";
  305.  
  306. echo "</div>";
  307. if($userid=="abanov")
  308. {
  309. echo "<div class='row'>";
  310.  
  311. //SECTION FOR ABSTRACT
  312. echo "<div class='medium-12 columns'>";
  313. echo "<label>Abstract: \n";
  314. echo "<input type='text' name='abstract' value='$abstract' />";
  315. echo "</label></div>";
  316.  
  317. echo "</div>";
  318. }
  319. echo "<div class='row'>";
  320.  
  321. //SECTION FOR START DATE
  322. echo "<div class='medium-3 columns'>";
  323. echo "<label>Start Date: \n";
  324. echo "<input type='text' id='startDate' name='startDate' value='$startDate' size='30'>";
  325. echo "</label></div>";
  326.  
  327. //SECTION FOR END DATE
  328. echo "<div class='medium-3 columns'>";
  329. echo "<label>End Date: \n";
  330. echo "<input type='text' id='endDate' name='endDate' value='$endDate' size='30'>";
  331. echo "</label></div>";
  332.  
  333. //SECTION FOR START TIME
  334. echo "<div class='medium-2 columns end'>";
  335. echo "<label>Start Time: \n";
  336. echo "<input type='text' id='startTime' name='startTime' value='$startTime' size='30'>";
  337. echo "</label></div>";
  338.  
  339. //SECTION FOR END TIME
  340. echo "<div class='medium-2 columns end'>";
  341. echo "<label>End Time: \n";
  342. echo "<input type='text' id='endTime' name='endTime' value='$endTime' size='30'>";
  343. echo "</label></div>";
  344.  
  345. if($userid=="abanov")
  346. {
  347. //SECTION FOR hosted By
  348. echo "<div class='medium-2 columns end'>";
  349. echo "<label>Host: \n";
  350. echo "<input type='text' name='hostedBy' value='$hostedBy'>";
  351. echo "</label></div>";
  352. }
  353.  
  354. echo "</div>";
  355. echo "<div class='row'>";
  356.  
  357. //SECTION FOR LOCATION
  358. echo "<div class='medium-5 columns end'>";
  359. echo "<label>Location: \n";
  360. echo "<input type='text' name='location' value='$location' />";
  361. echo "</label></div>";
  362. if($userid=="tim" OR $userid=="kbon080" OR $userid=="timmah" OR $userid=="allen" OR $userid="jonathan.perry.9" OR $userid="hwalker" OR $userid="aetaylor")
  363. {
  364. $count=0;
  365. $Group = array("Atomic Molecular and Optical" => "Atomic Molecular and Optical", "astronomy seminar" => "astronomy seminar", "Colloquium" => "Colloquium",
  366. "condensed matter seminar" => "condensed matter seminar", "Cyclotron Institute colloquium" => "Cyclotron Institute colloquium", "DEEP showcase" => "DEEP showcase",
  367. "grad student seminar" => "grad student seminar", "HEPEC seminar" => "HEPEC seminar", "high energy theory seminar" => "high energy theory seminar",
  368. "Just Add Science" => "Just Add Science", "mathematical physics seminar" => "mathematical physics seminar", "mock lecture" => "mock lecture", "nuclear theory seminar" => "nuclear theory seminar",
  369. "OSA" => "OSA", "Physics and Engineering Festival" => "Physics and Engineering Festival", "Physics Show" => "Physics Show", "Star Party"=>"Star Party");
  370.  
  371. echo "<div class='medium-4 columns end'>";
  372. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  373. foreach($Group as $key=>$value)
  374. {
  375. if($value==$event)
  376. {
  377. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  378. }
  379. else
  380. {
  381. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  382. }
  383. }
  384. echo $dropdown;
  385. echo "</select></label></div>";
  386. unset($Group);
  387. }
  388. elseif(in_array($userid, $groupmiadmins))
  389. {
  390. $count=1;
  391. $Group = array("Astronomy Seminar" => "Astronomy Seminars", "HEPEC Seminar" => "HEPEC Seminars",
  392. "HET Seminar"=>"HET Seminars", "Institute Meeting" => "Institute Meetings", "MI Scientific Event" => "MI Scientific Events",
  393. "REU" => "REU", "Star Parties"=>"Star Parties" );
  394. echo "<div class='medium-4 columns end'>";
  395. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  396. foreach($Group as $key=>$value)
  397. {
  398. if($value==$event)
  399. {
  400. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  401. }
  402. else
  403. {
  404. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  405. }
  406. }
  407. echo $dropdown;
  408. echo "</select></label></div>";
  409. unset($Group);
  410. }
  411. elseif(in_array($userid,$groupphysadmins) OR $userid=="msylvester")
  412. {
  413. $count=2;
  414. $Group = array("Mathematical Physics" => "Mathematical Physics","Harmonic Analysis"=>"Harmonic Analysis","Differential Equations Seminar"=>"Differential Equations Seminar");
  415. echo "<div class='medium-4 columns end'>";
  416. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  417. foreach($Group as $key=>$value)
  418. {
  419. if($value==$event)
  420. {
  421. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  422. }
  423. else
  424. {
  425. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  426. }
  427. }
  428. echo $dropdown;
  429. echo "</select></label></div>";
  430. unset($Group);
  431. }
  432. elseif($userid=="etanya")
  433. {
  434. $count=3;
  435. $Group = array("Just Add Science" => "Just Add Science","Grad Student Seminar"=>"Grad Student Seminars","Physics Show"=>"Physics Show");
  436. echo "<div class='medium-4 columns end'>";
  437. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  438. foreach($Group as $key=>$value)
  439. {
  440. if($value==$event)
  441. {
  442. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  443. }
  444. else
  445. {
  446. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  447. }
  448. }
  449. echo $dropdown;
  450. echo "</select></label></div>";
  451. unset($Group);
  452. }
  453. elseif($userid=="tony_shutov" OR $userid=="sashaa")
  454. {
  455. $count=4;
  456. $Group = array("OSA" => "OSA");
  457. echo "<div class='medium-4 columns end'>";
  458. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  459. foreach($Group as $key=>$value)
  460. {
  461. if($value==$event)
  462. {
  463. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  464. }
  465. else
  466. {
  467. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  468. }
  469. }
  470. echo $dropdown;
  471. echo "</select></label></div>";
  472. unset($Group);
  473. }
  474. elseif($userid=="rapp" OR $userid=="rjfries")
  475. {
  476. $count=5;
  477. $Group = array("Nuclear Theory" => "Nuclear Theory","Colloquium"=>"Colloquium");
  478. echo "<div class='medium-4 columns end'>";
  479. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  480. foreach($Group as $key=>$value)
  481. {
  482. if($value==$event)
  483. {
  484. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  485. }
  486. else
  487. {
  488. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  489. }
  490. }
  491. echo $dropdown;
  492. echo "</select></label></div>";
  493. unset($Group);
  494. }
  495. elseif($userid=="abanov")
  496. {
  497. $count=6;
  498. $Group = array("Condensed Matter" => "Condensed Matter", "Cyclotron Colloquium"=>"Cyclotron Colloquium");
  499. echo "<div class='medium-4 columns end'>";
  500. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  501. foreach($Group as $key=>$value)
  502. {
  503. if($value==$event)
  504. {
  505. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  506. }
  507. else
  508. {
  509. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  510. }
  511. }
  512. echo $dropdown;
  513. echo "</select></label></div>";
  514. unset($Group);
  515. }
  516. elseif($userid=="hwalker")
  517. {
  518. $count=7;
  519. $Group = array("Mathematical Physics" => "Mathematical Physics", "Harmonic Analysis"=>"Harmonic Analysis","Differential Equations Seminars"=>"Differential Equations Seminars");
  520. echo "<div class='medium-4 columns end'>";
  521. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  522. foreach($Group as $key=>$value)
  523. {
  524. if($value==$event)
  525. {
  526. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  527. }
  528. else
  529. {
  530. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  531. }
  532. }
  533. echo $dropdown;
  534. echo "</select></label></div>";
  535. unset($Group);
  536. }
  537. elseif($userid=="welch")
  538. {
  539. $count=8;
  540. $Group = array("Atomic Molecular and Optical" => "Atomic Molecular and Optical", "Quantum Optics Seminars"=>"Quantum Optics Seminars");
  541. echo "<div class='medium-4 columns end'>";
  542. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  543. foreach($Group as $key=>$value)
  544. {
  545. if($value==$event)
  546. {
  547. $dropdown .= '<option value="'.$value.'" selected >'.$key.'</option>';
  548. }
  549. else
  550. {
  551. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  552. }
  553. }
  554. echo $dropdown;
  555. echo "</select></label></div>";
  556. unset($Group);
  557. }
  558.  
  559. //SECTION FOR SUBMIT
  560. echo "<div class='medium-2 columns end' >";
  561. echo "<input type='submit' class='button' value='Submit Event' style='top: 10px;' name='submit' >";
  562. echo "</div>";
  563.  
  564. echo "</div>";
  565. echo "</form>";
  566.  
  567. $onlyoneform =1; //variable to make sure that only one version of the form shows up
  568. }
  569.  
  570.  
  571.  
  572. //check to make sure it only displays one version of the form
  573. if($onlyoneform!=1)
  574. {
  575. $con=mysqli_connect("localhost","calendarreader",$calendarreader,"calendars");
  576. echo "<form method='POST' action='' class='' name='form'>";
  577.  
  578. echo "<div class='row'>";
  579.  
  580. //SECTION FOR TITLE
  581. echo "<div class='medium-12 columns'>";
  582. echo "<label>Title of Event: \n";
  583. echo "<input type='text' name='title' value='' />";
  584. echo "</label></div>";
  585.  
  586. echo "</div>";
  587. echo "<div class='row'>";
  588.  
  589. //SECTION FOR DESCRIPTION
  590. if($userid!="etanya")
  591. {
  592. echo "<div class='medium-12 columns'>";
  593. echo "<label>Description: \n";
  594. echo "<input type='text' name='description' placeholder='Short Description of the Event' />";
  595. echo "</label></div>";
  596. }
  597.  
  598. echo "</div>";
  599. if($userid=="abanov")
  600. {
  601. echo "<div class='row'>";
  602.  
  603. //SECTION FOR ABSTRACT
  604. echo "<div class='medium-12 columns'>";
  605. echo "<label>Abstract: \n";
  606. echo "<input type='text' name='abstract' value='' />";
  607. echo "</label></div>";
  608.  
  609. echo "</div>";
  610. }
  611. echo "<div class='row'>";
  612.  
  613. //SECTION FOR START DATE
  614. echo "<div class='medium-3 columns'>";
  615. echo "<label>Start Date: \n";
  616. echo "<input type='text' id='startDate' name='startDate' size='30'>";
  617. echo "</label></div>";
  618.  
  619. //SECTION FOR END DATE
  620. echo "<div class='medium-3 columns'>";
  621. echo "<label>End Date: \n";
  622. echo "<input type='text' id='endDate' name='endDate' size='30'>";
  623. echo "</label></div>";
  624.  
  625. //SECTION FOR START TIME
  626. echo "<div class='medium-2 columns end'>";
  627. echo "<label>Start Time: \n";
  628. echo "<input type='text' id='startTime' name='startTime' size='30'>";
  629. echo "</label></div>";
  630.  
  631. //SECTION FOR START TIME
  632. echo "<div class='medium-2 columns end'>";
  633. echo "<label>End Time: \n";
  634. echo "<input type='text' id='endTime' name='endTime' size='30'>";
  635. echo "</label></div>";
  636.  
  637. if($userid=="abanov")
  638. {
  639. //SECTION FOR hosted By
  640. echo "<div class='medium-2 columns end'>";
  641. echo "<label>Host: \n";
  642. echo "<input type='text' name='hostedBy' value=''>";
  643. echo "</label></div>";
  644. }
  645.  
  646. echo "</div>";
  647. echo "<div class='row'>";
  648.  
  649. //SECTION FOR LOCATION
  650. echo "<div class='medium-5 columns end'>";
  651. echo "<label>Location: \n";
  652. if($userid=="abanov")
  653. {
  654. echo "<input type='text' name='location' value='MIST M102' />";
  655. } else {
  656. echo "<input type='text' name='location' placeholder='i.e. Hawking Auditorium, MPHY 103' />";
  657. }
  658. echo "</label></div>";
  659.  
  660.  
  661. //SECTION FOR GROUP
  662. $con=mysqli_connect("localhost","directoryreader",$directoryreader,"directory"); //set connection to directory
  663. $queryMistGroup = mysqli_query($con,"SELECT mistGroup FROM deptMistGroup WHERE ldapID='$ldapID' LIMIT 1"); //query to get which group the mitchell faculty member is in
  664. $fetchMistGroup = mysqli_fetch_array($queryMistGroup);//fetch array
  665. $mistGroup = $fetchMistGroup['mistGroup']; //use this variable to assign additional options for appropriate members
  666.  
  667.  
  668.  
  669. if($userid=="tim" OR $userid=="kbon080" OR $userid=="timmah" OR $userid=="allen" OR $userid="jonathan.perry.9" OR $userid="hwalker" OR $userid="aetaylor")
  670. {
  671. $count=0;
  672. $Group = array("Atomic Molecular and Optical" => "Atomic Molecular and Optical", "astronomy seminar" => "astronomy seminar", "Colloquium" => "Colloquium",
  673. "condensed matter seminar" => "condensed matter seminar", "Cyclotron Institute colloquium" => "Cyclotron Institute colloquium", "DEEP showcase" => "DEEP showcase",
  674. "grad student seminar" => "grad student seminar", "HEPEC seminar" => "HEPEC seminar", "high energy theory seminar" => "high energy theory seminar",
  675. "Just Add Science" => "Just Add Science", "mathematical physics seminar" => "mathematical physics seminar", "mock lecture" => "mock lecture", "nuclear theory seminar" => "nuclear theory seminar",
  676. "OSA" => "OSA", "Physics and Engineering Festival" => "Physics and Engineering Festival", "Physics Show" => "Physics Show", "Star Party"=>"Star Party");
  677.  
  678. echo "<div class='medium-4 columns end'>";
  679. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  680. foreach($Group as $key=>$value)
  681. {
  682. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  683. }
  684. echo $dropdown;
  685. echo "</select></label></div>";
  686. unset($Group);
  687. }
  688. elseif(in_array($userid, $groupmiadmins))
  689. {
  690. $count=1;
  691. $Group = array("Astronomy Seminar" => "Astronomy Seminars", "HEPEC Seminar" => "HEPEC Seminars",
  692. "HET Seminar"=>"HET Seminars", "Institute Meeting" => "Institute Meetings", "MI Scientific Event" => "MI Scientific Events",
  693. "REU" => "REU", "Star Parties"=>"Star Parties" );
  694. echo "<div class='medium-4 columns end'>";
  695. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  696. foreach($Group as $key=>$value)
  697. {
  698. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  699. }
  700. echo $dropdown;
  701. echo "</select></label></div>";
  702. echo $count;
  703. unset($Group);
  704. }
  705. elseif(in_array($userid,$groupphysadmins) OR $userid=="msylvester")
  706. {
  707. $count=2;
  708. $Group = array("Mathematical Physics" => "Mathematical Physics","Harmonic Analysis"=>"Harmonic Analysis","Differential Equations Seminar"=>"Differential Equations Seminar");
  709. echo "<div class='medium-4 columns end'>";
  710. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  711. foreach($Group as $key=>$value)
  712. {
  713. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  714. }
  715. echo $dropdown;
  716. echo "</select></label></div>";
  717. unset($Group);
  718. }
  719. elseif($userid=="etanya")
  720. {
  721. $count=3;
  722. $Group = array("Just Add Science" => "Just Add Science","Grad Student Seminar"=>"Grad Student Seminars","Physics Show"=>"Physics Show");
  723. echo "<div class='medium-4 columns end'>";
  724. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  725. foreach($Group as $key=>$value)
  726. {
  727. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  728. }
  729. echo $dropdown;
  730. echo "</select></label></div>";
  731. unset($Group);
  732. }
  733. elseif($userid=="tony_shutov" OR $userid=="sashaa")
  734. {
  735. $count=4;
  736. $Group = array("OSA" => "OSA");
  737. echo "<div class='medium-4 columns end'>";
  738. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  739. foreach($Group as $key=>$value)
  740. {
  741. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  742. }
  743. echo $dropdown;
  744. echo "</select></label></div>";
  745. unset($Group);
  746. }
  747. elseif($userid=="rapp" OR $userid=="rjfries")
  748. {
  749. $count=5;
  750. $Group = array("Nuclear Theory" => "Nuclear Theory","Colloquium"=>"Colloquium");
  751. echo "<div class='medium-4 columns end'>";
  752. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  753. foreach($Group as $key=>$value)
  754. {
  755. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  756. }
  757. echo $dropdown;
  758. echo "</select></label></div>";
  759. unset($Group);
  760. }
  761. elseif($userid=="abanov")
  762. {
  763. $count=6;
  764. $Group = array("Condensed Matter" => "Condensed Matter");
  765. echo "<div class='medium-4 columns end'>";
  766. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  767. foreach($Group as $key=>$value)
  768. {
  769. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  770. }
  771. echo $dropdown;
  772. echo "</select></label></div>";
  773. unset($Group);
  774. }
  775. elseif($userid=="hwalker")
  776. {
  777. $count=7;
  778. $Group = array("Mathematical Physics" => "Mathematical Physics", "Harmonic Analysis"=>"Harmonic Analysis","Differential Equations Seminars"=>"Differential Equations Seminars");
  779. echo "<div class='medium-4 columns end'>";
  780. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  781. foreach($Group as $key=>$value)
  782. {
  783. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  784. }
  785. echo $dropdown;
  786. echo "</select></label></div>";
  787. unset($Group);
  788. }
  789. elseif($userid=="welch")
  790. {
  791. $count=8;
  792. $Group = array("Atomic Molecular and Optical" => "Atomic Molecular and Optical", "Quantum Optics Seminars"=>"Quantum Optics Seminars");
  793. echo "<div class='medium-4 columns end'>";
  794. echo "<label>Calendar: <select id='organization' name='$count'>\n";
  795. foreach($Group as $key=>$value)
  796. {
  797. $dropdown .= '<option value="'.$value.'" >'.$key.'</option>';
  798. }
  799. echo $dropdown;
  800. echo "</select></label></div>";
  801. unset($Group);
  802. }
  803.  
  804. //SECTION FOR SUBMIT
  805. echo "<div class='medium-2 columns end' >";
  806. echo "<input type='submit' class='button' value='Submit Event' style='top: 10px; margin-top: 25px;' name='submit' >";
  807. echo "</div>";
  808. echo "</form>";
  809. }
  810. }
  811. else
  812. {
  813. echo "You are not eligible to sumit an event. If this is an error, email Kyle Bonar at kbon080@tamu.edu .";
  814. }
  815.  
  816. ?>
  817.  
  818. <script>
  819. var startDate = document.getElementById("startDate");
  820. var endDate = document.getElementById("endDate");
  821. var startTime = document.getElementById("startTime");
  822. var endTime = document.getElementById("endTime");
  823.  
  824. if (startDate)
  825. {
  826. startDate.addEventListener("input", function(){
  827. if(startDate.value.length>=10)
  828. {
  829. startDate.value = startDate.value.substring(0,10);
  830. }
  831.  
  832. });
  833. }
  834. if (endDate)
  835. {
  836. endDate.addEventListener("input", function(){
  837. if(endDate.value.length>=10)
  838. {
  839. endDate.value = endDate.value.substring(0,10);
  840. }
  841.  
  842. });
  843. }
  844. if (startTime)
  845. {
  846. startTime.addEventListener("input", function(){
  847. if(startTime.value.length>=8)
  848. {
  849. startTime.value = startTime.value.substring(0,8);
  850. }
  851.  
  852. });
  853. }
  854. if (endTime)
  855. {
  856. endTime.addEventListener("input", function(){
  857. if(endTime.value.length>=8)
  858. {
  859. endTime.value = endTime.value.substring(0,8);
  860. }
  861.  
  862. });
  863. }
  864.  
  865.  
  866. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement