From d2c5a8b6b4be01809abd1c113e09084e10277c22 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 1 Feb 2012 15:41:14 +0000 Subject: [PATCH] =?UTF-8?q?Autentificaci=C3=B3n=20de=20usuarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@9 77cfc57b-8ef4-1849-9df6-4a38aa5da120 --- www/protected/components/UserIdentity.php | 57 +++--- .../controllers/UsuarioController.php | 176 ++++++++++++++++++ .../m120127_152205_tbl_candidatos.php | 4 + www/protected/models/Candidato.php | 15 ++ www/protected/models/LoginForm.php | 1 + www/protected/models/Usuario.php | 21 ++- www/protected/runtime/application.log | 45 +++++ .../runtime/gii-1.1.10-dev/CrudCode.php | 5 + www/protected/tests/unit/CandidatoTest.php | 11 +- .../tests/unit/CapacidadIdiomaTest.php | 11 ++ www/protected/views/usuario/_form.php | 49 +++++ www/protected/views/usuario/_search.php | 39 ++++ www/protected/views/usuario/_view.php | 28 +++ www/protected/views/usuario/admin.php | 55 ++++++ www/protected/views/usuario/create.php | 15 ++ www/protected/views/usuario/index.php | 17 ++ www/protected/views/usuario/update.php | 18 ++ www/protected/views/usuario/view.php | 28 +++ 18 files changed, 565 insertions(+), 30 deletions(-) create mode 100644 www/protected/controllers/UsuarioController.php create mode 100644 www/protected/runtime/gii-1.1.10-dev/CrudCode.php create mode 100644 www/protected/views/usuario/_form.php create mode 100644 www/protected/views/usuario/_search.php create mode 100644 www/protected/views/usuario/_view.php create mode 100644 www/protected/views/usuario/admin.php create mode 100644 www/protected/views/usuario/create.php create mode 100644 www/protected/views/usuario/index.php create mode 100644 www/protected/views/usuario/update.php create mode 100644 www/protected/views/usuario/view.php diff --git a/www/protected/components/UserIdentity.php b/www/protected/components/UserIdentity.php index a9704e5..00feabb 100644 --- a/www/protected/components/UserIdentity.php +++ b/www/protected/components/UserIdentity.php @@ -7,27 +7,38 @@ */ class UserIdentity extends CUserIdentity { - /** - * Authenticates a user. - * The example implementation makes sure if the username and password - * are both 'demo'. - * In practical applications, this should be changed to authenticate - * against some persistent user identity storage (e.g. database). - * @return boolean whether authentication succeeds. - */ - public function authenticate() - { - $users=array( - // username => password - 'demo'=>'demo', - 'admin'=>'admin', - ); - if(!isset($users[$this->username])) - $this->errorCode=self::ERROR_USERNAME_INVALID; - else if($users[$this->username]!==$this->password) - $this->errorCode=self::ERROR_PASSWORD_INVALID; - else - $this->errorCode=self::ERROR_NONE; - return !$this->errorCode; - } + private $_id; + + /** + * Authenticates a user. + * @return boolean whether authentication succeeds. + */ + public function authenticate() + { + $user = Usuario::model()->findByAttributes(array('username'=>$this->username)); + if ($user === NULL) { + $this->errorCode = self::ERROR_USERNAME_INVALID; + } + else { + + if ($user->password !== $user->encrypt($this->password)) { + $this->errorCode = self::ERROR_PASSWORD_INVALID; + } + else { + $this->_id = $user->id; + if ($user->last_login_time === null) { + $lastLogin = time(); + } else { + $lastLogin = strtotime($user->last_login_time); + $this->setState('lastLoginTime', $lastLogin); + } + $this->errorCode = self::ERROR_NONE; + } + } + return !$this->errorCode; + } + + public function getId() { + return $this->_id; + } } \ No newline at end of file diff --git a/www/protected/controllers/UsuarioController.php b/www/protected/controllers/UsuarioController.php new file mode 100644 index 0000000..93e9539 --- /dev/null +++ b/www/protected/controllers/UsuarioController.php @@ -0,0 +1,176 @@ +array('index','view'), + 'users'=>array('*'), + ), + array('allow', // allow authenticated user to perform 'create' and 'update' actions + 'actions'=>array('create','update'), + 'users'=>array('@'), + ), + array('allow', // allow admin user to perform 'admin' and 'delete' actions + 'actions'=>array('admin','delete'), + 'users'=>array('admin'), + ), + array('deny', // deny all users + 'users'=>array('*'), + ), + ); + } + + /** + * Displays a particular model. + * @param integer $id the ID of the model to be displayed + */ + public function actionView($id) + { + $this->render('view',array( + 'model'=>$this->loadModel($id), + )); + } + + /** + * Creates a new model. + * If creation is successful, the browser will be redirected to the 'view' page. + */ + public function actionCreate() + { + $model=new Usuario; + + // Uncomment the following line if AJAX validation is needed + // $this->performAjaxValidation($model); + + if(isset($_POST['Usuario'])) + { + $model->attributes=$_POST['Usuario']; + if($model->save()) + $this->redirect(array('view','id'=>$model->id)); + } + + $this->render('create',array( + 'model'=>$model, + )); + } + + /** + * Updates a particular model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id the ID of the model to be updated + */ + public function actionUpdate($id) + { + $model=$this->loadModel($id); + + // Uncomment the following line if AJAX validation is needed + // $this->performAjaxValidation($model); + + if(isset($_POST['Usuario'])) + { + $model->attributes=$_POST['Usuario']; + if($model->save()) + $this->redirect(array('view','id'=>$model->id)); + } + + $this->render('update',array( + 'model'=>$model, + )); + } + + /** + * Deletes a particular model. + * If deletion is successful, the browser will be redirected to the 'admin' page. + * @param integer $id the ID of the model to be deleted + */ + public function actionDelete($id) + { + if(Yii::app()->request->isPostRequest) + { + // we only allow deletion via POST request + $this->loadModel($id)->delete(); + + // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser + if(!isset($_GET['ajax'])) + $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); + } + else + throw new CHttpException(400,'Invalid request. Please do not repeat this request again.'); + } + + /** + * Lists all models. + */ + public function actionIndex() + { + $dataProvider=new CActiveDataProvider('Usuario'); + $this->render('index',array( + 'dataProvider'=>$dataProvider, + )); + } + + /** + * Manages all models. + */ + public function actionAdmin() + { + $model=new Usuario('search'); + $model->unsetAttributes(); // clear any default values + if(isset($_GET['Usuario'])) + $model->attributes=$_GET['Usuario']; + + $this->render('admin',array( + 'model'=>$model, + )); + } + + /** + * Returns the data model based on the primary key given in the GET variable. + * If the data model is not found, an HTTP exception will be raised. + * @param integer the ID of the model to be loaded + */ + public function loadModel($id) + { + $model=Usuario::model()->findByPk($id); + if($model===null) + throw new CHttpException(404,'The requested page does not exist.'); + return $model; + } + + /** + * Performs the AJAX validation. + * @param CModel the model to be validated + */ + protected function performAjaxValidation($model) + { + if(isset($_POST['ajax']) && $_POST['ajax']==='usuario-form') + { + echo CActiveForm::validate($model); + Yii::app()->end(); + } + } +} diff --git a/www/protected/migrations/m120127_152205_tbl_candidatos.php b/www/protected/migrations/m120127_152205_tbl_candidatos.php index 13573fe..d07d0cc 100644 --- a/www/protected/migrations/m120127_152205_tbl_candidatos.php +++ b/www/protected/migrations/m120127_152205_tbl_candidatos.php @@ -16,6 +16,10 @@ class m120127_152205_tbl_candidatos extends CDbMigration 'sexo' => 'string', 'fecha_nacimiento' => 'date', 'lugar_nacimiento' => 'string', + 'fecha_alta' => 'datetime', + 'usuario_alta' => 'integer', + 'fecha_modificacion' => 'datetime', + 'usuario_modificacion' => 'integer', )); } diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index 61c8af2..2033244 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -147,4 +147,19 @@ class Candidato extends CActiveRecord 'criteria'=>$criteria, )); } + + protected function beforeValidate() { + if ($this->isNewRecord) { + $this->fecha_alta = date('Y-m-d H:i:s', time()); + $this->fecha_modificacion = $this->fecha_alta; + $this->usuario_alta = Yii::app()->user->id; + $this->usuario_modificacion = Yii::app()->user->id; + } + else { + $this->fecha_modificacion = date('Y-m-d H:i:s', time()); + $this->usuario_modificacion = Yii::app()->user->id; + } + + return parent::beforeValidate(); + } } \ No newline at end of file diff --git a/www/protected/models/LoginForm.php b/www/protected/models/LoginForm.php index eb36e4a..b867654 100644 --- a/www/protected/models/LoginForm.php +++ b/www/protected/models/LoginForm.php @@ -69,6 +69,7 @@ class LoginForm extends CFormModel { $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days Yii::app()->user->login($this->_identity,$duration); + Usuario::model()->updateByPk($this->_identity->id, array('last_login_time' => date('Y-m-d H:i:s', time()))); return true; } else diff --git a/www/protected/models/Usuario.php b/www/protected/models/Usuario.php index e0b98ac..3c41533 100644 --- a/www/protected/models/Usuario.php +++ b/www/protected/models/Usuario.php @@ -13,6 +13,9 @@ */ class Usuario extends CActiveRecord { + + public $password_repeat; + /** * Returns the static model of the specified AR class. * @param string $className active record class name. @@ -39,9 +42,11 @@ class Usuario extends CActiveRecord // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( - array('username, password', 'required'), + array('password', 'compare'), // el 'compare' busca otra propiedad que se llame 'password' + '_repeat' + array('password_repeat', 'safe'), + array('email, username, password, password_repeat', 'required'), array('email, name, username, password', 'length', 'max'=>255), - array('last_login_time', 'safe'), + array('email, username', 'unique'), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, email, name, username, password, last_login_time', 'safe', 'on'=>'search'), @@ -70,6 +75,7 @@ class Usuario extends CActiveRecord 'name' => 'Nombre', 'username' => 'Usuario', 'password' => 'Contraseña', + 'password_repeat' => 'Confirmar contraseña', 'last_login_time' => 'Último acceso', ); } @@ -96,4 +102,13 @@ class Usuario extends CActiveRecord 'criteria'=>$criteria, )); } -} \ No newline at end of file + + protected function afterValidate() { + parent::afterValidate(); + $this->password = $this->encrypt($this->password); + } + + public function encrypt($value) { + return md5($value); + } +} diff --git a/www/protected/runtime/application.log b/www/protected/runtime/application.log index ddba2a0..7922864 100644 --- a/www/protected/runtime/application.log +++ b/www/protected/runtime/application.log @@ -2,3 +2,48 @@ in C:\Intranet\www\index.php (13) 2012/01/30 11:56:20 [error] [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'intranet_dev.tbl_capacidades_candidatos' doesn't exist. The SQL statement executed was: SHOW COLUMNS FROM `tbl_capacidades_candidatos`. in C:\Intranet\www\index.php (13) +2012/02/01 09:52:54 [error] [exception.CException] exception 'CException' with message 'Property "Usuario.password_repeat_repeat" is not defined.' in C:\Intranet\yii\framework\base\CComponent.php:131 +Stack trace: +#0 C:\Intranet\yii\framework\db\ar\CActiveRecord.php(144): CComponent->__get('password_repeat...') +#1 C:\Intranet\yii\framework\validators\CCompareValidator.php(91): CActiveRecord->__get('password_repeat...') +#2 C:\Intranet\yii\framework\validators\CValidator.php(197): CCompareValidator->validateAttribute(Object(Usuario), 'password_repeat') +#3 C:\Intranet\yii\framework\base\CModel.php(158): CValidator->validate(Object(Usuario), NULL) +#4 C:\Intranet\yii\framework\db\ar\CActiveRecord.php(786): CModel->validate(NULL) +#5 C:\Intranet\www\protected\controllers\UsuarioController.php(72): CActiveRecord->save() +#6 C:\Intranet\yii\framework\web\actions\CInlineAction.php(50): UsuarioController->actionCreate() +#7 C:\Intranet\yii\framework\web\CController.php(309): CInlineAction->runWithParams(Array) +#8 C:\Intranet\yii\framework\web\filters\CFilterChain.php(134): CController->runAction(Object(CInlineAction)) +#9 C:\Intranet\yii\framework\web\filters\CFilter.php(41): CFilterChain->run() +#10 C:\Intranet\yii\framework\web\CController.php(1146): CFilter->filter(Object(CFilterChain)) +#11 C:\Intranet\yii\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain)) +#12 C:\Intranet\yii\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(Object(CFilterChain)) +#13 C:\Intranet\yii\framework\web\CController.php(292): CFilterChain->run() +#14 C:\Intranet\yii\framework\web\CController.php(266): CController->runActionWithFilters(Object(CInlineAction), Array) +#15 C:\Intranet\yii\framework\web\CWebApplication.php(276): CController->run('create') +#16 C:\Intranet\yii\framework\web\CWebApplication.php(135): CWebApplication->runController('usuario/create') +#17 C:\Intranet\yii\framework\base\CApplication.php(162): CWebApplication->processRequest() +#18 C:\Intranet\www\index.php(13): CApplication->run() +#19 {main} +REQUEST_URI=/intranet/index.php?r=usuario/create +HTTP_REFERER=http://localhost/intranet/index.php?r=usuario/create +--- +2012/02/01 10:12:49 [error] [php] include(Ususario.php) [function.include]: failed to open stream: No such file or directory (C:\Intranet\yii\framework\YiiBase.php:418) +Stack trace: +#0 C:\Intranet\www\protected\components\UserIdentity.php(18): spl_autoload_call() +#1 C:\Intranet\www\protected\models\LoginForm.php(52): UserIdentity->authenticate() +#2 C:\Intranet\yii\framework\validators\CInlineValidator.php(43): LoginForm->authenticate() +#3 C:\Intranet\yii\framework\validators\CValidator.php(197): CInlineValidator->validateAttribute() +#4 C:\Intranet\yii\framework\base\CModel.php(158): CInlineValidator->validate() +#5 C:\Intranet\www\protected\controllers\SiteController.php(88): LoginForm->validate() +#6 C:\Intranet\yii\framework\web\actions\CInlineAction.php(50): SiteController->actionLogin() +#7 C:\Intranet\yii\framework\web\CController.php(309): CInlineAction->runWithParams() +#8 C:\Intranet\yii\framework\web\CController.php(287): SiteController->runAction() +#9 C:\Intranet\yii\framework\web\CController.php(266): SiteController->runActionWithFilters() +#10 C:\Intranet\yii\framework\web\CWebApplication.php(276): SiteController->run() +#11 C:\Intranet\yii\framework\web\CWebApplication.php(135): CWebApplication->runController() +#12 C:\Intranet\yii\framework\base\CApplication.php(162): CWebApplication->processRequest() +#13 C:\Intranet\www\index.php(13): CWebApplication->run() +REQUEST_URI=/intranet/index.php?r=site/login +in C:\Intranet\www\protected\components\UserIdentity.php (18) +in C:\Intranet\www\protected\models\LoginForm.php (52) +in C:\Intranet\www\protected\controllers\SiteController.php (88) diff --git a/www/protected/runtime/gii-1.1.10-dev/CrudCode.php b/www/protected/runtime/gii-1.1.10-dev/CrudCode.php new file mode 100644 index 0000000..20e6de0 --- /dev/null +++ b/www/protected/runtime/gii-1.1.10-dev/CrudCode.php @@ -0,0 +1,5 @@ + 'default', + 'baseControllerClass' => 'Controller', +); diff --git a/www/protected/tests/unit/CandidatoTest.php b/www/protected/tests/unit/CandidatoTest.php index bed9b7c..6a85732 100644 --- a/www/protected/tests/unit/CandidatoTest.php +++ b/www/protected/tests/unit/CandidatoTest.php @@ -4,6 +4,7 @@ class CandidatoTest extends CDbTestCase { public $fixtures = array( 'datos_candidatos' => 'Candidato', + 'datos_usuarios' => 'Usuario', ); @@ -14,15 +15,17 @@ class CandidatoTest extends CDbTestCase { } public function testCreate() { - $candidato = $this->datos_candidatos('candidato1'); + $candidato = new Candidato(); + Yii::app()->user->setId($this->datos_usuarios('user1')->id); - $this->assertTrue($candidato instanceof Candidato); + $candidato->nombre = 'Juan'; $this->assertTrue($candidato->save()); - + $guardado = Candidato::model()->findByPk($candidato->id); $this->assertTrue($guardado instanceof Candidato); - $this->assertEmpty(array_diff($guardado->attributes, $candidato->attributes)); + $this->assertEmpty(array_diff($candidato->attributes, $guardado->attributes)); + $this->assertEquals(Yii::app()->user->id, $guardado->usuario_alta); } public function testUpdate() { diff --git a/www/protected/tests/unit/CapacidadIdiomaTest.php b/www/protected/tests/unit/CapacidadIdiomaTest.php index 3256ada..2901d51 100644 --- a/www/protected/tests/unit/CapacidadIdiomaTest.php +++ b/www/protected/tests/unit/CapacidadIdiomaTest.php @@ -58,5 +58,16 @@ class CapacidadIdiomaTest extends CDbTestCase { $this->assertEquals(1, count($idiomas)); $this->assertEquals($this->datos_idiomas['idioma2']['idioma'], $idiomas[0]->idioma); } + + public function testWith() { + $id = $this->datos_candidatos['candidato3']['id']; + + $candidato = Candidato::model()->findByPk($id); + $this->assertTrue($candidato instanceof Candidato); + } + + } + + ?> diff --git a/www/protected/views/usuario/_form.php b/www/protected/views/usuario/_form.php new file mode 100644 index 0000000..39f6c11 --- /dev/null +++ b/www/protected/views/usuario/_form.php @@ -0,0 +1,49 @@ +
+ +beginWidget('CActiveForm', array( + 'id'=>'usuario-form', + 'enableAjaxValidation'=>false, +)); ?> + +

Fields with * are required.

+ + errorSummary($model); ?> + +
+ labelEx($model,'email'); ?> + textField($model,'email',array('size'=>60,'maxlength'=>255)); ?> + error($model,'email'); ?> +
+ +
+ labelEx($model,'name'); ?> + textField($model,'name',array('size'=>60,'maxlength'=>255)); ?> + error($model,'name'); ?> +
+ +
+ labelEx($model,'username'); ?> + textField($model,'username',array('size'=>60,'maxlength'=>255)); ?> + error($model,'username'); ?> +
+ +
+ labelEx($model,'password'); ?> + passwordField($model,'password',array('size'=>60,'maxlength'=>255)); ?> + error($model,'password'); ?> +
+ +
+ labelEx($model,'password_repeat'); ?> + passwordField($model,'password_repeat',array('size'=>60,'maxlength'=>255)); ?> + error($model,'password_repeat'); ?> +
+ + +
+ isNewRecord ? 'Create' : 'Save'); ?> +
+ +endWidget(); ?> + +
\ No newline at end of file diff --git a/www/protected/views/usuario/_search.php b/www/protected/views/usuario/_search.php new file mode 100644 index 0000000..da5e619 --- /dev/null +++ b/www/protected/views/usuario/_search.php @@ -0,0 +1,39 @@ +
+ +beginWidget('CActiveForm', array( + 'action'=>Yii::app()->createUrl($this->route), + 'method'=>'get', +)); ?> + +
+ label($model,'id'); ?> + textField($model,'id'); ?> +
+ +
+ label($model,'email'); ?> + textField($model,'email',array('size'=>60,'maxlength'=>255)); ?> +
+ +
+ label($model,'name'); ?> + textField($model,'name',array('size'=>60,'maxlength'=>255)); ?> +
+ +
+ label($model,'username'); ?> + textField($model,'username',array('size'=>60,'maxlength'=>255)); ?> +
+ +
+ label($model,'last_login_time'); ?> + textField($model,'last_login_time'); ?> +
+ +
+ +
+ +endWidget(); ?> + +
\ No newline at end of file diff --git a/www/protected/views/usuario/_view.php b/www/protected/views/usuario/_view.php new file mode 100644 index 0000000..78e4f35 --- /dev/null +++ b/www/protected/views/usuario/_view.php @@ -0,0 +1,28 @@ +
+ + getAttributeLabel('id')); ?>: + id), array('view', 'id'=>$data->id)); ?> +
+ + getAttributeLabel('email')); ?>: + email); ?> +
+ + getAttributeLabel('name')); ?>: + name); ?> +
+ + getAttributeLabel('username')); ?>: + username); ?> +
+ + getAttributeLabel('password')); ?>: + password); ?> +
+ + getAttributeLabel('last_login_time')); ?>: + last_login_time); ?> +
+ + +
\ No newline at end of file diff --git a/www/protected/views/usuario/admin.php b/www/protected/views/usuario/admin.php new file mode 100644 index 0000000..3f6c1fe --- /dev/null +++ b/www/protected/views/usuario/admin.php @@ -0,0 +1,55 @@ +breadcrumbs=array( + 'Usuarios'=>array('index'), + 'Manage', +); + +$this->menu=array( + array('label'=>'List Usuario', 'url'=>array('index')), + array('label'=>'Create Usuario', 'url'=>array('create')), +); + +Yii::app()->clientScript->registerScript('search', " +$('.search-button').click(function(){ + $('.search-form').toggle(); + return false; +}); +$('.search-form form').submit(function(){ + $.fn.yiiGridView.update('usuario-grid', { + data: $(this).serialize() + }); + return false; +}); +"); +?> + +

Manage Usuarios

+ +

+You may optionally enter a comparison operator (<, <=, >, >=, <> +or =) at the beginning of each of your search values to specify how the comparison should be done. +

+ +'search-button')); ?> + + +widget('zii.widgets.grid.CGridView', array( + 'id'=>'usuario-grid', + 'dataProvider'=>$model->search(), + 'filter'=>$model, + 'columns'=>array( + 'id', + 'email', + 'name', + 'username', + 'password', + 'last_login_time', + array( + 'class'=>'CButtonColumn', + ), + ), +)); ?> diff --git a/www/protected/views/usuario/create.php b/www/protected/views/usuario/create.php new file mode 100644 index 0000000..5747b39 --- /dev/null +++ b/www/protected/views/usuario/create.php @@ -0,0 +1,15 @@ +breadcrumbs=array( + 'Usuarios'=>array('index'), + 'Create', +); + +$this->menu=array( + array('label'=>'List Usuario', 'url'=>array('index')), + array('label'=>'Manage Usuario', 'url'=>array('admin')), +); +?> + +

Create Usuario

+ +renderPartial('_form', array('model'=>$model)); ?> \ No newline at end of file diff --git a/www/protected/views/usuario/index.php b/www/protected/views/usuario/index.php new file mode 100644 index 0000000..0a57c4b --- /dev/null +++ b/www/protected/views/usuario/index.php @@ -0,0 +1,17 @@ +breadcrumbs=array( + 'Usuarios', +); + +$this->menu=array( + array('label'=>'Create Usuario', 'url'=>array('create')), + array('label'=>'Manage Usuario', 'url'=>array('admin')), +); +?> + +

Usuarios

+ +widget('zii.widgets.CListView', array( + 'dataProvider'=>$dataProvider, + 'itemView'=>'_view', +)); ?> diff --git a/www/protected/views/usuario/update.php b/www/protected/views/usuario/update.php new file mode 100644 index 0000000..72c5560 --- /dev/null +++ b/www/protected/views/usuario/update.php @@ -0,0 +1,18 @@ +breadcrumbs=array( + 'Usuarios'=>array('index'), + $model->name=>array('view','id'=>$model->id), + 'Update', +); + +$this->menu=array( + array('label'=>'List Usuario', 'url'=>array('index')), + array('label'=>'Create Usuario', 'url'=>array('create')), + array('label'=>'View Usuario', 'url'=>array('view', 'id'=>$model->id)), + array('label'=>'Manage Usuario', 'url'=>array('admin')), +); +?> + +

Update Usuario id; ?>

+ +renderPartial('_form', array('model'=>$model)); ?> \ No newline at end of file diff --git a/www/protected/views/usuario/view.php b/www/protected/views/usuario/view.php new file mode 100644 index 0000000..3ee1abe --- /dev/null +++ b/www/protected/views/usuario/view.php @@ -0,0 +1,28 @@ +breadcrumbs=array( + 'Usuarios'=>array('index'), + $model->name, +); + +$this->menu=array( + array('label'=>'List Usuario', 'url'=>array('index')), + array('label'=>'Create Usuario', 'url'=>array('create')), + array('label'=>'Update Usuario', 'url'=>array('update', 'id'=>$model->id)), + array('label'=>'Delete Usuario', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')), + array('label'=>'Manage Usuario', 'url'=>array('admin')), +); +?> + +

View Usuario #id; ?>

+ +widget('zii.widgets.CDetailView', array( + 'data'=>$model, + 'attributes'=>array( + 'id', + 'email', + 'name', + 'username', + 'password', + 'last_login_time', + ), +)); ?>