Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Pessoa();
     $endereco_res = new EnderecoResidencial();
     if (isset($_POST["EnderecoResidencial"])) {
         $model->endereco_residencial = json_encode($_POST["EnderecoResidencial"]);
     }
     $model->password = '';
     if (isset($_POST['Pessoa'])) {
         $model->attributes = $_POST['Pessoa'];
         $model->data_nascimento = Sipesq::dateRfc($model->data_nascimento);
         //Criptografa a senha
         if ($model->validate()) {
             $model->password = md5($model->password);
         }
         if (isset($_POST['Atividade']['projetos_atuante'])) {
             $model->projetos_atuante = $_POST['Pessoa']['projetos_atuante'];
         }
         if ($model->save()) {
             foreach ($model->projetos_atuante as $p) {
                 $ppa = new ProjetoPessoaAtuante();
                 $ppa->cod_pessoa = $model->cod_pessoa;
                 $ppa->cod_projeto = $p;
                 $ppa->save();
                 unset($ppa);
             }
             $this->redirect(array('view', 'id' => $model->cod_pessoa));
         }
     }
     $this->render('create', array('model' => $model, 'endereco_res' => $endereco_res));
 }
Ejemplo n.º 2
0
	
	<?php 
if ($model->tipo == RubricaCampo::CAMPO_TEXTO_LONGO) {
    ?>
		<?php 
    echo CHtml::textArea('ProjetoDespesaInfo[' . $key . '][valor]', $model->valor);
    ?>
	<?php 
}
?>
	
	<?php 
if ($model->tipo == RubricaCampo::CAMPO_DATA) {
    ?>
		<?php 
    echo CHtml::tag('input', array('name' => 'ProjetoDespesaInfo[' . $key . '][valor]', 'type' => 'date', 'value' => is_null($model->valor) ? date('Y-m-d') : Sipesq::dateRfc($model->valor)));
    ?>
	<?php 
}
?>
	
	<?php 
if ($model->tipo == RubricaCampo::CAMPO_ANEXO) {
    ?>
	
		<?php 
    if ($model->valor != '') {
        ?>
			<?php 
        $filename = substr($model->valor, stripos($model->valor, '_') + 1);
        ?>