public function actionUpdate() { $model = Arquiteto::model()->findByPk($_POST['id']); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $model->attributes = $_POST['Arquiteto']; $modelUser = User::model()->findByPk($model->id_user); $modelUser->attributes = $_POST['User']; // if ($modelUser->save()) { // $model->update(); $modelUser->update(); $this->render('index'); // $this->layout = false; // header('Content-type: application/json'); // $id = $_POST['User_username']; // echo json_encode($id); // // Yii::app()->end(); }
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $id_user = Yii::app()->user->getId(); $model = User::model()->find($condition = "id={$id_user}"); if (Arquiteto::model()->exists($condition = "id_user={$id_user}")) { $tipo = "Arquiteto"; $perfil = Arquiteto::model()->find($condition = "id_user={$id_user}"); } else { if (Loja::model()->exists($condition = "id_user={$id_user}")) { $tipo = "Loja"; $perfil = Loja::model()->find($condition = "id_user={$id_user}"); } else { $tipo = "Admin"; } } ?> <div class="content sortableContent"> <div class="page-header"> <div class="icon"> <span class="ico-user"></span> </div> <h1>Perfil <small>GERENCIAMENTO DO PERFIL</small></h1> </div> <div class="row-fluid"> <div class="span4 column">