Função de geração dos campos do formulário
@param  object $tableInfo
@return string
552494
private function genFieldsFormIni($tableInfo) {
        $return = "\n\n[formfieldsconfig]\n\n";

        $primaryKeyColumn = null;

        foreach ($tableInfo->getConstraints() as $key => $value) {
            if ($value->getType() == 'PRIMARY KEY') {
                $temp = $value->getColumns();
                $primaryKeyColumn = $temp[0];
            }
        }

        foreach ($tableInfo->getColumns() as $value) {

            $returnExtra = $returnBody = $returnType = $returnValidation = null;

            $key = $value->getName();

            if ($key == $primaryKeyColumn) {
                $returnType .= "{$key}.type = \"primary\"\n";
                $returnBody .= "{$key}.name = \"{$key}\"\n";
            } elseif (strtolower($key) === 'ind_status') {
                $returnType .= "{$key}.type = \"status\"\n";
                $returnBody .= "{$key}.name = \"{$key}\"\n";
                $returnExtra .= "{$key}.values = \"A,B\"\n";
            } else {

                switch (strtolower($value->getDataType())) {
                    case 'integer':
                        $returnType .= "{$key}.type = \"number\"\n";
                        $returnValidation .= "{$key}.validation = \"required number\"\n";
                        $returnValidation .= "{$key}.validationtype[] = \"int\"\n\n";
                        break;
                    case 'text':
                        $returnType .= "{$key}.type = \"textarea\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n\n";
                        break;
                    case 'character varying':
                        $returnType .= "{$key}.type = \"text\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n\n";
                        break;
                    case 'character':
                        $returnType .= "{$key}.type = \"status\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n\n";
                        break;
                    case 'timestamp without time zone':
                        $returnType .= "{$key}.type = \"datetime\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n";
                        $returnValidation .= "{$key}.validationtype[] = \"datetime\"\n\n";
                        break;
                    case 'date':
                        $returnType .= "{$key}.type = \"date\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n";
                        $returnValidation .= "{$key}.validationtype[] = \"date\"\n\n";
                        break;
                    case 'time without time zone':
                        $returnType .= "{$key}.type = \"time\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n";
                        $returnValidation .= "{$key}.validationtype[] = \"time\"\n\n";
                        break;
                    case 'decimal':
                    case 'float':
                    case 'double':
                        $returnType .= "{$key}.type = \"float\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n";
                        $returnValidation .= "{$key}.validationtype[] = \"float\"\n\n";
                        break;
                    default:
                        $returnType .= "{$key}.type = \"text\"\n";
                        $returnValidation .= "{$key}.validation = \"required\"\n\n";
                        break;
                }

                $returnBody .= "{$key}.name = \"{$key}\"\n";
                $returnBody .= "{$key}.tooltip = \"false\"\n";
                $returnBody .= "{$key}.description = \"false\"\n";
                $returnBody .= "{$key}.placeholder = \"false\"\n";
            }
            $return .= $returnType . $returnBody . $returnValidation . $returnExtra . "\n";
        }

        return $return;
    }
403156
public static function tableformat($array){  
		
		
		
		$t_str = '';
		$content = $array['content'];
		$i = 0;
		
								
		if(is_array($content) && !empty($content)){
			foreach($content as $d){
				$i++;
				if($i == 1){
					$t_str .='<thead><tr>';
					if(is_array($d) && !empty($d)){
						foreach($d as $v){
							$t_str .='<th>'.$v.'</th>';
						}
					}
					$t_str .='</tr></thead>';
				}else{
					if($i == 2)
						$t_str .='<tbody>';
					
					$t_str .='<tr>';
					if(is_array($d) && !empty($d)){
						foreach($d as $v){
							$t_str .='<td>'.$v.'</td>';
						}
					}
					$t_str .='</tr>';
					
				}
				
			}
			$t_str .='</tbody>';
		}
		$str = '
			<style>
			table.list th:first-child{
				width:22%;
				
			}
			</style>
			<table class="list" style="width:100%">
				<thead>
					<tr>
						<th>'.$array['title'].'</th>
					</tr>
				</thead>
				<tbody>
					
					<tr>
						<td>
							'.$array['description'].'
							<br/>
							
							<table class="list" style="width:100%">
								'.$t_str.'
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		<br/>';
		
		return $str;
			
	}
909648
public function getTableTitle()
    {
        $rate = _t(
            'TaxModifier.TABLE_TITLE',
            '{rate}% BTW',
            null,
            array(
                'rate' => (float)self::config()->get('tax_rate')
            )
        );

        if ((bool)self::config()->get('inclusive')) {
            $inc = _t('TaxModifier.INCLUSIVE', '(Incl.)');
            $rate .= " $inc";
        }

        return $rate;
    }
420687
public function getFieldData(VersionInfo $versionInfo)
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('product_id')
            ->from('ngsyliusproduct')
            ->where(
                $query->expr()->eq('contentobject_id', ':contentobject_id')
            )
            ->setParameter('contentobject_id', $versionInfo->contentInfo->id, Type::INTEGER);

        $statement = $query->execute();

        $rows = $statement->fetchAll(PDO::FETCH_ASSOC);

        return !empty($rows[0]['product_id']) ? (int) $rows[0]['product_id'] : null;
    }
987455
public function getTableInfo($table)
    {
        if (!$this->tableExists($table)) {
            return null;
        }
        
        $rtable = static::buildRealTableName($table, true);
        $key = 'db/tableinfo/' . $rtable;
        $data = static::getCache()->get($key);
        
        if (!$data) {
            $data = ['table_name' => $table];
            $data['fields'] = $this->getColumns($table);
            $pk = [];
            foreach ($data['fields'] as $key => $val) {
                if($val['is_primary']) {
                    $pk[] = $key;
                }
            }
            $data['primary_key'] = $pk ? $pk[0] : null;
            
            static::getCache()->set($key, $data);
        }
        
        return $data;
    }
117042
public function getParentIdColumnName(bool $withTableName = false): string
    {
        return ($withTableName) ? $this->addTableName($this->parentIdColumnName) : $this->parentIdColumnName;
    }
1283747
public function getModifyTableColumnsDDL(TableDiff $tableDiff)
    {
        $ret = '';

        foreach ($tableDiff->getRemovedColumns() as $column) {
            $ret .= $this->getRemoveColumnDDL($column);
        }

        foreach ($tableDiff->getRenamedColumns() as $columnRenaming) {
            $ret .= $this->getRenameColumnDDL($columnRenaming[0], $columnRenaming[1]);
        }

        if ($modifiedColumns = $tableDiff->getModifiedColumns()) {
            $ret .= $this->getModifyColumnsDDL($modifiedColumns);
        }

        if ($addedColumns = $tableDiff->getAddedColumns()) {
            $ret .= $this->getAddColumnsDDL($addedColumns);
        }

        return $ret;
    }
1090670
public function getTableAsString()
    {
        $lines = array();
        for ($i = 0; $i < count($this->getRows()); $i++) {
            $lines[] = $this->getRowAsString($i);
        }

        return implode("\n", $lines);
    }
890081
public function getLevelColumnName(bool $withTableName = false): string
    {
        return ($withTableName) ? $this->addTableName($this->levelColumnName) : $this->levelColumnName;
    }
1021543
protected function _fetchTableInfo($table)
    {
        $result = null;
        $sql    = $this->quoteValue($this->getTableNeedle().$table);

        if ($info  = $this->show('SHOW TABLE STATUS LIKE '.$sql, AnDatabase::FETCH_OBJECT)) {
            //Parse the table raw schema data
            $result = $this->_parseTableInfo($info);
        }

        return $result;
    }
1002543
protected function renderInfo()
    {
        $ret = '';
        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Elements ($info)');
        ksort($this->def->info);
        $ret .= $this->heavyHeader('Allowed tags', 2);
        $ret .= $this->start('tr');
        $ret .= $this->element('td', $this->listifyTagLookup($this->def->info), array('colspan' => 2));
        $ret .= $this->end('tr');
        foreach ($this->def->info as $name => $def) {
            $ret .= $this->start('tr');
            $ret .= $this->element('th', "<$name>", array('class' => 'heavy', 'colspan' => 2));
            $ret .= $this->end('tr');
            $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Inline content');
            $ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
            $ret .= $this->end('tr');
            if (!empty($def->excludes)) {
                $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Excludes');
                $ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
                $ret .= $this->end('tr');
            }
            if (!empty($def->attr_transform_pre)) {
                $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Pre-AttrTransform');
                $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
                $ret .= $this->end('tr');
            }
            if (!empty($def->attr_transform_post)) {
                $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Post-AttrTransform');
                $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
                $ret .= $this->end('tr');
            }
            if (!empty($def->auto_close)) {
                $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Auto closed by');
                $ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
                $ret .= $this->end('tr');
            }
            $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Allowed attributes');
            $ret .= $this->element('td', $this->listifyAttr($def->attr), array(), 0);
            $ret .= $this->end('tr');

            if (!empty($def->required_attr)) {
                $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
            }

            $ret .= $this->renderChildren($def->child);
        }
        $ret .= $this->end('table');
        return $ret;
    }
864560
protected function getAlterTableInfo($table)
    {
        $columns = $table->getColumns();
        $indexes = $table->getIndexes();
        $name    = $table->getName();

        $databaseService = new DatabaseService($this->config, $this->files);
        $upMigrations    = [
            'columns' => [
                'add'  => [],
                'drop' => [],
            ],
            'indexes' => [
                'add'  => [],
                'drop' => [],
            ],
        ];
        $downMigrations  = [
            'columns' => [
                'add'  => [],
                'drop' => [],
            ],
            'indexes' => [
                'add'  => [],
                'drop' => [],
            ],
        ];

        $updated = false;

        $currentColumns = $databaseService->getTableColumns($name);
        $newColumnNames = array_map(function ($column) {
            return $column->getName();
        }, $columns);
        $oldColumnNames = array_map(function ($column) {
            return $column->getName();
        }, $currentColumns);

        $mustHaveColumns = ['created_at', 'updated_at'];
        foreach ($mustHaveColumns as $column) {
            if (!in_array($column, $newColumnNames)) {
                $newColumnNames[] = $column;
            }
            if (!in_array($column, $oldColumnNames)) {
                $oldColumnNames[] = $column;
            }
        }

        $addedColumns   = array_diff($newColumnNames, $oldColumnNames);
        $removedColumns = array_diff($oldColumnNames, $newColumnNames);

        $previousColumnName = '';
        foreach ($columns as $column) {
            if (in_array($column->getName(), $addedColumns)) {
                $columnObject = new Column($column);

                $upMigrations['columns']['add'][]    = $columnObject->generateAddMigration($previousColumnName).';';
                $downMigrations['columns']['drop'][] = $columnObject->generateDropMigration().';';
                $updated                             = true;
            }
            $previousColumnName = $column->getName();
        }

        $previousColumnName = '';
        foreach ($currentColumns as $column) {
            if (in_array($column->getName(), $removedColumns)) {
                $columnObject = new Column($column);

                $upMigrations['columns']['drop'][]  = $columnObject->generateDropMigration().';';
                $downMigrations['columns']['add'][] = $columnObject->generateAddMigration($previousColumnName).';';
                $updated                            = true;
            }
            $previousColumnName = $column->getName();
        }

        $currentIndexes = $databaseService->getTableIndexes($name);
        $newIndexNames  = array_map(function ($index) {
            return $index->getName();
        }, $indexes);
        $oldIndexNames  = array_map(function ($index) {
            return $index->getName();
        }, $currentIndexes);

        $addedIndexes   = array_diff($newIndexNames, $oldIndexNames);
        $removedIndexes = array_diff($oldIndexNames, $newIndexNames);

        foreach ($indexes as $index) {
            if (in_array($index->getName(), $addedIndexes)) {
                $indexObject = new Index($index);

                $upMigrations['indexes']['add'][]    = $indexObject->generateAddMigration().';';
                $downMigrations['indexes']['drop'][] = $indexObject->generateDropMigration().';';
                $updated                             = true;
            }
        }

        foreach ($currentIndexes as $index) {
            if (in_array($index->getName(), $removedIndexes)) {
                $indexObject = new Index($index);

                $upMigrations['indexes']['drop'][]  = $indexObject->generateDropMigration().';';
                $downMigrations['indexes']['add'][] = $indexObject->generateAddMigration().';';
                $updated                            = true;
            }
        }

        if (!$updated) {
            return false;
        }

        return [
            'upMigrations'   => $upMigrations,
            'downMigrations' => $downMigrations,
        ];
    }
900297
public function infof()
    {
        $args = func_get_args();
        $format = array_shift($args);
        $this->info(vsprintf($format, $args));
    }
1274017
protected function _parseColumnInfo($info)
    {
        list($type, $length, $scope) = $this->_parseColumnType($info->Type);

        $column           = new KDatabaseSchemaColumn();
        $column->name     = $info->Field;
        $column->type     = $type;
        $column->length   = $length ? $length : null;
        $column->scope    = $scope ? (int) $scope : null;
        $column->default  = $info->Default;
        $column->required = $info->Null != 'YES';
        $column->primary  = $info->Key == 'PRI';
        $column->unique   = ($info->Key == 'UNI' || $info->Key == 'PRI');
        $column->autoinc  = strpos($info->Extra, 'auto_increment') !== false;
        $column->filter   = $this->_type_map[$type];

        // Don't keep "size" for integers.
        if(substr($type, -3) == 'int') {
            $column->length = null;
        }

        // Get the related fields if the column is primary key or part of a unique multi column index.
        if($indexes = $this->_table_schema[$info->Table]->indexes)
        {
            foreach($indexes as $index)
            {
                // We only deal with composite-unique indexes.
                if(count($index) > 1 && !$index[1]->Non_unique)
                {
                    $fields = array();
                    foreach($index as $field) {
                        $fields[$field->Column_name] = $field->Column_name;
                    }

                    if(array_key_exists($column->name, $fields))
                    {
                        unset($fields[$column->name]);
                        $column->related = array_values($fields);
                        $column->unique = true;
                        break;
                    }
                }
            }
        }

        return $column;
    }
550125
public function getSequenceName(Table $table)
    {
        static $longNamesMap = array();
        $result = null;
        if ($table->getIdMethod() == IDMethod::NATIVE) {
            $idMethodParams = $table->getIdMethodParameters();
            $maxIdentifierLength = $this->getMaxColumnNameLength();
            if (empty($idMethodParams)) {
                if (strlen($table->getName() . "_SEQ") > $maxIdentifierLength) {
                    if (!isset($longNamesMap[$table->getName()])) {
                        $longNamesMap[$table->getName()] = strval(count($longNamesMap) + 1);
                    }
                    $result = substr($table->getName(), 0, $maxIdentifierLength - strlen("_SEQ_" . $longNamesMap[$table->getName()])) . "_SEQ_" . $longNamesMap[$table->getName()];
                } else {
                    $result = substr($table->getName(), 0, $maxIdentifierLength - 4) . "_SEQ";
                }
            } else {
                $result = substr($idMethodParams[0]->getValue(), 0, $maxIdentifierLength);
            }
        }

        return $result;
    }
1332380
public static function getLinhaInfo($linha)
    {
        $info = self::getLinhaCamposPeloCodigo(self::montaCodigoPelaLinha($linha));
        $campo5 = $info['campo5'];

        // Vencimento
        $vencto = self::dataPeloFator(intval(substr($campo5, 0, 4)));

        // Valor
        $valor = self::valorPeloFator(substr($campo5, 4), 2);

        // Retorno
        return [
            'vencimento' => $vencto,
            'valor' => $valor,
        ];
    }
904664
function displayInfo()
    {
        if ( !$this->DisplayInfo )
        {
            $dataType = $this->dataType();
            if ( $dataType )
                $this->DisplayInfo = $dataType->objectDisplayInformation( $this, false );
        }
        return $this->DisplayInfo;
    }