本文整理汇总了PHP中HTML_Table::setCellAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Table::setCellAttributes方法的具体用法?PHP HTML_Table::setCellAttributes怎么用?PHP HTML_Table::setCellAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Table
的用法示例。
在下文中一共展示了HTML_Table::setCellAttributes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$colHeaders = array("License Server", "Description", "Status", "Current Usage", "Available features/license", "Master", "Version");
$table->addRow($colHeaders, $headerStyle, "TH");
# set width on description col
$table->setColAttributes(1, "width=\"180\"");
# grab all the different server types
foreach ($server as $host) {
$type[] = $host['type'];
}
# return only unique types
$types = array_unique($type);
# loop thru each unique type and make up status table
foreach ($types as $type) {
$servers = findServers($type, "type");
if (sizeof($servers) > 0) {
$table->addRow(array(strtoupper($type) . " Servers"), $headerStyle, "TH");
$table->setCellAttributes($table->getRowCount() - 1, 0, "colspan='" . $table->getColCount() . "'");
for ($i = 0; $i < sizeof($servers); $i++) {
$cur = current($servers);
$status_array = getDetails($cur);
# does this host contain a webui?
# currently only RLM offers webui
if (isset($cur["webui"])) {
$host = "<a href=\"" . $cur["webui"] . "\">" . $cur["hostname"] . "</a>";
} else {
$host = $cur["hostname"];
}
$table->AddRow(array($host, $cur["desc"], strtoupper($status_array["status"]["service"]), $status_array["status"]["clients"], $status_array["status"]["listing"], $status_array["status"]["master"], $status_array["status"]["version"]));
# Set the background color of status cell
$table->updateCellAttributes($table->getRowCount() - 1, 2, "class='" . $status_array["status"]["service"] . "'");
$table->updateCellAttributes(1, 0, "");
# fetch status
示例2: array
$row = 0;
$headers = array(get_lang('Title'), get_lang('HandedOutDate'), get_lang('HandOutDateLimit'), get_lang('Score'), get_lang('Actions'));
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$row++;
$column = 0;
foreach ($workPerUser as $work) {
$work = $work['work'];
$scoreWeight = intval($work->qualification) == 0 ? null : $work->qualification;
$workId = $work->id;
$workExtraData = get_work_assignment_by_id($workId);
foreach ($work->user_results as $userResult) {
$table->setCellContents($row, $column, $work->title . ' [' . strip_tags($userResult['title']) . ']');
$table->setCellAttributes($row, $column, array('width' => '300px'));
$column++;
$table->setCellContents($row, $column, $userResult['sent_date']);
$column++;
$dateQualification = !empty($workExtraData['expires_on']) && $workExtraData['expires_on'] != '0000-00-00 00:00:00' ? api_get_local_time($workExtraData['expires_on']) : '-';
$table->setCellContents($row, $column, $dateQualification);
$column++;
$score = '-';
if (!empty($scoreWeight)) {
$score = strip_tags($userResult['qualification']) . "/" . $scoreWeight;
}
$table->setCellContents($row, $column, $score);
$column++;
// Actions
$links = null;
// is a text
示例3: sprintf
<?php
/*
* This example will output html websafe colors in a table
* using HTML_Table.
*/
// $Id: Table_example2.php,v 1.1 2002/10/21 12:57:41 mansion Exp $
require_once 'HTML/Table.php';
$table = new HTML_Table('width=100%');
$table->setCaption('256 colors table');
$i = $j = 0;
for ($R = 0; $R <= 255; $R += 51) {
for ($G = 0; $G <= 255; $G += 51) {
for ($B = 0; $B <= 255; $B += 51) {
$table->setCellAttributes($i, $j, 'bgcolor=#' . sprintf('%02X%02X%02X', $R, $G, $B));
$j++;
}
}
$i++;
$j = 0;
}
echo $table->toHtml();
示例4: strtolower
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Klaus Guenther <klaus@capitalfocus.org> |
// +----------------------------------------------------------------------+
//
// $Id$
require_once 'HTML/Page2.php';
require_once 'HTML/Table.php';
// This is an example from HTML_Table
$table = new HTML_Table('width=100%');
$table->setCaption('256 colors table');
$i = $j = 0;
for ($R = 0; $R <= 255; $R += 51) {
for ($G = 0; $G <= 255; $G += 51) {
for ($B = 0; $B <= 255; $B += 51) {
$table->setCellAttributes($i, $j, 'style="background-color:#' . strtolower(sprintf('%02X%02X%02X', $R, $G, $B)) . ';"');
$j++;
}
}
$i++;
$j = 0;
}
// end of HTML_Table example
// The initializing code can also be in in the form of an HTML
// attr="value" string.
// Possible attributes are:
// - cache ("true" or "false")
// - charset (e.g., "utf-8")
// - doctype (e.g., "XHTML Basic 1.0")
// - language (two letter designator: e.g., "en")
// - lineend ("unix", "win", "mac", custom string)
示例5: generateTable
/**
* Generate the HTML_Table object of the calendar
*
* @param day day of the calendar to generate, null = today's day
* @param month month of the calendar to generate, null = today's month
* @param year year of the calendar to generate, null = today's year
*
* @access public
* @return the HTML_Table object of the calendar
*/
function generateTable($day = null, $month = null, $year = null)
{
if (empty($year)) {
$year = Date_Calc::dateNow('%Y');
}
if (empty($month)) {
$month = Date_Calc::dateNow('%m');
}
if (empty($day)) {
$day = Date_Calc::dateNow('%d');
}
$year = sprintf('%04d', $year);
$month = sprintf('%02d', $month);
$day = sprintf('%02d', $day);
// get month structure for generating calendar
$month_cal = Date_Calc::getCalendarMonth($month, $year, '%E');
$this->_todayDays = Date_Calc::dateFormat(null, null, null, '%E');
$this->_thisMonth = Date_Calc::dateFormat($day, $month, $year, '%m');
$row = 0;
$table = new HTML_Table($this->_attributes['table']);
$table->addRow(array($this->drawTitle($day, $month, $year)));
$table->setRowAttributes($row, $this->_attributes['title']);
$row++;
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawWeekDayText($col), 'TH');
}
$table->setRowAttributes($row++, $this->_attributes['weekday']);
for ($week = 0; $week < count($month_cal); $week++) {
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawCell($month_cal[$week][$col], $week, $col));
$type = $this->getType($month_cal[$week][$col]);
$table->setCellAttributes($row, $col, $this->_attributes['cell']);
$table->updateCellAttributes($row, $col, $this->_attributes['cell_' . $type]);
}
$row++;
}
return $table;
}
示例6: implode
}
if (sizeof($sub_links) >= $max_sub_links) {
$sub_links = implode(', ', $sub_links) . ' ' . make_image("caret-r.gif", "[more]");
} else {
$sub_links = implode(', ', $sub_links);
}
settype($npackages, 'string');
settype($ncategories, 'string');
$data = '<font size="+1"><b><a href="' . $script_name . '?catpid=' . $id . '&catname=' . urlencode($name) . '">' . $name . '</a></b></font> (' . $npackages . ')<br />';
//$name; //array($name, $npackages, $ncategories, $summary);
$data .= $sub_links . '<br />';
$catdata[] = $data;
$totalpackages += $npackages;
if ($nrow++ % 2 == 1) {
$table->addRow(array($catdata[0], $catdata[1]));
$table->setCellAttributes($table->getRowCount() - 1, 0, 'width="50%"');
$table->setCellAttributes($table->getRowCount() - 1, 1, 'width="50%"');
$catdata = array();
}
}
// End while
// Any left over (odd number of categories).
if (count($catdata) > 0) {
$table->addRow(array($catdata[0]));
$table->setCellAttributes($table->getRowCount() - 1, 0, 'width="50%"');
$table->setCellAttributes($table->getRowCount() - 1, 1, 'width="50%"');
}
/**
* Begin code for showing packages if we
* aren't at the top level.
*/
示例7: while
while ($pools->fetch()) {
$table->setCellContents($count, 0, '<input type="checkbox" value="' . $pools->id . '" name="ng_free_' . $count . '">');
$table->setCellContents($count, 1, $pools->name);
$table->setCellContents($count, 2, $pools->description);
$table->setCellContents($count, 3, $pools->country);
$table->setCellContents($count, 4, $pools->area);
$table->setRowAttributes($count, array("class" => "pools"));
++$count;
}
echo $table->toHTML();
echo '<img src="./images/arrow.png"> ';
echo '<input type="hidden" name="ng_free_count" value="' . $count . '">';
echo '<input type="submit" name="ng_free_submit" value="markierte freischalten"> / ';
echo '<input type="submit" name="ng_del_submit" value="markierte ablehnen">';
} else {
$table->setCellAttributes(1, 0, array("colspan" => "5", "align" => "center"));
$table->setCellContents(1, 0, '--- derzeit keine wartenden NutziGems ---');
echo $table->toHTML();
}
echo '</form>';
// pools to delete
// all pools are shown
// Instanciate pools-class
$pools = new pools();
$pools->wait = 0;
if ($pools->find()) {
echo '<p class="headline2" id="anzeigen">NutziGems löschen</p>';
echo '<p class="standard">';
while ($pools->fetch()) {
if ($pools->name != "Pool") {
echo '<a href="./admin.php?action=delete_pool&pool_id=' . $pools->id . '&server_password=' . $submit_server_password . '">' . $pools->name . '</a> ';
示例8: toHtml
/**
* Returns Html for the group
*
* @access public
* @return string
*/
function toHtml()
{
include_once 'HTML/Table.php';
$tripleLinkTable = new HTML_Table();
$tripleLinkTable->setAutoGrow(true);
$tripleLinkTable->setAutoFill('');
$tripleLinkTable->updateAttributes($this->getAttributes());
$row = 0;
$col = 0;
if ($this->_columnNames) {
foreach ($this->_columnNames as $key => $value) {
++$col;
$tripleLinkTable->setCellContents($row, $col, $value);
$tripleLinkTable->setCellAttributes($row, $col, array('style' => 'text-align: center'));
}
++$row;
}
foreach (array_keys($this->_rows) as $key) {
$col = 0;
$tripleLinkTable->setCellContents($row, $col, $this->_rowNames[$key]);
foreach (array_keys($this->_rows[$key]) as $key2) {
++$col;
$tripleLinkTable->setCellContents($row, $col, $this->_rows[$key][$key2]->toHTML());
$tripleLinkTable->setCellAttributes($row, $col, array('style' => 'text-align: center'));
}
++$row;
}
if ($this->_columnNames) {
$tripleLinkTable->setRowAttributes(0, array('class' => 'elementTableColumnLabel'), true);
}
$tripleLinkTable->setColAttributes(0, array('class' => 'elementTableRowLabel'));
return $tripleLinkTable->toHTML();
/*include_once('HTML/QuickForm/Renderer/Default.php');
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
$this->accept($renderer);
return $renderer->toHtml();*/
}
示例9: JOIN
$sql = "SELECT\n packages.package_type,\n packages.name,\n bugdb.ts2,\n bugdb.id AS bug_id,\n UNIX_TIMESTAMP(r.releasedate) as releasedate,\n unmaintained\nFROM\n packages\n JOIN bugdb ON packages.name = bugdb.package_name AND bugdb.status = 'Closed'\n LEFT JOIN (\n SELECT package, MAX(releasedate) as releasedate FROM releases GROUP BY package\n ) as r ON packages.id = r.package\nWHERE";
// In case we want to show all packages, including the superseeded ones.
if (!isset($_GET['showall'])) {
$sql .= "\n (packages.newchannel IS NULL OR packages.newchannel = '')\n AND\n (packages.newpackagename IS NULL OR packages.newpackagename = '')\n AND";
}
$sql .= "\n UNIX_TIMESTAMP(r.releasedate) < UNIX_TIMESTAMP(bugdb.ts2)\n AND\n UNIX_TIMESTAMP(r.releasedate) < {$min_release_date}\n AND \n packages.package_type = 'pear'\nGROUP BY\n packages.id, packages.name, bugdb.package_name, bugdb.id, r.package\nORDER BY\n unmaintained DESC, r.releasedate";
$res = $dbh->getAll($sql, null, DB_FETCHMODE_ASSOC);
$total_rows = $dbh->getOne('SELECT FOUND_ROWS()');
echo 'Found ' . $total_rows . ' reports that have been closed but their package has not had a release in 6 months<br /><br />';
$bugs = array('pear' => array());
foreach ($res as $data) {
$bugs[$data['package_type']][$data['name']]['bug_id'][] = $data['bug_id'];
$bugs[$data['package_type']][$data['name']]['last_release'] = $data['releasedate'];
$bugs[$data['package_type']][$data['name']]['unmaintained'] = $data['unmaintained'];
}
// PEAR
$table = new HTML_Table(array('class' => 'sortable'));
$table->setHeaderContents(0, 0, 'Package');
$table->setHeaderContents(0, 1, '# bugs');
$table->setHeaderContents(0, 2, 'Last Release Date');
$table->setHeaderContents(0, 3, "Unmaintained?");
$row = 1;
foreach ($bugs['pear'] as $name => $qa) {
$table->addRow(array(make_link('/package/' . $name . '/', $name), make_link('/bugs/search.php?cmd=display&package_name[]=' . $name . '&status=CRSLR', count($qa['bug_id'])), format_date($qa['last_release']), $qa['unmaintained'] ? 'Yes' : ''));
$table->setCellAttributes($row, 1, 'style="text-align: center;"');
$table->setCellAttributes($row, 3, 'style="text-align: center;"');
$row++;
}
echo '<h2 id="pear">PEAR (' . count($bugs['pear']) . ')</h2>';
echo $table->toHTML();
response_footer();