本文整理汇总了PHP中Resources::toHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Resources::toHtml方法的具体用法?PHP Resources::toHtml怎么用?PHP Resources::toHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources::toHtml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ResourcePropertyPage
/**
* Write the contents of the booking resources page.
*/
function content_of_resources_page()
{
if (isset($_GET['editResourceId'])) {
$rpp = new ResourcePropertyPage($_GET['editResourceId']);
// TODO: move to ResourcePropertyPage
// SAVE button was pressed on the edit resource property page
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$propertyIds = isset($_POST['resource_property']) ? $_POST['resource_property'] : array();
ResourceDBO::updateResourceProperties($_GET['editResourceId'], $propertyIds);
$rpp->isSaved = true;
}
error_log($rpp->toXml());
echo $rpp->toHtml();
} else {
$resources = new Resources();
try {
// TODO: move to Resources page
// if the user has just submitted an "Add new resource" request
if (isset($_POST['resource_name_new']) && $_POST['resource_name_new'] != '') {
ResourceDBO::insertResource($_POST['resource_name_new'], $_POST['resource_capacity_new'], $_POST['resource_parent_new'] == 0 ? null : $_POST['resource_parent_new'], $_POST['resource_type_new']);
}
} catch (DatabaseException $de) {
$resources->errorMessage = $de->getMessage();
}
echo $resources->toHtml();
}
}
示例2: wpdev_save_resource
/**
* Saves the selected resource row.
*/
function wpdev_save_resource()
{
$resourceId = $_POST['resource_id'];
$resourceName = $_POST['resource_name'];
error_log("wpdev_save_resource {$resourceId} {$resourceName}");
if ($resourceName != '') {
try {
ResourceDBO::editResource($resourceId, $resourceName);
} catch (DatabaseException $de) {
$msg = $de->getMessage();
}
}
$resources = new Resources();
if (isset($msg)) {
$resources->errorMessage = $msg;
}
?>
<script type="text/javascript">
document.getElementById('wpdev-bookingresources-content').innerHTML = <?php
echo json_encode($resources->toHtml());
?>
;
</script>
<?php
}