function course_search_display_edit_courses
Search API
7.x course_search.edit.inc | course_search_display_edit_courses() |
6.x course_search.edit.inc | course_search_display_edit_courses() |
4.x course_search.edit.inc | course_search_display_edit_courses() |
5.x course_search.edit.inc | course_search_display_edit_courses() |
Display a plain list of courses, making it easier for admins to edit schedules and details in one spot.
File
- modules/
course_search/ course_search.edit.inc, line 364 - This file contains functions relating to editing the course info, like rotation schedule and syllabus
Code
function course_search_display_edit_courses()
{
$rtn = "";
$current_catalog_year = variable_get("current_catalog_year", "");
// catalog_year is always just whatever the current year is.
$catalog_year = $current_catalog_year;
$cc = 1;
// Get the "upper range" (UR) and
// lower range (LR) of the courses in question...
$ur = trim($_GET ["ur"]);
$lr = trim($_GET ["lr"]);
if ($ur == "")
{ // meaning, no range was set. Use A - AZZZZZ, so, all of the A's.
$ur = $_SESSION ["dec_ur"];
$lr = $_SESSION ["dec_lr"];
if ($ur == "")
{ // if still blank, assign it..
$ur = "A";
$lr = "AZZZZ";
}
}
$_SESSION ["dec_ur"] = $ur;
$_SESSION ["dec_lr"] = $lr;
$rtn .= "<h2 class='title'>" . t("Update Course Information") . "</h2>
<div class='tenpt' style='margin-bottom: 20px;'>
" . t("To update a course's sample syllabus or schedule,
please select the course from the list below.") . "
<br>
" . l(t("View Reports"), "tools/course-search/view-reports") . "
</div>
";
$letter_ranges = array(
"A" => array("A", "AZZZZ"),
"B" => array("B", "BZZZZ"),
"C-CN" => array("C", "CNZZZ"),
"CO-CZ" => array("CO", "CZZZZ"),
"D" => array("D", "DZZZZ"),
"E" => array("E", "EZZZZ"),
"F" => array("F", "FZZZZ"),
"G" => array("G", "GZZZZ"),
"H" => array("H", "HZZZZ"),
"I-L" => array("I", "LZZZZ"),
"M-MR" => array("M", "MRZZZ"),
"MS-MZ" => array("MS", "MZZZZ"),
"N-O" => array("N", "OZZZZ"),
"P" => array("P", "PZZZZ"),
"Q-R" => array("Q", "RZZZZ"),
"S-SO" => array("S", "SOZZZ"),
"SP-SZ" => array("SP", "SZZZZ"),
"T-Z" => array("T", "ZZZZZ"),
);
$rtn .= "<div class='admin-courses-select-letter-bar'>
";
foreach ($letter_ranges as $disp => $vals) {
$rtn .= l($disp, "tools/course-search/edit-list", "ur=" . $vals [0] . "&lr=" . $vals [1], array("class" => "admin-courses-letter-link")) . " ";
}
$rtn .= "</div>
<hr>";
$rtn .= "<table border='0' cellpadding='3' cellspacing='0'>
<tr>
<td class='tenpt' width='95%'>Course</td>
<td class='tenpt'>Sch</td>
<td class='tenpt'>Syl</td>
<td class='tenpt'>Updated</td>
</tr>";
$res = db_query("SELECT * FROM courses
WHERE
`catalog_year`='?' AND
`subject_id` BETWEEN '?' AND '?'
AND `delete_flag`='0'
AND `exclude`='0'
ORDER BY `subject_id`, `course_num` ", $catalog_year, $ur, $lr);
while ($cur = db_fetch_array($res)) {
extract($cur, 3, "db");
$syl = $sch = $updated = "";
// Right here, maybe check to see if this course has
// a syllabus and/or schedule entered?
$syllabus_details = course_search_get_course_syllabus_details("", "", $db_course_id);
$filename = $syllabus_details ["filename"];
if ($filename != "") {
$url = $syllabus_details ["url"];
$syl = "<a href='$url'><img src='" . fp_theme_location() . "/images/document_icon.gif' border='0'></a>";
$updated = $syllabus_details ["posted"];
}
$schedule_array = course_search_get_course_rotation_schedule($db_course_id, $catalog_year, 100, TRUE);
$not_ant = course_search_get_course_rotation_schedule_not_anticipated($db_course_id);
if (count($schedule_array) > 0 || $not_ant == true) {
$sch = "<img src='" . fp_theme_location() . "/images/small_check.gif'>";
if ($not_ant) {
$sch = "NA";
}
// When was the schedule last updated?
$res2 = db_query("SELECT * FROM course_rotation_schedule
WHERE `course_id`='?' limit 1", $db_course_id);
$cur2 = db_fetch_array($res2);
$updated2 = $cur2 ["posted"];
if ($updated2 > $updated) {
$updated = $updated2;
}
}
if ($updated != "") {
$updated = date("n/d/y", $updated);
}
$hrs = $db_min_hours;
if (trim($db_min_hours) != trim($db_max_hours)) {
$hrs .= " - $db_max_hours";
}
$hrs .= " hrs.";
$rep_hours = "";
if ($db_repeat_hours > $db_min_hours)
{
$rep_hours = " rep to $db_repeat_hours hrs.";
}
// remove special chars from subject_id...
$display_subject_id = $db_subject_id;
$db_subject_id = urlencode($db_subject_id);
$rtn .= "<tr style='$spanstyle'>
<td valign='top' width='90%'>";
/*$rtn .= "<div style='padding:3px;'>
<a href='$moduleActionURL&performAction=editSpecificCourse&courseID=$db_course_id&subjectID=$db_subject_id&courseNum=$db_course_num'>$displaySubjectID $db_course_num - $db_title</a><!-- - $hrs$repHours --></div>";
*/
$rtn .= l("$display_subject_id $db_course_num - $db_title", "tools/course-search/edit-info-details", "course_id=$db_course_id&subject_id=$db_subject_id&course_num=$db_course_num");
// https://orion.ulm.edu/flightpath/tools/course-search/edit-info-details?course_id=468798&subject_id=ACCT&course_num=1010
$rtn .= "</td>
<td align='center'>$sch</td>
<td align='center'>$syl</td>
<td align='center' style='font-size: 8pt;'>$updated</td>
</tr>";
} // while
$rtn .= "</table>";
return $rtn;
}