From fce652ac7cb0d39c058634f7a5c3aaa5155a27f7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 26 May 2022 11:03:24 +0800 Subject: [PATCH] * Finish task#54988. --- module/program/control.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/module/program/control.php b/module/program/control.php index c8aa0be0f8..d0441708f0 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -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 ++; }