From 3a0bac60d66789e548846b5dfe6c0a246dae057c Mon Sep 17 00:00:00 2001 From: kobayashi <3011850@gmail.com> Date: Sun, 25 Jan 2015 19:40:10 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AE=8C=E6=88=90RecommandPoint=E9=A1=9E?= =?UTF-8?q?=E5=88=A5(=E9=9C=80=E8=A6=81=E5=81=9A=E5=96=AE=E5=85=83?= =?UTF-8?q?=E6=B8=AC=E8=A9=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/lib/Database/DBRecommand.php | 2 +- htdocs/lib/Recommand/RecommandPoint.php | 84 +++++++++++++++++++++++-- htdocs/lib/Study/Theme.php | 13 ++++ 3 files changed, 94 insertions(+), 5 deletions(-) diff --git a/htdocs/lib/Database/DBRecommand.php b/htdocs/lib/Database/DBRecommand.php index 043a28d..f839f16 100644 --- a/htdocs/lib/Database/DBRecommand.php +++ b/htdocs/lib/Database/DBRecommand.php @@ -89,7 +89,7 @@ class DBRecommand extends Database /** * 以目前的學習點編號查詢下一個學習點的資訊 * @param string $currentPoint 目前的學習點編號 - * @return array 查詢結果 + * @return array */ public function queryEdgeByID($currentPoint) { diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index df903e5..e0f1f22 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -37,6 +37,8 @@ class RecommandPoint const ALPHA=0.5; private $recommand; + private $theme; + private $activity; public function __construct() @@ -52,11 +54,11 @@ class RecommandPoint private function computeNormalizationParameter($theme_number) { $normal = 0; //正規化之後的GAMMA值 - $EntitySum = 0; //實體學習點分別算銓重之後的值 - $VirtualSum = 0; //虛擬學習點分別算銓重之後的值 + $EntitySum = 0; //實體學習點分別算權重之後的值 + $VirtualSum = 0; //虛擬學習點分別算權重之後的值 $edge = $this->recommand->queryEdgeByID('0'); - $theme = new Study\Theme($theme_number); + $this->theme = new Study\Theme($theme_number); for($i=0;$iisTargetLearned($target_id)) return true; + else return false; + } + + /** + * 過濾非法的標的 + * + */ + private function excludeIrregularTarget($point_list,$activityObj) + { + $regularTarget = array(); + for($i=0;$iisEnableTargetId($a)ctivityObj,$nextPoint)) array_push($reregularTarget,$point_list[i]); + } + return $regularTarget; + } + /** * 推薦學習點 + * @param int $current_point 目前的標的編號 + * @param int $theme_number 主題編號 + * @param int activity_number 學習活動編號 * @return array 學習點清單 */ - public function recommand($current_point,$theme_number,$activity_number) + public function recommand($current_point,$activity_number) { + $this->activity = new Study\StudyActivity($activity_number); + $themeID = $activity->getThemeId(); + $this->theme = new Study\Theme($themeID); + $this->gamma = $this->computeNormalizationParameter($themeID); + $pointList = $this->recommand->queryEdgeByID($current_point); + $targetList = $this->excludeIrregularTarget($pointList,$this->activity); + //計算路徑的權重值 + $pathCost = 0; + $VirtualPathCost = 0; + $recommand = array(); + $isEntity = true; + for($i=0;$itheme->getWeightByNextTarget($next_point); + if($nextPoint->isFullPeople()) + { + $pastCost = 0; + $virtualCost = RecommandPoint::ALPHA * $this->gamma * ($wright/$nextPoint->getLearnTime()); + $isEntity=false; + } + else + { + if($nextPoint->isNumberOfPeopleZero()) $Rj = 0; + else $Rj = $nextPoint->getMj()/$nextPoint->getPLj(); + $pastCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/$moveTime + $nextPoint->getLearnTime()); + $virtualCost = RecommandPoint::ALPHA * $this->gamma * ($wright/$nextPoint->getLearnTime()); + } + array_push($recommand,array("nextPoint"=>$nextPoint, + "isEntity" => $isEntity, + "PathCost"=>$pathCost, + "VirtualCost"=>$virtualCost)); + } + + foreach($recommand as $key=>$value) + { + $tmp[$key] = $value["PathCost"]; + } + array_multisort($tmp,SORT_DESC,$recommand,SORT_DESC); + + return $recommand; } } diff --git a/htdocs/lib/Study/Theme.php b/htdocs/lib/Study/Theme.php index d255601..a03e734 100644 --- a/htdocs/lib/Study/Theme.php +++ b/htdocs/lib/Study/Theme.php @@ -6,6 +6,7 @@ namespace UElearning\Study; require_once UELEARNING_LIB_ROOT.'/Database/DBTheme.php'; +require_once UELEARNING_LIB_ROOT.'/Database/DBRecommand.php'; require_once UELEARNING_LIB_ROOT.'/Study/Exception.php'; use UElearning\Database; use UElearning\Exception; @@ -166,4 +167,16 @@ class Theme { return $this->queryResultArray['modify_time']; } + /** + * 取得下一個標的所屬主題的權重 + * @param string $next_point + * @return int weight 權重 + * @since 2.0.0 + */ + public function getWeightByNextTarget($next_point){ + $belong = new Database\DBRecommand(); + $weight = $belong->queryBelongByID($next_point,$this->id); + return $weight['weight']; + } + } From 6f159c3a6354624a7b7441c0090cd2c1a81bc330 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Sun, 25 Jan 2015 20:29:15 +0800 Subject: [PATCH 2/5] Fix RecommandPoint Class --- htdocs/lib/Recommand/RecommandPoint.php | 33 ++++++++++++++++--------- htdocs/lib/Recommand/here | 0 2 files changed, 22 insertions(+), 11 deletions(-) delete mode 100644 htdocs/lib/Recommand/here diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index e0f1f22..c4b03cb 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -1,4 +1,7 @@ recommand->queryEdgeByID('0'); - $this->theme = new Study\Theme($theme_number); for($i=0;$irecommand->queryBelongByID($next_point,$theme->getId()); + $belong = $this->recommand->queryBelongByID($next_point,$theme_number); $weight = $belong["weight"]; $VirtualSum += $weight / $next_target->getLearnTime(); @@ -94,14 +100,19 @@ class RecommandPoint /** * 過濾非法的標的 * + * @param array $point_list 全部的標的清單 + * @param StudyActivity $activityObj 學習活動物件 + * @return array 合法的學習點 */ private function excludeIrregularTarget($point_list,$activityObj) { $regularTarget = array(); for($i=0;$iisEnableTargetId($a)ctivityObj,$nextPoint)) array_push($reregularTarget,$point_list[i]); + $nextPoint = $point_list[$i]['next_point']; + if($this->isEnableTargetId($activityObj,$nextPoint)) { + array_push($regularTarget,$point_list[$i]); + } } return $regularTarget; } @@ -116,7 +127,7 @@ class RecommandPoint public function recommand($current_point,$activity_number) { $this->activity = new Study\StudyActivity($activity_number); - $themeID = $activity->getThemeId(); + $themeID = $this->activity->getThemeId(); $this->theme = new Study\Theme($themeID); $this->gamma = $this->computeNormalizationParameter($themeID); $pointList = $this->recommand->queryEdgeByID($current_point); @@ -130,7 +141,7 @@ class RecommandPoint for($i=0;$itheme->getWeightByNextTarget($next_point); if($nextPoint->isFullPeople()) @@ -143,10 +154,10 @@ class RecommandPoint { if($nextPoint->isNumberOfPeopleZero()) $Rj = 0; else $Rj = $nextPoint->getMj()/$nextPoint->getPLj(); - $pastCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/$moveTime + $nextPoint->getLearnTime()); - $virtualCost = RecommandPoint::ALPHA * $this->gamma * ($wright/$nextPoint->getLearnTime()); + $pathCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/$moveTime + $nextPoint->getLearnTime()); + $virtualCost = RecommandPoint::ALPHA * $this->gamma * ($weight/$nextPoint->getLearnTime()); } - array_push($recommand,array("nextPoint"=>$nextPoint, + array_push($recommand,array("nextPoint"=>$next_point, "isEntity" => $isEntity, "PathCost"=>$pathCost, "VirtualCost"=>$virtualCost)); diff --git a/htdocs/lib/Recommand/here b/htdocs/lib/Recommand/here deleted file mode 100644 index e69de29..0000000 From b239c280465627278a0373e35f8ff90634a0f38f Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Sun, 25 Jan 2015 20:59:18 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=95=B4=E5=90=88RecommandPoint=E9=80=B2AP?= =?UTF-8?q?I=20&=20Fix=20RecommandPoint=20Class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/api/v2/index.php | 36 ++++++++++++++++--------- htdocs/lib/Database/DBTarget.php | 18 ++++++------- htdocs/lib/Recommand/RecommandPoint.php | 2 +- htdocs/lib/Target/Target.php | 2 +- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 03d37eb..91aa173 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -10,9 +10,11 @@ require_once UELEARNING_LIB_ROOT.'/Study/StudyActivityManager.php'; require_once UELEARNING_LIB_ROOT.'/Study/StudyManager.php'; require_once UELEARNING_LIB_ROOT.'/Target/Target.php'; require_once UELEARNING_LIB_ROOT.'/Target/TargetManager.php'; +require_once UELEARNING_LIB_ROOT.'/Recommand/RecommandPoint.php'; use UElearning\User; use UElearning\Study; use UElearning\Target; +use UElearning\Recommand; use UElearning\Exception; $app = new \Slim\Slim(array( @@ -1173,21 +1175,31 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { $currentTId = (int)$currentTId; - // TODO: 動作撰寫區 - - // 取得此活動的主題 - $tid = $sact->getThemeId(); + $tid = $sact->getThemeId(); // 取得此活動的主題 + $maxItemTotal = $sact->getLearnStyle(); // 取得最大推薦數 // 取得本次採用的教材風格 $materialMode = $sact->getMaterialStyle(); - // 取得主題內所有的標的資訊 - $target_manager = new Target\TargetManager(); - $output_targets = array( output_the_target_array(3, true, $materialMode), - output_the_target_array(7, true, $materialMode), - output_the_target_array(12, true, $materialMode), - ); - $recommand_total = count($output_targets); + // 取得推薦的學習點 + $recommand = new Recommand\RecommandPoint(); + $recommandResult = $recommand->recommand($currentTId, $saId); + $recommandTotal = count($recommandResult); + if($recommandTotal > $maxItemTotal) { + $result_recommand_total = $maxItemTotal; + } + else { + $result_recommand_total = $recommandTotal; + } + + + // 製作 + $output_targets = array(); + for($i=0; $i<$result_recommand_total; $i++) { + $target_id = $recommandResult[$i]['nextPoint']; + $isEntity = $recommandResult[$i]['isEntity']; + array_push($output_targets, output_the_target_array($target_id, $isEntity, $materialMode)); + } // 噴出結果 $app->render(200,array( @@ -1195,7 +1207,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { 'user_id' => $user_id, 'activity_id' => $sact->getId(), 'current_target_id' => $currentTId, - 'recommand_total' => $recommand_total, + 'recommand_total' => $result_recommand_total, 'recommand_target' => $output_targets, 'error' => false )); diff --git a/htdocs/lib/Database/DBTarget.php b/htdocs/lib/Database/DBTarget.php index 0dba41a..405f32b 100644 --- a/htdocs/lib/Database/DBTarget.php +++ b/htdocs/lib/Database/DBTarget.php @@ -51,17 +51,17 @@ class DBTarget extends Database { foreach($queryResultAll as $key => $thisResult) { array_push($result, - array( 'target_id' => $thisResult['TID'], - 'area_id' => $thisResult['AID'], - 'hall_id' => $thisResult['HID'], - 'target_number' => $thisResult['TNum'], + array( 'target_id' => (int)$thisResult['TID'], + 'area_id' => (int)$thisResult['AID'], + 'hall_id' => (int)$thisResult['HID'], + 'target_number' => (int)$thisResult['TNum'], 'name' => $thisResult['TName'], 'map_url' => $thisResult['TMapID'], - 'learn_time' => $thisResult['TLearnTime'], - 'PLj' => $thisResult['PLj'], - 'Mj' => $thisResult['Mj'], - 'S' => $thisResult['S'], - 'Fj' => $thisResult['Fj'] + 'learn_time' => (int)$thisResult['TLearnTime'], + 'PLj' => (int)$thisResult['PLj'], + 'Mj' => (int)$thisResult['Mj'], + 'S' => (int)$thisResult['S'], + 'Fj' => (int)$thisResult['Fj'] )); } return $result; diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index c4b03cb..fd9eef1 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -154,7 +154,7 @@ class RecommandPoint { if($nextPoint->isNumberOfPeopleZero()) $Rj = 0; else $Rj = $nextPoint->getMj()/$nextPoint->getPLj(); - $pathCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/$moveTime + $nextPoint->getLearnTime()); + $pathCost = RecommandPoint::ALPHA * $this->gamma * ($weight * ($nextPoint->getS()-$Rj+1)/($moveTime + $nextPoint->getLearnTime())); $virtualCost = RecommandPoint::ALPHA * $this->gamma * ($weight/$nextPoint->getLearnTime()); } array_push($recommand,array("nextPoint"=>$next_point, diff --git a/htdocs/lib/Target/Target.php b/htdocs/lib/Target/Target.php index f9ceb9c..7c72a88 100644 --- a/htdocs/lib/Target/Target.php +++ b/htdocs/lib/Target/Target.php @@ -105,7 +105,7 @@ class Target { * @since 2.0.0 */ public function __construct($inputTID){ - $this->tId = $inputTID; + $this->tId = (int)$inputTID; $this->getQuery(); } From 8ba983a999916bcfedc2669d625658dfbf3d291a Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Mon, 26 Jan 2015 15:57:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AF=A6=E4=BD=9C=E9=80=B2=E5=87=BA?= =?UTF-8?q?=E6=A8=99=E7=9A=84=E6=99=82=E5=8A=A0=E6=B8=9B=E6=A8=99=E7=9A=84?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E4=BA=BA=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/api/v2/index.php | 5 ++++- htdocs/lib/Database/DBStudy.php | 4 ++-- htdocs/lib/Study/Study.php | 12 +++++++++++- htdocs/lib/Study/StudyManager.php | 27 +++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 91aa173..930761e 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -1191,7 +1191,9 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { else { $result_recommand_total = $recommandTotal; } - + // 是否已經學完了 + if($recommandTotal <= 0) { $isEnd = true; } + else { $isEnd = false; } // 製作 $output_targets = array(); @@ -1207,6 +1209,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { 'user_id' => $user_id, 'activity_id' => $sact->getId(), 'current_target_id' => $currentTId, + 'is_end' => $isEnd, 'recommand_total' => $result_recommand_total, 'recommand_target' => $output_targets, 'error' => false diff --git a/htdocs/lib/Database/DBStudy.php b/htdocs/lib/Database/DBStudy.php index ad10220..283d231 100644 --- a/htdocs/lib/Database/DBStudy.php +++ b/htdocs/lib/Database/DBStudy.php @@ -266,7 +266,7 @@ class DBStudy extends Database { * @param string $study_id 此記錄編號 * @since 2.0.0 */ - public function toOutTaeget($study_id) + public function toOutTarget($study_id) { // 寫入 @@ -285,7 +285,7 @@ class DBStudy extends Database { * @param string $activity_id 活動編號 * @since 2.0.0 */ - public function allToOutTaeget($activity_id) + public function alltoOutTarget($activity_id) { // 寫入 diff --git a/htdocs/lib/Study/Study.php b/htdocs/lib/Study/Study.php index 25405f2..34cceff 100644 --- a/htdocs/lib/Study/Study.php +++ b/htdocs/lib/Study/Study.php @@ -7,7 +7,9 @@ namespace UElearning\Study; require_once UELEARNING_LIB_ROOT.'/Database/DBStudy.php'; require_once UELEARNING_LIB_ROOT.'/Study/Exception.php'; +require_once UELEARNING_LIB_ROOT.'/Target/Target.php'; use UElearning\Database; +use UElearning\Target; use UElearning\Exception; /** @@ -173,7 +175,15 @@ class Study { * @since 2.0.0 */ public function toOut() { + + // 將資料庫內容標示已離開 $db = new Database\DBStudy(); - $db->toOutTaeget($this->id); + $db->toOutTarget($this->id); + + // 將標的目前人數-1 + if($this->isEntity()) { + $target = new Target\Target($this->getTargetId); + $target->addMj(-1); + } } } diff --git a/htdocs/lib/Study/StudyManager.php b/htdocs/lib/Study/StudyManager.php index a1051c1..dd12778 100644 --- a/htdocs/lib/Study/StudyManager.php +++ b/htdocs/lib/Study/StudyManager.php @@ -7,7 +7,10 @@ namespace UElearning\Study; require_once UELEARNING_LIB_ROOT.'/Database/DBStudy.php'; require_once UELEARNING_LIB_ROOT.'/Study/Exception.php'; +require_once UELEARNING_LIB_ROOT.'/Target/Target.php'; +require_once UELEARNING_LIB_ROOT.'/Target/Exception.php'; use UElearning\Database; +use UElearning\Target; use UElearning\Exception; /** @@ -68,14 +71,24 @@ class StudyManager { * @param int $activity_id 活動編號 * @param int $target_id 標的編號 * @param bool $is_entity 是否為現場學習 + * @throw UElearning\Exception\TargetNoFoundException * return int 進出紀錄編號 */ public function toInTarget($activity_id, $target_id, $is_entity) { // 若沒有任一個點正在學習中 if($this->getCurrentInTargetId($activity_id) == null) { + // 紀錄進資料庫 $db = new Database\DBStudy(); - return $db->toInTaeget($activity_id, $target_id, $is_entity); + $id = $db->toInTaeget($activity_id, $target_id, $is_entity); + + // 將標的目前人數+1 + if($is_entity) { + $target = new Target\Target($target_id); + $target->addMj(1); + } + + return $id; } else { throw new Exception\InLearningException(); @@ -93,12 +106,22 @@ class StudyManager { // 從資料庫取得此活動此標的學習中資料 $db = new Database\DBStudy(); $learning_array = $db->getInStudyIdByTargetId($activity_id, $target_id); + $target = new Target\Target($target_id); + // 找到正在學習中的資料 if(isset($learning_array)) { + // 將所有此標的的進入紀錄全部標示 foreach($learning_array as $thisArray) { - $db->toOutTaeget($thisArray['study_id']); + // 將此紀錄標示為已離開 + $db->toOutTarget($thisArray['study_id']); + + // 將標的目前人數-1 + if($thisArray['is_entity'] = true) { + $target = new Target\Target($target_id); + $target->addMj(-1); + } } } } From 7c4bf21d93756eacf98fbc68ef2bb73c8080dee9 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Mon, 26 Jan 2015 16:11:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?Fix=20API:=20=E9=87=8D=E8=A4=87=E9=80=B2?= =?UTF-8?q?=E5=85=A5=E6=A8=99=E7=9A=84=E6=99=82=EF=BC=8C=E6=9C=83=E5=B0=87?= =?UTF-8?q?=E4=B8=8A=E5=80=8B=E5=B7=B2=E9=80=B2=E5=85=A5=E7=B4=80=E9=8C=84?= =?UTF-8?q?=E6=A8=99=E7=A4=BA=E7=82=BA=E9=9B=A2=E9=96=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/api/v2/index.php | 39 +++++++++++++++++++++--------- htdocs/lib/Study/StudyActivity.php | 14 +++++++++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 930761e..2b82909 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -1033,21 +1033,37 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { // 進入學習點 try{ $sid = $sact->toInTarget($tId, $is_entity); + + // 噴出結果 + $app->render(200,array( + 'token' => $token, + 'user_id' => $user_id, + 'activity_id' => $sact->getId(), + 'study_id' => $sid, + 'error' => false + )); } // 若狀態為正在標的內學習時,強制當成離開標的,重新進入 catch (Exception\InLearningException $e) { - $sact->toOutTarget($tId); - $sid = $sact->toInTarget($tId, $is_entity); - } - // 噴出結果 - $app->render(200,array( - 'token' => $token, - 'user_id' => $user_id, - 'activity_id' => $sact->getId(), - 'study_id' => $sid, - 'error' => false - )); + // 查詢目前所在的標的 + $inTId = $sact->getCurrentInTarget(); + + // 登記離開此標的 + $sact->toOutTarget($inTId); + + // 重新登記進入此標的 + $sid = $sact->toInTarget($tId, $is_entity); + + // 噴出結果 + $app->render(200,array( + 'token' => $token, + 'user_id' => $user_id, + 'activity_id' => $sact->getId(), + 'study_id' => $sid, + 'error' => false + )); + } } // 若非本人所有,則視同無此活動 @@ -1192,6 +1208,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { $result_recommand_total = $recommandTotal; } // 是否已經學完了 + // TODO: 改以取得已學習標的數來判定 if($recommandTotal <= 0) { $isEnd = true; } else { $isEnd = false; } diff --git a/htdocs/lib/Study/StudyActivity.php b/htdocs/lib/Study/StudyActivity.php index 86d7f47..de99a18 100644 --- a/htdocs/lib/Study/StudyActivity.php +++ b/htdocs/lib/Study/StudyActivity.php @@ -438,6 +438,20 @@ class StudyActivity { // ======================================================================== + /** + * 取得目前已進入的學習點 + * + * @return int 標的編號,若無則null + */ + public function getCurrentInTarget() { + + // 活動編號 + $saId = $this->id; + + $sct = new StudyManager(); + return $sct->getCurrentInTargetId($saId); + } + /** * 此標的是否已學習過 *