/* Extracting the course codes from '\\Classes\VOL1\ from the current semester*/ /* Selecting courses that have index pages or non-empty PUBLIC_HTML folders */ //get the current $cyear=$year-2000; if ($cyear<0) $cyear+=100; //get the current semester $csemester=$semester; $semester=strtoupper($semester); if ($semester=="WINTER") $semester="WT"; //get the current semester diretory path if ($cyear<10) $dir="../../".$semester."0".$cyear; else $dir="../../".$semester.$cyear; //print $dir; //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; while (false !== ($file = readdir($handle))) { if ($skip_root > 2){ $subdir=$dir."/".$file; //print $subdir; if (is_dir($subdir)){ //print "ha!"; $total++; //get the path to course PUBLIC_HTML directory $public_html=$subdir."/PUBLIC_HTML"; //int $public_html."\n"; 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); ?>