<div id="<?php echo $this->id; ?>" class="steps-content">
<?php
$form = $this->step4Form;
echo $this->form()->openTag($form);
?>
<div class="row">
<div class="col-sm-12">
<h3><?php echo $this->translate('tr_melistoolcreator_table_cols_title') ?></h3>
<p><?php echo $this->translate('tr_melistoolcreator_table_cols_desc') ?></p>
</div>
<?php if ($this->hasError){ ?>
<div class="col-sm-12">
<div class="alert alert-danger">
<p><?php echo $this->translate('tr_melistoolcreator_err_no_selected_col') ?></p>
</div>
</div>
<?php } ?>
<div class="col-sm-12">
<?php if ($this->langTblCols) { ?>
<h4><?php echo $this->translate('tr_melistoolcreator_pri_tbl_cols') ?></h4>
<?php } ?>
<div class="melis-toolcreator-steps-tbl-cols">
<div class="widget-body list table-responsive">
<table class="table table-striped table-primary">
<thead>
<tr>
<?php
$checkBoxIcon = "fa-check-square-o text-success";
if (isset($this->tblColumns)){
$ctr = 0;
foreach ($this->priTblCols As $col){
if (in_array($col['Field'], $this->tblColumns))
$ctr++;
// Counting field with Blob type
if (!is_bool(strpos($col['Type'], 'blob')))
$ctr++;
}
if (count($this->priTblCols) != $ctr)
$checkBoxIcon = "fa-square-o";
}
?>
<th><i class="fa <?php echo $checkBoxIcon ?> fa-lg tcf-fa-checkbox tcf-fa-checkall tfc-table-list" data-col-type="pri-cols"></i></th>
<th>#</th>
<th><?php echo $this->translate('tr_melistoolcreator_col_pk') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_name') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_type') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_null') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_default') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_extra') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_display') ?></th>
</tr>
</thead>
<?php
$ctr = 1;
foreach ($this->priTblCols As $col){
// Excluding field with Blob type
if (!is_bool(strpos($col['Type'], 'blob')))
continue;
$pk = in_array($col['Key'], array('PRI')) ? '<i class="fa fa-key fa-lg fa-rotate-90"></i>': '';
$checkBox = $form->get('tcf-db-table-cols')->setCheckedValue($col['Field']);
$colDsplay = $form->get('tcf-db-table-col-display');
$colDsplay->setAttribute('data-col-type', 'pri-cols');
$checkBoxIcon = "fa-check-square-o text-success";
$checkBox->setChecked(true);
if (!empty($this->tblColumns)){
if (!in_array($col['Field'], $this->tblColumns)){
$checkBox->setChecked(false);
$checkBoxIcon = "fa-square-o";
$colDsplay->setAttribute('disabled', 'disabled');
$colDsplay->setValue('rawView');
}else{
$colDsplay->removeAttribute('disabled');
$key = array_search($col['Field'], $this->tblColumns);
$colDsplay->setValue($this->tblColumnsDisplay[$key]);
}
}
echo '<tr>
<td>
<i class="fa '.$checkBoxIcon.' fa-lg tcf-fa-checkbox tcf-fa-checkitem tfc-table-list" data-col-type="pri-cols"></i>
'.$this->formElement($checkBox).'
</td>
<td>'.$ctr++.'</td>
<td>'.$pk.'</td>
<td><b>'.$col['Field'].'</b></td>
<td>'.$col['Type'].'</td>
<td>'.$col['Null'].'</td>
<td>'.$col['Default'].'</td>
<td>'.$col['Extra'].'</td>
<td>'.$this->formElement($colDsplay).'</td>
</tr>';
}
?>
</table>
</div>
</div>
</div>
<?php if ($this->langTblCols) { ?>
<div class="col-sm-12">
<h4><?php echo $this->translate('tr_melistoolcreator_lang_tbl_cols') ?></h4>
<div class="melis-toolcreator-steps-tbl-cols">
<div class="widget-body list table-responsive">
<table class="table table-striped table-primary">
<thead>
<tr>
<?php
$checkBoxIcon = "fa-check-square-o text-success";
if (isset($this->tblColumns)){
$ctr = 0;
foreach ($this->langTblCols As $col){
if (in_array('tclangtblcol_'.$col['Field'], $this->tblColumns))
$ctr++;
// Counting field with Blob type
if (!is_bool(strpos($col['Type'], 'blob')))
$ctr++;
}
if (count($this->langTblCols) != $ctr)
$checkBoxIcon = "fa-square-o";
}
?>
<th><i class="fa <?php echo $checkBoxIcon ?> fa-lg tcf-fa-checkbox tcf-fa-checkall tfc-table-list" data-col-type="lang-cols"></i></th>
<th>#</th>
<th><?php echo $this->translate('tr_melistoolcreator_col_pk') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_fk') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_name') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_type') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_null') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_default') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_extra') ?></th>
<th><?php echo $this->translate('tr_melistoolcreator_col_display') ?></th>
</tr>
</thead>
<?php
$ctr = 1;
foreach ($this->langTblCols As $col){
// Excluding field with Blob type
if (!is_bool(strpos($col['Type'], 'blob')))
continue;
$pk = in_array($col['Key'], array('PRI')) ? '<i class="fa fa-key fa-lg fa-rotate-90"></i>': '';
// Adding prefix "tclangtblcol_" for language columns
$langCOls = 'tclangtblcol_'.$col['Field'];
$checkBox = $form->get('tcf-db-table-cols')->setCheckedValue($langCOls);
$colDsplay = $form->get('tcf-db-table-col-display');
$colDsplay->setAttribute('data-col-type', 'lang-cols');
$checkBoxIcon = "fa-check-square-o text-success";
$checkBox->setChecked(true);
if (!empty($this->tblColumns)){
if (!in_array($langCOls, $this->tblColumns)){
$checkBox->setChecked(false);
$checkBoxIcon = "fa-square-o";
$colDsplay->setAttribute('disabled', 'disabled');
$colDsplay->setValue('rawView');
}else{
$colDsplay->removeAttribute('disabled');
$key = array_search($langCOls, $this->tblColumns);
$colDsplay->setValue($this->tblColumnsDisplay[$key]);
}
}
$fk = null;
if (!empty($this->fkCols)){
if (in_array('tclangtblcol_'.$col['Field'], $this->fkCols)){
$fk = '<i class="fa fa-key fa-lg fa-rotate-90 fa-key-fk"></i>';
}
}
$skipCol = false;
if ($col['Field'] == $this->fkMainTbl){
$skipCol = true;
}
if (!$skipCol){
echo '<tr>
<td>
<i class="fa '.$checkBoxIcon.' fa-lg tcf-fa-checkbox tcf-fa-checkitem tfc-table-list" data-col-type="lang-cols"></i>
'.$this->formElement($checkBox).'
</td>
<td>'.$ctr++.'</td>
<td>'.$pk.'</td>
<td>'.$fk.'</td>
<td><b>'.$col['Field'].'</b></td>
<td>'.$col['Type'].'</td>
<td>'.$col['Null'].'</td>
<td>'.$col['Default'].'</td>
<td>'.$col['Extra'].'</td>
<td>'.$this->formElement($colDsplay).'</td>
</tr>';
}
}
?>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
echo $this->form()->closeTag();
?>
<button class="btn btn-default btn-steps" data-curstep="4" data-nxtstep="3"><?php echo $this->translate('tr_melistoolcreator_back') ?></button>
<button class="btn btn-default float-right btn-steps tcf-validate" data-curstep="4" data-nxtstep="5"><?php echo $this->translate('tr_melistoolcreator_next') ?></button>
</div>
|