function __construct($horarios) { $this->horarios = $horarios; $this->clase = array('class' => 'tablaReporte'); $this->tabla = new HTML_Table($this->clase); $this->tabla->setAutoGrow(true); }
function __construct($listaHorasAsignadas, $numeroDocumentoIngresado) { $this->listaHorasAsignadas = $listaHorasAsignadas; $this->clase = array('class' => 'tablaReporte'); $this->tabla = new HTML_Table($this->clase); $this->tabla->setAutoGrow(true); $this->formulario = '<form action="horariohabitual.php" method="post">'; $this->numeroDocumentoIngresado = $numeroDocumentoIngresado; }
/** * Muestra el formulario para iniciar sesión. */ private function imprimirFormularioLogin() { imprimirTabulados(5); echo '<div class="tablaTituloBotones">'; imprimirTabulados(6); echo '<h2>Iniciar sesión</h2>'; imprimirTabulados(6); echo '<form action="index.php" method="post">'; imprimirTabulados(6); echo '<fieldset class="login">'; imprimirTabulados(6); $clase = array('class' => 'tablaCarga'); $tabla = new HTML_Table($clase); $tabla->setAutoGrow(true); $tabla->setHeaderContents(0, 0, 'Usuario'); $tabla->setCellContents(0, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="username" value="" />'); $tabla->setHeaderContents(1, 0, 'Contraseña'); $tabla->setCellContents(1, 1, '<input class="campoTexto campoTextoAlineado" type="password" name="password" value="" />'); $tabla->setColAttributes(0, $clase); $tabla->setColAttributes(1, $clase); echo $tabla->toHtml(); imprimirTabulados(6); echo '<br /><input type="submit" name="botonIniciarSesion" value="Iniciar sesión" >'; imprimirTabulados(6); echo '</fieldset>'; imprimirTabulados(6); echo '</form>'; imprimirTabulados(5); echo '</div>'; }
public function __construct() { parent::__construct('all_categories'); if ($this->loginError) { return; } $cat_list = pdCatList::create($this->db); echo '<h1>Publication Categories</h1>'; foreach (array_keys($cat_list) as $cat_id) { unset($fields); unset($cells); $category = new pdCategory(); $result = $category->dbLoad($this->db, $cat_id); assert('$result'); $table = new HTML_Table(array('class' => 'publist')); $table->setAutoGrow(true); $cells[] = '<b>' . $category->category . '</b><br/>'; if (count($category->info) > 0) { foreach ($category->info as $info_id => $name) { $fields[] = $name; } $cells[] = 'Fields: ' . implode(', ', $fields); } else { $cells[] = ''; } if ($this->access_level > 0) { $cells[] = $this->getCategoryIcons($category); } $table->addRow($cells); $table->updateColAttributes(0, array('class' => 'category'), NULL); $table->updateColAttributes(2, array('class' => 'icons'), NULL); echo $table->toHtml(); unset($table); } }
/** * 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()); }
public function __construct() { parent::__construct('bibtex', null, false); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_ids)) { $this->pageError = true; return; } $pubs = explode(',', $this->pub_ids); if (!is_array($pubs) || count($pubs) == 0) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pubs)); if (!is_array($pub_list) || count($pub_list) == 0) { $this->pageError = true; return; } $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $pub_count = 0; foreach ($pub_list as $pub) { $pub_count++; $result = $pub->dbLoad($this->db, $pub->pub_id); if ($result === false) { $this->pageError = true; return; } $table->addRow(array('<pre>' . $pub->getBibtex() . '</pre>')); } // now assign table attributes including highlighting for even and odd // rows for ($i = 0; $i < $table->getRowCount(); $i++) { if ($i & 1) { $table->updateRowAttributes($i, array('class' => 'even'), true); } else { $table->updateRowAttributes($i, array('class' => 'odd'), true); } } $table->updateColAttributes(0, array('class' => 'publist'), true); echo $table->toHtml(); }
public function authorShow($auth) { $result = ''; $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0')); $table->setAutoGrow(true); $table->addRow(array('Name:', $auth->name)); if (isset($auth->title) && trim($auth->title) != "") { $table->addRow(array('Title:', $auth->title)); } $table->addRow(array('Email:', "<a href='mailto:" . $auth->email . "'>" . $auth->email . "</a>")); $table->addRow(array('Organization:', $auth->organization)); $webpage = str_replace('http://', '', $auth->webpage); if (isset($auth->webpage) && !empty($webpage)) { $webpage = "<a href=\"" . $auth->webpage . "\" target=\"_blank\">" . $auth->webpage . "</a>"; } else { $webpage = "none"; } $table->addRow(array('Webpage:', $webpage)); $interestsStr = ''; if (isset($auth->interests) && is_array($auth->interests)) { $interestsStr = implode('; ', array_values($auth->interests)); } $table->addRow(array('Interest(s):', $interestsStr)); if ($auth->totalPublications == 0) { $table->addRow(array('No publications by this author'), array('colspan' => 2)); } else { if ($auth->totalPublications <= 6) { assert('is_array($auth->pub_list)'); $headingCell = 'Publications:'; $table->addRow(array($headingCell)); } else { $table->addRow(array('Publications:', '<a id="start" href="#">Show Publications by this author</a>')); } } $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%')); $result .= $table->toHtml(); if ($auth->totalPublications > 0 && $auth->totalPublications <= 6) { $result .= displayPubList($this->db, $auth->pub_list); } else { $result .= "<div id=\"publist\"> </div>"; } $this->css(); $this->javascript(); return $result; }
/** * 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(); }
/** * 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(); }
public function showUser() { $user =& $_SESSION['user']; $user->collaboratorsDbLoad($this->db); echo '<h2>Login Information <a href="edit_user.php?status=edit">', '<img src="../images/pencil.gif" title="edit" ', 'alt="edit" height="16" width="16" border="0" ', 'align="top" /></a></h2>'; $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0')); $table->setAutoGrow(true); $table->addRow(array('Login:'******'Name:', $user->name)); $table->addRow(array('E-mail:', $user->email)); $option_value = $user->showInternalInfo() ? 'Yes' : 'No'; $table->addRow(array('Show Internal Info:', $option_value)); $option_value = $user->showUserInfo() ? 'Yes' : 'No'; $table->addRow(array('Show User Info:', $option_value)); if (is_array($user->collaborators) && count($user->collaborators) > 0) { $rowcount = 0; foreach ($user->collaborators as $collaborator) { if ($rowcount == 0) { $cell1 = 'Favorite Collaborators:'; } else { $cell1 = ''; } $table->addRow(array($cell1, $collaborator)); $rowcount++; } } else { $table->addRow(array('Favorite Collaborators:', 'None assigned')); } $table->updateColAttributes(0, array('class' => 'emph', 'width' => '30%')); $this->table =& $table; }
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"; $col = 0; $table->setCellContents($record + 1, $col, $record + 1); $table->setRowAttributes($record + 1, $hrAttrs, true); 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}"); } } fwrite($csv, "\n"); $chartData .= "]"; } } $record++; } $chartData .= "\n]);\n"; $chartData .= "\n\nvar options = {\ntitle: '" . $sql_key . "'\n};\n\nvar chart = new google.visualization.LineChart(document.getElementById('chart_div'));\n chart.draw(data, options);\n}\n</script>"; fwrite($csv, "\n"); fclose($csv); $html .= "<body class='report'>\n"; $html .= "<h1>{$title}</h1>\n"; $html .= "<p>" . str_replace("\n", "<br>", $description) . "</p>\n"; $html .= "<h2>Report Name: {$report}</h2>\n"; $html .= "<h3>Parameters Passed:</h3>\n"; $html .= "<table>\n"; foreach ($parms as $key => $value) { $html .= "<tr><td>{$key}</td><td>{$value}</td></tr>\n"; } $html .= "</table>\n"; $html .= "<br>\n"; $html .= "<form method='post' action='report_download.php'>\n"; $html .= "<input name='report' type='hidden' value='" . $file_name . "'>\n"; $html .= "<input type='submit' value='Download CSV'>\n"; $html .= "</form>\n"; $html .= "<h3>" . $sql_key . " - " . $query[$sql_key] . "</h3>\n"; $html .= "<table><tr><td style='{vertical-align:top}'>\n"; $html .= $table->toHtml() . "</td>"; $html .= "<td style='{vertical-align:top}'><div id='chart_div' style='width: 900px; height: 600px;'></div><td>"; $html .= "</tr>\n</table>"; }
/** * 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()); }
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') { // Valid Column Format $table->setCellContents($record + 1, $col, $this->formatValue($this->formats[strtolower($key)]->type, $value)); } else { // Invalid Row Format $table->setCellContents($record + 1, $col, $value); } } else { // No format $table->setCellContents($record + 1, $col, $value); } } // CSV if ($col == 1) { fwrite($fh, '"' . $value . '"'); } else { fwrite($fh, ',"' . $value . '"'); } } fwrite($fh, "\n"); } } $record++; } fwrite($fh, "\n"); fclose($fh); // Get the HTML for the table if ($this->isHidden == FALSE) { $this->HTML = $table->toHTML(); } else { $this->HTML = ''; } }
/** * 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();*/ }
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; }
/** * Muestra el formulario para editar un período existente. */ private function imprimirFormularioEditarPeriodo() { $periodo = $this->gestorPeriodos->getPeriodo($_REQUEST['idPeriodoEditar']); imprimirTabulados(5); echo '<div class="tablaTituloBotones">'; imprimirTabulados(6); echo '<h1>Editar</h1>'; imprimirTabulados(6); echo '<form action="periodos.php" method="post">'; imprimirTabulados(6); echo '<fieldset>'; imprimirTabulados(6); $clase = array('class' => 'tablaCarga'); $tabla = new HTML_Table($clase); $tabla->setAutoGrow(true); $tabla->setHeaderContents(0, 0, 'Nombre'); $tabla->setCellContents(0, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="nombre" value="' . $periodo->getNombre() . '" />'); $tabla->setHeaderContents(1, 0, 'Fecha de inicio'); $tabla->setCellContents(1, 1, $periodo->imprimirInicio()); $tabla->setHeaderContents(2, 0, 'Fecha de fin'); $tabla->setCellContents(2, 1, $periodo->imprimirFin()); $tabla->setHeaderContents(3, 0, 'Área'); $tabla->setCellContents(3, 1, $periodo->getArea()->getNombreArea()); $tabla->setHeaderContents(4, 0, 'Observaciones'); $tabla->setCellContents(4, 1, '<textarea name="observaciones" rows="4" cols="20">' . $periodo->getObservaciones() . '</textarea>'); $tabla->setColAttributes(0, $clase); $tabla->setColAttributes(1, $clase); echo $tabla->toHtml(); imprimirTabulados(6); echo '<input type="hidden" name="idPeriodoEditar" value="' . $periodo->getIdPeriodo() . '" />'; imprimirTabulados(6); echo '<br /><input type="submit" name="enviarEditarPeriodo" value="Enviar" >'; imprimirTabulados(6); echo '</fieldset>'; imprimirTabulados(6); echo '</form>'; imprimirTabulados(5); echo '</div>'; }
<?php $data = array('0' => array('Bakken', 'Stig', '', '*****@*****.**'), '1' => array('Merz', 'Alexander', '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();
/** * 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(); }
/** * Muestra el formulario para dar de alta un nuevo usuario. */ private function imprimirFormularioNuevoUsuario() { imprimirTabulados(5); echo '<div class="tablaTituloBotones">'; imprimirTabulados(6); echo '<h1>Nuevo usuario</h1>'; imprimirTabulados(6); echo '<form action="usuario.php" method="post">'; imprimirTabulados(6); echo '<fieldset>'; imprimirTabulados(6); $clase = array('class' => 'tablaCarga'); $tabla = new HTML_Table($clase); $tabla->setAutoGrow(true); $tabla->setHeaderContents(0, 0, 'Tipo de documento'); $tabla->setCellContents(0, 1, '<select class="cuadroSeleccion cuadroSeleccionAlineado" name="tipoDocumento"><option>DNI</option><option>LE</option><option>LC</option></select>'); $tabla->setHeaderContents(1, 0, 'Número de documento *'); $tabla->setCellContents(1, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="numeroDocumentoNuevo" value="" />'); $tabla->setHeaderContents(2, 0, 'Nombre *'); $tabla->setCellContents(2, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="nombre" value="" />'); $tabla->setHeaderContents(3, 0, 'Segundo nombre'); $tabla->setCellContents(3, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="segundoNombre" value="" />'); $tabla->setHeaderContents(4, 0, 'Apellido *'); $tabla->setCellContents(4, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="apellido" value="" />'); $tabla->setHeaderContents(5, 0, 'Fecha de nacimiento *'); $tabla->setCellContents(5, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="fechaNacimiento" value="DD-MM-AAAA" />'); $tabla->setHeaderContents(6, 0, 'Dirección *'); $tabla->setCellContents(6, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="direccion" value="" />'); $tabla->setHeaderContents(7, 0, 'Teléfono fijo'); $tabla->setCellContents(7, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="telefonoFijo" value="" />'); $tabla->setHeaderContents(8, 0, 'Teléfono celular'); $tabla->setCellContents(8, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="telefonoCelular" value="" />'); $tabla->setHeaderContents(9, 0, 'E-mail *'); $tabla->setCellContents(9, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="email" value="" />'); $tabla->setHeaderContents(10, 0, 'Legajo *'); $tabla->setCellContents(10, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="legajo" value="" />'); $tabla->setHeaderContents(11, 0, 'Área *'); $tabla->setCellContents(11, 1, $this->mostrarAreasMultipleSeleccion()); $tabla->setHeaderContents(12, 0, 'Tipo de usuario'); $tabla->setCellContents(12, 1, $this->mostrarNiveles()); $tabla->setHeaderContents(13, 0, 'Activo'); $tabla->setCellContents(13, 1, '<select class="cuadroSeleccionAlineado" name="activo"><option value="1">Si</option><option value="0">No</option></select>'); $tabla->setHeaderContents(14, 0, 'Notas'); $tabla->setCellContents(14, 1, '<textarea class="areaTexto" name="notas" rows="4" cols="20"></textarea>'); $tabla->setColAttributes(0, $clase); $tabla->setColAttributes(1, $clase); echo $tabla->toHtml(); imprimirTabulados(6); echo '<br /><input type="submit" name="enviarNuevoUsuario" value="Enviar" >'; imprimirTabulados(6); echo '</fieldset>'; imprimirTabulados(6); echo '</form>'; imprimirTabulados(6); echo '<div class="notas">'; imprimirTabulados(7); echo '<p>(*) Campos obligatorios</p>'; imprimirTabulados(6); echo '</div>'; imprimirTabulados(5); echo '</div>'; }
function displayPubListByCategory(&$db, &$pub_list, $enumerate = true, $max = -1, $options = null, $url_prefix = '') { assert('is_object($db)'); assert('is_array($pub_list)'); $result = ''; $count = 0; $col_desciptions = pdPublication::collaborationsGet($db); foreach (pdPubList::catDisplayOrder() as $category) { $pubs =& $pub_list[$category]; if (empty($pubs)) { continue; } if ($category == 'Other') { $result .= "<h3>Other Categories</h3>\n"; } else { $result .= '<h3>' . $category . "</h3>\n"; } foreach ($pubs as $pub) { ++$count; $pub->dbLoad($db, $pub->pub_id); $cells = array(); $table = new HTML_Table(array('class' => 'publist', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $citation = $pub->getCitationHtml($url_prefix) . ' ' . getPubIcons($db, $pub, 0xf, $url_prefix); if (is_array($options) && !empty($options['show_internal_info']) && $options['show_internal_info'] || isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) { $citation .= '<br/><span style="font-size:80%">'; if (isset($pub->ranking)) { $citation .= 'Ranking: ' . $pub->ranking; } if (is_array($pub->collaborations) && count($pub->collaborations) > 0) { $values = array(); foreach ($pub->collaborations as $col_id) { $values[] = $col_desciptions[$col_id]; } $citation .= '<br/>Collaboration:' . implode(', ', $values); } if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) { $citation .= "<br/>User Info: {$pub->user}"; } $citation .= '</span>'; } if ($enumerate) { $cells[] = $count . '.'; } $cells[] = $citation; $table->addRow($cells); if ($enumerate) { $table->updateColAttributes(0, array('class' => 'item'), NULL); } $result .= $table->toHtml(); unset($table); if ($max > 0 && $count >= $max) { break; } } } return $result; }