整合開始活動與取得所有標的
This commit is contained in:
parent
e9736e5ff7
commit
272f982866
@ -498,8 +498,50 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
|||||||
// 取得開始後的學習活動資訊
|
// 取得開始後的學習活動資訊
|
||||||
$sact = new Study\StudyActivity($studyId);
|
$sact = new Study\StudyActivity($studyId);
|
||||||
|
|
||||||
|
// 取得此活動的主題
|
||||||
|
$tid = $sact->getThemeId();
|
||||||
|
|
||||||
// 噴出資訊
|
// 取得主題內所有的標的資訊
|
||||||
|
$target_manager = new Target\TargetManager();
|
||||||
|
$all_targets = $target_manager->getAllTargetInfoByTheme($tid);
|
||||||
|
|
||||||
|
// 取得本次採用的教材風格
|
||||||
|
$materialMode = $sact->getMaterialStyle();
|
||||||
|
|
||||||
|
// 處理噴出結果
|
||||||
|
$output_targets = array();
|
||||||
|
foreach($all_targets as $thisTargetArray) {
|
||||||
|
|
||||||
|
// 取得教材路徑
|
||||||
|
$targetObject = new Target\Target($thisTargetArray['target_id']);
|
||||||
|
$materialUrl = $targetObject->getMaterialUrl(true, $materialMode);
|
||||||
|
$virtualMaterialUrl = $targetObject->getMaterialUrl(false, $materialMode);
|
||||||
|
|
||||||
|
$thisOutput = array(
|
||||||
|
'theme_id' => $thisTargetArray['theme_id'],
|
||||||
|
'target_id' => $thisTargetArray['target_id'],
|
||||||
|
'weights' => $thisTargetArray['weights'],
|
||||||
|
'hall_id' => $thisTargetArray['hall_id'],
|
||||||
|
'hall_name' => $thisTargetArray['hall_name'],
|
||||||
|
'area_id' => $thisTargetArray['area_id'],
|
||||||
|
'area_name' => $thisTargetArray['area_name'],
|
||||||
|
'floor' => $thisTargetArray['floor'],
|
||||||
|
'area_number' => $thisTargetArray['area_number'],
|
||||||
|
'target_number' => $thisTargetArray['target_number'],
|
||||||
|
'name' => $thisTargetArray['name'],
|
||||||
|
'map_url' => $thisTargetArray['map_url'],
|
||||||
|
'material_url' => $materialUrl,
|
||||||
|
'virtual_material_url' => $virtualMaterialUrl,
|
||||||
|
'learn_time' => $thisTargetArray['learn_time'],
|
||||||
|
'PLj' => $thisTargetArray['PLj'],
|
||||||
|
'Mj' => $thisTargetArray['Mj'],
|
||||||
|
'S' => $thisTargetArray['S'],
|
||||||
|
'Fj' => $thisTargetArray['Fj']
|
||||||
|
);
|
||||||
|
array_push($output_targets, $thisOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 噴出結果
|
||||||
$app->render(200,array(
|
$app->render(200,array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
@ -522,6 +564,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
|||||||
'target_total' => $sact->getPointTotal(),
|
'target_total' => $sact->getPointTotal(),
|
||||||
'learned_total' => $sact->getLearnedPointTotal()
|
'learned_total' => $sact->getLearnedPointTotal()
|
||||||
),
|
),
|
||||||
|
'targets' => $output_targets,
|
||||||
'error' => false
|
'error' => false
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user