-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfessor.php
executable file
·70 lines (66 loc) · 2.59 KB
/
Professor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Handles processing of the main professor schedule page.
*
* Provides user input to other classes that need it and holds intermediary
* class information arrays used throughout this script.
*
* @author Bion Oren
* @version 1.0
*/
class Professor extends Main {
/** ARRAY List of meetings times associated with a professor. $profClassList[PROF_NAME][] = Meeting */
protected $profClassList = array();
/** STRING The name of the currently selected professor. */
protected $prof;
/**
* Initializes all the class variables.
*/
public function __construct() {
parent::__construct();
if(isset($_REQUEST["prof"])) {
$this->prof = $_REQUEST["prof"];
}
$this->generateProfList();
}
/**
* Generates a sorted list of meetings associated with and keyed by the professor teaching them.
*
* @return ARRAY $ret[PROF_NAME][] = Meeting
*/
protected function generateProfList() {
$classData = getClassData(Main::getSemester(), Main::isTraditional());
Main::$CAMPUS_MASK = array_pop($classData);
$this->setCampusMask();
//generate select option values for display later
$data = array_filter($classData, create_function('Course $class', 'return $class->getCampus() & "'.$this->campusMask.'";'));
foreach($data as $class) {
$list = $class->getProfClassList();
foreach($list as $prof=>$class2) {
$this->profClassList[$prof][] = $class2;
}
}
ksort($this->profClassList);
}
/**
* Displays dropdown to select which prof to show a schedule for.
*
* @return VOID
*/
public function printProfDropdown($choice=null) {
print '<div id="profChoice">';
print '<select name="prof" id="profDD" onchange="profSelected(this)">';
print '<option value="0">----</option>';
foreach($this->profClassList as $prof=>$classes) {
print '<option value="'.$prof.'"';
if($choice == $prof) {
print ' selected="selected"';
}
print '>'.$prof.'</option>';
}
print '</select>';
print '<label for="profDD" style="display:none;">Professor selection dropdown</label>';
print '</div>';
}
}
?>