function _DatabaseHandler::duplicate_course_for_year
Search API
4.x _DatabaseHandler.php | _DatabaseHandler::duplicate_course_for_year($course = null, $catalog_year) |
5.x _DatabaseHandler.php | _DatabaseHandler::duplicate_course_for_year($course = null, $catalog_year) |
File
- classes/
_DatabaseHandler.php, line 851
Class
Code
function duplicate_course_for_year($course = null, $catalog_year)
{
// Duplicate the course for the given catalog_year.
// If it already exists for that catalog_year, delete it from the
// table.
// In other words, copy all course data from some valid year into this
// new year.
$c = $course;
$course_id = $c->course_id;
$min_hours = $c->min_hours;
$max_hours = $c->max_hours;
if (@$c->bool_ghost_min_hour) {
$min_hours = 0;
}
if (@$c->bool_ghost_hour) {
$max_hours = 0;
}
$res = $this->db_query("DELETE FROM draft_courses WHERE
course_id = '?' AND catalog_year = '?'
AND subject_id = '?'
AND course_num = '?' ", $course_id, $catalog_year, $c->subject_id, $c->course_num);
$res2 = $this->db_query("INSERT INTO draft_courses(course_id,
subject_id, course_num, catalog_year,
title, description, min_hours, max_hours,
repeat_hours, exclude) values (
'?','?','?','?','?','?','?','?','?','?')
", $course_id, $c->subject_id, $c->course_num, $catalog_year, $c->title, $c->description, $min_hours, $max_hours, $c->repeat_hours, $c->db_exclude);
}