本文整理汇总了PHP中HTML_Table::setRowAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Table::setRowAttributes方法的具体用法?PHP HTML_Table::setRowAttributes怎么用?PHP HTML_Table::setRowAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Table
的用法示例。
在下文中一共展示了HTML_Table::setRowAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filaTablaHorasAsignadasEditar
private function filaTablaHorasAsignadasEditar($horario, $fila)
{
// Debe sumarse uno a la fila porque la fila 0 es la cabecera
$this->tabla->setCellContents($fila + 1, 0, $this->formulario . $horario->getArea()->getNombreArea());
$this->tabla->setCellContents($fila + 1, 1, '<input class="campoTexto campoTextoChico" type="text" name="cantidadHoras" size="4" value="' . $horario->getHorasAsignadas() . '" />');
$this->tabla->setCellContents($fila + 1, 2, $horario->getHorasActualmenteAsignadas());
$this->tabla->setCellContents($fila + 1, 3, $this->accionesFilaTablaHorasAsignadasEditar($horario->getArea()->getIdArea()));
$this->tabla->setRowAttributes($fila + 1, $this->clase, false);
}
示例2: viewList
/**
* View list
*
* @author John.meng
* @since version1.0 - Dec 12, 2005
*/
function viewList()
{
global $__Lang__, $FlushPHPObj, $smarty;
include_once PEAR_DIR . "HTML/Table.php";
include_once PEAR_DIR . "HTML/QuickForm.php";
include_once APP_DIR . "UI.class.php";
$form =& new HTML_QuickForm();
$FilesDirsObj = $FlushPHPObj->loadUtility("FilesDirs");
$FilesDirsObj->FilesDirs(MODULE_DIR, 1, "CVS,General");
$Module_arr = $FilesDirsObj->listDirs();
asort($Module_arr);
reset($Module_arr);
$data = array();
$installImageObj = new UIImage(THEMES_DIR . "images/install.gif");
$unInstallImageObj = new UIImage(THEMES_DIR . "images/uninstall.gif");
if (sizeof($Module_arr)) {
foreach ($Module_arr as $key => $value) {
$temp_Module_arr = $FlushPHPObj->getModuleInfo($value);
if (file_exists(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']) && $temp_Module_arr['logo']) {
$ModuleImageLogo = new UIImage(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']);
$Module_logo = $ModuleImageLogo->toHTML() . "<br/>";
}
$data[$key] = array($Module_logo . $temp_Module_arr['name'] . " <b> " . $temp_Module_arr['version'] . " <b/> ", $temp_Module_arr['description'], $temp_Module_arr['author'], $unInstallImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralUnInstall'], $installImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralInstall']);
}
}
$tableAttrs = array("class" => "grid_table");
$table = new HTML_Table($tableAttrs);
$table->setAutoGrow(true);
$table->setAutoFill("n/a");
for ($nr = 0; $nr < count($data); $nr++) {
$table->setHeaderContents($nr + 1, 0, (string) $nr);
for ($i = 0; $i < 5; $i++) {
if ("" != $data[$nr][$i]) {
$table->setCellContents($nr + 1, $i + 1, $data[$nr][$i]);
}
}
}
$table->setColAttributes(3, array(" align" => "center"));
$table->setColAttributes(4, array(" align" => "center"));
$table->setColAttributes(5, array(" align" => "center"));
$altRow = array("class" => "grid_table_tr_alternate");
$table->altRowAttributes(1, null, $altRow);
$table->setHeaderContents(0, 0, "");
$table->setHeaderContents(0, 1, $__Lang__['langMenuModule']);
$table->setHeaderContents(0, 2, $__Lang__['langGeneralSummary']);
$table->setHeaderContents(0, 3, $__Lang__['langGeneralAuthor']);
$table->setHeaderContents(0, 4, $__Lang__['langGeneralStatus']);
$table->setHeaderContents(0, 5, $__Lang__['langGeneralOperation']);
$hrAttrs = array("class" => "grid_table_head");
$table->setRowAttributes(0, $hrAttrs, true);
$table->setColAttributes(0, $hrAttrs);
$smarty->assign("Main", $table->toHtml());
}
示例3: viewList
/**
* View list
*
* @author John.meng
* @since version - Dec 23, 2005
* @param datatype paramname description
* @return datatype description
*/
function viewList()
{
global $__Lang__, $UrlParameter, $FlushPHPObj, $table, $page_data, $all_data, $links, $form, $smarty;
include_once PEAR_DIR . 'HTML/QuickForm.php';
include_once PEAR_DIR . "HTML/Table.php";
require_once PEAR_DIR . 'Pager/Pager.php';
$form = new HTML_QuickForm('viewList');
$renderer =& $form->defaultRenderer();
$renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n{content}\n</table>\n</form>");
$tableAttrs = array("class" => "grid_table");
$table = new HTML_Table($tableAttrs);
$table->setAutoGrow(true);
// $table->setAutoFill("n/a");
$hrAttrs = array("class" => "grid_table_head");
$table->setRowAttributes(0, $hrAttrs, true);
$params = array('itemData' => $all_data, 'perPage' => 10, 'delta' => 3, 'append' => true, 'separator' => ' . ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'prevImg' => $__Lang__['langPaginationPrev'], 'nextImg' => $__Lang__['langPaginationNext']);
$pager =& Pager::factory($params);
$page_data = $pager->getPageData();
$links = $pager->getLinks();
$selectBox = $pager->getPerPageSelectBox();
}
示例4: imprimirTablaPeriodos
/**
* Muestra la tabla con los períodos cargados en el sistema.
* @param array Períodos cargados en el sistema.
*/
private function imprimirTablaPeriodos($periodos)
{
imprimirTabulados(6);
$clase = array('class' => 'tablaReporte');
$tabla = new HTML_Table($clase);
$tabla->setAutoGrow(true);
// Encabezado
$tabla->setHeaderContents(0, 0, 'Nombre');
$tabla->setHeaderContents(0, 1, 'Area');
$tabla->setHeaderContents(0, 2, 'Inicio');
$tabla->setHeaderContents(0, 3, 'Fin');
$tabla->setRowAttributes(0, $clase, false);
// Contenido
for ($fila = 0; $fila <= count($periodos) - 1; $fila++) {
$periodo = $periodos[$fila];
$tabla->setCellContents($fila + 1, 0, '<a class="data" href="periodos.php?idPeriodo=' . $periodo->getIdPeriodo() . '">' . $periodo->getNombre() . '</a>');
$tabla->setCellContents($fila + 1, 1, $periodo->getArea()->getNombreArea());
$tabla->setCellContents($fila + 1, 2, $periodo->imprimirInicio());
$tabla->setCellContents($fila + 1, 3, $periodo->imprimirFin());
$tabla->setRowAttributes($fila + 1, $clase, false);
}
echo $tabla->toHtml();
// Notas
imprimirTabulados(6);
echo '<div class="notas">';
imprimirTabulados(7);
echo '<p>Click sobre el nombre para mayor información</p>';
imprimirTabulados(6);
echo '</div>';
// Notas
}
示例5: get_table
/**
* Get HTML table (as string that can be echoed)
*
* @param array $row_data (to appear in rows of table)
* @param array $column_headers (to appear in head of table
* @return string
*
* @access public
*/
public function get_table($row_data, $column_headers)
{
// see http://pear.php.net/manual/en/package.html.html-table.intro.php
$table = new HTML_Table();
$table->setAutoGrow(true);
$table->setAutoFill('n/a');
for ($nr = 0, $maxr = count($row_data); $nr < $maxr; $nr++) {
for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
if ('' != $row_data[$nr][$i]) {
$table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
}
}
}
for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
$table->setHeaderContents(0, $i, $column_headers[$i]);
}
$header_attribute = array('class' => 'header');
$table->setRowAttributes(0, $header_attribute, true);
$table->setColAttributes(0, $header_attribute);
$altRow = array('class' => 'alt_row');
$table->altRowAttributes(1, null, $altRow);
return $table->toHtml();
}
示例6: get_table
/**
* Get HTML table (as string that can be echoed)
*
* @param array $row_data (to appear in rows of table)
* @param array $column_headers (to appear in head of table
* @return string
*
* @access private
*/
private function get_table($row_data, $column_headers, $delete = false, $deleteColumn = -999, $deleteField = 'dummy-field-name')
{
// see http://pear.php.net/manual/en/package.html.html-table.intro.php
$table = new HTML_Table();
$table->setAutoGrow(true);
$table->setAutoFill('n/a');
for ($nr = 0, $maxr = count($row_data); $nr < $maxr; $nr++) {
for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
if (isset($row_data[$nr][$i])) {
if ('' != $row_data[$nr][$i]) {
if ($deleteColumn == $i) {
if ($delete) {
$table->setCellContents($nr + 1, $i, $this->getDeleteButton($row_data[$nr][$i], $deleteField));
}
} else {
$table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
}
}
} else {
$table->setCellContents($nr + 1, $i, $this->fillerForEmptyCell);
}
}
}
for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
$table->setHeaderContents(0, $i, $column_headers[$i]);
}
$header_attribute = array('class' => 'header');
$table->setRowAttributes(0, $header_attribute, true);
$table->setColAttributes(0, $header_attribute);
$altRow = array('class' => 'alt_row');
$table->altRowAttributes(1, null, $altRow);
return $table->toHtml();
}
示例7: array
<?php
$data = array('0' => array('Bakken', 'Stig', '', 'stig@example.com'), '1' => array('Merz', 'Alexander', 'alex.example.com', 'alex@example.com'), '2' => array('Daniel', 'Adam', '', ''));
require_once 'HTML/Table.php';
$attrs = array('width' => '600');
$table = new HTML_Table($attrs);
$table->setAutoGrow(true);
$table->setAutoFill('n/a');
for ($nr = 0; $nr < count($data); $nr++) {
// La primer columna es cabecera de tabla tambien
$table->setHeaderContents($nr + 1, 0, (string) $nr);
for ($i = 0; $i <= 3; $i++) {
if ('' != $data[$nr][$i]) {
$table->setCellContents($nr + 1, $i + 1, $data[$nr][$i]);
}
}
}
$altRow = array('bgcolor' => 'red');
$table->altRowAttributes(1, null, $altRow);
$table->setHeaderContents(0, 0, '');
$table->setHeaderContents(0, 1, 'Surname');
$table->setHeaderContents(0, 2, 'Name');
$table->setHeaderContents(0, 3, 'Website');
$table->setHeaderContents(0, 4, 'EMail');
$hrAttrs = array('bgcolor' => 'silver');
$table->setRowAttributes(0, $hrAttrs, true);
$table->setColAttributes(0, $hrAttrs);
echo $table->toHtml();
示例8: dataTable
public function dataTable($data, $header = null, $class = null)
{
$table = new HTML_Table();
$table->setAutoGrow(true);
$table->setAutoFill('');
$hrAttrs = $class ? array('class' => $class) : null;
for ($nr = 0; $nr < count($data); $nr++) {
$table->setHeaderContents($nr + 1, 0, (string) $data[$nr][0]);
for ($i = 1; $i < count($data[$nr]); $i++) {
if ('' != $data[$nr][$i]) {
$table->setCellContents($nr + 1, $i, $data[$nr][$i]);
}
$table->setRowAttributes($nr + 1, $hrAttrs, true);
}
}
for ($i = 0; $i < count($header); $i++) {
$table->setHeaderContents(0, $i, $header[$i]);
}
return $table;
}
示例9: imprimirListaUsuarios
private function imprimirListaUsuarios()
{
imprimirTabulados(5);
echo '<div class="tablaTituloBotones">';
imprimirTabulados(6);
echo '<h1>Personal</h1>';
$usuarios = $this->gestorUsuarios->getUsuarios();
if (empty($usuarios)) {
imprimirTabulados(6);
echo '<p>No hay usuarios cargados en el sistema</p>';
// Cierra el contenedor tablaTituloBotones
imprimirTabulados(5);
echo '</div>';
return;
}
$this->imprimirFormularioBusqueda();
$clase = array('class' => 'tablaReporte');
$tabla = new HTML_Table($clase);
$tabla->setAutoGrow(true);
// Encabezado
$tabla->setHeaderContents(0, 0, 'Nro');
$tabla->setHeaderContents(0, 1, 'Apellido');
$tabla->setHeaderContents(0, 2, 'Nombre');
$tabla->setHeaderContents(0, 3, 'Area');
$tabla->setRowAttributes(0, $clase, false);
// Contenido
for ($fila = 0; $fila <= count($usuarios) - 1; $fila++) {
$usuario = $usuarios[$fila];
$tabla->setCellContents($fila + 1, 0, $fila + 1);
$tabla->setCellContents($fila + 1, 1, '<a class="data" href="usuario.php?numeroDocumento=' . $usuario->getNumeroDocumento() . '">' . $usuario->getApellido() . '</a>');
$tabla->setCellContents($fila + 1, 2, $usuario->getNombre());
$tabla->setCellContents($fila + 1, 3, $usuario->getNombreAreas());
$tabla->setRowAttributes($fila + 1, $clase, false);
}
echo $tabla->toHtml();
// Notas
imprimirTabulados(6);
echo '<div class="notas">';
imprimirTabulados(7);
echo '<p>Click sobre el apellido para mayor información</p>';
imprimirTabulados(6);
echo '</div>';
// Notas
$this->imprimirBotonesPersonal();
imprimirTabulados(5);
echo '</div>';
}
示例10: build_html
function build_html(&$html, &$chartData, $query, $sql_key, $result, $report, $title, $description, $parms, $format = '', $timestamp)
{
//Create EXCEL output object
$file_name = "{$report}" . "_" . $timestamp . ".csv";
if (file_exists("/tmp/{$file_name}")) {
$csv = fopen("/tmp/{$file_name}", "a") or die("ERROR: Could not open file...");
} else {
$csv = fopen("/tmp/{$file_name}", "w") or die("ERROR: Could not open file...");
}
fwrite($csv, "{$title}\n");
fwrite($csv, "{$report}\n");
fwrite($csv, "{$description}\n");
fwrite($csv, "\n");
fwrite($csv, "Parameters Passed:\n");
foreach ($parms as $key => $value) {
fwrite($csv, "{$key},{$value}\n");
}
fwrite($csv, "\n");
$column_format = array();
//$attrs = array('width' => '600', 'border' => '1', 'class' => 'report');
$attrs = array('border' => '1', 'class' => 'report');
$table = new \HTML_Table($attrs);
$table->setAutoGrow(true);
$hrAttrs = array('bgcolor' => 'silver', 'align' => 'center');
$table->setRowAttributes(0, $hrAttrs, true);
$hrAttrs = array('align' => 'right');
foreach ($format as $key => $value) {
if ("{$key}" == "name") {
$column_format[strtolower($value)] = $format['format'];
break;
} else {
foreach ($value as $key2 => $value2) {
$column_format[strtolower($value2)] = $value['format'];
break;
}
}
}
$record = 0;
$chartData = "function drawChart() {\n var data = google.visualization.arrayToDataTable([\n";
while ($row = $result->fetch_assoc()) {
if ($record > 0) {
$col = 0;
$table->setCellContents($record + 1, $col, $record + 1);
$table->setRowAttributes($record + 1, $hrAttrs, true);
$chartData .= ",\n";
foreach ($row as $key => $value) {
$col++;
if (isset($column_format[strtolower($key)])) {
$fmt_value = format_column($value, $column_format[strtolower($key)]);
$table->setCellContents($record + 1, $col, $fmt_value);
// If we have a format, check its type
if (in_array($column_format[strtolower($key)], array('string', 'date'))) {
if ($col == 1) {
$chartData .= "['" . $value . "'";
} else {
$chartData .= ",'" . $value . "'";
}
} else {
if ($col == 1) {
$chartData .= "[" . $value;
} else {
$chartData .= "," . $value;
}
}
} else {
// If not format, we assume its a number
$table->setCellContents($record + 1, $col, $value);
if ($col == 1) {
$chartData .= $value;
} else {
$chartData .= "," . $value;
}
}
//CSV
if ($col == 1) {
fwrite($csv, "{$value}");
} else {
fwrite($csv, ",{$value}");
}
//Chart
}
fwrite($csv, "\n");
$chartData .= "]";
} else {
if ($record == 0) {
$col = 0;
$table->setHeaderContents(0, $col, '#');
foreach ($row as $key => $value) {
$col++;
$table->setHeaderContents($record, $col, ucfirst($key));
if ($col == 1) {
fwrite($csv, "{$key}");
$chartData .= "['" . ucfirst($key) . "'";
} else {
fwrite($csv, ",{$key}");
$chartData .= ",'" . ucfirst($key) . "'";
}
}
fwrite($csv, "\n");
$chartData .= "],\n";
//.........这里部分代码省略.........
示例11: SiteMenuDAO
/**
* function_description
*
* @author John.meng
* @since version - Jan 6, 2006
* @param datatype paramname description
* @return datatype description
*/
function opStep3()
{
global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty, $__MODULE__, $__TEMPLATES__;
include_once PEAR_DIR . "HTML/Table.php";
include_once MODULE_DIR . "Site/DAO/SiteMenuDAO.class.php";
parent::opAdd();
$form->addElement('header', null, $__Lang__['langSite'] . $__Lang__['langWizard'] . $__Lang__['langStep'] . " 3 ");
$sysMenuDao = new SiteMenuDAO();
$data_menu = $sysMenuDao->getMenuAllArr();
$tableAttrs = array("class" => "grid_sub_table", 'cellspacing' => "0");
$table = new HTML_Table($tableAttrs);
$table->setAutoGrow(true);
// $table->setAutoFill("n/a");
$cell_x = 0;
$data_menu = array(NULL => NULL) + $data_menu;
foreach ($data_menu as $key => $value) {
$table->addRow(array($value['Title'], $__MODULE__[$value['Module']], $__TEMPLATES__[$value['Template']], $value['URL'], " <table><tr><td><a href='####' onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Update&ID=" . $key . "' , 450, 450)\" ><img src='" . THEMES_DIR . "images/edit.gif' border='0'><br />" . $__Lang__['langGeneralUpdate'] . "</a></td><td><a href='####' onclick=\"confirm ( '" . $__Lang__['langGeneralCancelConfirm'] . "')?popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Cancel&ID=" . $key . "' , 20, 20):'';\"><img src='" . THEMES_DIR . "images/delete.gif' border='0'><br />" . $__Lang__['langGeneralCancel'] . "</a></td></tr></table>"));
$cell_x++;
}
$altRow = array("class" => "grid_table_tr_alternate");
$table->altRowAttributes(1, null, $altRow);
$hrAttrs = array("class" => "grid_sub_table_head");
$table->setRowAttributes(0, $hrAttrs, true);
$table->setHeaderContents(0, 0, $__Lang__['langMenu']);
$table->setHeaderContents(0, 1, $__Lang__['langSiteModule']);
$table->setHeaderContents(0, 2, $__Lang__['langSiteTemplate']);
$table->setHeaderContents(0, 3, $__Lang__['langGeneralURL']);
$table->setHeaderContents(0, 4, $__Lang__['langGeneralOperation']);
$form->addElement('static', NULL, NULL, $table->toHtml());
$step_nav[] =& HTML_QuickForm::createElement('submit', 'btnPre', $__Lang__['langPreStep'], "onclick=document.forms[0].Step.value='Step2' ");
$step_nav[] =& HTML_QuickForm::createElement('button', 'btnNew', $__Lang__['langGeneralAdd'] . $__Lang__['langMenu'], "onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Add', 450, 450)\" ");
$step_nav[] =& HTML_QuickForm::createElement('button', 'btnNext', $__Lang__['langFinish'], "onclick=\"window.location='?Module=Site&Page=Preview'\" ");
$form->addGroup($step_nav, 'step_navigation', " ");
$form->addElement('hidden', 'Module', $_REQUEST['Module']);
$form->addElement('hidden', 'Page', $_REQUEST['Page']);
$form->addElement('hidden', 'Action', $_REQUEST['Action']);
$form->addElement('hidden', 'Step');
if ($form->validate()) {
if ($_POST['Step'] == 'Step2') {
$this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step2");
} else {
$this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step4");
}
}
$smarty->assign("Main", $form->toHTML());
}
示例12: array
$c = 0;
$data = array();
foreach ($result as $row) {
$data[$c] = array($row->page, $row->mdate, '<a href="/content/edit/id-' . $row->page_id . '" style="text-decoration:none;" ><img src="/templates/' . $this->get('admin_config.site.template') . '/images/24x24/Edit3.png" class="Tips" title="Edit Page" rel="Click to edit the ' . $row->page . ' page contents" /></a>', '<a href="/content/delete/id-' . $row->page_id . '" ><img src="/templates/' . $this->get('admin_config.site.template') . '/images/24x24/DeleteRed.png" class="Tips" title="Delete Page" rel="Click to delete the ' . $row->page . ' page" /></a>');
$c++;
}
$table = new HTML_Table();
$table->setAutoGrow(true);
$table->setAutoFill('');
$hrAttrs = array('class' => 'highlight');
for ($nr = 0; $nr < count($data); $nr++) {
$table->setHeaderContents($nr + 1, 0, (string) $data[$nr][0]);
for ($i = 1; $i < 5; $i++) {
if ('' != $data[$nr][$i]) {
$table->setCellContents($nr + 1, $i, $data[$nr][$i]);
}
$table->setRowAttributes($nr + 1, $hrAttrs, true);
}
}
$table->setHeaderContents(0, 0, 'Page Name');
$table->setHeaderContents(0, 1, 'Last Modified');
$table->setHeaderContents(0, 2, '');
$table->setHeaderContents(0, 3, '');
$this->content .= '<div id="tableWrap">';
$this->content .= $table->toHtml();
$this->content .= '</div>';
} else {
$this->content .= '<h3>No Content Yet</h3>';
}
//if (isset($params)) $this->content .= $this->message($params);
}
示例13: array
echo '<p class="msg">' . $msg . '</p>';
echo '<p class="headline">NutziGems Administration</p>';
echo '<p class="standard">Das ist also die NutziGems-Administrationsoberfläche.</p>';
echo '<p class="headline2" id="anzeigen">NutziGems, die auf ihre Freischaltung warten</p>';
// Waiting NGs
echo '<form action="./admin.php" method="post">';
echo '<input type="hidden" name="server_password" value="' . $submit_server_password . '">';
$table = new HTML_Table(array("width" => "100%", "class" => "pools"));
$table->setAutoGrow(true);
$table->setAutoFill("n/a");
$table->setHeaderContents(0, 0, " ");
$table->setHeaderContents(0, 1, "Name");
$table->setHeaderContents(0, 2, "Beschreibung");
$table->setHeaderContents(0, 3, "Land");
$table->setHeaderContents(0, 4, "Gebiet");
$table->setRowAttributes(0, array("class" => "pools"));
// all pools are shown
// Instanciate pools-class
$pools = new pools();
$count = 1;
$pools->wait = 1;
if ($pools->find()) {
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;
}
示例14: setData
function setData($result)
{
// Reset results pointer
mysqli_data_seek($result, 0);
//Create EXCEL output object
$file_name = $this->csv;
if (file_exists("/tmp/" . $this->csv)) {
$fh = fopen("/tmp/" . $this->csv, "a") or die("ERROR: Could not open file...");
} else {
$fh = fopen("/tmp/" . $this->csv, "w") or die("ERROR: Could not open file...");
}
//$attrs = array('width' => '600', 'border' => '1', 'class' => 'report');
$attrs = array('class' => 'report', 'id' => 'id');
$rAttrs = array();
$table = new \HTML_Table($attrs);
$table->setAutoGrow(true);
$table->setRowAttributes(0, $rAttrs, true);
//$yui_data='var data = [\n';
//$yui_table='var table = new Y.DataTable({\n';
$record = 0;
while ($row = db_fetch_assoc($result)) {
$row_format = FALSE;
if ($record > 0) {
$col = 0;
$table->setCellContents($record + 1, $col, $record + 1);
$table->setRowAttributes($record + 1, $rAttrs, true);
foreach ($row as $key => $value) {
$col++;
// This checks if we have a valid ROW format based on col 1 value
if ($col == 1 && isset($this->formats[strtolower($key)]) && $this->formats[strtolower($key)]->class == 'row' && isset($this->formats[strtolower($key)]->rows[strtolower($value)])) {
$row_format = TRUE;
$row_format_column = strtolower($key);
$row_format_value = strtolower($value);
}
if ($col > 1 && $row_format == TRUE) {
// Valid ROW format
$table->setCellContents($record + 1, $col, $this->formatValue($this->formats[$row_format_column]->rows[$row_format_value], $value));
} else {
if (isset($this->formats[strtolower($key)])) {
// Valid format
if ($this->formats[strtolower($key)]->class == 'column') {
// Valid column format
$table->setCellContents($record + 1, $col, $this->formatValue($this->formats[strtolower($key)]->type, $value));
} else {
// Row format, but invalid value
$table->setCellContents($record + 1, $col, $value);
}
} else {
// If not format, we assume its a number
$table->setCellContents($record + 1, $col, $value);
}
}
//CSV
if ($col == 1) {
fwrite($fh, '"' . $value . '"');
} else {
fwrite($fh, ',"' . $value . '"');
}
}
fwrite($fh, "\n");
} else {
if ($record == 0) {
$col = 0;
$table->setHeaderContents(0, $col, '#');
//$yui_column='columns: [';
foreach ($row as $key => $value) {
$col++;
$table->setHeaderContents($record, $col, ucfirst($key));
if ($col > 1) {
//$yui_column.=$yui_column.",\"$col\"";
} else {
//$yui_column.=$yui_column."\"$col\"";
}
//CSV
if ($col == 1) {
fwrite($fh, "{$key}");
} else {
fwrite($fh, ",{$key}");
}
}
//$yui_column.=$yui_column."]";
fwrite($fh, "\n");
$col = 0;
$table->setCellContents($record + 1, $col, $record + 1);
$table->setRowAttributes($record + 1, $rAttrs, true);
foreach ($row as $key => $value) {
$col++;
// This checks if we have a valid ROW format based on col 1 value
if ($col == 1 && isset($this->formats[strtolower($key)]) && $this->formats[strtolower($key)]->class == 'row' && isset($this->formats[strtolower($key)]->rows[strtolower($value)])) {
$row_format = TRUE;
$row_format_column = strtolower($key);
$row_format_value = strtolower($value);
}
if ($col > 1 && $row_format == TRUE) {
// Valid ROW format
$table->setCellContents($record + 1, $col, $this->formatValue($this->formats[$row_format_column]->rows[$row_format_value], $value));
} else {
if (isset($this->formats[strtolower($key)])) {
// Valid Format
if ($this->formats[strtolower($key)]->class == 'column') {
//.........这里部分代码省略.........
示例15: 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();*/
}