add classes

This commit is contained in:
元兒~ 2014-07-20 19:03:20 +08:00
parent 4c35172b95
commit 8f58cb6c8e
17 changed files with 2301 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# 設定檔
# 建立測試用的檔案
test.php
# KDE Dolphin自己產生的垃圾
*.directory
.*.kate-swp
.DS_Store
.*.swp
# GitEye產生的
.project
# phpdoc產生的垃圾檔案
docs/phpdoc-cache-*
# PHP Composer
composer.phar
vendor/
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock

View File

@ -0,0 +1,12 @@
後端伺服器
===
主要的東西都放在Server那邊處理手機客戶端與伺服器資料的溝通。
包含每位學生的學習資料、場地狀況、學習教材。以及處理學習路徑規劃。
## 系統需求
* PHP5.3 以上需要有以下Extension:
* pdo_mysql
* zip
* MariaDB 5.5.31 (可用MySQL)

View File

@ -0,0 +1,47 @@
<?php namespace UElearning\Database;
/**
* @file
* 整體資料庫操作
*
* 此檔案針對整體資料庫的功能,像是建立此資料庫、建立表格、清空...等等
*/
/**
* 資料庫整體管理
*
* @author Yuan Chiu <chyuaner@gmail.com>
* @link https://github.com/CHU-TDAP/
* @since 3.0
*/
class Database {
/**
* 測試資料庫有無連接成功
*
* @todo
*/
public function connectTest() {
}
/**
* 建立資料庫
*
* 在資料庫系統內建立一個資料庫。
* (注意!需有建立資料庫的權限)
*
* @todo
*/
public function createDB() {
}
/**
* 建立所有所需的資料表
*
* @TODO rdkoprk
*/
public function createAllTable() {
}
}

View File

@ -0,0 +1,8 @@
Database
===
## 全域變數
* DB_NAME
* DB_HOST
* DB_USER
* DB_PASS

View File

@ -0,0 +1,77 @@
<?php namespace UElearning\Database;
/**
* @file
* 資料庫連接專用
*
* 有用到的Define:
* DB_NAME, DB_HOST, DB_USER, DB_PASS
*/
use \PDO;
/**
* 資料庫連接專用類別
*
* @extends PDO
* @author Yuan Chiu <chyuaner@gmail.com>
* @link https://github.com/CHU-TDAP/
* @version Version 2.0
* @see https://github.com/shuliu/myPDO
*/
class PDODB extends PDO {
/**
* 連結資料庫
*
* @access public
* @author Yuan Chiu <me@yuaner.tw>
* @version 2
*/
public function __construct(){
parent::__construct("mysql:dbname=".DB_NAME.";host:".DB_HOST.";
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");
}
// ========================================================================
/**
* 取得帶有前綴字元的完整資料表名稱
*
* @access public
* @param string $inputName 資料表名稱
* @return string 完整的資料表名稱
*
* @author Yuan Chiu <me@yuaner.tw>
* @version 3
*/
public function table($inputName){
return DB_PREFIX.$inputName;
}
// ========================================================================
/**
* 錯誤訊息的陣列
*
* 改寫Adodb -> ErrorMsg
*
* @access public
* @return array 錯誤訊息
*
* @since 2013.8.6
* @author shuliu <https://github.com/shuliu>
* @see https://github.com/shuliu/myPDO/blob/master/PDO.class.php
*/
public function ErrorMsg(){
$err = parent ::errorinfo();
if( $err[0]!='00000' ){
return array('errorCode'=>$err[0],'number'=>$err[1],'message'=>$err[2]);
}else{
return null;
}
}
}

View File

View File

11
htdocs/lib/User/NOTE.md Normal file
View File

@ -0,0 +1,11 @@
User Package
===
## UserControl.php
登入使用者帳號所用的
## User.php
## UserAdmin.php
管理使用者帳號、管理群組

8
htdocs/lib/User/User.php Normal file
View File

@ -0,0 +1,8 @@
<?php namespace UElearning\User;
/**
* @file
* 此位使用者的相關操作
*
* @todo: ew
*/
// @todo fdnskfjn

View File

@ -0,0 +1,24 @@
<?php namespace UElearning\User;
/**
* @file
* 管理使用者的操作
*
*
*/
/**
* 使用者管理
*
* @todo
*/
class UserAdmin {
/**
* 建立使用者
*
* @todo
*/
public function createUser() {
}
}

View File

View File

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
Software License Agreement (New BSD License)
Copyright (c) 2006-2009, Christoph Dorn
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Christoph Dorn nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,276 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
*
* This file is part of FirePHP (http://www.firephp.org/).
*
* Software License Agreement (New BSD License)
*
* Copyright (c) 2006-2010, Christoph Dorn
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Christoph Dorn nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007-2009 Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @license http://www.opensource.org/licenses/bsd-license.php
* @package FirePHPCore
*/
if(!class_exists('FirePHP')) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php';
}
/**
* Sends the given data to the FirePHP Firefox Extension.
* The data can be displayed in the Firebug Console or in the
* "Server" request tab.
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @return true
* @throws Exception
*/
function fb()
{
$instance = FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array($instance,'fb'),$args);
}
class FB
{
/**
* Enable and disable logging to Firebug
*
* @see FirePHP->setEnabled()
* @param boolean $Enabled TRUE to enable, FALSE to disable
* @return void
*/
public static function setEnabled($Enabled)
{
$instance = FirePHP::getInstance(true);
$instance->setEnabled($Enabled);
}
/**
* Check if logging is enabled
*
* @see FirePHP->getEnabled()
* @return boolean TRUE if enabled
*/
public static function getEnabled()
{
$instance = FirePHP::getInstance(true);
return $instance->getEnabled();
}
/**
* Specify a filter to be used when encoding an object
*
* Filters are used to exclude object members.
*
* @see FirePHP->setObjectFilter()
* @param string $Class The class name of the object
* @param array $Filter An array or members to exclude
* @return void
*/
public static function setObjectFilter($Class, $Filter)
{
$instance = FirePHP::getInstance(true);
$instance->setObjectFilter($Class, $Filter);
}
/**
* Set some options for the library
*
* @see FirePHP->setOptions()
* @param array $Options The options to be set
* @return void
*/
public static function setOptions($Options)
{
$instance = FirePHP::getInstance(true);
$instance->setOptions($Options);
}
/**
* Get options for the library
*
* @see FirePHP->getOptions()
* @return array The options
*/
public static function getOptions()
{
$instance = FirePHP::getInstance(true);
return $instance->getOptions();
}
/**
* Log object to firebug
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @return true
* @throws Exception
*/
public static function send()
{
$instance = FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array($instance,'fb'),$args);
}
/**
* Start a group for following messages
*
* Options:
* Collapsed: [true|false]
* Color: [#RRGGBB|ColorName]
*
* @param string $Name
* @param array $Options OPTIONAL Instructions on how to log the group
* @return true
*/
public static function group($Name, $Options=null)
{
$instance = FirePHP::getInstance(true);
return $instance->group($Name, $Options);
}
/**
* Ends a group you have started before
*
* @return true
* @throws Exception
*/
public static function groupEnd()
{
return self::send(null, null, FirePHP::GROUP_END);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::LOG
* @param mixes $Object
* @param string $Label
* @return true
* @throws Exception
*/
public static function log($Object, $Label=null)
{
return self::send($Object, $Label, FirePHP::LOG);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::INFO
* @param mixes $Object
* @param string $Label
* @return true
* @throws Exception
*/
public static function info($Object, $Label=null)
{
return self::send($Object, $Label, FirePHP::INFO);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::WARN
* @param mixes $Object
* @param string $Label
* @return true
* @throws Exception
*/
public static function warn($Object, $Label=null)
{
return self::send($Object, $Label, FirePHP::WARN);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::ERROR
* @param mixes $Object
* @param string $Label
* @return true
* @throws Exception
*/
public static function error($Object, $Label=null)
{
return self::send($Object, $Label, FirePHP::ERROR);
}
/**
* Dumps key and variable to firebug server panel
*
* @see FirePHP::DUMP
* @param string $Key
* @param mixed $Variable
* @return true
* @throws Exception
*/
public static function dump($Key, $Variable)
{
return self::send($Variable, $Key, FirePHP::DUMP);
}
/**
* Log a trace in the firebug console
*
* @see FirePHP::TRACE
* @param string $Label
* @return true
* @throws Exception
*/
public static function trace($Label)
{
return self::send($Label, FirePHP::TRACE);
}
/**
* Log a table in the firebug console
*
* @see FirePHP::TABLE
* @param string $Label
* @param string $Table
* @return true
* @throws Exception
*/
public static function table($Label, $Table)
{
return self::send($Table, $Label, FirePHP::TABLE);
}
}