/* Extracting the course codes from '\\Classes\VOL1\ from the current semester*/ /* Selecting courses that have index pages or non-empty PUBLIC_HTML folders */ include("config.php"); $updaterScriptLocation = "http://chisel.middlebury.edu/~achapin/et/courseware/webcourses2/semest.php"; $year = $_REQUEST[year]; $semester = $_REQUEST[semester]; ?>
![]() | ![]() |
//edit the current year $cyear=$year-2000; //if ($cyear<0) $cyear+=100; if ($cyear<0) { $cyear+=100; print " Cannot update semesters before 2000 ";
print "";
//print "";
exit();
}
//edit the current semester
$csemester=$semester;
//$semester=strtoupper($semester);
if ($semester=="WINTER") $semester="WT";
print $semester;
//get the current semester diretory path
if ($cyear<10)
$dir="../../".$semester."0".$cyear;
else
$dir="../../".$semester.$cyear;
print $dir.""; /****************************************************************************** * print out link to semester update script on ******************************************************************************/ print " "; print " ";
print $csemester." ".$year." ";
print "";
print "Update Segue";
print " ";
print ""; //exit(); //open the directory $handle=opendir($dir); //$index_courses contains the codes of the courses that have index pages $index_courses = array (); //$other_courses contains the codes of the courses that do not have index pages $other_courses = array (); /* Loop over the directory */ $skip_root=0; $total=0; $totalcourses=0; while (false !== ($file = readdir($handle))) { if ($skip_root > 2){ $subdir=$dir."/".$file; if (is_dir($subdir)){ $total++; $newcourse = substr($file, 0, 5); //print $newcourse; if ($newcourse == $currcourse) { $totalcourses++; } $currcourse = substr($file, 0, 5); //print $currcourse; //get the path to course PUBLIC_HTML directory $public_html=$subdir."/PUBLIC_HTML"; if (is_dir($public_html)){ //open the course PUBLIC_HTML directory $web_handle=opendir($public_html); $count=0; $has_index=0; while (false !== ($html_file = readdir($web_handle))){ $count++; if (("$html_file"=="index.html") || ("$html_file"=="index.htm")){ $has_index=1;} } closedir($web_handle); if ($count>3){ if ($has_index == 1){ array_push ($index_courses,$file); }else{ array_push ($other_courses,$file); } } } } }else{ $skip_root+=1; } } closedir($handle); if ($total == 0) $total = "no course folders found!"; if ($totalcourses == 0) $total = "no courses found!"; ?>
print "
"; print $csemester." ".$year." "; print ""; print "Update Segue"; print " "; ?> |