|
Perforce Chronicle 2012.2/486814
API Documentation
|
View helper that returns an instance of the named enabled module model. More...
Public Member Functions | |
| dojoIoResponse ($data, $handleAs= 'json') | |
| Create response text for dojo.io.iframe request. | |
View helper that returns an instance of the named enabled module model.
| P4Cms_View_Helper_DojoIoResponse::dojoIoResponse | ( | $ | data, |
| $ | handleAs = 'json' |
||
| ) |
Create response text for dojo.io.iframe request.
| mixed | $data | data to send to dojo.io.iframe |
| string | $handleAs | Encoding method one of: text, html, xml, json, javascript NOTE: Presently xml is not supported. |
{
$formats = array('json', 'html', 'text', 'javascript');
if (!in_array($handleAs, $formats)) {
throw new InvalidArgumentException(
'Invalid handleAs format. Expected one of: ' . implode(', ', $formats)
);
}
// automatically encode as json.
if ($handleAs == 'json') {
$data = Zend_Json::encode($data);
}
return '<html><head>'
. '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'
. '</head><body><textarea>'
. $this->view->escape($data)
. '</textarea></body></html>';
}