routeSQL : Allow the result to be displayed in HTML by the renderer
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2035 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
41
routeSQL.php
41
routeSQL.php
@@ -60,6 +60,12 @@ class routeSQL
|
|||||||
The array must be of the form array ("linkname"=>,"icon"=>)
|
The array must be of the form array ("linkname"=>,"icon"=>)
|
||||||
icon is optional and the linkname is used if it is not provided */
|
icon is optional and the linkname is used if it is not provided */
|
||||||
public $internalLinks = array ();
|
public $internalLinks = array ();
|
||||||
|
/** The renderer class to use for HTML pages */
|
||||||
|
public $rendererHTMLclass = false;
|
||||||
|
/** The renderer method to use for HTML pages */
|
||||||
|
public $rendererHTMLmethod = false;
|
||||||
|
/** The layout HTML to use for HTML pages */
|
||||||
|
public $rendererHTMLlayout = false;
|
||||||
|
|
||||||
/** The model file containing the database description */
|
/** The model file containing the database description */
|
||||||
private $model_file = "";
|
private $model_file = "";
|
||||||
@@ -553,7 +559,7 @@ class routeSQL
|
|||||||
$content .= " </div>\n";
|
$content .= " </div>\n";
|
||||||
$content .= " </div>\n"; // End of bottomBar
|
$content .= " </div>\n"; // End of bottomBar
|
||||||
$content .= "</div>\n";
|
$content .= "</div>\n";
|
||||||
echo $content;
|
$this->rendererhtml ($content);
|
||||||
});
|
});
|
||||||
|
|
||||||
$route->get ($this->url_prefix."/{id}/delete/{token}",
|
$route->get ($this->url_prefix."/{id}/delete/{token}",
|
||||||
@@ -726,7 +732,7 @@ echo $content;
|
|||||||
unset ($field);
|
unset ($field);
|
||||||
$f->fields ($fields);
|
$f->fields ($fields);
|
||||||
$content .= $f->printHTML ("post", $values, $errors);
|
$content .= $f->printHTML ("post", $values, $errors);
|
||||||
echo $content;
|
$this->rendererhtml ($content);
|
||||||
});
|
});
|
||||||
|
|
||||||
$route->post ($this->url_prefix."/add", function ($chain) use ($route)
|
$route->post ($this->url_prefix."/add", function ($chain) use ($route)
|
||||||
@@ -919,7 +925,7 @@ echo $content;
|
|||||||
}
|
}
|
||||||
$f->fields ($fields);
|
$f->fields ($fields);
|
||||||
$content .= $f->printHTML ("post", $values, $errors);
|
$content .= $f->printHTML ("post", $values, $errors);
|
||||||
echo $content;
|
$this->rendererhtml ($content);
|
||||||
});
|
});
|
||||||
|
|
||||||
$route->post ($this->url_prefix."/{id}", function ($id, $chain) use ($route)
|
$route->post ($this->url_prefix."/{id}", function ($id, $chain) use ($route)
|
||||||
@@ -1075,4 +1081,33 @@ echo $content;
|
|||||||
return $datas[0];
|
return $datas[0];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Display the data in HTML with the view class/method if they are defined */
|
||||||
|
private function rendererhtml ($data)
|
||||||
|
{
|
||||||
|
require_once ("domframework/outputhtml.php");
|
||||||
|
$route = new route ();
|
||||||
|
|
||||||
|
$html = new outputhtml ();
|
||||||
|
$replacement = array ("{baseurl}"=>$route->baseURL ());
|
||||||
|
if ($this->rendererHTMLlayout === false)
|
||||||
|
{
|
||||||
|
$this->rendererHTMLlayout = "<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>{title}</title>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{content}
|
||||||
|
</body>
|
||||||
|
</html>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : Test the $this->rendererHTMLclass, $this->rendererHTMLmethod !
|
||||||
|
echo $html->out ($data, FALSE,
|
||||||
|
$this->rendererHTMLclass, $this->rendererHTMLmethod,
|
||||||
|
$this->rendererHTMLlayout, $replacement);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user