CAS_functions.pl API
The following Perl subroutines from
CAS_functions.pl
provide the database access and query
functionality for template wrappers.
A note about lists
There are two points to notes about lists:
- The contents of a list are returned as a global Perl array. Each line of the array contains data in the format: name1=value1;name2=value2; etc.
- For example, one of the array values produced from this code:
local(@result);
while (@result = &sql_fetch) {
push(@groups, "group_name=$result[0];directory_name=$result[1];");
}
- might look like this:
- group_name=Information Systems;directory_name=infosys;
- The data will be unscrambled by the code that deals with
#foreachrow
in the replace
subroutine of
template_functions.pl
.
- A subroutine that uses this format to return lists returns
them globally; they are a "side effect" of the subroutine. The value returned
by the subroutine must be 1 (true) to signal a non-empty list, or an
empty string (false) if the list is empty.
- This returned value is then used by the
#if..#else..#elseif
operator in
conjunction with lists.
# Return true if data was found
if (@groups) {
return 1;
} else {
return "";
}
- CAS_open_connection
- Open connection to CAS.
- CAS_close_connection
- Close connection to CAS.
- CAS_get_staff_logins ($department)
- Returns an array of logins of members of staff for the given department name.
- CAS_get_rpg_logins ($department)
- Returns an array of logins of research postgraduates for the given department name.
- CAS_get_staff_research_groups ($uid)
- Returns a list of research groups and associated web space directory name that the staff member with the given user ID is a member of.
- CAS_get_research_group_list ($department)
- Returns an array of research group names for the given department name.
- CAS_get_research_group_name($directory_name, $department)
- Returns the full research group name for the specified directory_name E.g. returns "Theoretical Computer Science Group" when passed "tcs"
- CAS_get_research_group_directory_names ($department)
- Returns a list of research group names and associated web space directory names for the given department name.
- CAS_get_research_group_list_and_URLs ($department)
- Returns a list of research group names and associated web space directory names for the given department name.
- Same functionality as CAS_get_research_group_directory_names, but left in for backwards compatibility.
- CAS_get_staff_list ($department)
- Returns a list of the staff members for the given department name.
- Each list entry contains the login, forename, surname and position of that staff member.
- CAS_get_rpg_list ($department)
- Returns a list of the research student members for the given department name.
- Each list entry contains the login, forename, surname and position of that research student.
- CAS_get_staff_info ($uid)
- Returns an associative array containing details of the given staff user ID.
- These details are: uid, title, initials, forename, surname, location, extension, position, url, badge, email and are keyed on these strings. For more information on what the keys hold, see the online documentation.
- CAS_get_student_info ($uid)
- Returns an associative array containing details of the given undergraduate student user ID.
- These details are: uid, title, initials, forename, surname, college, year_study, faculty, tutor_initials, subject, segment_code, year_segment_entry, study_mode, study_status, tutor_uid, tutor_name, student_type, student_degree_title (phew!) and are keyed on these strings.
- For more information on what the keys hold, see the online documentation.
- CAS_get_ug_logins ($department)
- Returns an array of undergraduate student user IDs for the given department name.
- CAS_get_tpg_logins ($department)
- Returns an array of undergraduate student user IDs for the given department name.
- CAS_get_ug_list ($department, $letter)
- Returns an array of undergraduate student logins for the given department name and alphabet index.
- CAS_get_tpg_list ($department)
- Returns an array of undergraduate student logins for the given department name.
- CAS_get_student_classes ($uid, $year)
- Returns a list of classes taken by the given undergraduate student in the given year.
- The list contains the course code, course title and the user ID of the class supervisor for each class.
- CAS_get_research_group_heads ($group_name)
- Returns a list of the research group heads for the given research group name.
- The list contains the login, forename and surname of each person.
- CAS_get_research_group_academics ($group_name)
- Returns a list of the research group academics for the given research group name.
- The list contains the login, forename and surname of each person.
- CAS_get_research_group_researchers ($group_name)
- Returns a list of the research group researchers for the given research group name.
- The list contains the login, forename and surname of each person.
- CAS_get_research_group_servicers ($group_name)
- Returns a list of the research group servicers for the given research group name.
- The list contains the login, forename and surname of each person.
- CAS_get_research_group_staff_logins ($group_name)
- Returns a list of all the logins of research staff for the given research group name.
- CAS_get_tutees ($uid)
- Returns a list of tutees for the given staff user ID.
- The list contains the forename, surname and login of each tutee.
- CAS_get_supervisions ($uid, $year)
- Returns a list of classes supervised by the person with the given user ID. The list contains the course code, course name, user ID of the supervisor and an array of email addresses of students on the course, for every class supervised.
- CAS_get_lectureships ($uid, $year)
- Returns a list of lecture courses taken by the person with the given user ID.
- The list contains the course code and course title of every lecture course taken.
- CAS_get_responsibilities ($uid, $year)
- Returns a list of responsibilities of the person with the given user ID.
- The list contains the responsibility (or person_right), course code and course title of every responsibility.
- get_long_email_form ($uid)
- Returns the full length email address of the given user ID, using mailinfo.
- CAS_get_user_status ($uid)
- Returns the status of the specified user (e.g. staff, research student, etc)
- get_student_degree_type ($degree string)
- Where degree string is of the form:
- subject:degree type (e.g. COMPSCI:PHD-R)
- CAS_get_student_courses ($uid, $year)
- Returns a list of courses taken by the given undergraduate/taught postgrad student in the given year.
- The list contains the course code and course title for each course.
- CAS_get_publication_types
- Returns an array of publication types
- CAS_get_publication_attributes_allowed ($publication_type)
- Returns an associative array for each publication type containing details of which publication attributes are allowed for that type
- CAS_personnel_check ($login)
- Check the person with the specified login has an entry in the PERSONNEL table.
- Returns 1 for true, 0 for false.
- CAS_get_person_id ($login)
- Returns the person id of the specified login.
- Existance of login should have already been checked with CAS_personnel_check(login).
- CAS_get_research_group_id ($group name)
- Returns the group id of the specified research group.
- CAS_get_publication_core_attributes ($publication id)
- Returns details for creating the web page for the publication given by the specified publication id
- CAS_get_publication_optional_attributes ($publication id)
- Returns details for creating the web page for the publication given by the specified publication id
- CAS_get_publication_list ($year)
- Returns a list of *all* publication details for the specified year
- CAS_get_publication_ids_for_year ($year)
- Returns a list of all publication ids for the specified year
- CAS_get_publication_administrator_login
- Returns the login of the publication repository administrator.
- (Note that *only the first person* found in PUBLICATION_RIGHT gets their long form email address returned.)
- CAS_get_publication_ids
- Returns an associative array of years indexed by publication id
- CAS_get_individuals_publication_list (uid, start month, start year, end month, end year)
- Returns a list of the specified individual's publications
- CAS_get_publication_index_entries ($type, @matching_pub_ids)
- Returns the index entry for the specified publication.
- Used in individual, yearly and research group publication indexes.
- $type specifies the Bibtex style file to use:
- page --> csweb_pub.bst
- name --> csweb_name.bst
- date --> csweb_date.bst
- CAS_get_research_group_publication_list (research group, start month, start year, end month, end year)
- Returns a list of the specified research group's publications
- CAS_got_publication_person ($publication_id)
- Returns true if specified publication id has an associated person, false otherwise
- CAS_got_publication_research_group ($publication_id)
- Returns true if specified publication id has an associated research group, false otherwise
- CAS_count_individuals_publications
- Count individual publications for all individuals with one or more publications held in the database
- CAS_get_matching_publication_ids (ukc_logins, research_groups, publication_types, start_year, start_month, end_year, end_month)
- Returns an array containing the publication ids of publications matching the parameters passed to this subroutine.
- Note that the first three parameters are lists, with each element separated by ", "
- CAS_get_publication_year ($publication_id)
- Returns the year of the specified publication id
- CAS_create_bibtex_record ($publication_id)
- Create a Bibtex record for the specified publication id
- CAS_matching_person_index_status ($publication_id)
- Is there an entry in PERSON_PUBLICATION for the specified pub_id and specified person?
- CAS_matching_research_group_index_status (publication_id, department_id, research_group_id)
- Is there an entry in RESEARCH_GROUP_PUBLICATION for the specified pub_id?
- CAS_get_module_list ($year)
- Returns an array of course_codes for all modules in the specified year
- CAS_get_module_list_by_prefix ($year, $prefix)
- Returns an array of course_codes for all modules specified by year and by subject prefix.
- E.g. 'CO' = Computing, 'EL' = Electronics, etc.
- CAS_get_module_info ($course_code, $year)
- Returns all module details for the module specified by course_code
- CAS_get_module_lecturers ($course_code)
- Returns an array of logins of staff who lecture on the specified course
- CAS_get_module_classes ($course_code, $year)
- Returns a list of classes for the specified course_code in the specified year.
- CAS_get_module_assessments ($course_code, $year)
- Returns a list of assessments for the specified course_code in the specified year.specified year.
- munge_date ($old_date)
- CAS uses 07-feb-1997 (for example) sometimes. Change it to 7/2/97.
- munge_course_code ($course_code, $year)
- Work out where to put the module pages
- E.g. for CO301 in year 96/97, pages go into:
- /teaching/96/modules/CO/3/01/ or mnemonically:
- /teaching/year_start/modules/subject_prefix/level/code/











