StudyActivity: Add 學過的標的數
This commit is contained in:
parent
699e9fc29f
commit
7707cdc84d
@ -102,6 +102,7 @@ class DBStudyActivity extends Database {
|
|||||||
else
|
else
|
||||||
$to_materialMode = "'".MMODE."'";
|
$to_materialMode = "'".MMODE."'";
|
||||||
|
|
||||||
|
|
||||||
// 寫入學習活動資料
|
// 寫入學習活動資料
|
||||||
$sqlString = "INSERT INTO `".$this->table('StudyActivity').
|
$sqlString = "INSERT INTO `".$this->table('StudyActivity').
|
||||||
"` (`UID`, `ThID`,
|
"` (`UID`, `ThID`,
|
||||||
@ -111,8 +112,6 @@ class DBStudyActivity extends Database {
|
|||||||
".$to_startTime.", ".$to_endTime.", ".$to_learnTime." , :delay , :timeforce ,
|
".$to_startTime.", ".$to_endTime.", ".$to_learnTime." , :delay , :timeforce ,
|
||||||
".$to_learnStyle.", :lstyle_force , ".$to_materialMode.")";
|
".$to_learnStyle.", :lstyle_force , ".$to_materialMode.")";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$query = $this->connDB->prepare($sqlString);
|
$query = $this->connDB->prepare($sqlString);
|
||||||
$query->bindParam(":uid", $userId);
|
$query->bindParam(":uid", $userId);
|
||||||
$query->bindParam(":thid", $themeId);
|
$query->bindParam(":thid", $themeId);
|
||||||
@ -155,10 +154,18 @@ class DBStudyActivity extends Database {
|
|||||||
$sqlString = "SELECT `SaID`, `UID`, `ThID`, ".
|
$sqlString = "SELECT `SaID`, `UID`, `ThID`, ".
|
||||||
"`StartTime`, `EndTime`, ".
|
"`StartTime`, `EndTime`, ".
|
||||||
"`LearnTime`, `Delay`, `TimeForce`, ".
|
"`LearnTime`, `Delay`, `TimeForce`, ".
|
||||||
"`LMode`, `LModeForce`, `MMode` ".
|
"`LMode`, `LModeForce`, `MMode`, ".
|
||||||
"FROM `".$this->table('StudyActivity')."` AS Act ".
|
|
||||||
//"LEFT JOIN `".$this->table('Area')."` AS Area ".
|
"(SELECT count(`TID`)
|
||||||
//"ON Area.`AID` = Target.`AID` ".
|
FROM `chu__TBelong` AS `belong`
|
||||||
|
WHERE `belong`.`ThID` = `sa`.`ThID`) AS `TargetTotal`, ".
|
||||||
|
|
||||||
|
"(SELECT count(DISTINCT `TID`)
|
||||||
|
FROM `chu__Study` AS `study`
|
||||||
|
WHERE `Out_TargetTime` IS NOT NULL
|
||||||
|
AND `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`".
|
||||||
|
|
||||||
|
"FROM `".$this->table('StudyActivity')."` AS sa ".
|
||||||
"WHERE ".$where;
|
"WHERE ".$where;
|
||||||
|
|
||||||
$query = $this->connDB->prepare($sqlString);
|
$query = $this->connDB->prepare($sqlString);
|
||||||
@ -192,7 +199,10 @@ class DBStudyActivity extends Database {
|
|||||||
'time_force' => $output_time_force,
|
'time_force' => $output_time_force,
|
||||||
'learnStyle_mode' => $thisResult['LMode'],
|
'learnStyle_mode' => $thisResult['LMode'],
|
||||||
'learnStyle_force' => $output_learnStyleForce,
|
'learnStyle_force' => $output_learnStyleForce,
|
||||||
'material_mode' => $thisResult['MMode'])
|
'material_mode' => $thisResult['MMode'],
|
||||||
|
'target_total' => $thisResult['TargetTotal'],
|
||||||
|
'learned_total' => $thisResult['LearnedTotal']
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@ -234,7 +244,7 @@ class DBStudyActivity extends Database {
|
|||||||
* 'learnStyle_force' => <拒絕前往非推薦的學習點>,
|
* 'learnStyle_force' => <拒絕前往非推薦的學習點>,
|
||||||
* 'material_mode' => <教材模式>
|
* 'material_mode' => <教材模式>
|
||||||
* );
|
* );
|
||||||
*
|
* @param int $id 活動編號
|
||||||
*/
|
*/
|
||||||
public function queryActivity($id) {
|
public function queryActivity($id) {
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ class DBTheme extends Database {
|
|||||||
* 'name' => <主題名稱>,
|
* 'name' => <主題名稱>,
|
||||||
* 'learn_time' => <預估的學習時間>,
|
* 'learn_time' => <預估的學習時間>,
|
||||||
* 'introduction' => <主題介紹>,
|
* 'introduction' => <主題介紹>,
|
||||||
|
* 'target_total' => <此主題內有多少標的>,
|
||||||
* 'build_time' => <主題建立時間>,
|
* 'build_time' => <主題建立時間>,
|
||||||
* 'modify_time' => <主題資料修改時間>
|
* 'modify_time' => <主題資料修改時間>
|
||||||
* );
|
* );
|
||||||
@ -118,6 +119,7 @@ class DBTheme extends Database {
|
|||||||
* 'name' => <主題名稱>,
|
* 'name' => <主題名稱>,
|
||||||
* 'learn_time' => <預估的學習時間>,
|
* 'learn_time' => <預估的學習時間>,
|
||||||
* 'introduction' => <主題介紹>,
|
* 'introduction' => <主題介紹>,
|
||||||
|
* 'target_total' => <此主題內有多少標的>,
|
||||||
* 'build_time' => <主題建立時間>,
|
* 'build_time' => <主題建立時間>,
|
||||||
* 'modify_time' => <主題資料修改時間>
|
* 'modify_time' => <主題資料修改時間>
|
||||||
* )
|
* )
|
||||||
|
@ -139,24 +139,37 @@ class StudyActivity {
|
|||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 總共要學幾個學習點
|
||||||
|
*
|
||||||
|
* @return int 有幾個學習點
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
public function getPointTotal() {
|
||||||
|
return $this->queryResultArray['target_total'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得已經學過幾個學習點
|
* 取得已經學過幾個學習點
|
||||||
*
|
*
|
||||||
* @return ing 已學過幾個學習點
|
* @return int 已學過幾個學習點
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public function getLearnedPointTotal() {
|
public function getLearnedPointTotal() {
|
||||||
|
return $this->queryResultArray['learned_total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得還剩下幾個學習點還沒學
|
* 取得還剩下幾個學習點還沒學
|
||||||
*
|
*
|
||||||
* @return ing 還剩下幾個學習點
|
* @return int 還剩下幾個學習點
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public function getRemainingPointTotal() {
|
public function getRemainingPointTotal() {
|
||||||
|
$total = $this->getPointTotal();
|
||||||
|
$learned = $this->getLearnedPointTotal();
|
||||||
|
|
||||||
|
return $total - $learned;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ThemeManager.php
|
* ThemeManager.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace UElearning\User;
|
namespace UElearning\Study;
|
||||||
|
|
||||||
require_once UELEARNING_LIB_ROOT.'/Database/DBTheme.php';
|
require_once UELEARNING_LIB_ROOT.'/Database/DBTheme.php';
|
||||||
require_once UELEARNING_LIB_ROOT.'/Study/Exception.php';
|
require_once UELEARNING_LIB_ROOT.'/Study/Exception.php';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user