更改縮排字元 tab->4 whitespace

This commit is contained in:
Yuan Chiu 2014-11-06 16:42:59 +08:00
parent f12f21bb1c
commit d2b2f1bed1
30 changed files with 2820 additions and 2801 deletions

19
.editorconfig Normal file
View File

@ -0,0 +1,19 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@ -108,7 +108,7 @@
/**
* 你的地區
*/
date_default_timezone_set('Asia/Taipei'); //設定時區
date_default_timezone_set('Asia/Taipei'); //設定時區
// 路徑設定 ===================================================================
/**

View File

@ -84,7 +84,7 @@ class DBStudyActivity extends Database {
"WHERE `UID`=".$this->connDB->quote($userId);
$query = $this->connDB->prepare($sqlSUser);
$query->execute();
$query->execute();
$queryResult = $query->fetch();
}
@ -168,10 +168,10 @@ class DBStudyActivity extends Database {
"FROM `".$this->table('StudyActivity')."` AS sa ".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -250,7 +250,7 @@ class DBStudyActivity extends Database {
*/
public function queryActivity($id) {
$queryResultAll =
$queryResultAll =
$this->queryActivityByWhere("`SaID`=".$this->connDB->quote($id));
// 如果有查到一筆以上
@ -334,9 +334,9 @@ class DBStudyActivity extends Database {
" WHERE `SaID` = :id";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':id', $activity_id);
$query->bindParam(':id', $activity_id);
$query->bindParam(':value', $endTime);
$query->execute();
$query->execute();
}
/**
@ -351,8 +351,8 @@ class DBStudyActivity extends Database {
" WHERE `SaID` = :id";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':id', $activity_id);
$query->execute();
$query->bindParam(':id', $activity_id);
$query->execute();
}
/**
@ -368,9 +368,9 @@ class DBStudyActivity extends Database {
" WHERE `SaID` = :id";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':id', $activity_id);
$query->bindParam(':id', $activity_id);
$query->bindParam(':value', $delay);
$query->execute();
$query->execute();
}
// ========================================================================
@ -419,7 +419,7 @@ class DBStudyActivity extends Database {
"WHERE `UID`=".$this->connDB->quote($userId);
$query = $this->connDB->prepare($sqlSUser);
$query->execute();
$query->execute();
$queryResult = $query->fetch();
}
@ -498,10 +498,10 @@ class DBStudyActivity extends Database {
"FROM `".$this->table('StudyWill')."` AS `sw` ".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -586,7 +586,7 @@ class DBStudyActivity extends Database {
*/
public function queryWillActivity($id) {
$queryResultAll =
$queryResultAll =
$this->queryWillActivityByWhere("`SwID`=".$this->connDB->quote($id));
// 如果有查到一筆以上
@ -691,9 +691,9 @@ class DBStudyActivity extends Database {
" WHERE `SwID` = :id";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':id', $id);
$query->bindParam(':id', $id);
$query->bindParam(':value', $value);
$query->execute();
$query->execute();
}
/**

View File

@ -40,10 +40,10 @@ class DBTarget extends Database {
"ON Area.`AID` = Target.`AID` ".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -108,7 +108,7 @@ class DBTarget extends Database {
*/
public function queryTarget($tId) {
$queryResultAll = $this->queryTargetByWhere("`TID`=".$this->connDB->quote($tId));
$queryResultAll = $this->queryTargetByWhere("`TID`=".$this->connDB->quote($tId));
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
@ -176,9 +176,9 @@ class DBTarget extends Database {
" WHERE `TID` = :tid";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':tid', $tId);
$query->bindParam(':tid', $tId);
$query->bindParam(':value', $value);
$query->execute();
$query->execute();
}
// ========================================================================
@ -193,10 +193,10 @@ class DBTarget extends Database {
$sqlString = "SELECT * FROM `".$this->table('Area')."`".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -252,7 +252,7 @@ class DBTarget extends Database {
*/
public function queryArea($aId) {
$queryResultAll = $this->queryAreaByWhere("`AID`=".$this->connDB->quote($aId));
$queryResultAll = $this->queryAreaByWhere("`AID`=".$this->connDB->quote($aId));
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
@ -317,9 +317,9 @@ class DBTarget extends Database {
// " WHERE `TID` = :tid";
//
// $query = $this->connDB->prepare($sqlString);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':value', $value);
// $query->execute();
// $query->execute();
//}
// ========================================================================
@ -334,10 +334,10 @@ class DBTarget extends Database {
$sqlString = "SELECT * FROM `".$this->table('Hall')."`".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -387,7 +387,7 @@ class DBTarget extends Database {
*/
public function queryHall($hId) {
$queryResultAll = $this->queryHallByWhere("`HID`=".$this->connDB->quote($hId));
$queryResultAll = $this->queryHallByWhere("`HID`=".$this->connDB->quote($hId));
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
@ -448,9 +448,9 @@ class DBTarget extends Database {
// " WHERE `TID` = :tid";
//
// $query = $this->connDB->prepare($sqlString);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':value', $value);
// $query->execute();
// $query->execute();
//}
}

View File

@ -35,10 +35,10 @@ class DBTheme extends Database {
"FROM `".$this->table('Theme')."` AS `theme` ".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -95,7 +95,7 @@ class DBTheme extends Database {
*/
public function queryTheme($thId) {
$queryResultAll =
$queryResultAll =
$this->queryThemeByWhere("`ThID`=".$this->connDB->quote($thId));
// 如果有查到一筆以上
@ -160,9 +160,9 @@ class DBTheme extends Database {
// " WHERE `TID` = :tid";
//
// $query = $this->connDB->prepare($sqlString);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':tid', $tId);
// $query->bindParam(':value', $value);
// $query->execute();
// $query->execute();
// }
}

View File

@ -183,10 +183,10 @@ class DBUser extends Database {
"ON `class`.`CID` = `user`.`CID`".
"WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
// 製作回傳結果陣列
@ -279,7 +279,7 @@ class DBUser extends Database {
*/
public function queryUser($uId) {
$queryResultAll = $this->queryUserByWhere("`UID`=".$this->connDB->quote($uId));
$queryResultAll = $this->queryUserByWhere("`UID`=".$this->connDB->quote($uId));
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
@ -360,10 +360,10 @@ class DBUser extends Database {
" WHERE `UID` = :uid";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':uid', $uId);
$query->bindParam(':uid', $uId);
$query->bindParam(':value', $value);
$query->execute();
$query->execute();
}
// ========================================================================
@ -441,8 +441,8 @@ class DBUser extends Database {
$sqlString = "SELECT * FROM ".$this->table('AGroup').
" WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
@ -565,9 +565,9 @@ class DBUser extends Database {
" WHERE `GID` = :gid";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':gid', $gId);
$query->bindParam(':gid', $gId);
$query->bindParam(':value', $value);
$query->execute();
$query->execute();
}
// ========================================================================
@ -634,8 +634,8 @@ class DBUser extends Database {
$sqlString = "SELECT * FROM ".$this->table('CGroup').
" WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->execute();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
@ -739,9 +739,9 @@ class DBUser extends Database {
" WHERE `CID` = :cid";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':cid', $cId);
$query->bindParam(':cid', $cId);
$query->bindParam(':value', $value);
$query->execute();
$query->execute();
}
/**

View File

@ -92,11 +92,11 @@ class DBUserSession extends Database {
$sqlString = "SELECT * FROM ".$this->table('UserSession').
" WHERE `UToken` = :token";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':token', $token);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':token', $token);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
$queryResult = $queryResultAll[0];
@ -134,11 +134,11 @@ class DBUserSession extends Database {
$sqlString = "SELECT * FROM ".$this->table('UserSession').
" WHERE `UID` = :uid";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':uid', $uId);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':uid', $uId);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {
@ -180,11 +180,11 @@ class DBUserSession extends Database {
$sqlString = "SELECT * FROM ".$this->table('UserSession').
" WHERE `UID` = :uid AND `UToken` IS NOT NULL";
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':uid', $uId);
$query->execute();
$query = $this->connDB->prepare($sqlString);
$query->bindParam(':uid', $uId);
$query->execute();
$queryResultAll = $query->fetchAll();
$queryResultAll = $query->fetchAll();
// 如果有查到一筆以上
if( count($queryResultAll) >= 1 ) {

View File

@ -55,25 +55,25 @@ class StudyActivity {
* 學習階段流水號ID
* @type int
*/
protected $id;
protected $id;
// ------------------------------------------------------------------------
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得查詢
*
/**
* 從資料庫取得查詢
*
* @throw \UElearning\Exception\StudyActivityNoFoundException
* @since 2.0.0
*/
protected function getQuery() {
* @since 2.0.0
*/
protected function getQuery() {
// 從資料庫查詢
$db = new Database\DBStudyActivity();
@ -84,31 +84,31 @@ class StudyActivity {
$this->queryResultArray = $info;
}
else throw new Exception\StudyActivityNoFoundException($this->id);
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputID 學習階段流水號ID
/**
* 建構子
*
* @param int $inputID 學習階段流水號ID
* @since 2.0.0
*/
public function __construct($inputID) {
$this->id = $inputID;
$this->getQuery();
}
*/
public function __construct($inputID) {
$this->id = $inputID;
$this->getQuery();
}
// ========================================================================
// 控制這次學習階段時間:
/**
* 結束這次學習
* 結束這次學習
* *
* @throw \UElearning\Exception\StudyActivityNoFoundException
* @throw \UElearning\Exception\StudyActivityNoFoundException
* @since 2.0.0
*/
public function finishActivity() {
*/
public function finishActivity() {
// 此活動還在進行中
if($this->isLearning()) {
@ -117,17 +117,17 @@ class StudyActivity {
}
// 此活動已結束
else throw new Exception\StudyActivityFinishedException($this->id);
}
}
/**
* 撤銷這次學習
*
* 撤銷這次學習
*
* @since 2.0.0
*/
public function cancelActivity() {
//return $this->queryResultArray['name'];
*/
public function cancelActivity() {
//return $this->queryResultArray['name'];
// TODO: cancelActivity
}
}
/**
* 此學習階段是否正在學習中
@ -173,113 +173,113 @@ class StudyActivity {
}
// ========================================================================
// 取得資料:
/**
* 取得學習階段流水號ID
*
* @return int 學習階段流水號ID
* @since 2.0.0
*/
public function getId() {
return $this->id;
}
// 取得資料:
/**
* 取得這次是誰在學習物件
*
* @return \UElearning\User\User 使用者物件
* 取得學習階段流水號ID
*
* @return int 學習階段流水號ID
* @since 2.0.0
*/
public function getUser() {
*/
public function getId() {
return $this->id;
}
/**
* 取得這次是誰在學習物件
*
* @return \UElearning\User\User 使用者物件
* @since 2.0.0
*/
public function getUser() {
$userId = $this->queryResultArray['user_id'];;
return new User\User($userId);
}
return new User\User($userId);
}
/**
* 取得這次是誰在學習
*
* @return string 使用者ID
* 取得這次是誰在學習
*
* @return string 使用者ID
* @since 2.0.0
*/
public function getUserId() {
return $this->queryResultArray['user_id'];
}
*/
public function getUserId() {
return $this->queryResultArray['user_id'];
}
///**
// * 取得這次是學哪個主題物件
// *
// * @return int 主題物件
// * 取得這次是學哪個主題物件
// *
// * @return int 主題物件
// * @since 2.0.0
// */
//public function getTheme() {
// */
//public function getTheme() {
// $tId = $this->queryResultArray['theme_id'];
// return new Target\User($userId);;
//}
// return new Target\User($userId);;
//}
/**
* 取得這次是學哪個主題
*
* @return int 主題ID
* 取得這次是學哪個主題
*
* @return int 主題ID
* @since 2.0.0
*/
public function getThemeId() {
return $this->queryResultArray['theme_id'];
}
*/
public function getThemeId() {
return $this->queryResultArray['theme_id'];
}
// ------------------------------------------------------------------------
// 時間控制:
/**
* 取得這次學習是什麼時候開始的
*
* @return string 開始學習時間
* 取得這次學習是什麼時候開始的
*
* @return string 開始學習時間
* @since 2.0.0
*/
public function getStartTime() {
return $this->queryResultArray['start_time'];
}
*/
public function getStartTime() {
return $this->queryResultArray['start_time'];
}
/**
* 取得這次學習是什麼時候結束的
*
* @return string 結束學習時間
* 取得這次學習是什麼時候結束的
*
* @return string 結束學習時間
* @since 2.0.0
*/
public function getEndTime() {
return $this->queryResultArray['end_time'];
}
*/
public function getEndTime() {
return $this->queryResultArray['end_time'];
}
/**
* 取得這次學習所需時間
*
* @return int 所需學習時間()
* 取得這次學習所需時間
*
* @return int 所需學習時間()
* @since 2.0.0
*/
public function getLearnTime() {
return $this->queryResultArray['learn_time'];
}
*/
public function getLearnTime() {
return $this->queryResultArray['learn_time'];
}
/**
* 取得這次可實際學習時間(包含延時)
*
* @return int 可實際學習時間()
* 取得這次可實際學習時間(包含延時)
*
* @return int 可實際學習時間()
* @since 2.0.0
*/
public function getRealLearnTimeWith() {
*/
public function getRealLearnTimeWith() {
$learnTime = $this->queryResultArray['learn_time'];
$delay = $this->queryResultArray['delay'];
return $learnTime + $delay;
}
return $learnTime + $delay;
}
/**
* 取得這次學習還剩下多少學習時間
*
* @return int 剩下的學習時間()
* 取得這次學習還剩下多少學習時間
*
* @return int 剩下的學習時間()
* @since 2.0.0
*/
*/
public function getRemainingTime() {
// TODO: 取得這次學習還剩下多少學習時間
@ -294,23 +294,23 @@ class StudyActivity {
}
/**
* 取得這次學習時間要延長多久
*
* @return int 延長時間()
* 取得這次學習時間要延長多久
*
* @return int 延長時間()
* @since 2.0.0
*/
public function getDelay() {
return $this->queryResultArray['delay'];
}
*/
public function getDelay() {
return $this->queryResultArray['delay'];
}
/**
* 設定這次學習時間要延長多久
*
* @param int $minute 延長時間()
* 設定這次學習時間要延長多久
*
* @param int $minute 延長時間()
* @throw \UElearning\Exception\StudyActivityNoFoundException
* @since 2.0.0
*/
public function setDelay($minute) {
*/
public function setDelay($minute) {
// 此活動還在進行中
if($this->isLearning()) {
@ -322,16 +322,16 @@ class StudyActivity {
}
// 此活動已結束
else throw new Exception\StudyActivityFinishedException($this->id);
}
}
/**
* 設定累加這次學習時間要延長多久
*
* @param int $minute 延長時間()
* 設定累加這次學習時間要延長多久
*
* @param int $minute 延長時間()
* @throw \UElearning\Exception\StudyActivityNoFoundException
* @since 2.0.0
*/
public function addDelay($minute) {
*/
public function addDelay($minute) {
// 此活動還在進行中
if($this->isLearning()) {
@ -347,48 +347,48 @@ class StudyActivity {
}
// 此活動已結束
else throw new Exception\StudyActivityFinishedException($this->id);
}
}
/**
* 在這次學習時間已過,是否強制結束學習
*
* @return bool 是否在這次學習時間已過而強制結束學習
* 在這次學習時間已過,是否強制結束學習
*
* @return bool 是否在這次學習時間已過而強制結束學習
* @since 2.0.0
*/
public function isForceLearnTime() {
return $this->queryResultArray['time_force'];
}
*/
public function isForceLearnTime() {
return $this->queryResultArray['time_force'];
}
// ------------------------------------------------------------------------
/**
* 取得這次學習的導引風格
*
* @return int 將推薦幾個學習點
* 取得這次學習的導引風格
*
* @return int 將推薦幾個學習點
* @since 2.0.0
*/
public function getLearnStyle() {
return $this->queryResultArray['learnStyle_mode'];
}
*/
public function getLearnStyle() {
return $this->queryResultArray['learnStyle_mode'];
}
/**
* 在這次學習,是否拒絕使用者前往非推薦的學習點
*
* @return bool 是否拒絕前往非推薦的學習點
* 在這次學習,是否拒絕使用者前往非推薦的學習點
*
* @return bool 是否拒絕前往非推薦的學習點
* @since 2.0.0
*/
public function isForceLearnStyle() {
return $this->queryResultArray['learnStyle_force'];
}
*/
public function isForceLearnStyle() {
return $this->queryResultArray['learnStyle_force'];
}
/**
* 取得這次學習的教材風格
*
* @return string 教材風格
* 取得這次學習的教材風格
*
* @return string 教材風格
* @since 2.0.0
*/
public function getMaterialStyle() {
return $this->queryResultArray['material_mode'];
}
*/
public function getMaterialStyle() {
return $this->queryResultArray['material_mode'];
}
}

View File

@ -65,7 +65,7 @@ class StudyActivityManager {
// 傳回新增後得到的編號
return $resultId;
}
}
}
/**
* 從預約開始進行學習活動

View File

@ -25,25 +25,25 @@ class StudyWill {
* 預約學習階段流水號ID
* @type int
*/
protected $id;
protected $id;
// ------------------------------------------------------------------------
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得查詢
*
/**
* 從資料庫取得查詢
*
* @throw UElearning\Exception\AreaNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢
$db = new Database\DBStudyActivity();
@ -54,283 +54,283 @@ class StudyWill {
$this->queryResultArray = $info;
}
else throw new Exception\StudyActivityWillNoFoundException($this->id);
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputID 預約學習流水號ID
/**
* 建構子
*
* @param int $inputID 預約學習流水號ID
* @since 2.0.0
*/
public function __construct($inputID){
$this->id = $inputID;
$this->getQuery();
}
*/
public function __construct($inputID){
$this->id = $inputID;
$this->getQuery();
}
// ========================================================================
// 控制這次學習階段:
/**
* 撤銷這次預約
*
* 撤銷這次預約
*
* @since 2.0.0
*/
public function cancel(){
$db = new Database\DBStudyActivity();
*/
public function cancel(){
$db = new Database\DBStudyActivity();
$db->deleteWillActivity($this->id);
}
}
// ========================================================================
// 取得資料:
/**
* 取得預約學習階段流水號ID
*
* @return int 預約學習階段流水號ID
* @since 2.0.0
*/
public function getId(){
return $this->id;
}
// 取得資料:
/**
* 取得是誰要預約學習的使用者物件
*
* @return \UElearning\User\User 使用者物件
* 取得預約學習階段流水號ID
*
* @return int 預約學習階段流水號ID
* @since 2.0.0
*/
public function getUser(){
*/
public function getId(){
return $this->id;
}
/**
* 取得是誰要預約學習的使用者物件
*
* @return \UElearning\User\User 使用者物件
* @since 2.0.0
*/
public function getUser(){
$userId = $this->queryResultArray['user_id'];;
return new User\User($userId);
}
return new User\User($userId);
}
/**
* 取得是誰要預約學習
*
* @return string 使用者ID
* 取得是誰要預約學習
*
* @return string 使用者ID
* @since 2.0.0
*/
public function getUserId(){
return $this->queryResultArray['user_id'];
}
*/
public function getUserId(){
return $this->queryResultArray['user_id'];
}
/**
* 設定這次是誰要預約學習
*
* @param string $user_id 使用者ID
* 設定這次是誰要預約學習
*
* @param string $user_id 使用者ID
* @since 2.0.0
*/
public function setUserById($user_id){
$db = new Database\DBStudyActivity();
*/
public function setUserById($user_id){
$db = new Database\DBStudyActivity();
// TODO: 檢查使用者有無存在
$db->changeWillActivityData($this->id, 'user_id', $user_id);
$this->getQuery();
}
}
///**
// * 取得這次預約是學哪個主題物件
// *
// * @return int 主題物件
// * 取得這次預約是學哪個主題物件
// *
// * @return int 主題物件
// * @since 2.0.0
// */
//public function getTheme(){
// */
//public function getTheme(){
// $tId = $this->queryResultArray['theme_id'];
// return new Target\User($userId);;
//}
// return new Target\User($userId);;
//}
/**
* 取得這次預約是學哪個主題
*
* @return int 主題ID
* 取得這次預約是學哪個主題
*
* @return int 主題ID
* @since 2.0.0
*/
public function getThemeId(){
return $this->queryResultArray['theme_id'];
}
*/
public function getThemeId(){
return $this->queryResultArray['theme_id'];
}
/**
* 設定這次要預約學哪個主題
*
* @param int $theme_id 主題ID
* 設定這次要預約學哪個主題
*
* @param int $theme_id 主題ID
* @since 2.0.0
*/
public function setThemeById($theme_id){
$db = new Database\DBStudyActivity();
*/
public function setThemeById($theme_id){
$db = new Database\DBStudyActivity();
// TODO: 檢查主體有無存在
$db->changeWillActivityData($this->id, 'thime_id', $theme_id);
$this->getQuery();
}
}
/**
* 取得這次學習是預約在什麼時候開始
*
* @return string 開始學習預約時間
* 取得這次學習是預約在什麼時候開始
*
* @return string 開始學習預約時間
* @since 2.0.0
*/
public function getStartTime(){
return $this->queryResultArray['start_time'];
}
*/
public function getStartTime(){
return $this->queryResultArray['start_time'];
}
/**
* 設定這次學習是預約在什麼時候開始
*
* @param string $time 開始學習預約時間
* 設定這次學習是預約在什麼時候開始
*
* @param string $time 開始學習預約時間
* @since 2.0.0
*/
public function setStartTime($time){
$db = new Database\DBStudyActivity();
*/
public function setStartTime($time){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'start_time', $time);
$this->getQuery();
}
}
/**
* 取得這次學習預約什麼時候過期
*
* @return string 過期預約時間
* 取得這次學習預約什麼時候過期
*
* @return string 過期預約時間
* @since 2.0.0
*/
public function getExpiredTime(){
return $this->queryResultArray['expired_time'];
}
*/
public function getExpiredTime(){
return $this->queryResultArray['expired_time'];
}
/**
* 設定這次學習預約什麼時候過期
*
* @param string $time 過期預約時間
* 設定這次學習預約什麼時候過期
*
* @param string $time 過期預約時間
* @since 2.0.0
*/
public function setExpiredTime($time){
$db = new Database\DBStudyActivity();
*/
public function setExpiredTime($time){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'expired_time', $time);
$this->getQuery();
}
}
/**
* 取得預約學習所需時間
*
* @return int 所需學習時間()
* 取得預約學習所需時間
*
* @return int 所需學習時間()
* @since 2.0.0
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
/**
* 設定預約學習所需時間
*
* @param int $min 所需學習時間()
* 設定預約學習所需時間
*
* @param int $min 所需學習時間()
* @since 2.0.0
*/
public function setLearnTime($min){
$db = new Database\DBStudyActivity();
*/
public function setLearnTime($min){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'learn_time', $min);
$this->getQuery();
}
}
/**
* 在這次學習時間已過,是否強制結束學習
*
* @return bool 是否在這次學習時間已過而強制結束學習
* 在這次學習時間已過,是否強制結束學習
*
* @return bool 是否在這次學習時間已過而強制結束學習
* @since 2.0.0
*/
public function isForceLearnTime() {
return $this->queryResultArray['time_force'];
}
*/
public function isForceLearnTime() {
return $this->queryResultArray['time_force'];
}
/**
* 設定在這次學習時間已過,是否強制結束學習
*
* @param bool $value 是否在這次學習時間已過而強制結束學習
* 設定在這次學習時間已過,是否強制結束學習
*
* @param bool $value 是否在這次學習時間已過而強制結束學習
* @since 2.0.0
*/
public function setForceLearnTime($value) {
$db = new Database\DBStudyActivity();
*/
public function setForceLearnTime($value) {
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'time_force', $value);
$this->getQuery();
}
}
/**
* 取得預約學習的導引風格
*
* @return int 將推薦幾個學習點
* 取得預約學習的導引風格
*
* @return int 將推薦幾個學習點
* @since 2.0.0
*/
public function getLearnStyle(){
return $this->queryResultArray['learnStyle_mode'];
}
*/
public function getLearnStyle(){
return $this->queryResultArray['learnStyle_mode'];
}
/**
* 設定預約學習的導引風格
*
* @param int $num 將推薦幾個學習點
* 設定預約學習的導引風格
*
* @param int $num 將推薦幾個學習點
* @since 2.0.0
*/
public function setLearnStyle($num){
$db = new Database\DBStudyActivity();
*/
public function setLearnStyle($num){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'learnStyle_mode', $num);
$this->getQuery();
}
}
/**
* 在這次學習,是否拒絕使用者前往非推薦的學習點
*
* @return bool 是否拒絕前往非推薦的學習點
* 在這次學習,是否拒絕使用者前往非推薦的學習點
*
* @return bool 是否拒絕前往非推薦的學習點
* @since 2.0.0
*/
public function isForceLearnStyle(){
return $this->queryResultArray['learnStyle_force'];
}
*/
public function isForceLearnStyle(){
return $this->queryResultArray['learnStyle_force'];
}
/**
* 預約本次學習,是否拒絕使用者前往非推薦的學習點
*
* @param bool $value 是否拒絕前往非推薦的學習點
* 預約本次學習,是否拒絕使用者前往非推薦的學習點
*
* @param bool $value 是否拒絕前往非推薦的學習點
* @since 2.0.0
*/
public function setForceLearnStyle($value){
$db = new Database\DBStudyActivity();
*/
public function setForceLearnStyle($value){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'learnStyle_force', $value);
$this->getQuery();
}
}
/**
* 取得預約學習的教材風格
*
* @return string 教材風格
* 取得預約學習的教材風格
*
* @return string 教材風格
* @since 2.0.0
*/
public function getMaterialStyle(){
return $this->queryResultArray['material_mode'];
}
*/
public function getMaterialStyle(){
return $this->queryResultArray['material_mode'];
}
/**
* 設定預約學習的教材風格
*
* @param string $value 教材風格
* 設定預約學習的教材風格
*
* @param string $value 教材風格
* @since 2.0.0
*/
public function setMaterialStyle($value){
$db = new Database\DBStudyActivity();
*/
public function setMaterialStyle($value){
$db = new Database\DBStudyActivity();
$db->changeWillActivityData($this->id, 'material_mode', $value);
$this->getQuery();
}
}
/**
* 取得開始學習此預約前,是否允許讓學生自行更改設定
*
* @return bool 是否允許讓學生自行更改設定
*
* @return bool 是否允許讓學生自行更改設定
* @since 2.0.0
*/
public function isLock() {
@ -362,24 +362,24 @@ class StudyWill {
// ------------------------------------------------------------------------
/**
* 取得此預約建立時間
*
* @return string 建立時間
/**
* 取得此預約建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
/**
* 取得此預約修改時間
*
* @return string 修改時間
* 取得此預約修改時間
*
* @return string 修改時間
* @since 2.0.0
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
}

View File

@ -47,25 +47,25 @@ class Theme {
* 主題ID
* @type int
*/
protected $id;
protected $id;
// ------------------------------------------------------------------------
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得查詢
*
/**
* 從資料庫取得查詢
*
* @throw \UElearning\Exception\ThemeNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// TODO: 從資料庫取得查詢
//// 從資料庫查詢
$db = new Database\DBTheme();
@ -76,94 +76,94 @@ class Theme {
$this->queryResultArray = $info;
}
else throw new Exception\ThemeNoFoundException($this->id);
}
}
/**
* 從資料庫更新設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
// TODO: 從資料庫更新設定
// 將新設定寫進資料庫裡
//$db = new Database\DBTarget();
//$db = new Database\DBTarget();
//$db->changeTargetData($this->tId, $field, $value);
//$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputTID 主題ID
/**
* 建構子
*
* @param int $inputTID 主題ID
* @since 2.0.0
*/
public function __construct($inputID){
$this->id = $inputID;
$this->getQuery();
}
*/
public function __construct($inputID){
$this->id = $inputID;
$this->getQuery();
}
// ========================================================================
/**
* 取得主題ID
*
* @return int 主題ID
/**
* 取得主題ID
*
* @return int 主題ID
* @since 2.0.0
*/
public function getId(){
return $this->id;
}
/**
* 取得主題名稱
*
* @return string 主題名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getId(){
return $this->id;
}
/**
* 取得主題介紹
*
* @return string 主題介紹
* 取得主題名稱
*
* @return string 主題名稱
* @since 2.0.0
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
/**
* 取得此主題學習所需時間
*
* @return int 所需學習時間()
* 取得主題介紹
*
* @return string 主題介紹
* @since 2.0.0
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
/**
* 取得建立時間
*
* @return string 建立時間
* 取得此主題學習所需時間
*
* @return int 所需學習時間()
* @since 2.0.0
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
/**
* 取得修改時間
*
* @return string 修改時間
* 取得建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
/**
* 取得修改時間
*
* @return string 修改時間
* @since 2.0.0
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
}

View File

@ -41,25 +41,25 @@ class Area {
* 標的ID
* @type int
*/
protected $aId;
protected $aId;
// ------------------------------------------------------------------------
/**
* 查詢到此標的的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到此標的的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此標的查詢
*
/**
* 從資料庫取得此標的查詢
*
* @throw UElearning\Exception\AreaNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢
$db = new Database\DBTarget();
$areaInfo = $db->queryArea($this->aId);
@ -69,115 +69,115 @@ class Area {
$this->queryResultArray = $areaInfo;
}
else throw new Exception\AreaNoFoundException($this->aId);
}
}
/**
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
// 將新設定寫進資料庫裡
//$db = new Database\DBTarget();
//$db = new Database\DBTarget();
//$db->changeTargetData($this->tId, $field, $value);
//$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputAID 區域ID
/**
* 建構子
*
* @param int $inputAID 區域ID
* @since 2.0.0
*/
public function __construct($inputAID){
$this->aId = $inputAID;
$this->getQuery();
}
*/
public function __construct($inputAID){
$this->aId = $inputAID;
$this->getQuery();
}
// ========================================================================
/**
* 取得區域ID
*
* @return int 區域ID
/**
* 取得區域ID
*
* @return int 區域ID
* @since 2.0.0
*/
public function getId(){
return $this->aId;
}
*/
public function getId(){
return $this->aId;
}
/**
* 取得區域所在的廳ID
*
* @return int 區域所在的廳ID
* 取得區域所在的廳ID
*
* @return int 區域所在的廳ID
* @since 2.0.0
*/
public function getHallId(){
return $this->queryResultArray['hall_id'];
}
*/
public function getHallId(){
return $this->queryResultArray['hall_id'];
}
/**
* 取得區域所在樓層
*
* @return int 區域所在樓層
* 取得區域所在樓層
*
* @return int 區域所在樓層
* @since 2.0.0
*/
public function getFloor(){
return $this->queryResultArray['floor'];
}
*/
public function getFloor(){
return $this->queryResultArray['floor'];
}
/**
* 取得區域地圖上的編號
*
* @return int 地圖上的區域編號
* 取得區域地圖上的編號
*
* @return int 地圖上的區域編號
* @since 2.0.0
*/
public function getNumber(){
return $this->queryResultArray['area_number'];
}
*/
public function getNumber(){
return $this->queryResultArray['area_number'];
}
/**
* 取得區域名稱
*
* @return string 區域名稱
/**
* 取得區域名稱
*
* @return string 區域名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
///**
// * 設定區域名稱
// *
// * @param string $name 區域名稱
///**
// * 設定區域名稱
// *
// * @param string $name 區域名稱
// * @since 2.0.0
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// ========================================================================
/**
* 取得區域的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* 取得區域的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* @since 2.0.0
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
/**
* 取得區域簡介
*
* @return string 區域簡介
* 取得區域簡介
*
* @return string 區域簡介
* @since 2.0.0
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
}

View File

@ -39,25 +39,25 @@ class Hall {
* 廳ID
* @type int
*/
protected $hId;
protected $hId;
// ------------------------------------------------------------------------
/**
* 查詢到此廳的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到此廳的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此廳查詢
*
/**
* 從資料庫取得此廳查詢
*
* @throw UElearning\Exception\HallNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢
$db = new Database\DBTarget();
$hallInfo = $db->queryHall($this->hId);
@ -67,85 +67,85 @@ class Hall {
$this->queryResultArray = $hallInfo;
}
else throw new Exception\HallNoFoundException($this->hId);
}
}
/**
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
// 將新設定寫進資料庫裡
//$db = new Database\DBTarget();
//$db = new Database\DBTarget();
//$db->changeTargetData($this->tId, $field, $value);
//$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputAID 區域ID
/**
* 建構子
*
* @param int $inputAID 區域ID
* @since 2.0.0
*/
public function __construct($inputHID){
$this->hId = $inputHID;
$this->getQuery();
}
*/
public function __construct($inputHID){
$this->hId = $inputHID;
$this->getQuery();
}
// ========================================================================
/**
* 取得廳ID
*
* @return int 廳ID
/**
* 取得廳ID
*
* @return int 廳ID
* @since 2.0.0
*/
public function getId(){
return $this->hId;
}
*/
public function getId(){
return $this->hId;
}
/**
* 取得廳名稱
*
* @return string 廳名稱
/**
* 取得廳名稱
*
* @return string 廳名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
///**
// * 設定區域名稱
// *
// * @param string $name 區域名稱
///**
// * 設定區域名稱
// *
// * @param string $name 區域名稱
// * @since 2.0.0
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// ========================================================================
/**
* 取得區域的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* 取得區域的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* @since 2.0.0
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
/**
* 取得區域簡介
*
* @return string 區域簡介
* 取得區域簡介
*
* @return string 區域簡介
* @since 2.0.0
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
*/
public function getIntroduction(){
return $this->queryResultArray['introduction'];
}
}

View File

@ -53,25 +53,25 @@ class Target {
* 標的ID
* @type int
*/
protected $tId;
protected $tId;
// ------------------------------------------------------------------------
/**
* 查詢到此標的的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到此標的的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此標的查詢
*
/**
* 從資料庫取得此標的查詢
*
* @throw UElearning\Exception\TargetNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢此標的
$db = new Database\DBTarget();
$targetInfo = $db->queryTarget($this->tId);
@ -81,208 +81,208 @@ class Target {
$this->queryResultArray = $targetInfo;
}
else throw new Exception\TargetNoFoundException($this->tId);
}
}
/**
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此標的設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
// 將新設定寫進資料庫裡
$db = new Database\DBTarget();
$db = new Database\DBTarget();
$db->changeTargetData($this->tId, $field, $value);
$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputTID 標的ID
/**
* 建構子
*
* @param int $inputTID 標的ID
* @since 2.0.0
*/
public function __construct($inputTID){
$this->tId = $inputTID;
$this->getQuery();
}
*/
public function __construct($inputTID){
$this->tId = $inputTID;
$this->getQuery();
}
// ========================================================================
/**
* 取得標的ID
*
* @return int 標的ID
/**
* 取得標的ID
*
* @return int 標的ID
* @since 2.0.0
*/
public function getId(){
return $this->tId;
}
*/
public function getId(){
return $this->tId;
}
/**
* 取得標的所在的區域ID
*
* @return int 標的所在的區域ID
* 取得標的所在的區域ID
*
* @return int 標的所在的區域ID
* @since 2.0.0
*/
public function getAreaId(){
return $this->queryResultArray['area_id'];
}
*/
public function getAreaId(){
return $this->queryResultArray['area_id'];
}
/**
* 取得標的所在的廳ID
*
* @return int 標的所在的廳ID
* 取得標的所在的廳ID
*
* @return int 標的所在的廳ID
* @since 2.0.0
*/
public function getHallId(){
return $this->queryResultArray['hall_id'];
}
*/
public function getHallId(){
return $this->queryResultArray['hall_id'];
}
/**
* 取得標的地圖上的編號
*
* @return int 地圖上的標的編號
* 取得標的地圖上的編號
*
* @return int 地圖上的標的編號
* @since 2.0.0
*/
public function getNumber(){
return $this->queryResultArray['target_number'];
}
*/
public function getNumber(){
return $this->queryResultArray['target_number'];
}
// ========================================================================
/**
* 取得標的名稱
*
* @return string 標的名稱
/**
* 取得標的名稱
*
* @return string 標的名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
///**
// * 設定標的名稱
// *
// * @param string $name 標的名稱
///**
// * 設定標的名稱
// *
// * @param string $name 標的名稱
// * @since 2.0.0
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// */
//public function setName($name){
// $this->setUpdate('name', $name);
//}
// ========================================================================
/**
* 取得標的的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* 取得標的的地圖圖片檔路徑
*
* @return string 地圖圖片檔路徑
* @since 2.0.0
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
*/
public function getMapUrl(){
return $this->queryResultArray['map_url'];
}
/**
* 取得預估的學習時間
*
* @return int 預估的學習時間()
* 取得預估的學習時間
*
* @return int 預估的學習時間()
* @since 2.0.0
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
*/
public function getLearnTime(){
return $this->queryResultArray['learn_time'];
}
/**
* 取得學習標的的人數限制
*
* @return int 學習標的的人數限制
* 取得學習標的的人數限制
*
* @return int 學習標的的人數限制
* @since 2.0.0
*/
public function getPLj(){
return $this->queryResultArray['PLj'];
}
*/
public function getPLj(){
return $this->queryResultArray['PLj'];
}
/**
* 取得學習標的的人數限制
*
* @return int 學習標的的人數限制
* 取得學習標的的人數限制
*
* @return int 學習標的的人數限制
* @since 2.0.0
*/
public function getMaxPeople(){
return $this->getPLj();
}
*/
public function getMaxPeople(){
return $this->getPLj();
}
// ------------------------------------------------------------------------
/**
* 取得學習標的目前人數
*
* @return int 學習標的目前人數
* @since 2.0.0
*/
public function getMj(){
return $this->queryResultArray['Mj'];
}
/**
* 設定學習標的目前人數
*
* @param int $number 學習標的目前人數
* @since 2.0.0
*/
function setMj($number){
$this->setUpdate('Mj', $number);
}
/**
* 增加學習標的目前人數
* 取得學習標的目前人數
*
* 若要減少可直接在參數內帶入負值
*
* @param int $number 學習標的目前人數調整值
* @return int 學習標的目前人數
* @since 2.0.0
*/
function addMj($number){
*/
public function getMj(){
return $this->queryResultArray['Mj'];
}
/**
* 設定學習標的目前人數
*
* @param int $number 學習標的目前人數
* @since 2.0.0
*/
function setMj($number){
$this->setUpdate('Mj', $number);
}
/**
* 增加學習標的目前人數
*
* 若要減少可直接在參數內帶入負值
*
* @param int $number 學習標的目前人數調整值
* @return int 學習標的目前人數
* @since 2.0.0
*/
function addMj($number){
$setedNum = $this->queryResultArray['Mj']+$number;
if($setedNum < 0) $setedNum = 0;
$this->setUpdate('Mj', $setedNum);
}
$this->setUpdate('Mj', $setedNum);
}
/**
* 取得學習標的目前人數
*
* @return int 學習標的目前人數
* @since 2.0.0
*/
public function getCurrentPeople(){
return $this->getMj();
}
/**
* 增加學習標的目前人數
*
* 若要減少可直接在參數內帶入負值
* 取得學習標的目前人數
*
* @param int $number 學習標的目前人數調整值
* @return int 學習標的目前人數
* @since 2.0.0
*/
public function addCurrentPeople($number){
return $this->addMj($number);
}
*/
public function getCurrentPeople(){
return $this->getMj();
}
/**
* 設定學習標的目前人數
*
* @param int $number 學習標的目前人數
* 增加學習標的目前人數
*
* 若要減少可直接在參數內帶入負值
*
* @param int $number 學習標的目前人數調整值
* @return int 學習標的目前人數
* @since 2.0.0
*/
public function setCurrentPeople($number){
$this->setMj($number);
}
*/
public function addCurrentPeople($number){
return $this->addMj($number);
}
/**
* 設定學習標的目前人數
*
* @param int $number 學習標的目前人數
* @since 2.0.0
*/
public function setCurrentPeople($number){
$this->setMj($number);
}
/**
* 取得此標的還剩下人可容納
@ -295,36 +295,36 @@ class Target {
}
/**
* 目前此標的人數是否已滿
*
* @return bool 目前人數已滿
* 目前此標的人數是否已滿
*
* @return bool 目前人數已滿
* @since 2.0.0
*/
public function isFullPeople(){
if($this->getFj() >= 1) return true;
*/
public function isFullPeople(){
if($this->getFj() >= 1) return true;
else return false;
}
}
// ------------------------------------------------------------------------
/**
* 取得學習標的飽和率上限
*
* @return int 學習標的飽和率上限
* 取得學習標的飽和率上限
*
* @return int 學習標的飽和率上限
* @since 2.0.0
*/
public function getS(){
return $this->queryResultArray['S'];
}
*/
public function getS(){
return $this->queryResultArray['S'];
}
/**
* 取得學習標的滿額指標
*
* @return int 學習標的滿額指標
* 取得學習標的滿額指標
*
* @return int 學習標的滿額指標
* @since 2.0.0
*/
public function getFj(){
return $this->queryResultArray['Fj'];
}
*/
public function getFj(){
return $this->queryResultArray['Fj'];
}
}

View File

@ -42,26 +42,26 @@ class ClassGroup {
* 群組ID
* @type int
*/
protected $cId;
protected $cId;
// ========================================================================
/**
* 查詢到此帳號的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* 查詢到此帳號的所有資訊的結果
*
* @type array
*/
protected $queryResultArray;
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
*
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此群組查詢
*
* 從資料庫取得此群組查詢
*
* @throw UElearning\Exception\ClassNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢群組
$db = new Database\DBUser();
@ -72,97 +72,97 @@ class ClassGroup {
$this->queryResultArray = $groupInfo;
}
else throw new Exception\ClassNoFoundException($this->cId);
}
}
/**
* 從資料庫更新此群組設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此群組設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
// 將新設定寫進資料庫裡
$db = new Database\DBUser();
$db = new Database\DBUser();
$db->changeClassGroupData($this->cId, $field, $value);
$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param int $inputCID 班級ID
/**
* 建構子
*
* @param int $inputCID 班級ID
* @since 2.0.0
*/
public function __construct($inputCID){
$this->cId = $inputCID;
*/
public function __construct($inputCID){
$this->cId = $inputCID;
$this->getQuery();
}
}
// ========================================================================
/**
* 取得群組ID
*
* @return int 班級ID
/**
* 取得群組ID
*
* @return int 班級ID
* @since 2.0.0
*/
public function getID(){
return $this->cId;
}
*/
public function getID(){
return $this->cId;
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
/**
* 取得帳號建立時間
*
* @return string 建立時間
/**
* 取得帳號建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
// ========================================================================
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
// ========================================================================
/**
* 取得群組顯示名稱
*
* @return string 群組名稱
/**
* 取得群組顯示名稱
*
* @return string 群組名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
/**
* 設定群組顯示名稱
*
* @param string $name 群組名稱
/**
* 設定群組顯示名稱
*
* @param string $name 群組名稱
* @since 2.0.0
*/
public function setName($name){
$this->setUpdate('name', $name);
}
*/
public function setName($name){
$this->setUpdate('name', $name);
}
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
* @since 2.0.0
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
* @since 2.0.0
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
}

View File

@ -50,25 +50,25 @@ class User {
* 使用者ID
* @type string
*/
protected $uId;
protected $uId;
// ------------------------------------------------------------------------
/**
* 查詢到此帳號的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 查詢到此帳號的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此帳號查詢
*
/**
* 從資料庫取得此帳號查詢
*
* @throw UElearning\Exception\UserNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢使用者
$db = new Database\DBUser();
$userInfo = $db->queryUser($this->uId);
@ -78,135 +78,135 @@ class User {
$this->queryResultArray = $userInfo;
}
else throw new Exception\UserNoFoundException($this->uId);
}
}
/**
* 從資料庫更新此帳號設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此帳號設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
/// 將新設定寫進資料庫裡
$db = new Database\DBUser();
$db = new Database\DBUser();
$db->changeUserData($this->uId, $field, $value);
$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param string $inputUID 使用者ID
* @since 2.0.0
*/
public function __construct($inputUID){
$this->uId = $inputUID;
$this->getQuery();
}
// ========================================================================
/**
* 取得帳號名稱
*
* @return string 帳號名稱
* @since 2.0.0
*/
public function getId(){
return $this->uId;
}
/**
* 取得帳號名稱
*
* @return string 帳號名稱
* 建構子
*
* @param string $inputUID 使用者ID
* @since 2.0.0
*/
public function getUsername(){
return $this->uId;
}
*/
public function __construct($inputUID){
$this->uId = $inputUID;
$this->getQuery();
}
// ------------------------------------------------------------------------
// ========================================================================
/**
* 驗證密碼是否錯誤
*
* @param string $inputPasswd 密碼
* @return bool true:密碼正確false:密碼錯誤
/**
* 取得帳號名稱
*
* @return string 帳號名稱
* @since 2.0.0
*/
public function isPasswordCorrect($inputPasswd){
$passUtil = new Util\Password();
*/
public function getId(){
return $this->uId;
}
/**
* 取得帳號名稱
*
* @return string 帳號名稱
* @since 2.0.0
*/
public function getUsername(){
return $this->uId;
}
// ------------------------------------------------------------------------
/**
* 驗證密碼是否錯誤
*
* @param string $inputPasswd 密碼
* @return bool true:密碼正確false:密碼錯誤
* @since 2.0.0
*/
public function isPasswordCorrect($inputPasswd){
$passUtil = new Util\Password();
$this_passwd = $this->queryResultArray['password'];
return $passUtil->checkSame($this_passwd, $inputPasswd);
}
}
/**
* 更改密碼
*
* @param string $newPasswd 新密碼
* @param string $newPasswdMode 新密碼加密方式(可省略)
* @return string 狀態回傳
/**
* 更改密碼
*
* @param string $newPasswd 新密碼
* @param string $newPasswdMode 新密碼加密方式(可省略)
* @return string 狀態回傳
* @since 2.0.0
*/
public function changePassword($newPasswd){
*/
public function changePassword($newPasswd){
// 進行密碼加密
$passUtil = new Util\Password();
$passwdEncrypted = $passUtil->encrypt($newPasswd);
// 將新密碼寫進資料庫裡
$this->setUpdate('password', $passwdEncrypted);
}
$this->setUpdate('password', $passwdEncrypted);
}
// ------------------------------------------------------------------------
/**
* 取得帳號建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
// ------------------------------------------------------------------------
/**
* 取得帳號資訊修改時間
*
* @return string 修改時間
* 取得帳號建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
// ------------------------------------------------------------------------
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
/**
* 取得所在群組
*
* @return string 群組ID
/**
* 取得帳號資訊修改時間
*
* @return string 修改時間
* @since 2.0.0
*/
public function getGroupID(){
return $this->queryResultArray['group_id'];
}
*/
public function getModifyTime(){
return $this->queryResultArray['modify_time'];
}
// ------------------------------------------------------------------------
/**
* 取得所在群組顯示名稱
*
* @return string 群組名稱
/**
* 取得所在群組
*
* @return string 群組ID
* @since 2.0.0
*/
public function getGroupID(){
return $this->queryResultArray['group_id'];
}
/**
* 取得所在群組顯示名稱
*
* @return string 群組名稱
* @throw UElearning\Exception\GroupNoFoundException
* @since 2.0.0
*/
public function getGroupName(){
*/
public function getGroupName(){
return $this->queryResultArray['group_name'];
}
}
/**
* 設定所在群組
*
/**
* 設定所在群組
*
* 範例:
*
* try {
@ -223,13 +223,13 @@ class User {
* echo 'No Found user: '. $e->getUserId();
* }
*
* @param string $toGroup 群組ID
* @param string $toGroup 群組ID
* @throw UElearning\Exception\GroupNoFoundException
* @since 2.0.0
*/
public function setGroup($toGroup){
*/
public function setGroup($toGroup){
// 檢查有此群組
// 檢查有此群組
$groupAdmin = new UserGroupAdmin();
if($groupAdmin->isExist($toGroup)) {
$this->setUpdate('group_id', $toGroup);
@ -237,34 +237,34 @@ class User {
else {
throw new Exception\GroupNoFoundException($toGroup);
}
}
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
/**
* 取得所在班級
*
* @return string 班級ID
/**
* 取得所在班級
*
* @return string 班級ID
* @since 2.0.0
*/
public function getClass(){
return $this->queryResultArray['class_id'];
}
*/
public function getClass(){
return $this->queryResultArray['class_id'];
}
/**
* 取得所在班級名稱
*
* @return string 班級名稱
/**
* 取得所在班級名稱
*
* @return string 班級名稱
* @throw UElearning\Exception\ClassNoFoundException
* @since 2.0.0
*/
public function getClassName(){
return $this->queryResultArray['class_name'];
}
*/
public function getClassName(){
return $this->queryResultArray['class_name'];
}
/**
* 設定所在班級
*
/**
* 設定所在班級
*
* 範例:
*
* try {
@ -281,13 +281,13 @@ class User {
* echo 'No Found user: '. $e->getUserId();
* }
*
* @param string $toClass 班級ID
* @param string $toClass 班級ID
* @throw UElearning\Exception\ClassNoFoundException
* @since 2.0.0
*/
public function setClass($toClass){
*/
public function setClass($toClass){
// 檢查有此群組
// 檢查有此群組
if(isset($toClass)) {
$classGroupAdmin = new ClassGroupAdmin();
@ -302,253 +302,253 @@ class User {
$this->setUpdate('class_id', null);
}
}
}
// ------------------------------------------------------------------------
/**
* 取得帳號啟用狀態
*
* @return bool 是否已啟用
/**
* 取得帳號啟用狀態
*
* @return bool 是否已啟用
* @since 2.0.0
*/
public function isEnable(){
return $this->queryResultArray['enable'];
}
/**
* 設定帳號啟用狀態
*
* @param bool $isActive 是否為啟用
* @since 2.0.0
*/
public function setEnable($isActive){
public function isEnable(){
return $this->queryResultArray['enable'];
}
/**
* 設定帳號啟用狀態
*
* @param bool $isActive 是否為啟用
* @since 2.0.0
*/
public function setEnable($isActive){
// TODO: 防呆,至少一個帳號是啟用的
// 將新設定寫進資料庫裡
$this->setUpdate('enable', $isActive);
}
$this->setUpdate('enable', $isActive);
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
/**
* 取得這個人的學習導引風格
*
* @return int 將推薦幾個學習點
* 取得這個人的學習導引風格
*
* @return int 將推薦幾個學習點
* @since 2.0.0
*/
public function getLearnStyle(){
return $this->queryResultArray['learnStyle_mode'];
}
*/
public function getLearnStyle(){
return $this->queryResultArray['learnStyle_mode'];
}
/**
* 設定這個人的學習導引風格
*
* @param int $style 將推薦幾個學習點
/**
* 設定這個人的學習導引風格
*
* @param int $style 將推薦幾個學習點
* @since 2.0.0
*/
public function setLearnStyle($style){
*/
public function setLearnStyle($style){
if( $style >= 0 ) {
$this->setUpdate('learnStyle_mode', $style);
}
else {
else {
throw new \UnexpectedValueException();
}
}
}
/**
* 取得這個人的教材風格
*
* @return string 教材風格
* 取得這個人的教材風格
*
* @return string 教材風格
* @since 2.0.0
*/
public function getMaterialStyle(){
return $this->queryResultArray['material_mode'];
}
*/
public function getMaterialStyle(){
return $this->queryResultArray['material_mode'];
}
/**
* 設定這個人的教材風格
*
* @param string $style 教材風格
/**
* 設定這個人的教材風格
*
* @param string $style 教材風格
* @since 2.0.0
*/
public function setMaterialStyle($style){
*/
public function setMaterialStyle($style){
// TODO: 防呆- 無此教材
$this->setUpdate('material_mode', $style);
}
// TODO: 防呆- 無此教材
$this->setUpdate('material_mode', $style);
}
// ------------------------------------------------------------------------
/**
* 取得名稱
*
* @return string 依照有填入多少名字 <br />優先順序: 暱稱→真實名字→帳號名稱
* 取得名稱
*
* @return string 依照有填入多少名字 <br />優先順序: 暱稱→真實名字→帳號名稱
* @since 2.0.0
*/
public function getName(){
*/
public function getName(){
// TODO: 待修正-取得名稱
if($this->getNickName() != "") {
return $this->getNickName();
}
else if($this->getRealName() != "") {
return $this->getRealName();
}
else {
return $this->getUsername();
}
}
if($this->getNickName() != "") {
return $this->getNickName();
}
else if($this->getRealName() != "") {
return $this->getRealName();
}
else {
return $this->getUsername();
}
}
// ------------------------------------------------------------------------
/**
* 取得暱稱
*
* @return string 暱稱
* 取得暱稱
*
* @return string 暱稱
* @since 2.0.0
*/
public function getNickName(){
return $this->queryResultArray['nickname'];
}
*/
public function getNickName(){
return $this->queryResultArray['nickname'];
}
/**
* 修改暱稱
*
* @param string $input 新暱稱
/**
* 修改暱稱
*
* @param string $input 新暱稱
* @since 2.0.0
*/
public function setNickName($input){
// 將新設定寫進資料庫裡
$this->setUpdate('nickname', $input);
}
// ------------------------------------------------------------------------
/**
* 取得真實姓名
*
* @return string 真實姓名
* @since 2.0.0
*/
public function getRealName(){
return $this->queryResultArray['realname'];
}
/**
* 修改真實姓名
*
* @param string $input 新真實姓名
* @since 2.0.0
*/
public function setRealName($input){
// 將新設定寫進資料庫裡
$this->setUpdate('realname', $input);
}
// ------------------------------------------------------------------------
/**
* 取得帳號Email
*
* @return string 使用者資訊的Email
* @since 2.0.0
*/
public function getEmail(){
return $this->queryResultArray['email'];
}
/**
* 修改帳號Email
*
* @param string $input 新Email
* @since 2.0.0
*/
public function setEmail($input){
// 將新設定寫進資料庫裡
$this->setUpdate('email', $input);
}
*/
public function setNickName($input){
// 將新設定寫進資料庫裡
$this->setUpdate('nickname', $input);
}
// ------------------------------------------------------------------------
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
/**
* 取得真實姓名
*
* @return string 真實姓名
* @since 2.0.0
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
*/
public function getRealName(){
return $this->queryResultArray['realname'];
}
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
/**
* 修改真實姓名
*
* @param string $input 新真實姓名
* @since 2.0.0
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
*/
public function setRealName($input){
// 將新設定寫進資料庫裡
$this->setUpdate('realname', $input);
}
// ========================================================================
// ------------------------------------------------------------------------
/**
* 取得權限清單
*
* @return array 權限清單
/**
* 取得帳號Email
*
* @return string 使用者資訊的Email
* @since 2.0.0
*/
public function getEmail(){
return $this->queryResultArray['email'];
}
/**
* 修改帳號Email
*
* @param string $input 新Email
* @since 2.0.0
*/
public function setEmail($input){
// 將新設定寫進資料庫裡
$this->setUpdate('email', $input);
}
// ------------------------------------------------------------------------
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
* @since 2.0.0
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
* @since 2.0.0
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
// ========================================================================
/**
* 取得權限清單
*
* @return array 權限清單
* @since 2.0.0
*/
public function getPermissionList() {
$thisGroup = new UserGroup($this->getQueryInfo("GID"));
return $thisGroup->getPermissionList();
}
*/
public function getPermissionList() {
$thisGroup = new UserGroup($this->getQueryInfo("GID"));
return $thisGroup->getPermissionList();
}
/**
* 是否擁有此權限
*
* @param string $permissionName 權限名稱
* @return bool 是否擁有
/**
* 是否擁有此權限
*
* @param string $permissionName 權限名稱
* @return bool 是否擁有
* @throw UElearning\User\Exception\PermissionNoFoundException
* @since 2.0.0
*/
public function havePermission($permissionName) {
$thisGroup = new UserGroup($this->getQueryInfo("GID"));
*/
public function havePermission($permissionName) {
$thisGroup = new UserGroup($this->getQueryInfo("GID"));
return $thisGroup->havePermission($permissionName);
}
}
// ========================================================================
// ========================================================================
/**
* 取得登入次數
*
* @return int 登入了多少次
* 取得登入次數
*
* @return int 登入了多少次
* @since 2.0.0
*/
public function getLoginTimes() {
*/
public function getLoginTimes() {
// TODO: 取得登入次數
}
/**
* 目前有幾個裝置登入
*
* @return int 幾個已登入的登入階段
* 目前有幾個裝置登入
*
* @return int 幾個已登入的登入階段
* @since 2.0.0
*/
public function getCurrentLoginTotal() {
*/
public function getCurrentLoginTotal() {
// TODO: 取得登入次數
}
// ========================================================================
/**
* 目前有哪些活動可以進行學習
*
* @return array 可以學習的活動清單
* 目前有哪些活動可以進行學習
*
* @return array 可以學習的活動清單
* @since 2.0.0
*/
public function getStudyActivity() {
*/
public function getStudyActivity() {
// TODO: 可以學習的活動清單
}

View File

@ -43,26 +43,26 @@ class UserGroup {
* 群組ID
* @type string
*/
protected $gId;
protected $gId;
// ========================================================================
/**
* 查詢到此帳號的所有資訊的結果
*
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
* 查詢到此帳號的所有資訊的結果
*
* @type array
*/
protected $queryResultArray;
* $this->getQuery() 抓取資料表中所有資訊,並放在此陣列裡
*
* @type array
*/
protected $queryResultArray;
/**
* 從資料庫取得此群組查詢
*
* 從資料庫取得此群組查詢
*
* @throw UElearning\Exception\GroupNoFoundException
* @since 2.0.0
*/
protected function getQuery(){
* @since 2.0.0
*/
protected function getQuery(){
// 從資料庫查詢群組
$db = new Database\DBUser();
@ -73,121 +73,121 @@ class UserGroup {
$this->queryResultArray = $groupInfo;
}
else throw new Exception\GroupNoFoundException($this->gId);
}
}
/**
* 從資料庫更新此群組設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
* 從資料庫更新此群組設定
*
* @since 2.0.0
*/
protected function setUpdate($field, $value){
/// 將新設定寫進資料庫裡
$db = new Database\DBUser();
$db = new Database\DBUser();
$db->changeGroupData($this->gId, $field, $value);
$this->getQuery();
}
}
// ========================================================================
/**
* 建構子
*
* @param string $inputGID 群組ID
/**
* 建構子
*
* @param string $inputGID 群組ID
* @since 2.0.0
*/
public function __construct($inputGID){
$this->gId = $inputGID;
*/
public function __construct($inputGID){
$this->gId = $inputGID;
$this->getQuery();
}
}
// ========================================================================
/**
* 取得群組ID
*
* @return string 群組ID
/**
* 取得群組ID
*
* @return string 群組ID
* @since 2.0.0
*/
public function getID(){
return $this->gId;
}
*/
public function getID(){
return $this->gId;
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
/**
* 取得帳號建立時間
*
* @return string 建立時間
/**
* 取得帳號建立時間
*
* @return string 建立時間
* @since 2.0.0
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
// ========================================================================
*/
public function getCreateTime(){
return $this->queryResultArray['build_time'];
}
// ========================================================================
/**
* 取得群組顯示名稱
*
* @return string 群組名稱
/**
* 取得群組顯示名稱
*
* @return string 群組名稱
* @since 2.0.0
*/
public function getName(){
return $this->queryResultArray['name'];
}
*/
public function getName(){
return $this->queryResultArray['name'];
}
/**
* 設定群組顯示名稱
*
* @param string $name 群組名稱
/**
* 設定群組顯示名稱
*
* @param string $name 群組名稱
* @since 2.0.0
*/
public function setName($name){
$this->setUpdate('name', $name);
}
*/
public function setName($name){
$this->setUpdate('name', $name);
}
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
/**
* 取得帳號備註資訊
*
* @return string 使用者帳號備註資訊
* @since 2.0.0
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
*/
public function getMemo(){
return $this->queryResultArray['memo'];
}
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
/**
* 修改帳號備註資訊
*
* @param string $input 新的帳號備註資訊
* @since 2.0.0
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
*/
public function setMemo($input){
$this->setUpdate('memo', $input);
}
// ========================================================================
// ========================================================================
/**
* 取得權限清單
*
* @return array 權限清單
*/
public function getPermissionList() {
// TODO: 取得權限清單
/**
* 取得權限清單
*
* @return array 權限清單
*/
public function getPermissionList() {
// TODO: 取得權限清單
}
}
/**
* 是否擁有此權限
*
* @param string $permissionName 權限名稱
* @return bool 是否擁有
/**
* 是否擁有此權限
*
* @param string $permissionName 權限名稱
* @return bool 是否擁有
* @throw UElearning\Exception\PermissionNoFoundException
* @since 2.0.0
*/
public function havePermission($permissionName) {
switch($permissionName) {
*/
public function havePermission($permissionName) {
switch($permissionName) {
case 'server_admin':
case 'serverAdmin':
case 'ServerAdmin':
@ -204,19 +204,19 @@ class UserGroup {
throw new Exception\PermissionNoFoundException('$permissionName');
return false;
}
}
}
/**
* 設定擁有此權限
*
* @param string $permissionName 權限名稱
* 設定擁有此權限
*
* @param string $permissionName 權限名稱
* @param string $setBool 是否給予
* @return bool 是否擁有
* @return bool 是否擁有
* @throw UElearning\Exception\PermissionNoFoundException
* @since 2.0.0
*/
public function setPermission($permissionName, $setBool) {
switch($permissionName) {
*/
public function setPermission($permissionName, $setBool) {
switch($permissionName) {
case 'server_admin':
case 'serverAdmin':
case 'ServerAdmin':
@ -231,6 +231,6 @@ class UserGroup {
default:
throw new Exception\PermissionNoFoundException('$permissionName');
}
}
}
}