From 4f97623af5484b1c6cafb64a34991fe631c846ac Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Wed, 4 May 2016 07:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=82=BA=E5=8F=AA=E8=A6=81?= =?UTF-8?q?=E6=9C=89=E4=BB=BB=E4=BD=95=E5=AD=B8=E7=BF=92=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=B4=BB=E5=8B=95=EF=BC=8C=E5=B0=B1=E5=BC=B7=E5=88=B6=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E9=80=B2=E8=A1=8C=E6=9C=AA=E5=AD=B8=E7=BF=92=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=9A=84=E6=B4=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/lib/Study/StudyActivityManager.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/Study/StudyActivityManager.php b/htdocs/lib/Study/StudyActivityManager.php index 356784b..28ed3a3 100644 --- a/htdocs/lib/Study/StudyActivityManager.php +++ b/htdocs/lib/Study/StudyActivityManager.php @@ -212,6 +212,25 @@ class StudyActivityManager { public function getEnableActivityByUserId($user_id) { $db = new Database\DBStudyActivity(); - return $db->getEnableActivityByUserId($user_id); + $list = $db->getEnableActivityByUserId($user_id); + + // 若有任何一項學習中活動 + $have_study = false; + foreach($list as $theActA) { + if ($theActA['type'] == 'study') { + $have_study = true; + } + } + + if ($have_study) { + foreach($list as $key => $theActB) { + if ($theActB['type'] != 'study') { + unset($list[$key]); + } + } + } + +// return $have_study; + return $list; } }