Esempio n. 1
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     if (isset($_POST['idStudent']) && isset($_POST['idProfile'])) {
         if (!empty($_POST['idStudent']) && !empty($_POST['idProfile'])) {
             $model = Students::model()->find('id=' . $_POST['idStudent']);
             $model->tutor_id = Tutor::model()->find('profile_id=' . $_POST['idProfile'])->id_tutor;
             if ($model->save()) {
                 Yii::app()->user->setFlash('save', 'El Tutor se ha asignado correctamente.');
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
         Yii::app()->user->setFlash('error', 'Debe seleccionar un Tutor.');
         $this->redirect(array('view', 'id' => $_POST['idStudent']));
     }
     $this->render('view', array('model' => $this->loadModel($id)));
 }
Esempio n. 2
0
<?php 
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataStudents, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array(array('header' => 'ID', 'value' => '$data->id'), array('header' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->profile->firstname, $data->profile->secondname, $data->profile->lastname1, $data->profile->lastname2);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data->profile->sex);
}, 'type' => 'raw'), array('header' => 'Correo', 'value' => '$data->profile->email'), array('header' => 'Tutor', 'value' => function ($data, $row) {
    return Tutor::model()->getNombre($data->tutor_id);
}, 'type' => 'raw'), array('header' => 'Registrado', 'value' => function ($data, $row) {
    return Yii::app()->dateFormatter->formatDateTime($data->profile->user->regdate, 'medium', false);
}, 'type' => 'raw'), array('header' => 'Status', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->validarStatus($data->profile->cruge_user_iduser);
}), array('header' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->botonStatus($data->profile->cruge_user_iduser);
}), array('name' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return Tutor::model()->botonAsignar($data->tutor_id, $data->id);
}))));
$this->endWidget();
?>
<!-- End Box de Estudiantes VC -->

<!-- Box de Tutors VC -->
<?php 
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => 'Tutores VC', 'headerIcon' => 'icon-th-list', 'headerButtons' => array(TbHtml::buttonGroup(array(array('label' => 'Gestionar Tutor', 'submit' => array('tutor/admin')))))));
?>

<?php 
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataTutor, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array(array('header' => 'ID', 'value' => '$data->id_tutor'), array('header' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->profile->firstname, $data->profile->secondname, $data->profile->lastname1, $data->profile->lastname2);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data->profile->sex);
Esempio n. 3
0
 public function getNombre($id)
 {
     if (!empty($id)) {
         $tutor = Tutor::model()->findByPk($id);
         return Profile::model()->nombreApellido($tutor->profile->firstname, $tutor->profile->secondname, $tutor->profile->lastname1, $tutor->profile->lastname2);
     }
     return TbHtml::labelTb("Sin asignar", array('color' => TbHtml::LABEL_COLOR_IMPORTANT));
 }
Esempio n. 4
0
 /**
  * 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 Tutor the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Tutor::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 5
0
<legend>
	<a href="#" id="mostrarInf"><i class="fa fa-chevron-down"></i></a>
	<a href="#" id="ocultarInf" style="display: none;"><i class="fa fa-chevron-up"></i></a>
	Información del Essay
</legend>
<div id="informacion" style="display: none;">
<!-- Informacion de tutor/estudiante -->
<?php 
if (Yii::app()->user->checkAccess('Tutor') || Yii::app()->user->checkAccess('College') || Yii::app()->user->isSuperAdmin) {
    $user = Students::model()->findByPk($essay->students_id);
    $name = "Estudiante";
} else {
    if (Yii::app()->user->checkAccess('Estudiante') && !Yii::app()->user->isSuperAdmin) {
        $stundet = Students::model()->findByPk($essay->students_id);
        $user = Tutor::model()->findByPk($stundet->tutor_id);
        $name = "Tutor";
    }
}
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => $name . " Asignado", 'headerIcon' => 'icon-user'));
?>

<?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $user, 'attributes' => array(array('type' => 'raw', 'label' => 'Nombre', 'value' => Profile::model()->nombreCompleto($user->profile->firstname, $user->profile->secondname)), array('type' => 'raw', 'label' => 'Apellido', 'value' => Profile::model()->apellidoCompleto($user->profile->lastname1, $user->profile->lastname2)), array('value' => Profile::model()->validarSexo($user->profile->sex), 'type' => 'raw', 'label' => 'Sexo'), array('name' => 'profile.email', 'label' => 'Correo'))));
?>

<?php 
$this->endWidget();
?>
<!-- End Box de Informacion tutor/estudiante -->
</div>
Esempio n. 6
0
 public function actionIndex()
 {
     if (Yii::app()->user->checkAccess('Tutor') && !Yii::app()->user->isSuperAdmin) {
         $profile = Profile::model()->find('cruge_user_iduser='******'Students', array(
         		'criteria'=>array(
         			'condition'=>'tutor_id= :id AND NOT EXISTS (SELECT * FROM essays_has_cruge_user WHERE students_id = id) AND EXISTS (SELECT * FROM profile WHERE t.id = id)',
         			//'condition'=>'tutor_id= :id',
         			'params'=>array(':id'=>Tutor::model()->find('profile_id='.$profile->id_profile)->id_tutor)
         			),
         		));	*/
         $dataStudentEssay = new CActiveDataProvider('EssaysHasCrugeUser', array('criteria' => array('condition' => 'EXISTS (SELECT * FROM students WHERE tutor_id = :id AND students_id = id)', 'params' => array(':id' => Tutor::model()->find('profile_id=' . $profile->id_profile)->id_tutor))));
     } else {
         if (Yii::app()->user->checkAccess('Aliado') || Yii::app()->user->checkAccess('College') || Yii::app()->user->isSuperAdmin) {
             /*$dataStudents=new CActiveDataProvider('Students', array(
             		'criteria'=>array(
             			'condition'=>'NOT EXISTS (SELECT * FROM essays_has_cruge_user WHERE students_id = id)',
             			//'condition'=>'tutor_id= :id',
             			//'params'=>array(':id'=>Tutor::model()->find('profile_id='.$profile->id)->id_tutor)
             			),
             		));*/
             /*$dataStudents=new CActiveDataProvider('Students', array(
             			'criteria'=>array(
             				'with'=>array('profile'=>array(
             						'with'=>array('crugeUserIduser'=>array(
             							'on' => '`cruge_user` ON cruge_user_iduser = iduser AND `cruge_user`.state =1',
             							'joinType' => 'INNER JOIN',								
             						)),
             						'on' => 'students`.profile_id =  `profile`.id_profile',
             						'joinType' => 'INNER JOIN',
             				)),
             			//'condition'=>'t.state= :id',
             			//'params'=>array(':id'=>0)
             			),
             		));*/
             /*$sql='SELECT id, firstname, secondname, lastname1, lastname2, sex,  `profile`.email, tutor_id, cruge_user_iduser,  `cruge_user`.state
             					FROM  `students` 
             					INNER JOIN (
             					`profile` 
             					INNER JOIN  `cruge_user` ON cruge_user_iduser = iduser
             					AND  `cruge_user`.state =1
             					) ON  `students`.profile_id =  `profile`.id_profile';
             						
             			$count = Yii::app()->db->createCommand('SELECT COUNT(*)
             													FROM  `students` 
             													INNER JOIN (
             													`profile` 
             													INNER JOIN  `cruge_user` ON cruge_user_iduser = iduser
             													AND  `cruge_user`.state =1
             													) ON  `students`.profile_id =  `profile`.id_profile')->queryScalar();	
             
             			$dataStudents =  new CSqlDataProvider($sql,array(
                                 'totalItemCount' => $count,
              
                                 'sort' => array(
                                     'defaultOrder' => array(
                                         'id' => CSort::SORT_ASC, //default sort value
                                     ),
             						'attributes'=>array(
             							 'id', 'firstname', 'secondname', 'lastname1', 'lastname2', 'sex', 'email', 'tutor_id', 'cruge_user_iduser', 'state'
             						),						
                                 ),
                                 'pagination' => array(
                                     'pageSize' => 10,
                                 ),			
             			));	*/
             $dataStudentEssay = new CActiveDataProvider('EssaysHasCrugeUser', array('criteria' => array('condition' => 'EXISTS (SELECT * FROM students WHERE students_id = id)'), 'pagination' => array('pageSize' => 10)));
         } else {
             if (Yii::app()->user->checkAccess('Estudiante') && !Yii::app()->user->isSuperAdmin) {
                 $profile = Profile::model()->find('cruge_user_iduser='******'EssaysHasCrugeUser', array('criteria' => array('condition' => 'students_id = :id', 'params' => array(':id' => Students::model()->find('profile_id=' . $profile->id_profile)->id))));
             }
         }
     }
     $this->render('index', array('dataStudentEssay' => $dataStudentEssay));
 }
Esempio n. 7
0
<!-- Estudiante del Tutor -->
<?php 
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => 'Estudiantes sin Tutor', 'headerIcon' => 'icon-th-list'));
?>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_STRIPED, 'dataProvider' => $dataStudents, 'template' => "{summary}{items}{pager}", 'enablePagination' => true, 'columns' => array(array('value' => '$data["id"]', 'header' => 'ID'), array('header' => 'Nombre', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data["firstname"], $data["secondname"], $data["lastname1"], $data["lastname2"]);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data["sex"]);
}, 'type' => 'raw'), array('header' => 'Correo', 'value' => '$data["email"]'), array('header' => 'Tutor', 'value' => function ($data, $row) {
    return Tutor::model()->getNombre($data["tutor_id"]);
}, 'type' => 'raw', 'visible' => Yii::app()->user->checkAccess('Tutor') && Yii::app()->user->isSuperAdmin), array('header' => 'Status', 'value' => function ($data, $row) {
    return Profile::model()->validarStatus($data["cruge_user_iduser"]);
}, 'type' => 'raw'), array('name' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return Tutor::model()->botonAsignar($data["tutor_id"], $data["id"]);
}))));
?>

<?php 
$this->endWidget();
?>
<!-- End Box de Estudents sin Essay -->