Skip to content

A simple HTML Table to see which DB tables have been generated

Philip Michael Raab edited this page Jun 26, 2014 · 3 revisions

A simple HTML Table to see which DB tables have been generated

This will create a simple html table to show the status of the class files.

As you can see i used a mad ass route with children... change this for what ever suits you.

The tables name colour code:

  • Red: No class file
  • Orange: Outdated class file
  • Green: Correct class file

Controller-action:

$bm = new BuilderManager('Dossier');
return new ViewModel(['builderManager' => $bm]);

View:

<?php
$route = 'dossier/default/builder';
$routeChild = ['controller' => 'builder', 'action' => 'build', 'table' => '0', 'type' => 0];
?>
<table>
<tr>
	<th>table</th>
	<th colspan='3'>generate</th>
</tr>
<tr>
		<td>Write All</td>
		<td><a class='bmButton' style='color: blue' href='<?= $this->url($route, $routeChild)?>'>dataTable</a></td>
		<?php $routeChild['type'] = 1; ?>
		<td><a class='bmButton' style='color: blue' href='<?= $this->url($route, $routeChild)?>'>entityabstract</a></td>
		<?php $routeChild['type'] = 2; ?>
		<td><a class='bmButton' style='color: blue' href='<?= $this->url($route, $routeChild)?>'>entity</a></td>
	</tr>
<?php
$bm = $this->builderManager;
$statusColour=[-1 => 'red', 0 => 'orange', 1 => 'green'];

while ($bm->nextTable()) {
	$table = $bm->getTableName();
	
	$dtc = $statusColour[$bm->existsDataTable()];
	$eac = $statusColour[$bm->existsEntityAbstract()];
	$ec = $statusColour[$bm->existsEntity()];
	
	$routeChild['table'] = $table;
	?>
	<tr>
		<td><?=$table ?></td>
		<?php $routeChild['type'] = 0; ?>
		<td><a class='bmButton' style='color: <?=$dtc?>' href='<?= $this->url($route, $routeChild)?>'>dataTable</a></td>
		<?php $routeChild['type'] = 1; ?>
		<td><a class='bmButton' style='color: <?=$eac?>' href='<?= $this->url($route, $routeChild)?>'>entityabstract</a></td>
		<?php $routeChild['type'] = 2; ?>
		<td><a class='bmButton' style='color: <?=$ec?>' href='<?= $this->url($route, $routeChild)?>'>entity</a></td>
	</tr>
<?php } ?>

Home

Real Easy

Using the classes

  • Properties
  • Relations
  • Events

Generating the classes

Clone this wiki locally