* Finish task#54988.

This commit is contained in:
xieqiyu
2022-05-26 11:03:24 +08:00
parent fe8362dc59
commit fce652ac7c
+22
View File
@@ -55,10 +55,32 @@ class program extends control
$topPrograms = $this->program->getList($status, $orderBy, $pager, 'top');
$programs = $this->program->getList($status, $orderBy, null, 'child', $topPrograms);
/* Filter programs that do not need to be displayed. */
$copyPrograms = $programs;
ksort($copyPrograms);
foreach($copyPrograms as $programInfo)
{
if($programInfo->type == 'program' and strpos(",{$this->app->user->view->programs},", ",$programInfo->id,") === false)
{
unset($copyPrograms[$programInfo->id]);
continue;
}
foreach(explode(',', trim($programInfo->path, ',')) as $pathID)
{
if(!isset($copyPrograms[$pathID])) $copyPrograms[$pathID] = $programs[$pathID];
}
}
/* Get summary. */
$topCount = $indCount = 0;
foreach($programs as $program)
{
if(!isset($copyPrograms[$program->id]))
{
unset($programs[$program->id]);
continue;
}
if($program->type == 'program' and $program->parent == 0) $topCount ++;
if($program->type == 'project' and $program->parent == 0) $indCount ++;
}