Skip to content

Instantly share code, notes, and snippets.

@braulioholtz
Created May 5, 2014 14:00
Show Gist options
  • Save braulioholtz/0d3540f8685e16944a64 to your computer and use it in GitHub Desktop.
Save braulioholtz/0d3540f8685e16944a64 to your computer and use it in GitHub Desktop.
<?php
echo $this->Form->create("Cliente");
?>
<h3>Visualizar dados do Clientes</h3><br/>
<label>Cliente:</label>
<input type="hidden" name="id" value="<?php echo $clientes['Cliente']['id']; ?>"/>
<?php
$options = array('class' => 'form-control');
echo $this->Form->hidden('id');
echo $this->Form->input('nome', $options);
echo $this->Form->input('email', $options);
echo $this->Form->input('telefone', $options);
echo $this->Form->input('mais', $options);
$i = 0;
foreach ($opcoes as $data):
$i++;
$id = $data['Opcao']['id'];
$host_ativ = $data['Opcao']['host_ativ'];
$usuario_ativ = $data['Opcao']['usuario_ativ'];
$host = "";
$usuario = "";
$senha = "";
foreach ($clientes['opcoes_clientes'] as $op_value) {
if ($op_value["id"] == $id) {
$host = $op_value['host'];
$usuario = $op_value['user'];
$senha = $op_value['password'];
}
}
echo $this->Form->hidden('opcoes_clientes.'.$i.'.opco_id', array('value' => $id));
echo $this->Form->hidden('opcoes_clientes.'.$i.'.cliente_id', array('value' => $clientes['Cliente']['id']));
echo ' <fieldset><legend>' . $data['Opcao']['opcao'] . '</legend>';
if ($host_ativ == '1') {
$options = array('class' => 'form-control');
echo $this->Form->input('opcoes_clientes.'.$i.'.host', $options);
}
if ($usuario_ativ == '1') {
$options = array('value' => $usuario, 'class' => 'form-control');
echo $this->Form->input('opcoes_clientes.'.$i.'.user', $options);
}
$options = array('value' => $senha, 'class' => 'form-control');
echo $this->Form->input('opcoes_clientes.'.$i.'.password', $options);
endforeach;
$options = array(
'label' => 'Salvar',
'class' => 'btn btn-lg btn-primary btn-block',
);
echo $this->Form->end($options);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment