* code for task#1541.

This commit is contained in:
zhujinyong
2013-07-13 01:27:53 +00:00
parent c5087451c7
commit 4f061e273f
6 changed files with 152 additions and 1 deletions
+39
View File
@@ -47,4 +47,43 @@ class api extends control
$this->output = json_encode($output);
die($this->output);
}
public function view($filePath, $action)
{
if($filePath)
{
$host = common::getSysURL() . $this->config->webRoot;
$filePath = helper::safe64Decode($filePath);
if($action == 'extendModel')
{
$method = $this->api->getMethod($filePath, 'Model');
}
elseif($action == 'extendControl')
{
$method = $this->api->getMethod($filePath);
}
if(!empty($_POST))
{
$param = '';
foreach($_POST as $key => $value) $param .= '&' . $key . '=' . $value;
$param = trim($param, '&') . "&{$this->config->sessionVar}=" . session_id();
$url = rtrim($host, '/') . $this->createLink($method->className, $method->methodName, $param, 'json');
$content = file_get_contents($url);
$result = json_decode($content);
$status = $result->status;
$data = json_decode($result->data);
$data = '<xmp>' . print_r($data, true) . '</xmp>';
$response['result'] = 'success';
$response['status'] = $status;
$response['url'] = $url;
$response['data'] = $data;
$this->send($response);
}
$this->view->method = $method;
$this->view->filePath = $filePath;
$this->display();
}
}
}