/**
* The required files
*/
require_once(HTML_MVC_VIEW_PATH.'/ViewLimit.php');
require_once(HTML_BASIC_UTIL_PATH.'/Rowcolor.php');
require_once(HTML_BASE_UTIL_PATH.'/Link.php');
require_once(HTML_BASE_UTIL_PATH.'/Raw.php');
require_once(HTML_BASE_UTIL_PATH.'/ImageLink.php');
require_once(HTML_BASE_UTIL_PATH.'/Links.php');
require_once(HTML_BASE_UTIL_PATH.'/Images.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Table.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Tr.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Th.php');
require_once(HTML_TABLE_COMPONENT_PATH.'/Td.php');
require_once(HTML_UTIL_COMPONENT_PATH.'/Format.php');
require_once(HTML_UTIL_COMPONENT_PATH.'/Encrypt.php');
require_once(HTML_UTIL_COMPONENT_PATH.'/Params.php');
require_once(HTML_DTO_UTIL_PATH.'/DataReader.php');
if (defined('HTML_LANGUAGE_UTIL_PATH')) {
require_once(HTML_LANGUAGE_UTIL_PATH.'/Translate.php');
}
if (defined('HTML_DB_RESOURCE_PATH')) {
require_once(HTML_DB_RESOURCE_PATH.'/TableInfo.php');
}
if (defined('HTML_LOG_UTIL_PATH')) {
require_once(HTML_LOG_UTIL_PATH.'/Log.php');
}
/**
* This is the base class for Form View or List View
* You must extend this class, and write your own getHtml()
* <code>
* Usage:
* $view = new ViewCommon($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* print $view->getHtml();
* Or
* ViewCommon::display($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
*
* Generates a complete View Common interface
* +--------------------------------
* |>| Text header
* +--------------------------------
* | head1 | head2 | head3 | etc.
* +--------------------------------
* | dat_1 | dat_2 | dat_3 | etc.
* +--------------------------------
* </code>
* @package mvc
*/
class ViewCommon extends Table {
/**
* @var DataReader $datareader The DataReader object to use
*/
var $datareader = null;
/**
* @var int $id The primary key to use
*/
var $id = '';
/**
* @var real $subtotal The SubTotal to use
*/
var $subtotal = null;
/**
* Constructor
* @param DataReader $datareader The Data Reader object
* @param String $text The text header for the table
* @param String $width The Width for the table
* @param String $class The Class
* @param String $border The Border
* @param String $cellpadding The CellSpacing
* @param String $cellspacing The CellPadding
* @param String $summary The Summary
* @param String $caption The Caption
*/
function ViewCommon($datareader,$text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$this->Table($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
$this->datareader = $datareader;
}
/**
* You may override this methode in order to create your own hiddens
* If no request parameters are supplied, then popup the login form
* Return the Hiddens as an object
* @abstract
* @return Object The Hiddens as an Object
*/
function newHiddens() {
$keyValue = array(REQUEST_COMMAND=>Request::get(REQUEST_COMMAND));
return new Hiddens($keyValue,VIEW_LOGIN_FORM,$this->getClassName()); // VIEW_LOGIN_FORM
}
/**
* You may override this methode in order to create other types of buttons
* Return the Buttons as an object
* @abstract
* @return Object The Buttons as a new Object
*/
function newButtons() {
return new Buttons(VIEW_LOGIN_FORM,FORM_BUTTON_SHOW); // VIEW_LOGIN_FORM ?
}
/**
* Return the Label and TexField as an object
* @param String $type The type to use
* @param String $key The Key to use
* @param String $name The name to use
* @param String $value The value to use
* @param String $len The maxsize to use
* @param String $required The required text to use, if any
* @param String $debug The debug text to use, if any
* @param String $checked The checked attribute if ticked off for radio/checkbox
* @return Object The html as a new Object
*/
function newElement($type,$key,$name,$value,$len='',$required='',$debug='',$checked='') {
return ElementFactory::newElement($type,$key,$name,$value,$len,$required,$debug,$checked);
}
/**
* Return the html
* @return String The html
*/
function getHtml() {
$html = $this->html;
$html .= "<h1>".$this->getClassName()."->getHtml() TODO, you must override this</h1>\r\n";
return $html;
}
/**
* Display html
* <code>
* Usage:
* ViewCommon::display($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* </code>
* @static
* @param DataReader $datareader The Data Reader object
* @param String $text The text header for the table
* @param String $width The width of the table
* @param String $class The class of the table
* @param String $border The border of the table
* @param String $cellpadding The CellSpacing
* @param String $cellspacing The CellPadding
* @param String $summary The Summary
* @param String $caption The Caption
*/
function display($datareader,$text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
$html = new ViewCommon($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for ViewCommon klassen
<?
<h1>Viewcommon->getHtml() TODO, you must override this</h1>
?>
Class methods
Her er 'klasse metoderne' for ViewCommon klassen:
object
getclassname
getmsg
addhtml
gethtml
tostring
getcachefilename
save
content
html
setobject
set
get
getattribute
gettag
add
getsizeof
getelement
getelements
gettoogle
getmaximize
getminimize
newtriangle
display
showsource
table
newtextrow
gettableheader
getstart
getend
start
end
viewcommon
newhiddens
newbuttons
newelement
Object vars
Her er 'objekt variable' for ViewCommon klassen:
html =>
sql =>
elements => Array
sizeof => 0
text =>
width => 100%
class => theTable
border => 0
cellpadding => 2
cellspacing => 0
summary =>
caption =>
datareader => Object
id =>
subtotal =>
DataReader.php
Her er felterne i DataReader for ViewCommon klassen: