diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 96da6c9..bea0211 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -454,6 +454,8 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { ? $_POST['learnStyle_mode'] : null; $learnStyle_force = isset($_POST['learnStyle_force']) ? $_POST['learnStyle_force'] : null; + $enable_virtual = isset($_POST['enable_virtual']) + ? $_POST['enable_virtual'] : null; $materialMode = isset($_POST['material_mode']) ? $_POST['material_mode'] : null; } @@ -491,7 +493,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { $studyId = $studyMgr->startActivity($user_id, $themeId, $learnTime, $timeForce, $learnStyle, $learnStyle_force, - $materialMode); + $enable_virtual, $materialMode); // 取得開始後的學習活動資訊 $sact = new Study\StudyActivity($studyId); @@ -515,6 +517,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { 'time_force' => $sact->isForceLearnTime(), 'learnStyle_mode' => $sact->getLearnStyle(), 'learnStyle_force' => $sact->isForceLearnStyle(), + 'enable_virtual' => $sact->isEnableVirtual(), 'material_mode' => $sact->getMaterialStyle(), 'target_total' => $sact->getPointTotal(), 'learned_total' => $sact->getLearnedPointTotal() @@ -577,6 +580,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { 'time_force' => $sact->isForceLearnTime(), 'learnStyle_mode' => $sact->getLearnStyle(), 'learnStyle_force' => $sact->isForceLearnStyle(), + 'enable_virtual' => $sact->isEnableVirtual(), 'material_mode' => $sact->getMaterialStyle(), 'target_total' => $sact->getPointTotal(), 'learned_total' => $sact->getLearnedPointTotal() @@ -643,6 +647,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { 'end_time' => $sact->getEndTime(), 'learnStyle_mode' => $sact->getLearnStyle(), 'learnStyle_force' => $sact->isForceLearnStyle(), + 'enable_virtual' => $sact->isEnableVirtual(), 'material_mode' => $sact->getMaterialStyle(), 'target_total' => $sact->getPointTotal(), 'learned_total' => $sact->getLearnedPointTotal() diff --git a/htdocs/lib/Database/MySQLDB.php b/htdocs/lib/Database/MySQLDB.php index 1b1975f..77b3ec1 100644 --- a/htdocs/lib/Database/MySQLDB.php +++ b/htdocs/lib/Database/MySQLDB.php @@ -21,13 +21,13 @@ use \PDO; * @subpackage Database */ class MySQLDB extends PDO { - + /** * 連結資料庫 * * @param string $dbname 資料庫名稱 * @param string $host 資料庫伺服器位址 - * @param int $port 資料庫伺服器連接埠 + * @param int $port 資料庫伺服器連接埠 * @param string $user 資料庫伺服器帳號 * @param string $passwd 資料庫伺服器密碼 * @author Yuan Chiu @@ -35,13 +35,12 @@ class MySQLDB extends PDO { */ public function __construct($dbname, $host, $port, $user, $passwd){ parent::__construct('mysql:dbname='.$dbname - .';host:'.$host.';port='.$port + .';host='.$host.';port='.$port .';charset=utf8', DB_USER, DB_PASS); //配合PHP< 5.3.6 PDO沒有charset用的 //參考: http://gdfan1114.wordpress.com/2013/06/24/php-5-3-6-%E7%89%88-pdo-%E9%85%8D%E5%90%88%E5%AD%98%E5%8F%96%E8%B3%87%E6%96%99%E5%BA%AB%E6%99%82%E7%9A%84%E4%B8%AD%E6%96%87%E5%95%8F%E9%A1%8C/ $this->exec('set names utf8'); - } // ======================================================================== @@ -52,7 +51,7 @@ class MySQLDB extends PDO { * * @access public * @return array 錯誤訊息 - * + * * @since 2.0.0 * @author shuliu * @see https://github.com/shuliu/myPDO/blob/master/PDO.class.php