mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-24 02:11:27 +01:00
add badge for each tabs
This commit is contained in:
@@ -1290,3 +1290,31 @@ function writeApiUrlsInDoc($file_api, $file_doc)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* count directories or files in modulebuilder folder
|
||||
* @param string $path path of directory
|
||||
* @param int $type type of file 1= file,2=directory
|
||||
* @return int|bool
|
||||
*/
|
||||
function countItemsInDirectory($path, $type = 1)
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$allFilesAndDirs = scandir($path);
|
||||
$count = 0;
|
||||
|
||||
foreach ($allFilesAndDirs as $item) {
|
||||
if ($item != '.' && $item != '..') {
|
||||
if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) {
|
||||
$count++;
|
||||
} elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user