Exemplo n.º 1
0
$this->menu = array(array('label' => CHtml::image(Yii::app()->theme->baseUrl . "/img/operaciones/list29.png") . 'Mis Essays', 'url' => array('index'), 'visible' => Yii::app()->user->checkAccess('Estudiante') && !Yii::app()->user->isSuperAdmin), array('label' => CHtml::image(Yii::app()->theme->baseUrl . "/img/operaciones/group.png") . 'Mis Estudiantes', 'url' => array('index'), 'visible' => Yii::app()->user->checkAccess('Tutor') || Yii::app()->user->checkAccess('College') || Yii::app()->user->isSuperAdmin), array('label' => CHtml::image(Yii::app()->theme->baseUrl . "/img/operaciones/speech59.png") . 'Chat', 'url' => '#'), array('label' => CHtml::image(Yii::app()->theme->baseUrl . "/img/operaciones/user.png") . 'Perfil', 'url' => '#', 'visible' => Yii::app()->user->checkAccess('Estudiante') && !Yii::app()->user->isSuperAdmin));
?>
<legend>Essay: <?php 
echo $essay->title_essay;
?>
</legend>

<?php 
echo TbHtml::beginFormTb(TbHtml::FORM_LAYOUT_INLINE);
?>

	<?php 
echo TbHtml::label('<b>Status Essay</b>', 'text');
?>
	<?php 
echo EssaysHasCrugeUser::model()->validarStatus($essay->status);
?>
		
	<?php 
if (Yii::app()->user->checkAccess('Tutor') || Yii::app()->user->checkAccess('College') || Yii::app()->user->isSuperAdmin) {
    ?>
		<?php 
    echo "|";
    ?>
		<?php 
    echo TbHtml::Button('Cambiar Status', array('name' => 'end', 'color' => TbHtml::BUTTON_COLOR_DANGER, 'size' => TbHtml::BUTTON_SIZE_MINI, 'onclick' => '$("#myModal").dialog("open"); return false;'));
    ?>
	
		<?php 
    echo CHtml::hiddenField('idEssay', $essay->id_essay_cruge);
    ?>
Exemplo n.º 2
0
 public function getNameTitleEssay($id, $idColleges, $idTypeEssay, $idEssay)
 {
     $numEssay = EssaysHasCrugeUser::model()->calcularEssay($id, $idEssay, $idColleges, $idTypeEssay);
     return Students::model()->getNameShort($id) . "-" . $this->getNameFileEssay($idColleges, $idTypeEssay) . $numEssay;
 }
Exemplo n.º 3
0
 public function actionWrite($id)
 {
     $_SESSION['KCFINDER']['disabled'] = false;
     // enables the file browser in the admin
     $_SESSION['KCFINDER']['uploadURL'] = Yii::app()->baseUrl . "/uploads/";
     // enables the file browser in the admin
     $_SESSION['KCFINDER']['uploadDir'] = Yii::app()->basePath . "/../uploads/";
     // enables the file browser in the admin
     /*$model=EssaysHasCrugeUser::model()->findByPk($id);				
     
     		if(empty($model->essaysDetails) && !isset($_POST['EssaysDetail'])){			
     			$model->addDetail();		
     		}
     
     		if (isset($_POST['EssaysDetail'])) {
     
     			$model->setRelationRecords('essaysDetails',is_array(@$_POST['EssaysDetail']) ? $_POST['EssaysDetail'] : array());	
     
     			if ($model->save()) {			
     				Yii::app()->user->setFlash('profile-flash','save');			
     				$this->redirect(array('write','id'=>$id));
     			}
     		}
     		
     		$this->render('write',array(
     			'model'=>$model,//'essay' => $essay,
     		));*/
     $essay = EssaysHasCrugeUser::model()->findByPk($id);
     if (empty($essay->essaysDetails)) {
         $model = new EssaysDetail();
     } else {
         $criteria = new CDbCriteria();
         $criteria->condition = "essays_has_cruge_user_id_essay_cruge= :searched ORDER BY lastdate DESC";
         $criteria->params = array(":searched" => $id);
         $model = EssaysDetail::model()->find($criteria);
     }
     if (isset($_POST['EssaysDetail'])) {
         /*echo "<pre>";
         		echo print_r($_POST);
         		echo "</pre>";
         		Yii::app()->end();*/
         $detail = new EssaysDetail();
         $detail->attributes = $_POST['EssaysDetail'];
         $detail->lastdate = time();
         $detail->essays_has_cruge_user_id_essay_cruge = $_POST['idEssay'];
         if (isset($_POST['send'])) {
             $historial = new EssaysHistorical();
             $historial->attributes = $_POST['EssaysDetail'];
             $historial->lastdate = time();
             $historial->file_name = $essay->title_essay . "-" . EssaysHistorical::model()->calcularVersion($_POST['idEssay']);
             $historial->version = EssaysHistorical::model()->calcularVersion($_POST['idEssay']);
             $historial->essays_has_cruge_user_id_essay_cruge = $_POST['idEssay'];
             $essay->status = 8;
             if ($detail->save() && $historial->save() && $essay->save()) {
                 Yii::app()->user->setFlash('send', 'El Essay se ha enviado correctamente.');
                 $this->redirect(array('write', 'id' => $detail->essays_has_cruge_user_id_essay_cruge));
             }
         }
         if (isset($_POST['upload']) && isset($_FILES)) {
             $name = $_FILES['EssaysHistorical']['name']['file_name'];
             $ruta = $_FILES['EssaysHistorical']['tmp_name']['file_name'];
             $name = htmlentities($name, ENT_QUOTES);
             $pos = strripos($name, '.');
             //$tipo=explode(".",$name);
             //$type=strtolower($tipo[1]);
             $type = substr($name, $pos + 1, strlen($name));
             if ($type == "pdf") {
                 $version = Yii::app()->db->createCommand("SELECT COUNT(*) FROM essays_historical WHERE essays_has_cruge_user_id_essay_cruge=" . $_POST['idEssay'])->queryScalar() - 1;
                 $historial = EssaysHistorical::model()->find('essays_has_cruge_user_id_essay_cruge=' . $_POST['idEssay'] . ' AND version="V' . $version . '"');
                 //$refencia=sha1(date("r"));
                 $refencia = $essay->title_essay . "-" . $historial->version . "-CORR";
                 $file = $refencia . "." . $type;
                 $directorio = "D:/htdocs/via-college/uploads/" . $file;
                 //$directorio = "C:/xampp/htdocs/via-college/uploads/" . $file;
                 //$directorio = "var/www/vhosts/via-college.com/app.via-college.com/uploads/" . $file;
                 if (move_uploaded_file($ruta, $directorio)) {
                     //print( "El archivo fue subido con éxito.");
                     //Yii::app()->end();
                     $historial->attributes = $_POST['EssaysDetail'];
                     $historial->lastdate = time();
                     $historial->file_name = $file;
                     $historial->essays_has_cruge_user_id_essay_cruge = $_POST['idEssay'];
                     $essay->status = 7;
                     if ($historial->save() && $essay->save()) {
                         Yii::app()->user->setFlash('upload', 'Las corrección del Essay se ha enviado correctamente.');
                         $this->redirect(array('write', 'id' => $model->essays_has_cruge_user_id_essay_cruge));
                     }
                 } else {
                     Yii::app()->user->setFlash('error', 'Error al intentar subir el archivo.');
                     $this->redirect(array('write', 'id' => $model->essays_has_cruge_user_id_essay_cruge));
                     //print("Error al intentar subir el archivo.");
                     //Yii::app()->end();
                 }
             } else {
                 //print("El tipo de archivo permitido no es el correcto.");
                 //Yii::app()->end();
                 Yii::app()->user->setFlash('file', 'El tipo de archivo permitido para la correción no es el correcto.');
                 $this->redirect(array('write', 'id' => $model->essays_has_cruge_user_id_essay_cruge));
             }
         }
         if ($detail->save()) {
             Yii::app()->user->setFlash('save', 'El Essay se ha agregado correctamente.');
             $this->redirect(array('write', 'id' => $detail->essays_has_cruge_user_id_essay_cruge));
         }
     }
     if (isset($_POST['end'])) {
         $version = Yii::app()->db->createCommand("SELECT COUNT(*) FROM essays_historical WHERE essays_has_cruge_user_id_essay_cruge=" . $_POST['idEssay'])->queryScalar() - 1;
         $historial = EssaysHistorical::model()->find('essays_has_cruge_user_id_essay_cruge=' . $_POST['idEssay'] . ' AND version="V' . $version . '"');
         $name = $essay->title_essay;
         $historial->file_name = $name . "-VF";
         $historial->version = "VF";
         $essay->status = 10;
         if ($historial->save() && $essay->save()) {
             Yii::app()->user->setFlash('end', 'El Essay Final se ha enviado correctamente.');
             $this->redirect(array('write', 'id' => $model->essays_has_cruge_user_id_essay_cruge));
         }
     }
     if (isset($_POST['Status'])) {
         $essay->status = $_POST['Status'];
         if ($essay->save()) {
             Yii::app()->user->setFlash('status', 'El Status se ha cambiado correctamente.');
             $this->redirect(array('write', 'id' => $essay->id_essay_cruge));
         }
     }
     $this->render('write', array('model' => $model, 'essay' => $essay));
 }
Exemplo n.º 4
0
 public function actionRemove($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = EssaysHasCrugeUser::model()->find('students_id=' . $id . ' AND essays_id=' . $_POST['idx']);
         $model->delete();
         Yii::app()->user->setFlash('remove', 'El Estudiante se ha removido correctamente.');
         $this->redirect(array('view', 'id' => $_POST['idx']));
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
Exemplo n.º 5
0
    $this->renderPartial('_admin', array('dataStudents' => $dataStudents));
}
?>

<!-- Estudiante del Tutor -->
<?php 
if (Yii::app()->user->checkAccess('Tutor') || Yii::app()->user->checkAccess('College') || Yii::app()->user->isSuperAdmin) {
    $name = "Estudiantes con Essays";
} else {
    if (Yii::app()->user->checkAccess('Estudiante') && !Yii::app()->user->isSuperAdmin) {
        $name = "Mis Essays";
    }
}
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => $name, 'headerIcon' => 'icon-th-list'));
?>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_STRIPED, 'dataProvider' => $dataStudentEssay, 'template' => "{summary}{items}{pager}", 'enablePagination' => true, 'columns' => array(array('name' => 'ID', 'value' => '$data->id_essay_cruge'), array('name' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->students->profile->firstname, $data->students->profile->secondname, $data->students->profile->lastname1, $data->students->profile->lastname2);
}, 'visible' => Yii::app()->user->checkAccess('College') || Yii::app()->user->checkAccess('Tutor') || Yii::app()->user->isSuperAdmin), array('name' => 'Essay', 'name' => 'Titulo', 'value' => '$data->title_essay'), array('name' => 'Tipo', 'value' => '$data->essays->typeEssay->short_name'), array('name' => 'Inicio', 'type' => 'datetime', 'value' => '$data->stardate'), array('name' => 'Entrega', 'type' => 'datetime', 'value' => '$data->enddate'), array('name' => 'Status', 'type' => 'raw', 'value' => function ($data, $row) {
    return EssaysHasCrugeUser::model()->validarStatus($data->status);
}), array('name' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return EssaysHasCrugeUser::model()->getButtonEssay($data->id_essay_cruge);
}, 'htmlOptions' => array('width' => '20')))));
?>

<?php 
$this->endWidget();
?>
<!-- End Box de Estudents con Essay -->
Exemplo n.º 6
0
}))));
?>

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

<!-- Estudiante del Tutor -->
<?php 
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => 'Estudiantes con Essay', 'headerIcon' => 'icon-th-list'));
?>

<?php 
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataStudentEssay, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array(array('name' => 'ID', 'value' => '$data->id_essay_cruge'), array('name' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->students->profile->firstname, $data->students->profile->secondname, $data->students->profile->lastname1, $data->students->profile->lastname2);
}), array('name' => 'Essay', 'name' => 'Titulo', 'value' => '$data->title_essay'), array('name' => 'Tipo', 'value' => '$data->essays->typeEssay->short_name'), array('name' => 'Inicio', 'type' => 'datetime', 'value' => '$data->stardate'), array('name' => 'Entrega', 'type' => 'datetime', 'value' => '$data->enddate'), array('name' => 'Status', 'type' => 'raw', 'value' => function ($data, $row) {
    return EssaysHasCrugeUser::model()->validarStatus($data->status);
}), array('name' => '', 'type' => 'raw', 'value' => "TbHtml::submitButton('Essay',array(\n                        'submit'=>array('essayStudents/write','id'=>" . '$data->id_essay_cruge' . "),\n                        'color'=>TbHtml::BUTTON_COLOR_PRIMARY,\n                        'size'=>TbHtml::BUTTON_SIZE_MINI,\n                    ))"))));
?>

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

<?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'myModal', 'options' => array('title' => 'Asignar Tutor a Estudiante', 'autoOpen' => false, 'modal' => true, 'width' => 400, 'height' => 430, 'resizable' => false)));
//$student = new Students;
//echo $this->renderPartial('_student', array('model'=>$model, 'student'=>$student));
$this->endWidget('zii.widgets.jui.CJuiDialog');
Exemplo n.º 7
0
 public function getLinkCorr($file, $version)
 {
     $name = explode(".", $file);
     $name = $name[0];
     $pos = strrpos($name, '-');
     $ver = substr($name, $pos + 1, strlen($name));
     /*echo "<pre>";
     		echo print_r($ver);
     		echo "</pre>";*/
     if ($ver == "CORR") {
         //return CHtml::link(CHtml::encode('Descargar'), 'http://'.$_SERVER['SERVER_NAME'].Yii::app()->baseUrl.'/uploads/' . $file /*. '.pdf'*/,array('target'=>'_blank'));
         //return CHtml::link(CHtml::encode('Descargar'), array('download','name'=>$file));
         return CHtml::link('Descargar', array('essayStudents/download?file=' . urlencode($file)), array('target' => '_blank'));
     } else {
         if ($version == "VF") {
             return EssaysHasCrugeUser::model()->validarStatus(10);
             /*}else if($version == "VF"){
             		return  CHtml::link('Ver / Generar Essay',
             					   //array('requirements/report/idr/$model->id/ids/$student->id'),
             					   array('#'),
             					   array('target'=>'_blank'));*/
         }
     }
     return EssaysHasCrugeUser::model()->validarStatus(9);
 }