public function EmpresasContactoEmpresaInactivos() { $criteria = new CDbCriteria(); $criteria->with = 'usuarioEmpresa'; $criteria->order = 'usuarioEmpresa.NombreEmpresa ASC'; $criteria->addInCondition('t.Activo', array('0')); return CHtml::listData(ContactoEmpresa::model()->findAll($criteria), 'usuarioEmpresa.IdUsuarioEmpresa', 'usuarioEmpresa.NombreEmpresa'); }
public function authenticateEmpresa() { $user = ContactoEmpresa::model()->findByAttributes(array('Usuario' => $this->username)); //$user = UsuarioUnitec::model()->find("LOWER(username)=?",array(strtolower($this->username))); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } elseif ($this->password !== $user->Contrasena) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_ActivoEmpresa = $user->Activo; $this->_id = $user->IdContactoEmpresa; $this->setState('Activo', (string) $user->Activo); $this->setState('EmpresaActivo', (string) $user->usuarioEmpresa->Activo); $this->errorCode = self::ERROR_NONE; } return !$this->errorCode; }
public function actionverificarUsuarioDuplicado() { $Estudiante = UsuarioEstudiante::model()->findAllByAttributes(array('Usuario' => $_POST["username"])); $Unitec = UsuarioUnitec::model()->findAllByAttributes(array('Usuario' => $_POST["username"])); $ContactoEmpresa = ContactoEmpresa::model()->findAllByAttributes(array('Usuario' => $_POST["username"])); if (!empty($Estudiante) or !empty($Unitec) or !empty($ContactoEmpresa)) { echo "<div class='alert alert-warning fade in alert-dismissable'>\n\t\t\t\t<strong>Oh-Oh! </strong> Parece que este NOMBRE DE USUARIO ya tiene dueño!\n\t\t\t\t</div> "; } }
public function VerificarDuplicidadUsuario2($userName) { $Estudiante = UsuarioEstudiante::model()->findAllByAttributes(array('Usuario' => $userName)); $Unitec = UsuarioUnitec::model()->findAllByAttributes(array('Usuario' => $userName)); $ContactoEmpresa = ContactoEmpresa::model()->findAllByAttributes(array('Usuario' => $userName)); if (!empty($Estudiante) or !empty($Unitec) or !empty($ContactoEmpresa)) { return true; } else { return false; } }
public function actionCreate() { $this->layout = 'main'; $model = new UsuarioEmpresa(); $modelContactoEmpresa = new ContactoEmpresa(); $modelTipoEmpresa = new TipoEmpresa(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['NombreEmpresa'], $_POST['number'], $_POST['nombreContactoEmpresa'], $_POST['telefonoCelularContacto'])) { if (UsuarioEstudiante::model()->VerificarDuplicidadUsuario2($_POST['UsuarioContactoEmpresa']) == "") { //EMPEZAMOS A GUARDAR LOS VALORES QUE VIENEN POR POST DE LA EMPRESA $model->NombreEmpresa = strtoupper($_POST['NombreEmpresa']); $model->TelefonoEmpresa = strtoupper($_POST['number']); $model->CorreoEmpresa = strtolower($_POST['emailEmpresa']); $model->SitioWebEmpresa = strtolower($_POST['url']); $model->RubroEmpresa = strtoupper($_POST['rubroEmpresa']); $model->Mision = $_POST['Mision']; $model->Vision = $_POST['Vision']; date_default_timezone_set('America/Guatemala'); $model->FechaCreacion = date('Y-m-d H:i:s'); $model->FechaModificacion = date('Y-m-d H:i:s'); $model->Activo = 0; if (Yii::app()->user->isGuest) { $model->CreadoPor = "Invitado"; $model->ModificadoPor = "Invitado"; } if (!Yii::app()->user->isGuest) { // usted ha creado un usuario , se ha enviado un correo //electronico a la persona de quien se ha creado el usuario $model->CreadoPor = Yii::app()->user->name; $model->ModificadoPor = Yii::app()->user->name; } $model->Rol_IdRol = 1; $model->TipoEmpresa_IdTipoEmpresa = $_POST['tipoEmpresa']; // TERMINAMOS DE GUARDAR TODO PUES // NO ES NECESARIA POR QUE YA VALIDO CON JQUERY // $validarUsuarioEmpresa = $model->validate(); // $validarContactoEmpresa = $modelContactoEmpresa->validate() && $validarUsuarioEmpresa; if ($model->save()) { // EMPEZAMOS A GUARDAR LOS VALORES QUE VIENEN POR POST DEL USUARIO DE LA EMPRESA $modelContactoEmpresa->NombreCompleto = strtoupper($_POST['nombreContactoEmpresa']); $modelContactoEmpresa->CorreoElectronico = strtolower($_POST['emailContacto']); $modelContactoEmpresa->TelefonoFijo = $_POST['telefonoFijoContacto']; $modelContactoEmpresa->TelefonoCelular = $_POST['telefonoCelularContacto']; $modelContactoEmpresa->PuestoEmpresa = strtoupper($_POST['puestoEmpresa']); $modelContactoEmpresa->Activo = 0; $modelContactoEmpresa->Usuario = $_POST['UsuarioContactoEmpresa']; $modelContactoEmpresa->Contrasena = $_POST['ContrasenaContactoEmpresa']; $modelContactoEmpresa->FechaCreacion = date('Y-m-d H:i:s'); $modelContactoEmpresa->FechaModificacion = date('Y-m-d H:i:s'); $modelContactoEmpresa->UsuarioEmpresa_IdUsuarioEmpresa = Yii::app()->db->getLastInsertID('UsuarioEmpresa'); $modelContactoEmpresa->UsuarioEmpresa_Rol_IdRol = 1; $modelContactoEmpresa->UsuarioEmpresa_TipoEmpresa_IdTipoEmpresa = 1; if ($modelContactoEmpresa->save()) { Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Su USUARIO ha sido creado exitosamente. Inicie sesion para ver su perfil"); $this->redirect($this->redirect(array('Site/loginEmpresa'))); } } } else { Yii::app()->user->setFlash("warning", "<strong>Ummmm...</strong> El NOMBRE DE USUARIO se encuentra asociado con una cuenta existente"); } } $this->render('create', array('model' => $model, 'modelContactoEmpresa' => $modelContactoEmpresa, 'modelTipoEmpresa' => $modelTipoEmpresa)); }
/** * 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 $id the ID of the model to be loaded * @return ContactoEmpresa the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ContactoEmpresa::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionVerificarUsuarios() { $model = new UsuarioEmpresa('search'); $modelEstudiantes = new UsuarioEstudiante('BusquedaAlumnosInactivos'); $modelUnitec = new UsuarioUnitec('BusquedaUnitecInactivos'); $modelUsuarioEmpresa = new ContactoEmpresa('BusquedaUsuariosEmpresaInactivos'); $empresa = new ContactoEmpresa(); $carrerasPorUsuarioUnitec = new CarreraPorUsuarioUnitec('BusquedaPrueba'); $Practicas = new PracticaProfesional('BusquedaPracticasInactivas'); $model->unsetAttributes(); $modelEstudiantes->unsetAttributes(); $modelUnitec->unsetAttributes(); $modelUsuarioEmpresa->unsetAttributes(); $carrerasPorUsuarioUnitec->unsetAttributes(); $Practicas->unsetAttributes(); if (isset($_GET['UsuarioEmpresa'])) { $model->attributes = $_GET['UsuarioEmpresa']; } if (isset($_GET['UsuarioEstudiante'])) { $modelEstudiantes->attributes = $_GET['UsuarioEstudiante']; } if (isset($_GET['UsuarioUnitec'])) { $modelUnitec->attributes = $_GET['UsuarioUnitec']; } if (isset($_GET['ContactoEmpresa'])) { $modelUsuarioEmpresa->attributes = $_GET['ContactoEmpresa']; } if (isset($_GET['CarreraPorUsuarioUnitec'])) { $carrerasPorUsuarioUnitec->attributes = $_GET['CarreraPorUsuarioUnitec']; } if (isset($_GET['BusquedaPracticasInactivas'])) { $Practicas->attributes = $_GET['BusquedaPracticasInactivas']; } $this->render('verificarUsuarios', array('model' => $model, 'modelEstudiantes' => $modelEstudiantes, 'modelUnitec' => $modelUnitec, 'modelUsuarioEmpresa' => $modelUsuarioEmpresa, 'empresa' => $empresa, 'carrerasPorUsuarioUnitec' => $carrerasPorUsuarioUnitec, 'Practicas' => $Practicas)); }
?> </div> <div id ="usuariosEmpresasTab" class="profile-edit tab-pane fade"> <h2 class ="heading-md">Panel de Verificación de usuarios Empresariales</h2> <p>Abajo se encuentran nuevos usuarios de empresas ya creadas. UTILIZA LOS FILTROS para realizar búsquedas.</p> </br> <?php $this->widget('booster.widgets.TbExtendedGridView', array("id" => 'test4', 'type' => 'striped bordered', 'dataProvider' => $modelUsuarioEmpresa->BusquedaUsuariosEmpresaInactivos(), 'filter' => $modelUsuarioEmpresa, 'emptyText' => 'No se encontraron registros', 'columns' => array(array('name' => 'NombreCompleto', 'type' => 'raw', 'value' => 'CHtml::encode($data->NombreCompleto) '), array('name' => 'UsuarioEmpresa_IdUsuarioEmpresa', 'type' => 'raw', 'header' => 'Empresa', 'filter' => ContactoEmpresa::model()->EmpresasContactoEmpresaInactivos(), 'value' => 'CHtml::Link($data->usuarioEmpresa->NombreEmpresa)'), array('name' => 'TelefonoCelular', 'type' => 'raw', 'value' => 'CHtml::encode($data->TelefonoCelular)'), array('name' => 'PuestoEmpresa', 'type' => 'raw', 'value' => 'CHtml::encode($data->PuestoEmpresa)'), array('class' => 'CButtonColumn', 'template' => '{Email} ', 'header' => 'Email', 'htmlOptions' => array('encodeLabel' => false), 'buttons' => array('Email' => array('url' => 'Yii::app()->createUrl("UsuarioUnitec/EnviarCorreoEmpresa", array("CorreoEmpresa"=>$data->CorreoElectronico))', 'label' => ' <div class="row text-center"> <i class="fa fa-envelope" ></i> </div> ', 'options' => array('rel' => 'tooltip', 'data-toggle' => 'tooltip', 'title' => 'Enviar Correo Electrónico')))), array('class' => 'CButtonColumn', 'template' => '{Verificar} ', 'header' => 'Verificar', 'htmlOptions' => array('encodeLabel' => false), 'buttons' => array('Verificar' => array('url' => 'Yii::app()->createUrl("UsuarioUnitec/VerificarUsuarioEmpresa", array("Activar"=>$data->IdContactoEmpresa))', 'label' => ' <div class="row text-center"> <i class="fa fa-check-square-o" ></i> Verificar </div>', 'options' => array('rel' => 'tooltip', 'data-toggle' => 'tooltip', 'title' => 'Verificar Empresa', 'confirm' => '¿Seguro que desea verificar esta usuario?'))))))); ?> <!-- <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $modelUsuarioEmpresa->BusquedaUsuariosEmpresaInactivos(), 'filter' => $modelUsuarioEmpresa, 'htmlOptions' => array('class' => 'table-responsive'), 'columns' => array(array('name' => 'NombreCompleto', 'type' => 'raw', 'value' => 'CHtml::encode($data->NombreCompleto) '), array('name' => 'UsuarioEmpresa_IdUsuarioEmpresa', 'type' => 'raw', 'header' => 'Empresa', 'filter' => CHtml::listData(UsuarioEmpresa::model()->findAll(array('order' => 'NombreEmpresa')), 'IdUsuarioEmpresa', 'NombreEmpresa'), 'value' => 'CHtml::Link($data->usuarioEmpresa->NombreEmpresa)'), array('name' => 'TelefonoCelular', 'type' => 'raw', 'value' => 'CHtml::encode($data->TelefonoCelular)'), array('name' => 'PuestoEmpresa', 'type' => 'raw', 'value' => 'CHtml::encode($data->PuestoEmpresa)'), array('class' => 'CButtonColumn', 'template' => '{Email} ', 'header' => 'Email', 'htmlOptions' => array('encodeLabel' => false), 'buttons' => array('Email' => array('url' => 'Yii::app()->createUrl("UsuarioUnitec/EnviarCorreoEmpresa", array("CorreoEmpresa"=>$data->CorreoElectronico))', 'label' => ' <div class="row text-center"> <i class="fa fa-envelope" ></i> </div> ', 'options' => array('rel' => 'tooltip', 'data-toggle' => 'tooltip', 'title' => 'Enviar Correo Electrónico')))), array('class' => 'CButtonColumn', 'template' => '{Verificar} ', 'header' => 'Verificar', 'htmlOptions' => array('encodeLabel' => false), 'buttons' => array('Verificar' => array('url' => 'Yii::app()->createUrl("UsuarioUnitec/VerificarUsuarioEmpresa", array("Activar"=>$data->IdContactoEmpresa))', 'label' => ' <div class="row text-center"> <i class="fa fa-check-square-o" ></i> Verificar </div>', 'options' => array('rel' => 'tooltip', 'data-toggle' => 'tooltip', 'title' => 'Verificar Empresa', 'confirm' => '¿Seguro que desea verificar esta usuario?'))))))); ?> --> </div> <div id ="passwordTab" class="profile-edit tab-pane fade"> <h2 class ="heading-md">Panel de Verificación de Alumnos</h2>