<div class="preview_tpl" id="previewData"> <div class="header_tpl">Strings</div> <table cellspacing="0" cellpadding="0" border="0"> <tr class="tr_hdr_tpl"><td>Template</td><td>Key</td><td>Value</td><td>Result</td></tr> <tr class="first_row_tpl"><td>uppercase</td><td>first_name</td><td>#first_name#</td><td>#first_name|uppercase#</td></tr> <tr><td>uppercase</td><td>last_name</td><td>#last_name#</td><td>#last_name|uppercase#</td></tr> <tr><td>lowercase</td><td>addr1</td><td>#addr1#</td><td>#addr1|lowercase#</td></tr> <tr><td>lowercase</td><td>addr2</td><td>#addr2#</td><td>#addr2|lowercase#</td></tr> <tr><td>maxlength</td><td>company</td><td>#company#</td><td>#company|maxlength:11:true#</td></tr> </table> </div> <?php $table = new \core\html\Table(); $table->addAtributos("tr", array("class" => "tr_hdr_tpl")); $table->body(array("Tabela", "Registros", "metadados", "editar")); $table->addAtributos("tr", array("class" => "first_row_tpl")); foreach ($listaTabelas as $lista => $metadados) { $linkMetaDados = '<a href="' . \core\url\Url::setURL("tabelas", "metaDadosTable", array(), null, array('table' => $metadados['TABLE_NAME'])) . '" title="editar metadados da tabela ' . $metadados['TABLE_NAME'] . '">IMG META</a>'; $linkEditar = '<a href="' . \core\url\Url::setURL("tabelas", "visualizarDados", array(), null, array('table' => $metadados['TABLE_NAME'])) . '" title="editar dados da tabela ' . $metadados['TABLE_NAME'] . '">EDITAR DADOS</a>'; $table->body(array($metadados['TABLE_NAME'], $metadados['TABLE_ROWS'], $linkMetaDados, $linkEditar)); } echo '<div class="preview_tpl" id="previewData">'; echo '<div class="header_tpl">Lista de tabelas do sistema</div>'; echo $table->getTable(); echo '</div>'; ?> </body>
$label[] = $column_name['column_name']; } foreach ($label as $vLabel) { $dados[] = '<label for="' . $vLabel . '">' . $vLabel . ': </label>'; if ($vLabel == $primary_key) { $dados[] = '<input type="text" name="' . $vLabel . '" value="' . $registroTabela[0][$vLabel] . '" readonly="readonly">'; $id = $registroTabela[0][$vLabel]; } else { $dados[] = '<input type="text" name="' . $vLabel . '" value="' . $registroTabela[0][$vLabel] . '" >'; } //$table->body( $dados ); //unset( $dados ); $output[] = $dados; unset($dados); } $table = new \core\html\Table(); /* foreach ( $arrayLabel as $key => $column_name ){ $label[] = $column_name['column_name']; } foreach( $label as $vLabel ){ $dados[] = '<label for="'.$vLabel.'">'.$vLabel.': </label>'; if( $vLabel == $primary_key ){ $dados[] = '<input type="text" name="'.$vLabel.'" value="'.$registroTabela[0][$vLabel].'" readonly="readonly">'; }else{ $dados[] = '<input type="text" name="'.$vLabel.'" value="'.$registroTabela[0][$vLabel].'" >'; } $table->body( $dados ); unset( $dados );
font-size: 12px; font-family: Monospace,Consolas; padding: 2px 20px 2px 5px; } div.preview_tpl tr.tr_hdr_tpl td { border-bottom: 1px solid #a4bed4; padding-bottom: 8px; } div.preview_tpl tr.first_row_tpl td { padding-top: 7px; } </style> </head> <body> <?php $table = new \core\html\Table(); $table->addAtributos("tr", array("class" => "tr_hdr_tpl")); foreach ($cabecalhoTabela as $key => $column_name) { $cabecalho[] = $column_name['column_name']; } # define o cabeçalho da tabela //$cabecalhoTabela = array_keys( $metaDadosTabela[0] ); $cabecalho[] = "editar"; $cabecalho[] = "excluir"; //$table->body( array_keys( $dadosTabela[0] ) ); $table->body($cabecalho); $table->addAtributos("tr", array("class" => "first_row_tpl")); //debug(__FILE__, __LINE__, array_keys($metaDataTable[0]) ); foreach ($dadosTabela as $row => $dados) { /* * é necessário a identificação automática da chave primária para
var data = { first_name: "Richard", last_name: "Wilson", addr1: "Upton Avenue 1870", addr2: "Liberty Square 4949", company: "Monk Home Loans" }; var parentObj = document.getElementById("previewData"); parentObj.innerHTML = window.dhx4.template(parentObj.innerHTML, data); } </script> </head> <body onload="doOnLoad();"> <?php $table = new \core\html\Table(); $table->addAtributos("tr", array("class" => "tr_hdr_tpl")); # define o cabeçalho da tabela $table->body(array_keys($metaDataTable[0])); $table->addAtributos("tr", array("class" => "first_row_tpl")); //debug(__FILE__, __LINE__, array_keys($metaDataTable[0]) ); foreach ($metaDataTable as $row => $metadados) { //$linkMetaDados = '<a href="'..'" title="editar metadados da tabela '.$metadados['TABLE_NAME'].'">IMG META</a>'; //$linkEditar = '<a href="'..'" title="editar dados da tabela '.$metadados['TABLE_NAME'].'">EDITAR DADOS</a>'; //$table->body(array($metadados['TABLE_NAME'], $metadados['TABLE_ROWS'])); $table->body($metadados); } echo '<div class="preview_tpl" id="previewData">'; echo '<div class="header_tpl">Metadados da tabela <b>' . $tabelaAnalise['table'] . '</b></div>'; echo $table->getTable(); echo '</div>';