/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// MXML SOURCE
//
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initVars()" >
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable] private var submissionsViewAryCol:XMLListCollection;
[Bindable] private var currPage:uint;
[Bindable] private var total:uint;
[Bindable] private var pagePer:uint = 10;
private function initVars():void {
System.useCodePage = true;
currPage = 0;
myService.send();
}
private function handleQueryResult(event:ResultEvent):void{
var k:XML = new XML( myService.lastResult );
var kl:XMLList = new XMLList(k.descendants("user"));
submissionsViewAryCol = new XMLListCollection(kl);
var totalRow:Number = Number(k.descendants("total"));
total = Math.round(totalRow/10);
}
private function getNext():void{
isNextBtnEnabled();
currPage++;
myService.send();
}
private function getPrevious():void{
isNextBtnEnabled();
currPage--;
myService.send();
}
private function isNextBtnEnabled():void{
trace(currPage, total);
nextBtn.enabled = Boolean((currPage+1) < total);
previousBtn.enabled = Boolean(currPage > 1);
}
]]>
</mx:Script>
<mx:HTTPService id="myService" url="http://localhost/test/list.php" useProxy="false" method="POST" resultFormat="text"
result="handleQueryResult(event)" fault="Alert.show(event.fault.message)">
<mx:request xmlns="">
<pp>{pagePer}</pp>
<cp>{currPage}</cp>
</mx:request>
</mx:HTTPService>
<mx:Panel width="80%" height="80%" layout="vertical" title="Page Through The Submissions"
horizontalAlign="center" verticalAlign="top">
<mx:VBox width="100%" height="100%" verticalAlign="top" horizontalAlign="left">
<mx:Label text="Use the Previous and Next buttons to Get More Submissions"/>
<mx:HBox width="100%">
<mx:Button label="Previous" id="previousBtn" enabled="false" click="getPrevious()"/>
<mx:Spacer width="50%"/>
<mx:Label text="Viewing Submissions {currPage+1} of {total} Submissions" />
<mx:Spacer width="50%"/>
<mx:Button label="Next" id="nextBtn" enabled="true" click="getNext()"/>
</mx:HBox>
<mx:DataGrid width="100%" height="100%" id="submissionsDG" dataProvider="{submissionsViewAryCol}"
fontFamily="Verdana" fontSize="10">
<mx:columns>
<mx:DataGridColumn dataField="uid" width="80" headerText="NO"/>
<mx:DataGridColumn dataField="name" width="400" headerText="이름" wordWrap="true"/>
<mx:DataGridColumn dataField="subject" headerText="제목" wordWrap="true"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Panel>
</mx:Application>
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// PHP SOURCE LIST.PHP
//
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
<?php
require_once dirname(__FILE__)."/program/config.php";
if(!defined("CONFIG")) die("DIE");
@extract($HTTP_GET_VARS);
@extract($HTTP_POST_VARS);
$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db( DB_NAME )or die(mysql_error());
$query = "SELECT count(id) as cnt FROM " . TABLE_PREFIX . "_notebook ";
$result = mysql_query($query);
$count = mysql_fetch_object($result);
$cp = $cp * 10;
$query = "SELECT `id`,`memo`,`notebook` FROM " . TABLE_PREFIX . "_notebook ORDER BY id DESC LIMIT ".$cp." ,".$pp;
$result= mysql_query($query);
$Return .="<root>";
$Return .= "<total>" . $count->cnt . "</total>";
$Return .="<users>";
while($row = @mysql_fetch_assoc($result)){
$Return .="<user>";
$Return .= "<uid>" . $row['id'] . "</uid>";
$Return .= "<name>" . $row['notebook'] . "</name>";
$Return .= "<subject>" . $row['memo'] . "</subject>";
$Return .="</user>";
}
$Return .="</users>";
$Return .="</root>";
print($Return);
?>
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// PHP SOURCE CONFIG.PHP
//
/////////////////////////////////////////////////////////////////////////////////////////////////
<?php
define("DB_HOST", "localhost"); # mysql host
define("DB_USER", "kidari70"); # mysql username
define("DB_PASS", "1234"); # mysql password
define("DB_NAME", "kidari70"); # mysql DB name
define("TABLE_PREFIX", "kidari70"); # mysql Table prefix
?>
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
// -- phpMyAdmin SQL Dump
// -- version 2.7.0-pl2
// -- http://www.phpmyadmin.net
// --
// -- 호스트: localhost
// -- 처리한 시간: 07-05-03 19:53
// -- 서버 버전: 4.0.26
// -- PHP 버전: 4.4.2
// --
// -- 데이터베이스: `kidari70`
// --
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
-- --------------------------------------------------------
--
-- 테이블 구조 `kidari70_notebook`
--
CREATE TABLE `kidari70_notebook` (
`id` int(20) unsigned NOT NULL auto_increment,
`memo` text NOT NULL,
`notebook` varchar(255) default NULL,
`wdate` int(8) default NULL,
`sdate` int(8) default NULL,
`edate` int(8) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM;
--
-- 테이블의 덤프 데이터 `kidari70_notebook`
--
INSERT INTO `ni_notebook` (`id`, `memo`, `notebook`, `wdate`, `sdate`, `edate`) VALUES (20, '한국기계연구원', 'N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|check_49|N|N|N|N|N|N|N|N|N|N|N|N|', 20070312, 20070312, 20070315);
INSERT INTO `ni_notebook` (`id`, `memo`, `notebook`, `wdate`, `sdate`, `edate`) VALUES (21, 'Realtime 교육_노트북', 'N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|check_27|N|N|N|N|N|check_38|N|N|check_41|check_42|N|N|N|check_48|N|check_
50|N|N|N|N|check_62|N|N|check_65|N|N|N|', 20070313, 20070313, 20070315);
INSERT INTO `ni_notebook` (`id`, `memo`, `notebook`, `wdate`, `sdate`, `edate`) VALUES (18, '항공우주연구원', 'N|N|N|N|N|N|N|check_17|N|N|N|N|N|N|N|N|N|N|check_33|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|', 20070313, 20070313, 20070314);
INSERT INTO `ni_notebook` (`id`, `memo`, `notebook`, `wdate`, `sdate`, `edate`) VALUES (45, '한전전력연구원', 'N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N|N@check_67@(67) ^기사님스케쥴|N|', 20070405, 20070405, 20070405);