public function actionverificarUsuarioDuplicado() { $Estudiante = UsuarioEstudiante::model()->findAllByAttributes(array('Usuario' => $_POST["UsuarioContactoEmpresa"])); $Unitec = UsuarioUnitec::model()->findAllByAttributes(array('Usuario' => $_POST["UsuarioContactoEmpresa"])); $ContactoEmpresa = ContactoEmpresa::model()->findAllByAttributes(array('Usuario' => $_POST["UsuarioContactoEmpresa"])); 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> "; } }
/** * 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() { $user = UsuarioUnitec::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 { $VerificaAsesor = $Curso = CarreraPorUsuarioUnitec::model()->findAllByAttributes(array('UsuarioUnitec_IdUsuarioUnitec' => $user->IdUsuarioUnitec, 'TipoUsuarioUnitec_IdTipoUsuarioUnitec' => 2, 'Activo' => 1)); if (!empty($VerificaAsesor)) { $this->setState('EsJefeAcademico', true); } else { $this->setState('EsJefeAcademico', false); } $this->_id = $user->IdUsuarioUnitec; $this->errorCode = self::ERROR_NONE; } return !$this->errorCode; }
<h2> Busca empresas para vincular a los estudiante con su práctica profesional.</h2> </div> <div class="job-img-inputs"> <div class="container"> <div class="row"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'BuscarFilter', 'action' => Yii::app()->createUrl("UsuarioUnitec/resultadoBusquedaPP"), 'enableAjaxValidation' => false)); ?> <div class="col-sm-4 md-margin-bottom-10"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-cog fa-spin"></i></span> <?php $this->widget('booster.widgets.TbSelect2', array('name' => 'Carrera', 'id' => 'Carrera', 'data' => UsuarioUnitec::model()->CarrerasPorJefe(), 'htmlOptions' => array('placeholder' => 'Seleccione su Carrera', "ajax" => array("url" => $this->createUrl("site/BuscarPracticas"), "type" => "POST", "update" => "#Empresas", 'beforeSend' => 'function() { $("#Empresas").empty(); }')), 'options' => array('width' => '100%'), 'events' => array("change" => 'js:function(){ $("#Empresas").select2("val", "");}'))); ?> </div> </div> <div class="col-sm-6 ld-margin-bottom-10"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-spinner fa-spin"></i></span> <?php $this->widget('booster.widgets.TbSelect2', array('name' => 'Empresas', 'htmlOptions' => array('multiple' => 'multiple', 'placeholder' => 'Seleccione Empresas'), 'options' => array('width' => '100%'))); ?> </div> </div> <div class="col-sm-2"> <button type="submit" class="btn-u btn-block btn-u-dark">Buscar</button>
public function BusquedaAlumnosInactivos() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->addInCondition('Carrera_IdCarrera', UsuarioUnitec::model()->CarrerasPorJefe2()); $criteria->compare('CONCAT(Nombre," ",PrimerApellido, " ",SegundoApellido)', $this->Nombre, true); $criteria->compare('NumeroDeCuenta', $this->NumeroDeCuenta, true); $criteria->compare('Carrera_IdCarrera', $this->Carrera_IdCarrera, true); $criteria->compare('Activo', $this->Activo = 0, true); return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'FechaCreacion ASC'), 'pagination' => array('pageSize' => 6))); }
/** * 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 UsuarioUnitec the loaded model * @throws CHttpException */ public function loadModel($id) { $model = UsuarioUnitec::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<li class="active"><a data-toggle="tab" href="#Matricula">Asociar Estudiante con Curso</a></li> <li><a data-toggle="tab" href="#CursosPorAlumno">Cursos Por Alumno</a></li> <li><a data-toggle="tab" href="#BusquedaEdicionEstudiante"> Búsqueda / Edición de Estudiantes</a></li> </ul> </div> <div class="tab-content"> <div id="Matricula" class="profile-edit tab-pane fade in active "> <h2 class="heading-md">Panel de asociación Estudiante - Curso</h2> <p>Utiliza los filtros para buscar alumnos, luego puedes vincular uno o varios alumnos con un curso... Siempre y cuando seas Jefe Académico de las carreras vinculadas con ese curso.</p> </br> <?php $this->widget('booster.widgets.TbExtendedGridView', array("id" => 'test2', 'type' => 'striped bordered', 'dataProvider' => $modelEstudiantes->BusquedaAlumnosActivos(), 'filter' => $modelEstudiantes, 'emptyText' => 'No se encontraron registros', 'selectableRows' => 2, 'bulkActions' => array('actionButtons' => array(array('id' => 'prueba', 'buttonType' => 'button', 'context' => 'primary', 'size' => 'small', 'label' => 'Matricular Alumnos', 'click' => 'js:function(values){console.log(values); $("#MatricularAlumnos").modal("show"); document.getElementById("trans").value =values; document.getElementById("Carrera").value = document.getElementById("UsuarioEstudiante_Carrera_IdCarrera").value ; $(CursosPorCarrera).empty();}')), 'checkBoxColumnConfig' => array('name' => 'id')), 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => '$data->IdCurso'), array('name' => 'Carrera_IdCarrera', 'header' => 'Carrera', 'filter' => UsuarioUnitec::model()->CarrerasPorJefe(), 'value' => '$data->carrera->NombreCarrera', 'htmlOptions' => array('nowrap' => 'nowrap')), array('name' => 'Nombre', 'header' => 'Estudiante', 'value' => '$data->NombreCompleto', 'htmlOptions' => array('nowrap' => 'nowrap')), array('name' => 'NumeroDeCuenta', 'header' => 'Nº Cuenta', 'value' => '$data->NumeroDeCuenta', 'htmlOptions' => array('nowrap' => 'nowrap'))))); ?> </div> <div id ="CursosPorAlumno" class="profile-edit tab-pane fade"> <h2 class ="heading-md">Cursos Por Estudiante</h2> <p>Abajo se encuentran la información de los cursos vinculados con estudiantes activos en el sistema, puedes realizar búsquedas y cambiar el estado de los cursos.</p> </br>
}', 'success' => 'js: function() {$.fn.yiiGridView.update("test"); $.fn.yiiGridView.update("test2"); $.fn.yiiGridView.update("test3");}'))))); ?> </div> <div id ="CarrerasPorCurso" class="profile-edit tab-pane fade"> <h2 class ="heading-md">Carreras Por Curso</h2> <p>La asignación de carreras a cursos sirve para poder vincular los alumnos por carrera por curso =P Vamos a actualizar la descripción despues.</p> </br> <?php $this->widget('booster.widgets.TbExtendedGridView', array('id' => 'test3', 'type' => 'striped bordered', 'dataProvider' => $CarrerasPorCurso->BusquedaCarrerasPorCurso(), 'filter' => $CarrerasPorCurso, 'responsiveTable' => true, 'emptyText' => 'No se encontraron registros', 'columns' => array(array('name' => 'Carrera_IdCarrera', 'header' => 'Carrera', 'value' => '$data->carrera->NombreCarrera', 'filter' => Carrera::model()->getCarreras()), array('name' => 'Curso_IdCurso', 'header' => 'Nombre del Curso / Sección / Código', 'value' => '$data->curso->CursoCompleto'), array('name' => 'prueba', 'header' => 'Asesor', 'filter' => CHtml::listData(UsuarioUnitec::model()->findAll("Activo=?", array(1)), 'IdUsuarioUnitec', 'NombreCompleto'), 'value' => '$data->curso->usuarioUnitec->PrimerNombrePrimerApellido')))); ?> </div> </div> </div> </div> <!--End Profile Body-->
$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> <p>Abajo se encuentran los alumnos de las carreras que tu asesoras. UTILIZA LOS FILTROS para realizar búsquedas.</p> </br> <?php $this->widget('booster.widgets.TbExtendedGridView', array("id" => 'PanelVerificacionAlumnos', 'type' => 'striped bordered', 'dataProvider' => $modelEstudiantes->BusquedaAlumnosInactivos(), 'filter' => $modelEstudiantes, 'emptyText' => 'No se encontraron registros', 'columns' => array(array('name' => 'Nombre', 'type' => 'raw', 'value' => 'CHtml::encode($data->NombreCompleto)'), array('name' => 'NumeroDeCuenta', 'type' => 'raw', 'value' => 'CHtml::encode($data->NumeroDeCuenta)'), array('name' => 'Carrera_IdCarrera', 'type' => 'raw', 'filter' => UsuarioUnitec::model()->CarrerasPorJefe(), 'value' => 'CHtml::encode($data->carrera->NombreCarrera)'), array('class' => 'CButtonColumn', 'template' => '{Verificar} ', 'header' => 'Verificar', 'htmlOptions' => array('encodeLabel' => false), 'buttons' => array('Verificar' => array('url' => 'Yii::app()->createUrl("UsuarioUnitec/VerificarAlumnos", array("Activar"=>$data->IdUsuarioEstudiante))', '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 este alumno?'))))))); ?> <!-- <label class="toggle toggle-change"><input type="checkbox" checked="" name="checkbox-toggle-1"><i></i>Remember password</label> --> </br> <!-- <section> <label class="checkbox"><input type="checkbox" id="terms" name="terms"><i></i><a href="#">I agree with the Terms and Conditions</a></label> </section> -->