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); }
/** * 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()); }
/** * 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(); }
/** * 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 }
/** * 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();
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; }
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>'; }
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()); }
$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); }
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; }
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();*/ }
$row = 0; $column = 0; foreach ($header_names as $item) { $table->setHeaderContents($row, $column, $item); $column++; } $row = 1; if (!empty($survey_data)) { foreach ($survey_data as $data) { $column = 0; $table->setCellContents($row, $column, $data); $class = 'class="row_odd"'; if ($row % 2) { $class = 'class="row_even"'; } $table->setRowAttributes($row, $class, true); $column++; $row++; } } echo $table->toHtml(); } } // line about other tools echo '<table class="data_table">'; $csv_content[] = array(); $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId); $messages = Tracking::count_student_messages($student_id, $course_code, $sessionId); $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId); $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId); $documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
/** * Generate the HTML_Table object of the calendar * * @param day day of the calendar to generate, null = today's day * @param month month of the calendar to generate, null = today's month * @param year year of the calendar to generate, null = today's year * * @access public * @return the HTML_Table object of the calendar */ function generateTable($day = null, $month = null, $year = null) { if (empty($year)) { $year = Date_Calc::dateNow('%Y'); } if (empty($month)) { $month = Date_Calc::dateNow('%m'); } if (empty($day)) { $day = Date_Calc::dateNow('%d'); } $year = sprintf('%04d', $year); $month = sprintf('%02d', $month); $day = sprintf('%02d', $day); // get month structure for generating calendar $month_cal = Date_Calc::getCalendarMonth($month, $year, '%E'); $this->_todayDays = Date_Calc::dateFormat(null, null, null, '%E'); $this->_thisMonth = Date_Calc::dateFormat($day, $month, $year, '%m'); $row = 0; $table = new HTML_Table($this->_attributes['table']); $table->addRow(array($this->drawTitle($day, $month, $year))); $table->setRowAttributes($row, $this->_attributes['title']); $row++; for ($col = 0; $col < 7; $col++) { $table->setCellContents($row, $col, $this->drawWeekDayText($col), 'TH'); } $table->setRowAttributes($row++, $this->_attributes['weekday']); for ($week = 0; $week < count($month_cal); $week++) { for ($col = 0; $col < 7; $col++) { $table->setCellContents($row, $col, $this->drawCell($month_cal[$week][$col], $week, $col)); $type = $this->getType($month_cal[$week][$col]); $table->setCellAttributes($row, $col, $this->_attributes['cell']); $table->updateCellAttributes($row, $col, $this->_attributes['cell_' . $type]); } $row++; } return $table; }
} $allparams = $DB->get_records('settings_current', array(), 'variable,subkey'); $table = new HTML_Table(array('class' => 'data_table', 'width' => '100%')); $column = 0; $row = 0; // $table->set_additional_parameters($parameters); $headers = array('', $plugininstance->get_lang('variable'), $plugininstance->get_lang('subkey'), $plugininstance->get_lang('category'), $plugininstance->get_lang('accessurl'), $plugininstance->get_lang('value'), ''); $attrs = array('center' => 'left'); $table->addRow($headers, $attrs, 'th'); foreach ($allparams as $param) { // $check = '<input type="checkbox" name="sync_'.$param->id.'" value="'.$param->selected_value.'" />'; $check = ''; $attrs = array('center' => 'left'); $syncthisbutton = '<input type="button" name="syncthis" value="' . $plugininstance->get_lang('syncthis') . '" onclick="ajax_sync_setting(\'' . $_configuration['root_web'] . '\', \'' . $param->id . '\')" /> <input type="checkbox" name="del_' . $param->id . '" value="1" title="' . $plugininstance->get_lang('deleteifempty') . '" /> <span id="res_' . $param->id . '"></span>'; $data = array($check, $param->variable, $param->subkey, $param->category, $param->access_url, '<input type="text" name="value_' . $param->id . '" value="' . htmlspecialchars($param->selected_value, ENT_COMPAT, 'UTF-8') . '" size="40" />', $syncthisbutton); $row = $table->addRow($data, $attrs, 'td'); $table->setRowAttributes($row, array('id' => 'row_' . $param->id), true); } $content .= '<form name="settingsform" action="' . $thisurl . '">'; $content .= '<input type="hidden" name="what" value="" />'; $content .= $table->toHtml(); // $content .= '<div class"vchamilo-right"><div></div><div><input type="button" name="syncall" value="'.$plugininstance->get_lang('syncall').'" onclick="this.form.what.value=\'syncall\';this.form.submit();">'; $content .= '</form>'; $actions = ''; $message = ''; $message = require_js('ajax.js', 'vchamilo', true); $tpl = new Template($tool_name, true, true, false, true, false); $tpl->assign('actions', $actions); $tpl->assign('message', $message); $tpl->assign('content', $content); $tpl->display_one_col_template();
/** * Returns a category summary report * * @param int exercise id * @param array prefilled array with the category_id, score, and weight example: array(1 => array('score' => '10', 'total' => 20)); * @param bool $categoryMinusOne shows category - 1 see BT#6540 * @return string */ public static function get_stats_table_by_attempt($exercise_id, $category_list = array(), $categoryMinusOne = false) { if (empty($category_list)) { return null; } $category_name_list = Testcategory::getListOfCategoriesNameForTest($exercise_id, false); $table = new HTML_Table(array('class' => 'data_table')); $table->setHeaderContents(0, 0, get_lang('Categories')); $table->setHeaderContents(0, 1, get_lang('AbsoluteScore')); $table->setHeaderContents(0, 2, get_lang('RelativeScore')); $row = 1; $none_category = array(); if (isset($category_list['none'])) { $none_category = $category_list['none']; unset($category_list['none']); } $total = array(); if (isset($category_list['total'])) { $total = $category_list['total']; unset($category_list['total']); } $em = Database::getManager(); $repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory'); $redefineCategoryList = array(); if (!empty($category_list) && count($category_list) > 1) { $globalCategoryScore = array(); foreach ($category_list as $category_id => $category_item) { $cat = $em->find('ChamiloCoreBundle:CQuizCategory', $category_id); $path = $repo->getPath($cat); $categoryName = $category_name_list[$category_id]; $index = 0; if ($categoryMinusOne) { $index = 1; } if (isset($path[$index])) { $category_id = $path[$index]->getIid(); $categoryName = $path[$index]->getTitle(); } if (!isset($globalCategoryScore[$category_id])) { $globalCategoryScore[$category_id] = array(); $globalCategoryScore[$category_id]['score'] = 0; $globalCategoryScore[$category_id]['total'] = 0; $globalCategoryScore[$category_id]['title'] = ''; } $globalCategoryScore[$category_id]['score'] += $category_item['score']; $globalCategoryScore[$category_id]['total'] += $category_item['total']; $globalCategoryScore[$category_id]['title'] = $categoryName; } foreach ($globalCategoryScore as $category_item) { $table->setCellContents($row, 0, $category_item['title']); $table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false)); $table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true)); $class = 'class="row_odd"'; if ($row % 2) { $class = 'class="row_even"'; } $table->setRowAttributes($row, $class, true); $row++; } if (!empty($none_category)) { $table->setCellContents($row, 0, get_lang('None')); $table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false)); $table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true)); $row++; } if (!empty($total)) { $table->setCellContents($row, 0, get_lang('Total')); $table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false)); $table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true)); $table->setRowAttributes($row, 'class="row_total"', true); } return $table->toHtml(); } return null; }
} else { $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); } break; } $column = 0; foreach ($header_names as $item) { $table->setHeaderContents(0, $column, $item); $column++; } $row = 1; if (!empty($my_attempt_array)) { foreach ($my_attempt_array as $data) { $column = 0; $table->setCellContents($row, $column, $data); $table->setRowAttributes($row, null, true); $column++; $row++; } } $table_content = $table->toHtml(); } if ($objExercise->selectAttempts()) { $attempt_message = get_lang('Attempts') . ' ' . $counter . ' / ' . $objExercise->selectAttempts(); if ($counter == $objExercise->selectAttempts()) { $attempt_message = Display::return_message($attempt_message, 'error'); } else { $attempt_message = Display::return_message($attempt_message, 'info'); } if ($visible_return['value'] == true) { $message .= $attempt_message;