/** * 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()); }
/** * 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(); }
/** * 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(); }
<?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();
if ($this->authorize()) { $sql = "\n\t\tSELECT page_id, page, mdate\n\t\tFROM " . $this->registry->core . "pages\n\t"; $result = $this->registry->db->query($sql); $num_pages = count($result); $menuBar = array('new_page' => '/content/new'); $this->content .= $num_pages <= $this->registry->settings['pages'] || $this->registry->settings['pages'] == -1 ? $this->makeToolbar($menuBar, 24) : $this->message(array('TYPE' => 'info', 'MESSAGE' => '<h2>You have reach your page limit. To add more pages please contact your administrator.</h2>')); if ($num_pages > 0) { $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">';
// set $msg if ($freed) { $msg = 'freeng_success'; } } include './inc/adminHeader.php'; 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);
/** * 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; }