diff --git a/htdocs/lib/Database/DBRecommand.php b/htdocs/lib/Database/DBRecommand.php index 3efbaf1..c2b8003 100644 --- a/htdocs/lib/Database/DBRecommand.php +++ b/htdocs/lib/Database/DBRecommand.php @@ -9,13 +9,35 @@ require_once UELEARNING_LIB_ROOT.'/Database/Exception.php'; class DBRecomamnd extends Database { - public function __construct() - { - - } - + + /** + * 內部查詢用 + * @param string $where SQL WHERE子句 + * @return array 查詢結果 + */ protected function queryBelongByWhere($where) { - + $sqlString = "SELECT DISTINCT ".$this->table('Edge').".Ti, ".$this->table('Edge').".Tj, ".$this->table('Edge').".MoveTime". + " FROM ".$this->table('Edge')." WHERE ".$where; + $this->conndb->prepare($sqlString); + $this->conndb->execute(); + + $queryAllResult = $this->conndb->fetchAll(); + + if(count($queryAllResult) != 0) + { + $result = array(); + foreach ($queryAllResult as $key => $thisResult) + { + array_push($result, + array("Ti" => $thisResult['Ti'], + "Tj" => $thisResult['Tj'], + "MoveTime" => $thisResult['MoveTime'])); + } + + return $result; + } + else return null; } -} \ No newline at end of file + +} diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index b896bb6..0e297c7 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -28,6 +28,8 @@ class RecommandPoint * @type double */ private const $ALPHA = 0.5; + + private public function __construct() @@ -41,14 +43,14 @@ class RecommandPoint */ private function computeNormalizationParameter() { - + $ } /** * 推薦學習點 * @return array 學習點清單 */ - public function recommand() + public function recommand($ ) { }