1 / 32

Proedu Framework

Proedu Framework. IDIC. 傳統網頁系統. 系統與功能緊密連結 系統無法重覆利用 功能無法重覆利用. 系統 基礎架構. 模組 B. 模組 A. 模組 C. Proedu Framework. 提供一平台,做為網頁系統的基礎架構,具有以下特點 將系統功能 模組 化 與 系統基礎 架構視為 平台 分開維護 讓模組與 系統基礎架構 可以重覆被使用 模組開發者與系統基礎架構開發者的分工更明確 提供系統與模組更新機制 必避相同問題在不同系統會面臨重覆修改的情況發生. 系統 = 平台 + 模組. ( 系統 基礎 架構 ).

bonita
Download Presentation

Proedu Framework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Proedu Framework IDIC

  2. 傳統網頁系統 • 系統與功能緊密連結 • 系統無法重覆利用 • 功能無法重覆利用 系統基礎架構 模組B 模組A 模組C

  3. Proedu Framework 提供一平台,做為網頁系統的基礎架構,具有以下特點 • 將系統功能模組化與系統基礎架構視為平台分開維護 • 讓模組與系統基礎架構可以重覆被使用 • 模組開發者與系統基礎架構開發者的分工更明確 • 提供系統與模組更新機制 • 必避相同問題在不同系統會面臨重覆修改的情況發生 系統 = 平台 + 模組 (系統基礎架構)

  4. Proedu架構 • 透過此架構來決定平台網頁呈現內容,主要提供以下功能 • 使用者身份認証 • 網站版面管理 • 功能權限控管 • 系統組態 – 系統名稱、登入方式設定 • 常用函數庫 – Utility、Mail、 • 外部套件-Smarty、ezSQL、Dojo..等 使用者身份認証 權限 版型管理 系統使用者 系統組態

  5. 互動模式 Static Files Script/HTML/CSS TPL File Static Files Script/HTML/CSS TPL File 平台 View 模組 View HTML/JavaScript HTML/JSON Client Browser Main Controller Process (Business Logic Layer) Action (Business Logic Layer) Use Access Data Request/Response Include Model Shared Library Model Database

  6. 環境設定 • 平台環境 • Apache2 • PHP 5.3, MySQL • 平台下載位置:http://pdc.idic.kuas.edu.tw/~idic_training/homework/08 proedu framework.zip • 啟用必要的 PHP 套件

  7. 環境設定(續) • 步驟一:建立資料庫 idic, 並匯入 SQL 檔案 • 平台資料夾裡面的sql/proedu_core-5.23.3.sql • 步驟二:將平台檔案解壓縮並放置於執行的位置 • 步驟三:設定 include/config.inc.php • define(‘SITE_ROOT’, ‘.’); // 根目錄 • define(‘SITE_BASE’,’D:/wamp/www/develop/platform’); // 平台絕對位置 • define('URL_HOST', ‘203.64.105.131'); // 平台網域位置 • define(‘URL_ROOT’, ‘/develop/platform’); // 平台瀏覽位置 • define('SITE_KEY', ''); // 平台驗證碼 • define('DB_USER', ‘root'); // 資料庫的使用者帳號 • define('DB_PASSWD', ‘asdfasdf');  // 資料庫的使用者密碼 • define('DB_NAME', 'idic'); // 資料庫名稱 • define('DB_HOST', ‘localhost'); // 資料庫的主機位址 • 連線測試 • http://203.64.105.131/develop/platform/ • Id:maintainer password:maintainer

  8. 檔案結構

  9. 共用函數庫

  10. 模組檔案結構

  11. 模組安裝與升級 • 模組安裝 • 選擇模組並上傳安裝 • 開啓模組權限 • 模組升級 • 系統組態 - 系統組態設定 • 設定更新伺服器網址: http://modser2.idic.kuas.edu.tw • 設定專案代號: test

  12. 模組執行 • 假設要執行mod_manager後台模組功能 • 進入點 http://203.64.105.156/develop/platform/admin.php?site_id=0&mod=mod_manager&func=show_swfupload • admin.php 後台系統進入點 • site_id = 子站編號 • mod = 模組ID • func = 模組函數名稱

  13. 外部套件 以下外部套件,都是由平台自動載入 • Smarty • 樣版變數採用<{$變數名稱}> • ezSQL • 連結資料庫請用 init_db() • 例如: $db= init_db(); $results = $db->get_results($query); • Dojo 1.6

  14. IDIC 製作模組

  15. 平台與模組關係 • 模組可以重覆再利用,發展出不同系統 • 例如: • 公告模組,可以搭配拍賣模組,變成一個線上拍賣網站, • 公告模組,也可以搭配系友模組,變成一個系友網站 • 模組的使用權限,由平台統一控管 • 模組 安裝/升級/缷除 都是透過平台

  16. 建立模組-撰寫模組必要檔案 • 為了讓平台能夠正常取得模組基本資訊。而且可以讓平台能正常安裝/移除模組,所以模組必需建立以下檔案

  17. config.xml 參數

  18. config.xml 參數

  19. config.xml 完整範例 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module_config SYSTEM "../mod_manager/config.xml.dtd"> <module_config> <id>announce</id> <name>公告管理2</name> <version>1.02.0000</version> <core>0</core> <description>公告發佈的基本功能、能夠附加檔案、公告類別管理並加入標籤功能。在新增與修改公告的功能中,加入通知對象功能,對選擇對象進行發送信件功能,信件內容可附加圖片與檔案。 </description> <constriants> <system min="5.23" max="6.99" /> <dependence></dependence> <extensions></extensions> <multisite support="yes"/> <for_profile profile="" /> <for_sitetypesitetype="" /> </constriants> <front_type> <front_element name ="" enabled="false" /> <front_page name ="" enabled="false" /> <front_component enabled="false" /> <front_render enabled="false" /> </front_type> <admin_type> <admin enabled="true" /> <admin_theme_editor enabled="false" /> <admin_theme_layout enabled="false" /> <admin_profile enabled="false"></admin_profile> <admin_site enabled="false"></admin_site> </admin_type> </module_config>

  20. install.xml

  21. 建立模組-install xml 撰寫內容模組的資料表安裝 / 升級 / 缷除(install.xml) • 資料表SQL請放至以下區塊 • <install>可包含多個 statement </install> • <uninstall>可包含多個 statement </uninstall> • <upgrade>可包含多個 statement </upgrade> • 每個<statement></statement>只能執行一次SQL <statement> <type>sql</type> <instruction> <!– 把你的 sql放這裡喔 --> </instruction> </statement>

  22. install.xml 完整範例 <?xml version="1.0" encoding="UTF-8"?> <module> <install> <statement> <type>sql</type> <instruction> <!-- create table sql--> </instruction> </statement> <statement> <type>sql</type> <instruction> <!-- create table sql--> </instruction> </statement> </install> <uninstall> <statement> <type>sql</type> <instruction><!-- drop table sql--></instruction> </statement> <statement> <type>sql</type> <instruction><!-- drop table sql--></instruction> </statement> </uninstall> <upgrade> </upgrade> </module>

  23. Changelog.xml 格式 • 修正記錄(changelog.xml)格式如下

  24. Changelog.xml 完整範例 <?xml version="1.0" encoding="UTF-8"?> <xml> <changelog> <version>1.00.0001</version> <developer>林建瑋</developer> <modify_date>2011-03-12</modify_date> <modify_content> <item>修正固定版型配置離開時的轉址錯誤</item> <item>修正固定版型前台傳遞模組參數錯誤的問題</item> <item>修正版型編輯新增版型</item> </modify_content> </changelog> <changelog> <version>1.00.0000</version> <developer>林建瑋</developer> <modify_date>2010-12-04</modify_date> <modify_content> <item>建立固定版面配置模組</item> </modify_content> </changelog> </xml>

  25. 建立模組- 後台必備檔案

  26. 建立模組- 前台必備檔案

  27. 模組 Controller /**index.php主程式*/ Class模組ID extends模組原型{ /**初始化模組*/ public function main(){ } /**取得模組顯示內容*/ public function get_column_content(&$ref, $args = null, $key =null){ return true | false; } } 模組原型可參考下一頁

  28. 模組 Controller(續) • 選擇合適的模組原型 • 模組原型檔案路徑:./include/modules.abs.php

  29. 模組 Controller(續) • 主程式(index.php) 函數 get_column_content用途: 取得模組顯示內容參數 回傳值 Type:bool回傳 true 代表要套版型, false 代表自行產生結果

  30. 在瀏覽器顯示模組畫面 • 畫面顯示 • 透過URL 取得欲顯示的模組資訊 • 前台 • http://localhost/5.23.2/main.php?mod=action_log&func=show_action_log&site_id=0 • 後台 • http://localhost/5.23.2/admin.php?mod=action_log&func=show_action_log&site_id=0

  31. 模組檔案注意事項 • 檔案格式需為 utf8 檔首無bom

  32. 練習 • 管理記錄 (ID: action_log) 模組,用來記錄使用者的操作記錄,我需要一張表記錄,資料表定義如下 • 資料表名 mod_action_log • 欄位

More Related