add StudyActivityManager: createWiilActivity
This commit is contained in:
parent
7952511d72
commit
670a875a0d
@ -20,6 +20,23 @@ use UElearning\Exception;
|
||||
*/
|
||||
class StudyActivityManager {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Type} $uid
|
||||
* @param {Type} tid
|
||||
* @param {Type} mmode
|
||||
* @return bool 輸入的資料是否存在來新增學習活動記錄
|
||||
*/
|
||||
protected function checkDataIsExist($uid, $tid, $mmode) {
|
||||
|
||||
// TODO: 使用者存不存在
|
||||
|
||||
// TODO: 標的存不存在
|
||||
|
||||
// TODO: 教材是否存在
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 開始這次學習
|
||||
*
|
||||
@ -37,19 +54,17 @@ class StudyActivityManager {
|
||||
$learnStyle, $learnStyle_force, $materialMode )
|
||||
{
|
||||
|
||||
// TODO: 使用者存不存在
|
||||
|
||||
// TODO: 標的存不存在
|
||||
|
||||
// TODO: 教材是否存在
|
||||
if($this->checkDataIsExist($userId, $themeId, $materialMode)) {
|
||||
|
||||
// 存入資料庫
|
||||
$db = new Database\DBStudyActivity();
|
||||
$resultId = $db->insertActivity($userId, $themeId, null, null,
|
||||
$learnTime, 0, $timeForce, $learnStyle, $learnStyle_force, $materialMode);
|
||||
|
||||
// 傳回新增後得到的編號
|
||||
return $resultId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 幫學生預約學習
|
||||
@ -71,6 +86,17 @@ class StudyActivityManager {
|
||||
$learnTime, $timeForce, $learnStyle, $learnStyle_force, $materialMode, $lock)
|
||||
{
|
||||
|
||||
if($this->checkDataIsExist($userId, $themeId, $materialMode)) {
|
||||
|
||||
// 存入資料庫
|
||||
$db = new Database\DBStudyActivity();
|
||||
$resultId = $db->insertWillActivity($userId, $themeId,
|
||||
$startTime, $expiredTime, $learnTime, $timeForce,
|
||||
$learnStyle, $learnStyle_force, $materialMode, $lock);
|
||||
|
||||
// 傳回新增後得到的編號
|
||||
return $resultId;
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user