Flex files
Teacherevalute.mxml
| The code is as follows |
Copy Code |
<?xml version= "1.0" encoding= "Utf-8"?>
<mx:module xmlns:mx= "Http://www.adobe.com/2006/mxml" layout= "absolute" width= "686" height= "470" Readxmlfile () ">
<mx:Script>
<!--[cdata[
Import Mx.utils.ObjectProxy;
Import mx.rpc.events.ResultEvent;
Import mx.controls.*;
Import mx.events.*;
Import Mx.controls.SWFLoader;
Import mx.collections.ArrayCollection;
Import Mx.managers.PopUpManager;
Import Mx.managers.DragManager;
private Var Dragmanager:dragmanager;
private Var phpstr:string;
[bindable]
Private Var optflag:string;//action tag, such as: "Query" is an inquiry
private Var login_result:string;
private var arrayc:arraycollection=new arraycollection ();
private var array:array=new array ();
private var medalsac:arraycollection = new ArrayCollection ();
Reading configuration Files
Private Function Readxmlfile (): void{
var loader:urlloader=new urlloader (New URLRequest ("Phpsrc/config/config.xml"));
Loader.addeventlistener (event.complete,handlecompleted);
}
Private Function handlecompleted (event:event): void {
var configxml:xml=xml (Event.target.data);
Phpstr=configxml.phprooturl;
userrequest.url=phpstr+ "teacherevalute.php";
Alert.show (Userrequest.url);
Userrequest.send ();
Arraycollectiondate ();
Initapp ();
}
Private Function Resulthandler (event:resultevent): void{
try{
Chart.dataprovider = new ArrayCollection ([{Country: "very good", Gold:userRequest.lastResult.dataroot.datalist.first1},
{Country: "good", Gold:userRequest.lastResult.dataroot.datalist.first2},
{Country: "Poor", Gold:userRequest.lastResult.dataroot.datalist.first3}]);
}catch (e:error) {
login_result= "Error";
}
if (login_result== "error") {
Alert.show (query failed!) ");
}
}
/**
* Close the window
*/
Private Function Closepanel (): void{
Popupmanager.removepopup (this);
}
private var medalsac:arraycollection = new ArrayCollection ([
{Country: "the USA", Gold:35, silver:39, bronze:29},
{Country: "China", gold:32, Silver:17, bronze:14},
{Country: "Russia", gold:27, Silver:27, bronze:38});
Private Function Displaygold (Data:object, field:string, Index:number, Percentvalue:number): String {
var temp:string= ("" + Percentvalue). substr (0,6);
return data. Country + ":" + '/n ' + "number:" + data. Gold + '/n ' + temp + "%";
}
]]-->
</mx:Script>
<!--Define Custom colors for use as pie wedge fills. -->
<mx:solidcolor id= "SC1" color= "Blue" alpha= ". 6"/>
<mx:solidcolor id= "SC2" color= "Red" alpha= ". 6"/>
<mx:solidcolor id= "SC3" color= "0x663300" alpha= ". 6"/>
<!--This Stroke are used for the callout lines. -->
<mx:stroke id= "callouts" weight= "2" color= "0x999999" alpha= ". 8" caps= "Square"/>
<!--This Stroke are used to separate the wedges in the pie. -->
<mx:stroke id= "Radial" weight= "1" color= "0xFFFFCC" alpha= ". 3"/>
<!--This Stroke are used for the outer border of the pie. -->
<mx:stroke id= "Pieborder" color= "0x000000" weight= "2" alpha= ". 5"/>
<mx:httpservice id= "Userrequest" Url= "useproxy=" false "method=" POST "result=" Resulthandler (event) ">
<mx:request xmlns= "" >
<optFlag>{optFlag}</optFlag>
</mx:request>
</mx:HTTPService>
<mx:panel title= "Curriculum evaluation" height= "100%" width= "100%" layout= "absolute" fontsize= ">"
<mx:piechart id= "Chart"
height= "373"
Width= "575"
Paddingright= "5"
paddingleft= "5"
Showdatatips= "true"
Dataprovider= "{Medalsac}"
Fontsize= "fontweight=" "bold" x= "a" y= "ten" >
<!--
-->
<mx:series>
<mx:pieseries
Namefield= "Country"
labelposition= "Callout"
Field= "Gold"
labelfunction= "Displaygold"
Calloutstroke= "{callouts}"
Radialstroke= "{Radial}"
Stroke= "{Pieborder}"
Fills= "{[Sc1, SC2, SC3]}"
>
<!--clear the drop shadow filters from the chart. -->
<mx:filters>
<mx:Array/>
</mx:filters>
</mx:PieSeries>
</mx:series>
</mx:PieChart>
<mx:button x= "585" y= "374" label= "return" click= "Closepanel ()" Width= "" "height=" "fontsize="
</mx:Panel>
</mx:Module>
|
Configuration file:
| The code is as follows |
Copy Code |
|
<?xml version= "1.0" encoding= "Utf-8"?>
<config>
<phpRootUrl>http://192.168.8.108/armyDemo/phpsrc/</phpRootUrl>
<pageNumber>20</pageNumber>
</config>
|
PHP File:
teacherevalute.php
| The code is as follows |
Copy Code |
|
<?php
Require_once (DirName (_file_). '/dbcon/mysqlconnect.php ');
$optFlag =$_post[optflag];
$irt =mysqlconnect ();
if ($irt ==0)
{
Print Errormessage2xml ("error");
Break
}
$SQL 1 = "SELECT COUNT (*) as mm1 from Tbl_class_evaluate where Class_evaluate =/" very good/";";
$SQL 2 = "SELECT COUNT (*) as mm2 from tbl_class_evaluate where class_evaluate = ' good ';";
$SQL 3 = "SELECT COUNT (*) as mm3 from tbl_class_evaluate where class_evaluate = ' difference ';";
$result 1 = mysql_resultto2dassocarray ($SQL 1);
$result 2 = Mysql_resultto2dassocarray ($SQL 2);
$result 3 = Mysql_resultto2dassocarray ($SQL 3);
$recXml = ' <dataroot><datalist><first1> ';
$recXml. = $result 1[0][MM1];
$recXml. = ' </first1><first2> ';
$recXml. = $result 2[0][mm2];
$recXml. = ' </first2><first3> ';
$recXml. = $result 3[0][MM3];
$recXml. = ' </first3></datalist></dataroot> ';
Print $recXml;
Print "result1-->". $result 1[0][mm1]. ";". $result 2[0][mm2]. " <--RESULT3---> ". $result 3[mm3];
?> |