} } } //} } ######################################################## # Center columns 2,4,5and 6. Columns start with 0 index ######################################################## $table->updateColAttributes(1, "align=center"); $table->updateColAttributes(4, "align=center"); $table->updateColAttributes(5, "align=center"); $table->updateColAttributes(3, "align=center"); ######################################################## # Dump the table HTML into a variable ######################################################## $table_html = $table->toHTML(); #echo($table_html); $message = "<HTML>\n<BODY>\nThese licenses will expire within " . $lead_time . " days. Licenses \nwill expire at 23:59 on the day of expiration.<p>"; $message .= $table_html; ######################################################################## # If the table has more than one row (header row will be one) there # are expiring licenses ########################################################################( if ($table->getRowCount() > 1) { if ($notify_to && !isset($_GET['nomail'])) { $message .= "<p>URL: <a href=\"" . $URL . "\">" . $URL . "</a></p>"; $message .= "</HTML>"; echo "Emailing to {$notify_to}<p>\n"; mail($notify_to, "ALERT: License expiration within " . $lead_time . " days", $message, "From: License Robot <" . $notify_from . ">\nContent-Type: text/html\nMime-Version: 1.0"); } }
$table->setHeaderContents(0, 0, "Order ID"); $table->setHeaderContents(0, 1, "Client ID"); $table->setHeaderContents(0, 2, "Order Time"); $table->setHeaderContents(0, 3, "Sub Total"); $table->setHeaderContents(0, 4, "Shipping Cost"); $table->setHeaderContents(0, 5, "Total Cost"); // Cycle through the array to produce the table data // Create and execute the query $query = "SELECT id AS `Order ID`, client_id AS `Client ID`,\n order_time AS `Order Time`,\n CONCAT('\$', sub_total) AS `Sub Total`,\n CONCAT('\$', shipping_cost) AS `Shipping Cost`,\n CONCAT('\$', total_cost) AS `Total Cost`\n FROM sales ORDER BY id"; $stmt = $mysqli->prepare($query); $stmt->execute(); $stmt->bind_result($orderID, $clientID, $time, $subtotal, $shipping, $total); // Begin at row 1 so don't overwrite the header $rownum = 1; // Format each row while ($stmt->fetch()) { $table->setCellContents($rownum, 0, $orderID); $table->setCellContents($rownum, 1, $clientID); $table->setCellContents($rownum, 2, $time); $table->setCellContents($rownum, 3, $subtotal); $table->setCellContents($rownum, 4, $shipping); $table->setCellContents($rownum, 5, $total); $rownum++; } // Output the data echo $table->toHTML(); // Close the MySQL connection $mysqli->close(); ?>
function getDetails($id, $tplname = 'details.tpl.html') { $this->tpl = new HTML_Template_IT($basedir); $this->tpl->loadTemplateFile($this->basedir . $tplname); $query = "select * from " . $this->cfg['table']['compound'] . " where id = {$id}"; $row = $this->db_con->getRow($query); $this->tpl->setVariable("HEADING", $row->{"name_" . LC_LANG}); $this->tpl->setVariable('LC_SPECIFICATIONS', $this->lang->translate('specifications')); $query = "select *,comp.id as mixid, comp.name_de as mischname_de,comp.name_en as mischname_en,cat_comp.name_de as mischkatname_de,cat_comp.name_en as mischkatname_en\n from " . $this->cfg['table']['cat_compound'] . ' as cat_comp, ' . $this->cfg['table']['compound'] . " as comp\n where comp.id_mischungkat=cat_comp.id AND comp.id={$id}"; $row = $this->db_con->getRow($query); include_once 'HTML/Table.php'; $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array($this->lang->translate('name'), $row->{"mischname_" . LC_LANG})); $tbl->addRow(array($this->lang->translate('category'), $row->{"mischkatname_" . LC_LANG})); $tbl->addRow(array('M100', $row->m100)); $tbl->addRow(array('M300', $row->m300)); $tbl->addRow(array('TS', $row->ts)); $tbl->addRow(array('EAB', $row->eab)); $tbl->addRow(array('Rebound', $row->rebound)); $tbl->addRow(array('Shore A', $row->shore_a)); $tbl->addRow(array('SG', $row->sg)); $tbl->setColAttributes(0, 'width="100"'); $tbl->setColAttributes(1, 'width="300"'); $row1Style = array('class' => 'overview'); $row2Style = array('class' => 'overviewalternate'); $tbl->altRowAttributes(0, $row1Style, $row2Style); $this->tpl->setVariable("COMPOUND_DATA", $tbl->toHTML()); $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array('Name', 'phr'), 'class="overview"', 'TH'); $query = "select * from " . $this->cfg['table']['details_compound'] . " where id_mischung={$id}"; $this->db_res = $this->db_con->Query($query); while ($row = $this->db_res->fetchrow(DB_FETCHMODE_OBJECT)) { if ($row->id_produkt) { $_url = '<a class="maroon" href="' . url(array('module' => 'product', 'action' => 'details', 'id' => $row->id_produkt)) . '">' . $row->name . '</a>'; } else { $_url = $row->name; } $tbl->addRow(array($_url, $row->phr)); } $query = "select sum(phr) as phrsum from " . $this->cfg['table']['details_compound'] . " where id_mischung={$id}"; $row = $this->db_con->getRow($query); $tbl->addRow(array('', $row->phrsum)); $tbl->updateColAttributes(1, 'align="right" "bgcolor=#eeeeee"'); $tbl->updateRowAttributes($tbl->getrowCount() - 1, "bgcolor=#CCCCCC"); $this->tpl->setVariable('TBL_DETAILS', $tbl->toHTML()); $this->tpl->setVariable("CATEGORY_COLOR", $this->color); return $this->tpl->get(); }
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if (is_readable($this->file . "/action/" . $this->registry->action . ".php") == false || $this->registry->action == "index") { $this->registry->Error('404 Page NOT Found', $this->registry->path); } else { $title = ucwords(str_replace("_", " ", $this->registry->action)); $this->registry->page_title = $title; $this->setTitle($title . ' | ' . $this->get('config.server.site_name')); $table_attrs = array('class' => 'contentpaneopen'); $rowAttrs = array('class' => 'contentheading', 'width' => '100%'); $table = new HTML_Table($table_attrs); $table->setCellContents(0, 0, $this->registry->page_title); $table->setColAttributes(0, $rowAttrs); $this->addContent($table->toHTML()); require_once 'action/' . $this->registry->action . '.php'; }
$tbl->addRow(array($lang->translate('website'), $row->product_url)); $tbl->setColAttributes(0, 'width="100"'); $tbl->setColAttributes(1, 'width="300"'); $row1Style = array('class' => 'overview'); $row2Style = array('class' => 'overviewalternate'); $tbl->altRowAttributes(0, $row1Style, $row2Style); $tpl->setVariable("UEBERSCHRIFT", $row->product_name); $tpl->SetVariable("TABELLE_UEBERSCHRIFT", $row->product_name . " (" . $link_back . ")"); /** BEGIN Vertrieb **/ $query = "select *,t_reseller.name as reseller\n from {$table['product']},{$table['company']} as t_reseller, {$table['reseller']}\n where {$table['product']}.id={$id}\n AND {$table['product']}.id={$table['reseller']}.id_produkt\n AND {$table['reseller']}.id_firma=t_reseller.id"; require_once 'mms_tablepager.php'; $tabpage = new PageTable($cfg['database']['dsn'], "overview"); $tabpage->fields = array('name', 'land'); $tabpage->make_url = false; $tabpage->add_extra = false; $tabpage->col_view = 'name'; $tabpage->url_view = url(array('module' => 'company', 'action' => 'details')); $res_vertrieb = '<h2>' . $lang->translate('reseller') . '</h2>' . $tabpage->get($query, $from, 'overview') . '<br>'; /** END Vertrieb **/ /** BEGIN Beispielmischungen **/ $query = "select *,{$table['compound']}.id as mixid, {$table['compound']}.name_" . LC_LANG . " as mischname from {$table['product']},{$table['compound_details']},{$table['compound']} where {$table['compound_details']}.id_produkt={$table['product']}.id AND {$table['compound']}.id = {$table['compound_details']}.id_mischung AND {$table['product']}.id={$id}"; $tabpage = new PageTable($cfg['database']['dsn'], "overview"); $tabpage->fields = array('mischname'); $tabpage->map_cols = array('mischname' => $lang->translate('compound')); $tabpage->url_view = url(array('module' => 'compound', 'action' => 'details')); $tabpage->setEmptyString($lang->translate('no compounds available for this product')); $res_compound = '<h2>' . $lang->translate('compound') . '</h2>' . $tabpage->get($query, $from, 'overview'); /** END Beispielmischungen **/ $tpl->setCurrentBlock("TABELLEBLOCK"); $tpl->setVariable("TABELLE", $tbl->toHTML() . $res_vertrieb . $res_compound); $tpl->parseCurrentBlock();
$stmt = $mysqli->prepare($query); $stmt->execute(); $stmt->bind_result($id, $number, $name, $sex, $birthday, $age, $idno, $cell, $tel, $email, $marriage, $hometown, $livesite, $feature, $memo); $rownum = 1; //不是从第0行,而是从第1行开始,所以不会覆盖表头 while ($stmt->fetch()) { $table->setCellContents($rownum, 0, $id); $table->setCellContents($rownum, 1, $number); $table->setCellContents($rownum, 2, $name); $table->setCellContents($rownum, 3, $sex); $table->setCellContents($rownum, 4, $birthday); $table->setCellContents($rownum, 5, $age); $table->setCellContents($rownum, 6, $idno); $table->setCellContents($rownum, 7, $cell); $table->setCellContents($rownum, 8, $tel); $table->setCellContents($rownum, 9, $email); $table->setCellContents($rownum, 10, $marriage); $table->setCellContents($rownum, 11, $hometown); $table->setCellContents($rownum, 12, $livesite); $table->setCellContents($rownum, 13, $feature); $table->setCellContents($rownum, 14, $memo); $table->altRowAttributes(1, null, array("class" => "alt")); //隔行变色 $rownum++; } $tb = $table->toHTML(); $mysqli->close(); ?>
/** fiches_a_valider () - Renvoie les annonces restant a valider par un administrateur * * @return string HTML */ function fiches_a_valider() { // Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique // On effectue une requete sur le bazar pour voir les fiches a administrer $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_ADMIN); $res = '<h2>' . BAZ_ANNONCES_A_ADMINISTRER . '</h2><br />' . "\n"; $requete = 'SELECT * FROM ' . BAZ_PREFIXE . 'fiche, ' . BAZ_PREFIXE . 'nature WHERE bf_statut_fiche=0 AND ' . 'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN (' . $GLOBALS['_BAZAR_']['categorie_nature'] . ') '; if (isset($GLOBALS['_BAZAR_']['langue'])) { $requete .= ' and bn_ce_i18n like "' . $GLOBALS['_BAZAR_']['langue'] . '%" '; } $requete .= 'ORDER BY bf_date_maj_fiche DESC'; $resultat = $GLOBALS['_BAZAR_']['db']->query($requete); if (DB::isError($resultat)) { echo 'Echec de la requete<br />' . $resultat->getMessage() . '<br />' . $resultat->getDebugInfo(); } if ($resultat->numRows() != 0) { $tableAttr = array('id' => 'table_bazar'); $table = new HTML_Table($tableAttr); $entete = array(BAZ_TITREANNONCE, BAZ_ANNONCEUR, BAZ_TYPE_FICHE, BAZ_PUBLIER, BAZ_SUPPRIMER); $table->addRow($entete); $table->setRowType(0, 'th'); // On affiche une ligne par proposition while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { //Requete pour trouver le nom et prenom de l'annonceur $requetenomprenom = 'SELECT ' . BAZ_CHAMPS_PRENOM . ', ' . BAZ_CHAMPS_NOM . ' FROM ' . BAZ_ANNUAIRE . ' WHERE ' . BAZ_CHAMPS_ID . '=' . $ligne['bf_ce_utilisateur']; $resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query($requetenomprenom); if (DB::isError($resultatnomprenom)) { echo "Echec de la requete<br />" . $resultatnomprenom->getMessage() . "<br />" . $resultatnomprenom->getDebugInfo(); } while ($lignenomprenom = $resultatnomprenom->fetchRow(DB_FETCHMODE_ASSOC)) { $annonceur = $lignenomprenom[BAZ_CHAMPS_PRENOM] . " " . $lignenomprenom[BAZ_CHAMPS_NOM]; } $lien_voir = $GLOBALS['_BAZAR_']['url']; $lien_voir->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']); //$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']); // Nettoyage de l'url // NOTE (jpm - 23 mai 2007): pour �tre compatible avec PHP5 il faut utiliser tjrs $GLOBALS['_BAZAR_']['url'] car en php4 on // copie bien une variable mais pas en php5, cela reste une r�f�rence... $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); //$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce'); $GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']); $GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $ligne['bn_id_nature']); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien_voir = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PUBLIER); $lien_publie_oui = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PAS_PUBLIER); $lien_publie_non = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_SUPPRESSION); $lien_supprimer = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce'); $table->addRow(array('<a href="' . $lien_voir . '">' . $ligne['bf_titre'] . '</a>' . "\n", $annonceur . "\n", $ligne['bn_label_nature'] . "\n", "<a href=\"" . $lien_publie_oui . "\">" . BAZ_OUI . "</a> / \n" . "<a href=\"" . $lien_publie_non . "\">" . BAZ_NON . "</a>", "<a href=\"" . $lien_supprimer . "\"" . " onclick=\"javascript:return confirm('" . BAZ_CONFIRMATION_SUPPRESSION . "');\">" . BAZ_SUPPRIMER . "</a>\n")); // col 5 : supprimer } $table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire")); $table->updateColAttributes(1, array("align" => "center")); $table->updateColAttributes(2, array("align" => "center")); $table->updateColAttributes(3, array("align" => "center")); $table->updateColAttributes(4, array("align" => "center")); $res .= $table->toHTML(); } else { $res .= '<p class="zone_info">' . BAZ_PAS_DE_FICHE_A_VALIDER . '</p>' . "\n"; } $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_TOUTES_ANNONCES); // Nettoyage de l'url $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce'); // Les autres fiches, deja validees $res .= '<h2>' . BAZ_TOUTES_LES_FICHES . '</h2>' . "\n"; $requete = 'SELECT * FROM ' . BAZ_PREFIXE . 'fiche, ' . BAZ_PREFIXE . 'nature WHERE bf_statut_fiche=1 AND ' . 'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN (' . $GLOBALS['_BAZAR_']['categorie_nature'] . ') '; if (isset($GLOBALS['_BAZAR_']['langue'])) { $requete .= ' and bn_ce_i18n like "' . $GLOBALS['_BAZAR_']['langue'] . '%" '; } $requete .= 'ORDER BY bf_date_maj_fiche DESC'; $resultat = $GLOBALS['_BAZAR_']['db']->query($requete); if (DB::isError($resultat)) { echo 'Echec de la requete<br />' . $resultat->getMessage() . '<br />' . $resultat->getDebugInfo(); } if ($resultat->numRows() != 0) { $tableAttr = array('class' => 'table_bazar'); $table = new HTML_Table($tableAttr); $entete = array(BAZ_TITREANNONCE, BAZ_ANNONCEUR, BAZ_TYPE_FICHE, BAZ_PUBLIER, BAZ_SUPPRIMER); $table->addRow($entete); $table->setRowType(0, 'th'); // On affiche une ligne par proposition while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { //Requete pour trouver le nom et prenom de l'annonceur $requetenomprenom = 'SELECT ' . BAZ_CHAMPS_PRENOM . ', ' . BAZ_CHAMPS_NOM . ' FROM ' . BAZ_ANNUAIRE . ' WHERE ' . BAZ_CHAMPS_ID . '=' . $ligne['bf_ce_utilisateur']; $resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query($requetenomprenom); if (DB::isError($resultatnomprenom)) { echo "Echec de la requete<br />" . $resultatnomprenom->getMessage() . "<br />" . $resultatnomprenom->getDebugInfo(); } while ($lignenomprenom = $resultatnomprenom->fetchRow(DB_FETCHMODE_ASSOC)) { $annonceur = $lignenomprenom[BAZ_CHAMPS_PRENOM] . " " . $lignenomprenom[BAZ_CHAMPS_NOM]; } $lien_voir = $GLOBALS['_BAZAR_']['url']; $lien_voir->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']); $lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']); // Nettoyage de l'url // NOTE (jpm - 23 mai 2007): pour être compatible avec PHP5 il faut utiliser tjrs $GLOBALS['_BAZAR_']['url'] car en php4 on // copie bien une variable mais pas en php5, cela reste une référence... $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce'); $GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']); $GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $ligne['bn_id_nature']); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien_voir = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PUBLIER); $lien_publie_oui = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PAS_PUBLIER); $lien_publie_non = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_SUPPRESSION); $lien_supprimer = $GLOBALS['_BAZAR_']['url']->getURL(); $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce'); $table->addRow(array('<a href="' . $lien_voir . '">' . $ligne['bf_titre'] . '</a>' . "\n", $annonceur . "\n", $ligne['bn_label_nature'] . "\n", "<a href=\"" . $lien_publie_oui . "\">" . BAZ_OUI . "</a> / \n" . "<a href=\"" . $lien_publie_non . "\">" . BAZ_NON . "</a>", "<a href=\"" . $lien_supprimer . "\"" . " onclick=\"javascript:return confirm('" . BAZ_CONFIRMATION_SUPPRESSION . "');\">" . BAZ_SUPPRIMER . "</a>\n")); // col 5 : supprimer } $table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire")); $table->updateColAttributes(1, array("align" => "center")); $table->updateColAttributes(2, array("align" => "center")); $table->updateColAttributes(3, array("align" => "center")); $table->updateColAttributes(4, array("align" => "center")); $res .= $table->toHTML(); } $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR); return $res; }
/** * Draw the cell for the day $days * * @param days Date_Calc's 'days' value * @param week week number of this cell in the calendar * @param col column number of this cell in the calendar * * @access public * @return string of the rendered HTML */ function drawCell($days, $week, $col) { $type = $this->getType($days); $a = array_merge($this->_attributes['day'], $this->_attributes['day_' . $type]); $t = new HTML_Table($a); $t->addRow(array($this->drawCellLabel($days, $week, $col))); $t->setRowAttributes(0, $this->_attributes['label']); $t->updateRowAttributes(0, $this->_attributes['label_' . $type]); if ($this->_size & HTML_CALENDAR_FULL) { $type = $this->getType($days); if (!$this->_otherMonths && $type == 'other_month') { $cell_text = ' '; } else { $cell_text = $this->drawCellText($days, $week, $col); } $t->addRow(array($cell_text)); $t->setRowAttributes(1, $this->_attributes['text']); $t->updateRowAttributes(1, $this->_attributes['text_' . $type]); } return $t->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 = ''; } }
function listTableDbVars($withForm = 1, $doNl2Br = 1, $listAction = "") { //Ajouter les identifiants ajoutés precédemment au liens HREF de la table //Cf MODIF_FP.pl require_once 'HTML/Table.php'; $table = new HTML_Table("class=\"localList\""); $header = $this->fetchHeader(); $content = $this->fetchListe(); $id_name = $this->getIdName(); foreach ($header as $value) { if ($value->visible) { $tab_row[0][] = $value->content; } } $fkeys = $this->getFKeysString(); $cpt_row = 1; while ($a_row = fetchRowAssocDb($content)) { foreach ($header as $key => $value) { if ($value->visible && $key != "ATAB_CHKSELECT_" && $key != "ATAB_SELECT_") { if ($doNl2Br == 1) { $tab_row[$cpt_row][] = nl2br(htmlentities($a_row[$key], ENT_QUOTES, $this->encoding)); } else { $tab_row[$cpt_row][] = htmlentities($a_row[$key], ENT_QUOTES, $this->encoding); } } } // Afficher ou non la colonne des checkbox de selection if ($header['ATAB_CHKSELECT_']->visible) { $tab_row[$cpt_row][] = "<p align=\"center\"><input type=\"checkbox\" name=\"SEL_" . $id_name . "_" . $a_row[$id_name] . "\" value=\"ON\" " . ($this->vars["SEL_" . $id_name . "_" . $a_row[$id_name]] == "ON" ? "CHECKED" : "") . "><input type=\"hidden\" name=\"WAS_" . $id_name . "_" . $a_row[$id_name] . "\" value = \"" . $this->vars["SEL_" . $id_name . "_" . $a_row[$id_name]] . "\" size=\"6\"></p>"; } // Afficher ou non la colonne des liens de selection if ($header['ATAB_SELECT_']->visible) { $tab_row[$cpt_row][] = "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?" . $id_name . "=" . $a_row[$id_name] . "&" . $fkeys . "\">[{$cpt_row}]</A>"; } $cpt_row++; } foreach ($tab_row as $key => $value) { $table->addRow($tab_row[$key], $key == 0 ? "class=\"firstLine\"" : ""); } //formulaire ayant action sur le tableau $str_form = "<div align=\"center\">\n"; if ($withForm == 1) { $str_form .= "<form method=\"post\" name=\"{$this->name}_TBL\" action=\"" . $_SERVER['PHP_SELF'] . "?" . $GLOBALS['QUERY_STRING'] . "\">\n"; } $str_form .= $table->toHTML(); if ($withForm == 1) { $str_form .= "<input type=\"submit\" value=\"Sélectionner\" name=\"SELECTIONNER_{$this->name}\">\n"; $str_form .= "<input type=\"submit\" value=\"Supprimer\" name=\"SUPPRIMER_{$this->name}\">\n"; $str_form .= "</form></div>\n"; } $str_form .= "\n"; return $str_form; }
/** * 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();*/ }
// | Authors: Tim Franz <*****@*****.**> | // +----------------------------------------------------------------------+ // // $Id: details.php,v 1.1 2002/08/07 09:25:47 moleman Exp $ $tabelle = $cfg['table']['company']; $query = "select * from {$tabelle} where id = {$id}"; $row = $db_con->getRow($query); include_once 'HTML/Table.php'; $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array($lang->translate('company_name'), $row->name)); $tbl->addRow(array($lang->translate('street'), $row->strasse)); $tbl->addRow(array($lang->translate('street_postnr'), $row->strasse_plz)); $tbl->addRow(array($lang->translate('pobox'), $row->postfach)); $tbl->addRow(array($lang->translate('pobox_postnr'), $row->postfach_plz)); $tbl->addRow(array($lang->translate('phone'), $row->tel)); $tbl->addRow(array($lang->translate('fax'), $row->fax)); $tbl->addRow(array($lang->translate('city'), $row->ort)); $tbl->addRow(array($lang->translate('country'), $row->land)); $tbl->setColAttributes(0, 'width="100"'); $tbl->setColAttributes(1, 'width="300"'); $row1Style = array('class' => 'overview'); $row2Style = array('class' => 'overviewalternate'); $tbl->altRowAttributes(0, $row1Style, $row2Style); $tpl->setVariable("UEBERSCHRIFT", $row->name); if ($row->url_logo) { $tpl->setVariable("COMPANY_LOGO", "<img src=\"" . URL_LOGO . $row->url_logo . "\">"); } $tpl->setCurrentBlock("TABELLEBLOCK"); $tpl->SetVariable("TABELLE_UEBERSCHRIFT", $lang->translate('company')); $tpl->setVariable("TABELLE", $tbl->toHTML()); $tpl->parseCurrentBlock();
private function contentpaneHeading($heading) { $table = new HTML_Table(array('class' => 'contentpaneopen')); $table->setCellContents(0, 0, stripslashes($heading)); $table->setColAttributes(0, array('class' => 'contentheading')); return $table->toHTML(); }
# Keep track of total number of licenses for a particular feature # this is since you can have licenses with different expiration $total_licenses += $feature_array[$p]["num_licenses"]; $feature_table->addRow(array($feature_array[$p]["num_licenses"] . " license(s) expire(s) in " . $feature_array[$p]["days_to_expiration"] . " day(s) Date of expiration: " . $feature_array[$p]["expiration_date"]), "colspan=\"3\""); ####################################################################### # Check whether license is close to expiration date ####################################################################### if ($feature_array[$p]["days_to_expiration"] <= $lead_time) { if ($feature_array[$p]["days_to_expiration"] >= 0) { $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"expires_soon\""); } elseif ($feature_array[$p]["days_to_expiration"] < 0) { $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"already_expired\""); } } } $table->addRow(array($key, $feature_array[0]["vendor_daemon"], $total_licenses, $feature_table->toHTML())); unset($feature_table); } ######################################################## # Center columns 2. Columns start with 0 index ######################################################## $table->updateColAttributes(1, "align=\"center\""); $table->display(); } else { ######################################################## # Licenses currently being used ######################################################## echo "<p>Following is the list of licenses currently being used. Licenses that are currently not in use are not shown.</p>\n"; # stop the annoying errors in error_log saying undefined var # happens when no user lics been checked out if (isset($host['cacti'])) {
include_once 'HTML/Table.php'; $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array($lang->translate('company_name'), $row->name)); $tbl->addRow(array($lang->translate('street'), $row->strasse)); $tbl->addRow(array($lang->translate('street_postnr'), $row->strasse_plz)); $tbl->addRow(array($lang->translate('pobox'), $row->postfach)); $tbl->addRow(array($lang->translate('pobox_postnr'), $row->postfach_plz)); $tbl->addRow(array($lang->translate('phone'), $row->tel)); $tbl->addRow(array($lang->translate('fax'), $row->fax)); $tbl->addRow(array($lang->translate('city'), $row->ort)); $tbl->addRow(array($lang->translate('country'), $row->land)); $tbl->addRow(array($lang->translate('Email'), make_link($row->email))); $tbl->addRow(array($lang->translate('Website'), make_link($row->website))); $tbl->setColAttributes(0, 'width="100"'); $tbl->setColAttributes(1, 'width="300"'); $row1Style = array('class' => 'overview'); $row2Style = array('class' => 'overviewalternate'); $tbl->altRowAttributes(0, $row1Style, $row2Style); if (strlen($row->{"profile_" . LC_LANG}) > 0) { "<h2>" . $lang->translate('profile') . "</h2>" . $row->{"profile_" . LC_LANG}; } else { $profile = ""; } $tpl->setVariable("UEBERSCHRIFT", $row->name); if ($row->url_logo) { $tpl->setVariable("COMPANY_LOGO", "<img src=\"" . $cfg['path']['logo'] . $row->url_logo . "\">"); } $tpl->setCurrentBlock("TABELLEBLOCK"); $tpl->SetVariable("TABELLE_UEBERSCHRIFT", $lang->translate('company')); $tpl->setVariable("TABELLE", $tbl->toHTML() . $profile); $tpl->parseCurrentBlock();