 | |
|  |
Viewing, Editing, and Managing Lessons
$buildDir = "specs";
function list_modules()
{ global $buildDir;
$author = $_SERVER['PHP_AUTH_USER'];
$dir_handle = @opendir($buildDir) or die("Unable to open $buildDir");
$modules = array();
while ($file = readdir($dir_handle))
{ if ( ! preg_match("/^\./", $file) )
{ array_push($modules, $file); }
}
closedir($dir_handle);
foreach($modules as $module)
{ $path = "$buildDir/$module/$author";
if ( is_dir($path) )
{ print "$module Module\n";
list_lessons($path);
}
}
}
function list_lessons($path)
{ $dir_handle = @opendir($path) or die("Unable to open $path");
$lessons = array();
while ($file = readdir($dir_handle))
{ if ( preg_match("/\.spec$/", $file) )
{ array_push($lessons, $file); }
}
closedir($dir_handle);
sort($lessons);
while ( ! empty( $lessons ) )
{ $pages = array();
$lesson = array_shift($lessons);
array_push($pages, $lesson);
$lesson = substr($lesson, 0, strlen($lesson)-7);
while ( $lesson == substr($lessons[0], 0, strlen($lessons[0])-7) )
{ $pc++; array_push($pages, array_shift($lessons)); }
list_one_lesson($lesson, $pages, $path);
}
}
function list_one_lesson($name, $pages, $dir)
{ print "
\n";
}
?>
|