5.2. Instructor Interface (view.sl)


(****
 *
 * This file defines the objects and operations related to the different
 * views available to the Instructor type user and the interface they see.
 *
 *
 *)

from InstructorDB import InstructorDB;
 
object LoginName = integer
    description: (*
        The employee ID of the Instructor wishing to login
    *);
end;

object LoginPassword = string
description: (*
        The password to match with the Instructor Database that belongs with LoginName
    *);
end;

object LoginButton;
object CancelButton;

object InstructorLoginView
    components: LoginName and LoginPassword and LoginButton and CancelButton;
    description: (*
        The log in for an Instructor to edit their preferences.
    *);
end InstructorLoginView;

object CourseNumber = integer;
object CourseRatings
    components: CourseNumber and rating:integer;
    description: (*
        The course rating for a particular course number.
    *);
end CourseRatings;

axiom forall (c: CourseRatings) (c.rating >= 0 and c.rating <= 5) or c.rating = nil;

object FallRating = boolean
    description: (*
        The rating for a particular course in the Fall
    *);
end;

object WinterRating = boolean
    description: (*
        The rating for a particular course in the Winter
    *);
end;

object SpringRating = boolean
    description: (*
        The rating for a particular course in the Spring
    *);
end;

object SummerRating = boolean
    description: (*
        The rating for a particular course in the Summer
    *);
end;

object QuarterRatings
    components: CourseNumber and FallRating and WinterRating and SpringRating and
        SummerRating;
    description: (*
        The preference of teaching a course in the particular quarter for an Instructor
    *);
end QuarterRatings;

object InstructorCourseView
    components: CourseNumber* and CourseRatings* and QuarterRatings* and SavePreferenceButton;
    description: (*
        InstructorCourseView is the view for when the Instructor
        is looking at their course preferences.
    *);
end InstructorCourseView;

object BuildingNumber = integer;
object RoomNumber = integer;
object RRating;
object RoomRatings
    components: BuildingNumber and RoomNumber and rating:integer;
    description: (*
        The rating for a particular building number and room.
    *);
end RoomRatings;

axiom forall (r: RoomRatings) (r.rating >= 0 and r.rating <=5) or r.rating = nil;

object RoomsList
    components: BuildingNumber* and RoomNumber* and RoomRatings*;
    description: (*
        This contains the list of rooms and their attributes returned by the Rooms Database.
    *);
end RoomsList;

object Building = string;
object SmartRoom = boolean;
object Projector = boolean;
object Screen = boolean;
object Overhead = boolean;
object Speakers = boolean;
object Capacity = integer;
object Whiteboard = boolean;
object Chalkboard = boolean;
object Computers = boolean;
object CompNumber = integer;
object OtherOption = string;

object SearchOptions
    components: Building and SmartRoom and Projector and Screen and Overhead and Speakers and 
    Capacity and Whiteboard and Chalkboard and Computers and CompNumber and OtherOption;
    description: (*
        This is the view box which contains all the search options for filtering the Rooms 
        Database
    *);
end SearchOptions;

object SearchButton;

object InstructorRoomView
    components: RoomsList and SearchOptions and SavePreferenceButton and SearchButton;
    description: (*
        Instructor view contains both the list of rooms and the search options to filter those
        list of rooms.
    *);
end InstructorRoomView;

(* Days of the week *)

object Sunday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Monday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Tuesday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Wednesday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Thursday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Friday = string
    description: (*
        One of the seven days of the week
    *);
end;

object Saturday = string
    description: (*
        One of the seven days of the week
    *);
end;

object DaysOfWeek
    components: Sunday or Monday or Tuesday or Wednesday or Thursday or Friday or Saturday;
    description: (*
        Contains the days of the week used for TimesOfDay in the Instructor Time Preferences
    *);
end DaysOfWeek;

object FromTime = integer;
object ToTime = integer;
object FromAMPM = string;
object ToAMPM = string;

object TimeInterval
    components: FromTime and FromAMPM and ToTime and ToAMPM;
    description: (*
        This is the hour time interval. For example, 11:00AM to 12:00PM.
    *);
end TimeInterval;

object TimesOfDay
    components: TimeInterval and DaysOfWeek;
    description: (*
        This is the combination of a day of the week and the time interval. This is used to 
        model which checkbox the Instructor checks during the Time Preferences.
    *);
end TimesOfDay;

object TimeRatings 
    components: TimesOfDay and rating:integer;
    description: (*
        The preference rating for a particular day and time interval
    *);
end TimeRatings;

axiom forall (t: TimeRatings) (t.rating >= 0 and t.rating <=5) or t.rating = nil;

object InstructorTimeView
    components: DaysOfWeek and TimesOfDay* and TimeRatings* and SavePreferenceButton;
    description: (*
        InstructorTimeView includes every time of day and day of week combination along with
        the rating for each combination.
    *);
end InstructorTimeView;

object UpdatedPrefs
    components: CourseRatings* and QuarterRatings* and TimeRatings* and RoomRatings*;
    description: (*
        The updated preferences for every Course, Time and Room rating.
    *);
end UpdatedPrefs;

object SavePreferenceButton;

operation SavePreference
    inputs: c:CourseRatings* and q:QuarterRatings* and t:TimeRatings* and r:RoomRatings*;
    outputs: (* Updated in the databases *);
    precondition: (* None, handled by axioms for every rating*);
    postcondition: (* None *);
    description: (*
        SavePreferenceClick takes a click from the mouse on top of the 
        SavePreferenceButton. Once pressed, the scheduler will automatically 
        update the InstructorDB and change their preferences based on what
        the Instructor specified for each type of preference.
    *);
end SavePreference;

operation LoginInstructor
    inputs: ln:LoginName, lp:LoginPassword, idb:InstructorDB;
    outputs: InstructorCourseView;
    precondition: ;
    postcondition: 
        (* Login EMPID must be in the InstructorDB and the password much match *)
        (exists (ir in idb) (idb.ln = ln) and (idb.lp = lp);
    description: (*
        The log in operation when the Instructor first tries to access their preferences.
    *);
end LoginInstructor;








Prev: admin.sl | Next: student.sl | Up: spec | Top: index