北 星 学 園 大 学 短 期 大 学 部 英 文 学 科 英 語 読 解 能 力 の 効 率 的 習 得 向 上 システム インストール&テクニカルマニュアル 2005 年 3 月 ( 有 )ITコンピュータシステム システムエンジニア 関 谷 成 実
Installation 1 Make directories and copy all files as follows (Please refer to php/javascript/html/flash source codes and comments for details of each program) 以 下 と 同 様 の 構 造 のディレクトリを 作 成 してください ( 詳 細 はPHP/JavaScript/html/flashなどのソース 内 コメントをご 覧 下 さい) You need to adjust permission for download and upload directory. またダウンロード アップロードなどのディレクトリには 適 切 なパーミッションを 与 えてください Directory Program/Data Explanation common (Technical programs) read_db.inc Extended reading class for MySQL var $Host = "localhost"; (db_mysql.inc) MySQL access class(from PHPLIB) var $Database = "abc"; moodle_db.inc Extended reading class for Moodle on MySQL var $User = "abc_user"; reading.inc functions for this system ( 関 数 群 ) var $Password = "abc_pass"; common.inc Common functions(original by Narumi Sekiya) *ご 自 身 のシステムにあわせて 設 定 してください jcode.phps Free Japanese Encode/Decode functions *Please set your own information open.php moodle connection page index.html main page reading.swf Flash object embeded on index.html reading.fla checkperson.php Check id/pw with moodle's mdl_user (moodleデータベースに 対 するチェック)/LDAP server getsession.php get session information getcat12.txt Get category1-2 list from text file (カテゴリー1,2のリスト) getcatresult.php Get category3 list from MySQL by cat1-2 keys (カテゴリー1,2の 条 件 によるカテゴリー3のリスト) logout.php geturl("logout.php") menu.php Menu readstory.php Stories learnwords.php Learn Words Meanings sc.php Words into Gaps quiz.php True or False? style.css Style sheet for html files updatestory.php cron program for keeping stories and words (Cronプログラム) hint.js hints Javascript functions admin (Administrator Pages) index.php Word List Maintenance story.php Story Maintenance word.php Word Maintenance
2 Make MySQL DB(same setting as reading_db.in (Please refer to MySQL/Cpanel/phpMyAdmin/Etc manuals for details of each setting.) Database: User Password abc abc_user abc_pass CREATE TABLE t_story( id INT AUTO_INCREMENT PRIMARY KEY, cat1 TEXT, cat2 INT, cat3 INT, no INT NOT NULL, title TEXT NOT NULL, text TEXT NOT NULL, gapwords TEXT, questions TEXT, wordindex1 TEXT, wordindex2 TEXT, wordindex3 TEXT, level TEXT, chk INT, upd TEXT NOT NULL )
CREATE TABLE t_word( id INT AUTO_INCREMENT PRIMARY KEY, word TEXT NOT NULL, explanation TEXT NOT NULL, sentence1 TEXT, sentence2 TEXT, sentence3 TEXT, hint1 TEXT, hint2 TEXT, hint3 TEXT, adda TEXT, addb TEXT, upd TEXT NOT NULL ) CREATE TABLE t_score ( id int(11) NOT NULL auto_increment, mdl_user_id int(10) unsigned NOT NULL default '0', dt text NOT NULL, cat1 text NOT NULL, cat2 text NOT NULL, cat3 text NOT NULL, kind text NOT NULL, score text, upd text NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM AUTO_INCREMENT=15 ;
Flowchart of data TAB separated text file HyperCard Stack export as text(tab separated) import to MySQL on Web MySQL + PHP + Flash Self maintenance on Web
Procedure 1 Maintain data(word, story) by FileMaker Pro 2 Export the data as tab separated text 3 Import the data into READING MATERIAL SYSTEM on the web 4 Check them on the web Technical Points 1 wordindex is for speedy display 2 t_story's wordindex depends on t_word, so if you change some words in t_word, you need to regenerate wordindex. 3 Style Sheet/Javascript gives display interface for students How it works story1 story2 story3 t_story story4 story5 a word about the aches. a, an word used before nouns, to indicate... about nearly, approximately... t_word ache (n), aches continuous dull pain... <a class="hint1" title="help message" onclick="showhint(this);">word</a>.hint1 { text-decoration:underline } pop up message for Internet Explorer message by Javascript
Basic procedure for accessing Database(PHPLib) $db = new DB_reading; prepare for db access $sql = "SELECT * " make SQL. " FROM t_story " SELECT all items FROM table t_story WHERE id is $id. " WHERE id = $id "; $db->query($sql); execute SQL $db->next_record(); read the first record from table(t_story) $no = $db->f("no"); get no $title = $db->f("title"); get title $text = $db->f("text"); get text $wordindex = $db->f("wordindex"); get wordindex LDAP authentication checkperson.php $ds=ldap_connect("aries.hokusei.ac.jp"); if ($ds) { $r=@ldap_bind($ds,"uid=$un,ou=users,dc=hokusei,dc=ac,dc=jp",$pw); if ($r === -1) { print "Error: ".ldap_error($ds); } elseif ($r === TRUE) { $sr=ldap_search($ds,"ou=users, dc=hokusei,dc=ac,dc=jp", "uid=$un"); $info = ldap_get_entries($ds, $sr); $fsname = split("\.",$info[0]["gecos"][0]); $st.= "&id=".$un; $st.= "&firstname=".$fsname[0]; $st.= "&lastname=".$fsname[1]; $st.= "&email=".$un."@hokusei.ac.jp"; LDAP connect LDAP bind LDAP search LDAP get_entries
Connection from Moodle CMS Home >> Course >> Resources >> Reading >> Editing resource open.php $sql = "SELECT * ". " FROM mdl_user". " WHERE username = '$id' ". " AND password = '$pw' " データが 存 在 する 場 合 セッションをセット $_SESSION["ss_id"] = $id; $_SESSION["ss_name"] = $nm; データが 存 在 しない 場 合 セッションクリア header("location: index.html"); index.html reading.swf getsession.php セッションからss_id, ss_nameを 取 得 しswfへ 返 す