added new HTML generation

This commit is contained in:
Roland Gruber 2010-05-23 10:35:33 +00:00
parent b6fda6b305
commit 2314156648
2 changed files with 59 additions and 0 deletions

55
lam/lib/html.inc Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Interface between modules and other parts of LAM.
*
* @package modules
* @author Roland Gruber
*/
/**
* Represents a HTML element.
* This is used to build HTML code by using objects.
*
* @package modules
*/
interface htmlElement {
/**
* Prints the HTML code for this element.
*
* @param string $module Name of account module
* @param array $input List of meta-HTML elements
* @param array $values List of values which override the defaults in $input (name => value)
* @param boolean $restricted If true then no buttons will be displayed
* @param integer $tabindex Start value of tabulator index for input fields
* @param string $scope Account type
* @return array List of input field names and their type (name => type)
*/
function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope);
}
?>

View File

@ -701,6 +701,10 @@ function getRequiredExtensions() {
* @return array List of input field names and their type (name => type)
*/
function parseHtml($module, $input, $values, $restricted, &$tabindex, $scope) {
include_once("html.inc");
if ($input instanceof htmlElement) {
return $input->generateHTML($module, $values, $restricted, $tabindex, $scope);
}
$ret = array();
if (is_array($input)) {
echo "<table>\n";