1.形式一:

 

1 <iframe scrolling="yes" src="action.php?c=HLogin&a=linkPage&p=fx" width="100%" height="100%" frameborder="0"></iframe>

 

----------

访问的方法:

 1     //关联页面管理:
 2     public function linkPageAction()
 3     {
 4         $theKey = isset($_REQUEST["p"]) ? $_REQUEST["p"] : 'pj';
 5 
 6 
 7 
 8 
 9         switch ($theKey)
10         {
11             //1: 评价:
12             case 'pj':
13                 $this->pjService();
14                 break;
15 
16             //2: 分析:
17             case 'fx':
18                 $this->fxService();
19                 break;
20 
21             //3: 留言板:
22             case 'lyb':
23                 $this->lybService();
24                 break;
25 
26             default:
27                 $this->pjService();
28                 break;
29         }
30 
31 
32 
33 
34     }

 

  1     //2: 分析 页面:
  2     public function fxService()
  3     {
  4 
  5         //1: 取出分析
  6         $chart = array();
  7 
  8         $AnalysisModel = new AnalysisModel();
  9         $where["where"] = " isHidden = 0 order by orderBy asc, id asc ";
 10         $data = $AnalysisModel->getDataList($where);
 11 
 12         foreach ($data["rows"] as $k => $model)
 13         {
 14             $cell = array();
 15             $cell["id"] = $model->id;
 16             $cell["chart"] = $model->chart;
 17             $cell["title"] = $model->title;
 18 
 19             $chart[] = $cell;
 20         }
 21 
 22         foreach ($chart as $k => &$v)
 23         {
 24             if ($v["chart"] == 0)
 25             {
 26                 // echo "条形图";
 27                 //条形图:
 28                 $v["content"] = $this->txChartService($v["id"]);
 29             }
 30             else
 31             {
 32                 // echo "雷达图";
 33                 //雷达图:
 34                 $v["content"] = $this->ldChartService($v["id"]);
 35             }
 36 
 37         }
 38 
 39         //去除引用的变量值$v
 40         unset($v);
 41 
 42 
 43         // echo "<pre>";
 44         // var_dump($chart);
 45 
 46 
 47 
 48         //返回数据:
 49         $parameter = array();
 50         $parameter["chart"] = $chart;
 51 
 52         $this->display("Home/iframe/fx.php", $parameter);
 53     }
 54 
 55 
 56 
 57     /**
 58      * [txChartService 处理条形图数据]
 59      * @param  [type] $id [Analysis 的 id ]
 60      * @return [type]     [description]
 61      */
 62     public function txChartService($id)
 63     {
 64         //1: 取出 分析 对应 的 分析项:
 65         $content = array();
 66 
 67         $AnalysisItemModel = new AnalysisItemModel();
 68         $where["where"] = " analysisId = $id order by orderBy asc, id asc ";
 69         $data = $AnalysisItemModel->getDataList($where);
 70 
 71         //分析项:
 72         $legend = array();
 73         foreach ($data["rows"] as $k => $model)
 74         {
 75             $legend[$model->id] = $model->title;
 76         }
 77 
 78         //取出学生: 如果所有的分析项 都没有数据. 那么剔除这个学生.
 79         $yAxis = array();
 80         $StudentModel = new StudentModel();
 81         $where["where"] = " 1 = 1 order by orderBy asc, id asc ";
 82         $data = $StudentModel->getDataList($where);
 83         foreach ($data["rows"] as $k => $model)
 84         {
 85             $num = 0;
 86 
 87             foreach ($legend as $k2 => $v2)
 88             {
 89                 $StudentAnalysisItemModel = new StudentAnalysisItemModel();
 90                 $where = " where studentId = $model->id and analysisItemId = $k2 ";
 91                 $StudentAnalysisItemModel->getDataRow($where);
 92 
 93                 if ($StudentAnalysisItemModel->getDB == false)
 94                 {
 95                     $num++;
 96                 }
 97             }
 98 
 99             if ($num != count($legend))
100             {
101                 $yAxis[$model->id] = $model->userName;
102             }
103         }
104 
105 
106         //取出每个分类项 对应 的 学生数据.
107         $series = array();
108 
109         foreach ($legend as $k => $v)
110         {
111             $cell = array();
112             $cell["name"] = $v;
113             $cell["type"] = 'bar';
114 
115             foreach ($yAxis as $k2 => $v2)
116             {
117                 $StudentAnalysisItemModel = new StudentAnalysisItemModel();
118                 $where = " where studentId = $k2 and analysisItemId = $k ";
119                 $StudentAnalysisItemModel->getDataRow($where);
120 
121                 if ($StudentAnalysisItemModel->getDB)
122                 {
123                     $cell["data"][] = intval($StudentAnalysisItemModel->score);
124                 }
125                 else
126                 {
127                     $cell["data"][] = 0;
128                 }
129 
130             }
131 
132             $series[] = $cell;
133         }
134 
135 
136         $hasContent = empty($yAxis) ? 0 : 1;
137 
138         $content["hasContent"] = $hasContent;
139         $content["legend"] = $legend;
140         $content["yAxis"] = $yAxis;
141         $content["series"] = $series;
142 
143         return $content;
144 
145 
146 
147 
148     }
149 
150 
151 
152     /**
153      * [ldChartService 处理 雷达图数据]
154      * @param  [type] $id [Analysis 的 id]
155      * @return [type]     [description]
156      */
157     public function ldChartService($id)
158     {
159         //1: 取出 分析 对应 的 分析项:
160         $content = array();
161 
162         $AnalysisItemModel = new AnalysisItemModel();
163         $where["where"] = " analysisId = $id order by orderBy asc, id asc ";
164         $data = $AnalysisItemModel->getDataList($where);
165 
166         //分析项:
167         $item = array();
168         foreach ($data["rows"] as $k => $model)
169         {
170             $item[$model->id] = $model->title;
171         }
172 
173         //indicator:
174         $indicator = array();
175         foreach ($item as $k => $v)
176         {
177             $cell = array();
178             $cell["name"] = $v;
179             $cell["max"] = 0;
180 
181             $StudentAnalysisItemModel = new StudentAnalysisItemModel();
182             $where["where"] = " analysisItemId = $k ";
183             $data = $StudentAnalysisItemModel->getDataList($where);
184             foreach ($data["rows"] as $k2 => $model2)
185             {
186                 if (intval($model2->score) > $cell["max"])
187                 {
188                     $cell["max"] = intval($model2->score);
189                 }
190             }
191 
192             $indicator[] = $cell;
193         }
194 
195         //取出学生: 如果所有的分析项 都没有数据. 那么剔除这个学生.
196         $legend = array();
197         $StudentModel = new StudentModel();
198         $where["where"] = " 1 = 1 order by orderBy asc, id asc ";
199         $data = $StudentModel->getDataList($where);
200         foreach ($data["rows"] as $k => $model)
201         {
202             $num = 0;
203 
204             foreach ($item as $k2 => $v2)
205             {
206                 $StudentAnalysisItemModel = new StudentAnalysisItemModel();
207                 $where = " where studentId = $model->id and analysisItemId = $k2 ";
208                 $StudentAnalysisItemModel->getDataRow($where);
209 
210                 if ($StudentAnalysisItemModel->getDB == false)
211                 {
212                     $num++;
213                 }
214             }
215 
216             if ($num != count($item))
217             {
218                 $legend[$model->id] = $model->userName;
219             }
220         }
221 
222 
223         //取出每个分类项 对应 的 学生数据.
224         $series = array();
225 
226         foreach ($legend as $k => $v)
227         {
228             $cell = array();
229             $cell["name"] = $v;
230 
231             foreach ($item as $k2 => $v2)
232             {
233                 $StudentAnalysisItemModel = new StudentAnalysisItemModel();
234                 $where = " where studentId = $k and analysisItemId = $k2 ";
235                 $StudentAnalysisItemModel->getDataRow($where);
236 
237                 if ($StudentAnalysisItemModel->getDB)
238                 {
239                     $cell["value"][] = intval($StudentAnalysisItemModel->score);
240                 }
241                 else
242                 {
243                     $cell["value"][] = 0;
244                 }
245 
246             }
247 
248             $series[] = $cell;
249         }
250 
251 
252         $hasContent = empty($legend) ? 0 : 1;
253 
254         $content["hasContent"] = $hasContent;
255         $content["indicator"] = $indicator;
256         $content["legend"] = $legend;
257         $content["series"] = $series;
258 
259         return $content;
260     }

 

display方法:

 1     /**
 2      * 显示页面
 3      * 
 4      * @param unknown $parameter            
 5      * @param unknown $url            
 6      */
 7     protected function display($url, $parameter = array()) {
 8         $path = pathinfo ( $url );
 9         $location = CURR_VIEW_PATH . $path ["dirname"] . '/' . $path ["filename"] . 'Proxy' . '.' . $path ["extension"];
10         if (file_exists ( $location )) {
11             // 读取文件行数5.0以上版本
12             $fileProxy = fopen ( $location, 'r' );
13             $line = 0; // 初始化行数
14             while ( stream_get_line ( $fileProxy, 8192, "\n" ) ) {
15                 $line ++;
16             }
17             fclose ( $fileProxy ); // 关闭文件
18                                 
19             // 读取文件行数,效率低,适合5.0及5.0以下版本
20             // $line = count(file($location));
21                                 
22             // 如果文件行数 大于一行,择跳转该文件
23             if ($line > 1) {
24                 include $location;
25             } else {
26                 include CURR_VIEW_PATH . $url;
27             }
28         } else {
29             include CURR_VIEW_PATH . $url;
30         }
31     }

 

 

 

 

2. 形式2. 网址.

1 <iframe scrolling="yes" src="127.0.0.1/test/test.php" width="100%" height="100%" frameborder="0"></iframe>

 

 

3. 形式三  . 相对地址.

1 <iframe scrolling="yes" src="./test/test.php" width="100%" height="100%" frameborder="0"></iframe>