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 actionActualizarDatos() { $modelContactoEmpresa = ContactoEmpresa::model()->findByPk(Yii::app()->user->getId()); $model = UsuarioEmpresa::model()->findByPk($modelContactoEmpresa->UsuarioEmpresa_IdUsuarioEmpresa); if (isset($_POST['NombreEmpresa'])) { $model->NombreEmpresa = strtoupper($_POST['NombreEmpresa']); $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> El NOMBRE DE LA EMPRESA ha sido actualizado"); $this->redirect(array('UsuarioEmpresa/editarPerfilEmpresa')); } if (isset($_POST['TelefonoEmpresa'])) { $model->TelefonoEmpresa = strtoupper($_POST['TelefonoEmpresa']); $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Tu NÚMERO DE TELÉFONO de la empresa ha sido actualizado"); $this->redirect(array('UsuarioEmpresa/editarPerfilEmpresa')); } if (isset($_POST['CorreoEmpresa'])) { $model->CorreoEmpresa = strtolower($_POST['CorreoEmpresa']); $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> El CORREO ELECTRÓNICO de tu empresa ha sido actualizado"); Yii::app()->user->setFlash("warning", "<strong>Recuerda!</strong> Las notificaciones del sistema se enviarán a tu nuevo correo electrónico"); $this->redirect(array('UsuarioEmpresa/editarPerfilEmpresa')); } if (isset($_POST['RubroEmpresa'])) { $model->RubroEmpresa = strtoupper($_POST['RubroEmpresa']); $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> El RUBRO de tu empresa ha sido actualizado"); $this->redirect(array('UsuarioEmpresa/editarPerfilEmpresa')); } if (isset($_POST['SitioWebEmpresa'])) { $model->SitioWebEmpresa = strtolower($_POST['SitioWebEmpresa']); $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> El SITIO WEB de tu empresa ha sido actualizado"); $this->redirect(array('UsuarioEmpresa/editarPerfilEmpresa')); } if (isset($_POST['NombreContacto'])) { $modelContactoEmpresa->NombreCompleto = strtoupper($_POST['NombreContacto']); $modelContactoEmpresa->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Su NOMBRE ha sido actualizado exitosamente"); $this->redirect(array('UsuarioEmpresa/editarPerfil')); } if (isset($_POST['TelefonoFijoo'])) { $modelContactoEmpresa->TelefonoFijo = $_POST['TelefonoFijoo']; $modelContactoEmpresa->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Su NÚMERO DE TELEFONO FIJO ha sido actualizado exitosamente"); $this->redirect(array('UsuarioEmpresa/editarPerfil')); } if (isset($_POST['TelefonoCelularContacto'])) { $modelContactoEmpresa->TelefonoCelular = $_POST['TelefonoCelularContacto']; $modelContactoEmpresa->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Su NÚMERO DE TELEFONO CELULAR ha sido actualizado exitosamente"); $this->redirect(array('UsuarioEmpresa/editarPerfil')); } if (isset($_POST['correoContacto'])) { $modelContactoEmpresa->CorreoElectronico = $_POST['correoContacto']; $modelContactoEmpresa->save(); Yii::app()->user->setFlash("success", "<strong>Excelente!</strong> Su Correo Electrónico ha sido actualizado exitosamente"); $this->redirect(array('UsuarioEmpresa/editarPerfil')); } }
/** * 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 actionVerificarUsuarioEmpresa($Activar) { date_default_timezone_set('America/Tegucigalpa'); $model = ContactoEmpresa::model()->findByPk($Activar); $model->Activo = 1; $model->FechaVerificacion = date('Y-m-d H:i:s'); $model->VerificadoPor = Yii::app()->user->name; $model->save(); Yii::app()->user->setFlash("success", "<strong>Excelente! </strong>" . "El usuario " . $model->NombreCompleto . " ha sido verificado, se ha enviado un correo de bienvenida a " . $model->CorreoElectronico . " ."); $this->redirect(Yii::app()->request->urlReferrer . "#usuariosEmp"); }
?> </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>