Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1392 → Rev 1393

/asterisk-stats/trunk/includes/display.php
90,7 → 90,7
protected $rowid = 0;
protected $rows = array();
protected $row_styles = array();
protected $hdr = array();
protected $header_rows = array();
 
#Define an array to store the stylesheet classes for each row
protected $table_class = '';
97,12 → 97,11
protected $header_class = '';
 
function __construct($header = array()) {
$this->hdr = $header;
array_push($this->header_rows, $header);
}
 
public function destroy() {
$this->hdr = array();
$this->sc = array();
$this->header_rows = array();
$this->rows = array();
}
 
114,6 → 113,10
$this->rows[] = array();
}
 
public function add_header_row($row) {
array_push($this->header_rows, $row);
}
 
public function addcell($data) {
$key = count($this->rows) - 1;
if($key < 0) {
169,14 → 172,19
$output = "<$tag>\n";
 
#Display the header
if($this->hdr) {
$output .= "\t<thead>\n\t\t<tr>\n";
if(count($this->header_rows) > 0) {
$output .= "\t<thead>\n";
 
foreach($this->hdr as $cell) {
$output .= $this->build_cell($cell, 'th');
foreach($this->header_rows as $row) {
$output .= "\t\t<tr>\n";
 
foreach($row as $cell) {
$output .= $this->build_cell($cell, 'th');
}
$output .= "\t\t</tr>\n";
}
 
$output .= "\t\t</tr>\n\t</thead>\n";
$output .= "\t</thead>\n";
}
 
$output .= "\t<tbody>\n";
197,9 → 205,20
}
}
 
function display_input($type, $name, $value = '') {
return '<input type="' . htmlspecialchars($type) . '" name="'
. htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . "\">";
function display_input($type, $name, $value = NULL, $additional = NULL) {
return '<input type="' . htmlspecialchars($type) . '" name="' . htmlspecialchars($name) . '"'
. ($value == NULL ? '' : ' value="' . htmlspecialchars($value) . '"')
. ($additional == NULL ? '' : " $additional")
. '>';
}
 
function ellipsis($str, $len) {
if(strlen($str) <= $len) {
return htmlspecialchars($str);
}
else {
return (htmlspecialchars(substr($str, 0, $len)) . '&hellip;');
}
}
 
?>