@@ 981-997 (lines=17) @@ | ||
978 | * @author Julio Montoya Dokeos |
|
979 | * @version April 2008 |
|
980 | */ |
|
981 | function directory_to_array($directory) |
|
982 | { |
|
983 | $array_items = array(); |
|
984 | if ($handle = @opendir($directory)) { |
|
985 | while (false !== ($file = readdir($handle))) { |
|
986 | if ($file != '.' && $file != '..') { |
|
987 | if (is_dir($directory. '/' . $file)) { |
|
988 | $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file)); |
|
989 | $file = $directory . '/' . $file; |
|
990 | $array_items[] = preg_replace("/\/\//si", '/', $file); |
|
991 | } |
|
992 | } |
|
993 | } |
|
994 | closedir($handle); |
|
995 | } |
|
996 | return $array_items; |
|
997 | } |
|
998 | ||
999 | /** |
|
1000 | * Insert into the DB of the course all the directories |
@@ 410-426 (lines=17) @@ | ||
407 | * @param string $directory Full path to a directory |
|
408 | * @return array A list of files and dirs in the directory |
|
409 | */ |
|
410 | function my_directory_to_array($directory) |
|
411 | { |
|
412 | $array_items = array(); |
|
413 | if ($handle = opendir($directory)) { |
|
414 | while (false !== ($file = readdir($handle))) { |
|
415 | if ($file != "." && $file != "..") { |
|
416 | if (is_dir($directory. "/" . $file)) { |
|
417 | $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file)); |
|
418 | $file = $directory . "/" . $file; |
|
419 | $array_items[] = preg_replace("/\/\//si", '/', $file); |
|
420 | } |
|
421 | } |
|
422 | } |
|
423 | closedir($handle); |
|
424 | } |
|
425 | return $array_items; |
|
426 | } |
|
427 | ||
428 | /** |
|
429 | * This function returns the value of a parameter from the configuration file |