Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sv_name = "";
- $username = "";
- $password = "";
- $db_name = "";
- ?>
- <script type="text/javascript">
- var psi1;
- var psi2;
- var psi3;
- var psi4;
- //var xmlhttp;
- var lvl;
- var sub1;
- var sub2;
- var sub3;
- var sub4;
- var si1;
- var si2;
- var si3;
- var si4;
- var todisable;
- var isvalid1;
- var isvalid2;
- var isvalid3;
- var isvalid4;
- var tmpFunc;
- //loaded();
- function loaded()
- {
- if(window.XMLHttpRequest)
- {
- xmlhttp=new XMLHttpRequest();
- }
- else
- {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- }
- function ClearChoices()
- {
- document.getElementById('div1type1').style.display = 'none';
- document.getElementById('div2').style.display = 'none';
- document.getElementById('div3').style.display = 'none';
- document.getElementById('div4').style.display = 'none';
- document.getElementById('divTimetable').style.display = 'none';
- document.uniform.level.selectedIndex = 0;
- document.uniform.subject1.selectedIndex = 0;
- document.uniform.subject2.selectedIndex = 0;
- document.uniform.subject3.selectedIndex = 0;
- document.uniform.subject4.selectedIndex = 0;
- }
- function typeChanged()
- {
- if(document.uniform.level.value == "1")
- {
- document.getElementById('div1type1').style.display = '';
- document.getElementById('div2').style.display = '';
- document.getElementById('div3').style.display = '';
- document.getElementById('div4').style.display = 'none';
- document.uniform.subject4.selectedIndex = 0;
- }
- else if(document.uniform.level.value == "2")
- {
- document.getElementById('div1type1').style.display = '';
- document.getElementById('div2').style.display = '';
- document.getElementById('div3').style.display = 'none';
- document.getElementById('div4').style.display = 'none';
- document.uniform.subject3.selectedIndex = 0;
- document.uniform.subject4.selectedIndex = 0;
- }
- else if(document.uniform.level.value == "3")
- {
- document.getElementById('div1type1').style.display = '';
- document.getElementById('div2').style.display = '';
- document.getElementById('div3').style.display = '';
- document.getElementById('div4').style.display = 'none';
- document.uniform.subject4.selectedIndex = 0;
- }
- else if(document.uniform.level.value == "4")
- {
- document.getElementById('div1type1').style.display = '';
- document.getElementById('div2').style.display = '';
- document.getElementById('div3').style.display = '';
- document.getElementById('div4').style.display = '';
- }
- document.getElementById('divTimetable').style.display = 'none';
- document.uniform.subject1.selectedIndex = 0;
- document.uniform.subject2.selectedIndex = 0;
- document.uniform.subject3.selectedIndex = 0;
- document.uniform.subject4.selectedIndex = 0;
- SubjectNames();
- update();
- }
- function update() // changes made: reversed style and option disable
- {
- for(var i=1; i<document.uniform.subject1.options.length; i++)
- {
- if (document.uniform.subject1.value < 1)
- {
- document.uniform.subject1.options[i].disabled = false;
- document.uniform.subject1.options[i].style.display = '';
- }
- if (document.uniform.subject2.value < 1)
- {
- document.uniform.subject2.options[i].disabled = false;
- document.uniform.subject2.options[i].style.display = '';
- }
- if (document.uniform.subject3.value < 1)
- {
- document.uniform.subject3.options[i].disabled = false;
- document.uniform.subject3.options[i].style.display = '';
- }
- if (document.uniform.subject4.value < 1)
- {
- document.uniform.subject4.options[i].disabled = false;
- document.uniform.subject4.options[i].style.display = '';
- }
- }
- }
- function displayTimetable()
- {
- var xmlhttp;
- if(window.XMLHttpRequest)
- {
- xmlhttp=new XMLHttpRequest();
- }
- else
- {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- si1 = document.uniform.subject1.selectedIndex;
- si2 = document.uniform.subject2.selectedIndex;
- si3 = document.uniform.subject3.selectedIndex;
- si4 = document.uniform.subject4.selectedIndex;
- var typeid = document.uniform.level.value;
- var subid1 = document.uniform.subject1.options[si1].value;
- var subid2 = document.uniform.subject2.options[si2].value;
- var subid3 = document.uniform.subject3.options[si3].value;
- var subid4 = document.uniform.subject4.options[si4].value;
- xmlhttp.onreadystatechange=function()
- {
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- var response1 = xmlhttp.responseText;
- var response = response1.replace(/\+/g, " ");
- document.getElementById('divTimetable').innerHTML = unescape(response);
- document.getElementById('divTimetable').style.display = '';
- }
- }
- xmlhttp.open("GET", "./timetable.php?typeid=" + typeid + "&subid1="+subid1 + "&subid2="+subid2 + "&subid3="+subid3 + "&subid4="+subid4, true);
- xmlhttp.send();
- }
- function SubjectNames()
- {
- if(document.uniform.level.value == "1")
- {
- document.getElementById('sub1').innerHTML = "Fach 1: ";
- document.getElementById('sub2').innerHTML = "Fach 2: ";
- document.getElementById('sub3').innerHTML = "Individual-Profil: ";
- }
- if(document.uniform.level.value == "2")
- {
- document.getElementById('sub1').innerHTML = "Fach 1: ";
- document.getElementById('sub2').innerHTML = "Fach 2: ";
- }
- if(document.uniform.level.value == "3")
- {
- document.getElementById('sub1').innerHTML = "Fach 1: ";
- document.getElementById('sub2').innerHTML = "Fach 2: ";
- document.getElementById('sub3').innerHTML = "Individual-Profil: ";
- }
- if(document.uniform.level.value == "4")
- {
- document.getElementById('sub1').innerHTML = "Fach: ";
- document.getElementById('sub2').innerHTML = "Vertiefungsfach: ";
- document.getElementById('sub3').innerHTML = "Vertiefungsfach: ";
- document.getElementById('sub4').innerHTML = "Individual-Profil: ";
- }
- }
- function DisableSubs()
- {
- var xmlhttp;
- if(window.XMLHttpRequest)
- {
- xmlhttp=new XMLHttpRequest();
- }
- else
- {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- si1 = document.uniform.subject1.selectedIndex;
- si2 = document.uniform.subject2.selectedIndex;
- si3 = document.uniform.subject3.selectedIndex;
- si4 = document.uniform.subject4.selectedIndex;
- var typeid = document.uniform.level.value;
- var subid1 = document.uniform.subject1.options[si1].value;
- var subid2 = document.uniform.subject2.options[si2].value;
- var subid3 = document.uniform.subject3.options[si3].value;
- var subid4 = document.uniform.subject4.options[si4].value;
- xmlhttp.onreadystatechange=function()
- {
- //alert('GYPSY');
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- var response = xmlhttp.responseText;
- eval(response.replace(/\n/g, " "));
- }
- }
- xmlhttp.open("GET", "./disablesubs.php?typeid="+typeid + "&subid1="+subid1 + "&subid2="+subid2 + "&subid3="+subid3 + "&subid4="+subid4 + "&si1="+si1 + "&si2="+si2 + "&si3="+si3 + "&si4="+si4, true);
- xmlhttp.send();
- }
- function sleep(milliSeconds){
- var startTime = new Date().getTime(); // get the current time
- while (new Date().getTime() < startTime + milliSeconds); // hog cpu
- }
- function disableSelected() {
- document.uniform.subject2.options[si1].disabled = true;
- document.uniform.subject2.options[si3].disabled = true;
- document.uniform.subject2.options[si4].disabled = true;
- document.uniform.subject3.options[si1].disabled = true;
- document.uniform.subject3.options[si2].disabled = true;
- document.uniform.subject3.options[si4].disabled = true;
- document.uniform.subject4.options[si1].disabled = true;
- document.uniform.subject4.options[si2].disabled = true;
- document.uniform.subject4.options[si3].disabled = true;
- for(var i=1; i<document.uniform.subject1.options.length; i++)
- {
- document.uniform.subject1.options[i].disabled = false;
- document.uniform.subject1.options[i].style.display = '';
- }
- }
- function openImg(filename) {
- document.getElementById('popupimg').style.display = '';
- document.getElementById('popupimg').innerHTML = "<img src=\"close.png\" style=\"margin-left: 770px; margin-top: 5px; position: absolute;\" onclick=\"closeImg()\" onmouseover=\"this.style.cursor='pointer';\" /><img src='"+filename+"' onclick=\"closeImg()\" onmouseover=\"this.style.cursor='pointer';\" />";
- }
- function closeImg() {
- document.getElementById('popupimg').style.display = 'none';
- document.getElementById('popupimg').innerHTML = "";
- }
- </script>
- <div id="popupimg" style="display: none; position: absolute; margin-left: 200px; padding: 5px;box-shadow:inset 0 0 10px #000000; background-color: #ffffff;"></div>
- <table>
- <tr>
- <form name="uniform">
- <td><span style="">Profil:</span>
- <select style="width: 200px;" name="level" value="1" onchange="typeChanged();">
- <option value="">- Auswählen -</option>
- <?php
- $pages_table_name = "uni_types";
- $con = mysql_connect($sv_name, $username, $password) or die(mysql_error());
- mysql_select_db($db_name, $con) or die(mysql_error());
- $query = "SELECT * FROM " . $pages_table_name;
- $result_types = mysql_query($query, $con) or die(mysql_error());
- while($row_types = mysql_fetch_array($result_types))
- {
- echo("<option value=\"" . $row_types['id'] . "\">" . $row_types['name'] . "</option>");
- }
- ?>
- </select></td>
- <td><a href="" onclick="ClearChoices(); return false;">Zurücksetzen</a></td>
- </tr>
- <tr>
- <td>
- <div id="div1type1" style="display:none;">
- <div id="sub1" style="float: left;"></div>
- <select name="subject1" style="margin-right: 20px; width: 150px;" onchange="document.uniform.subject2.selectedIndex = 0; document.uniform.subject3.selectedIndex = 0; document.uniform.subject4.selectedIndex = 0; update(); DisableSubs(); displayTimetable(); disableSelected() ">
- <option value="0" >- Auswählen -</option>
- <?php
- $pages_table_name = "uni_subjects";
- $query = "SELECT * FROM " . $pages_table_name;
- $result_types = mysql_query($query, $con) or die(mysql_error());
- $subcount = 0;
- while($row_types = mysql_fetch_array($result_types))
- {
- if ($row_types['name'] != "DELETED")
- {
- echo("<option value=\"" . $row_types['id'] . "\">" . $row_types['name'] . "</option>");
- $subcount++;
- }
- }
- ?>
- </select>
- </div>
- </td>
- <td><div id="div2" style="display:none;">
- <div id="sub2" style="float: left;"></div>
- <select name="subject2" style="margin-right: 20px; width: 150px;" onchange="document.uniform.subject3.selectedIndex = 0; document.uniform.subject4.selectedIndex = 0; update(); DisableSubs(); displayTimetable(); disableSelected()">
- <option value="0" >- Auswählen -</option>
- <?php
- $pages_table_name = "uni_subjects";
- $query = "SELECT * FROM " . $pages_table_name;
- $result_types = mysql_query($query, $con) or die(mysql_error());
- while($row_types = mysql_fetch_array($result_types))
- {
- if ($row_types['name'] != "DELETED")
- {
- echo("<option value=\"" . $row_types['id'] . "\">" . $row_types['name'] . "</option>");
- }
- }
- ?>
- </select>
- </div></td>
- <td><div id="div3" style="display:none;">
- <div id="sub3" style="float: left;"></div>
- <select name="subject3" style="margin-right: 20px; width: 150px;" onchange="document.uniform.subject4.selectedIndex = 0; update(); DisableSubs(); displayTimetable(); disableSelected()">
- <option value="0" >- Auswählen -</option>
- <?php
- $pages_table_name = "uni_subjects";
- $query = "SELECT * FROM " . $pages_table_name;
- $result_types = mysql_query($query, $con) or die(mysql_error());
- while($row_types = mysql_fetch_array($result_types))
- {
- if ($row_types['name'] != "DELETED")
- {
- echo("<option value=\"" . $row_types['id'] . "\">" . $row_types['name'] . "</option>");
- }
- }
- ?>
- </select>
- </div></td>
- <td><div id="div4" style="display:none;">
- <div id="sub4" style="float: left;"></div>
- <select name="subject4" style="margin-right: 20px; width: 150px;" onchange="update(); DisableSubs(); displayTimetable(); disableSelected()">
- <option value="0" >- Auswählen -</option>
- <?php
- $pages_table_name = "uni_subjects";
- $query = "SELECT * FROM " . $pages_table_name;
- $result_types = mysql_query($query, $con) or die(mysql_error());
- while($row_types = mysql_fetch_array($result_types))
- {
- if ($row_types['name'] != "DELETED")
- {
- echo("<option value=\"" . $row_types['id'] . "\">" . $row_types['name'] . "</option>");
- }
- }
- ?>
- </select>
- </div></td>
- <script id="disablesubs" type="text/javascript">
- </script>
- <input type="hidden" name="combinationid" />
- <br />
- <input name="showTimetable" type="hidden" value="Show Timetable" />
- </form>
- </tr>
- </table>
- <script type="text/javascript">
- document.uniform.subject1.selectedIndex = 0;
- document.uniform.subject2.selectedIndex = 0;
- document.uniform.subject3.selectedIndex = 0;
- document.uniform.subject4.selectedIndex = 0;
- document.getElementById('div4').style.display = 'none';
- </script>
- <div id="divTimetable" style="margin-left: 10px; margin-top: 100px; width: 98%;">
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement