Files
DomFramework/outputrest.php
2020-09-07 14:08:26 +00:00

41 lines
1.6 KiB
PHP

<?php
/** DomFramework
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
*/
require_once ("domframework/output.php");
require_once ("domframework/rest.php");
/** Display in REST the data provided.
* Allow all the output types : JSON, XML, TXT...
*/
class outputrest extends output
{
/** Data is printed by viewClass->viewmethod, in the middle of $layout
* title is put in the title of the HTML page
* $replacement modify the result (it can do title too :
* array ("{title}"=>"title to display")
* @param mixed $data Data to display on the page
* @param string|null $title Title to put on head of page
* @param string|null $viewClass Class in views to use to display
* @param string|null $viewMethod Method in the class in views
* @param string|null $layout Layout file in views
* @param array|null $replacement Replace the {key}=>value
* @param array|null $variable PHP variables send to the view and to layout
* (can be processed by foreach, if...)
* @param string|null $module The module name to use if needed
* @return Exit from PHP at the end of HTML display
*/
public function out ($data, $title = FALSE,
$viewClass = FALSE, $viewMethod = FALSE,
$layout = FALSE, $replacement = array(),
$variable = array (), $module = "")
{
if (! isset ($variable["exceptionCode"]))
$variable["exceptionCode"] = 200;
$rest = new rest ();
$rest->display ($data, $variable["exceptionCode"]);
}
}