diff --git a/www/fotos/no_avatar.png b/www/fotos/no_avatar.png deleted file mode 100644 index 6428072..0000000 Binary files a/www/fotos/no_avatar.png and /dev/null differ diff --git a/www/protected/config/main.php b/www/protected/config/main.php index c40d1ae..ca7d04e 100644 --- a/www/protected/config/main.php +++ b/www/protected/config/main.php @@ -4,8 +4,8 @@ $yiiPath = dirname(__FILE__) . '/../../../yii/framework/yii.php'; // Set YII_DEBUG and YII_TRACE_LEVEL flags -$debug = true; -$traceLevel = 0; +//$debug = true; +//$traceLevel = 0; $config = array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', @@ -23,7 +23,6 @@ $config = array( 'ext.PageSize.*', 'application.modules.auditTrail.models.AuditTrail', ), - 'modules'=>array( 'auditTrail'=>array( diff --git a/www/protected/config/mode_development.php b/www/protected/config/mode_development.php index 49ffd78..9556d80 100644 --- a/www/protected/config/mode_development.php +++ b/www/protected/config/mode_development.php @@ -59,9 +59,12 @@ $configSpecific = array( ), ), ), - ), - + + 'params'=>array( + // Ruta de los currículums de los candidatos + 'curriculumPath' => dirname(__FILE__) . '/../../documentos/', + ), ); ?> \ No newline at end of file diff --git a/www/protected/controllers/CandidatoDocumentoController.php b/www/protected/controllers/CandidatoDocumentoController.php new file mode 100644 index 0000000..da6c651 --- /dev/null +++ b/www/protected/controllers/CandidatoDocumentoController.php @@ -0,0 +1,263 @@ + array('index', 'view', 'create', 'update', 'delete', 'admin', 'upload'), + 'users' => array('@'), + ), + array('allow', // deny all users + 'users' => array('*'), + ), + ); + } + + /** + * Displays a particular model. + * @param integer $id the ID of the model to be displayed + */ + public function actionView($id) { + $this->render('view', array( + 'model' => $this->loadModel($id), + )); + } + + /** + * Guarda el documento en el sistema + * @param CandidatoDocumento $documento el documento + * @param CUploadedFile $file el fichero asociado al documento a guardar + * @return boolean true cuando el fichero se guarda correctamente + */ + private function guardarDocumento($documento, $file) { + if (!is_null($file)) { + $folder = $this->darRutaDocumentos() . $documento->candidato_id . '/'; + + if (!is_dir($folder)) + mkdir($folder, 0755, true); + + $file->saveAs($folder . $documento->nombre_fichero); + } + } + + /** + * Genera un nombre de fichero para guardar el documento. Se comprueba + * que no exista ningún otro fichero con ese mismo nombre. + * @param CandidatoDocumento $model Documento + * @return string + */ + private function generarNombreDocumento($model) { + $cid = $model->candidato_id; + $old_filename = FileHelper::sanitizeFileName(pathinfo($model->nombre_fichero, PATHINFO_FILENAME)); + $ext = pathinfo($model->nombre_fichero, PATHINFO_EXTENSION); + $folder = $this->darRutaDocumentos() . $cid . '/'; + $contador = 1; + + $filename = $old_filename . '.' . $ext; + + // existe el directorio? + if (is_dir($folder)) { + // ya existe el fichero? + while (file_exists($folder . $filename)) { + $filename = $old_filename . '_' . $contador . '.' . $ext; + $contador++; + } + } + + return $filename; + } + + /** + * Da la ruta donde se guardan los documentos + * @return string ruta de los documentos + */ + private function darRutaDocumentos() { + return Yii::app()->params['curriculumPath']; + } + + /** + * Borrar el documento del sistema + * @param CandidatoDocumento $documento el documento a borrar + * @return boolean true cuando el fichero se borra correctamente + */ + private function borrarDocumento($documento) { + $cid = $documento->candidato_id; + $folder = $this->darRutaDocumentos() . $cid . '/'; + + if (file_exists($folder . $documento->nombre_fichero)) + unlink($folder . $documento->nombre_fichero); + } + + /** + * Descarga el documento + * @param integer $id el ID del documento + */ + public function actionDownload($id) { + $model = $this->loadModel($id); + $cid = $model->candidato_id; + $folder = $this->darRutaDocumentos() . $model->candidato_id . '/' . $model->nombre_fichero; + + GDownloadHelper::send($folder); + } + + /** + * Creates a new model. + * @param integer $cid el ID del candidato + */ + public function actionCreate($cid) { + $model = new CandidatoDocumento; + $model->candidato_id = $cid; + + $candidato = Candidato::model()->findByPk($cid); + + // Uncomment the following line if AJAX validation is needed + // $this->performAjaxValidation($model); + + if (isset($_POST['CandidatoDocumento'])) { + $model->attributes = $_POST['CandidatoDocumento']; + $documento = CUploadedFile::getInstance($model, 'file'); + $model->nombre_fichero = $documento->name; + + // Me aseguro que el nombre del fichero no tiene "cosas raras" + $model->nombre_fichero = $this->generarNombreDocumento($model); + + if ($model->save()) { + $this->guardarDocumento($model, $documento); + Yii::app()->user->setFlash('success', Yii::t('intranet', 'Currículum guardado correctamente.')); + $url = $this->createUrl('index', array('cid' => $model->candidato_id)); + $this->redirect($url); + } + } + + $this->render('create', array( + 'model' => $model, + 'candidato' => $candidato, + )); + } + + /** + * Updates a particular model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id the ID of the model to be updated + */ + public function actionUpdate($id) { + $model = $this->loadModel($id); + + // Uncomment the following line if AJAX validation is needed + // $this->performAjaxValidation($model); + + if (isset($_POST['CandidatoDocumento'])) { + $model->attributes = $_POST['CandidatoDocumento']; + if ($model->save()) + $this->redirect(array('view', 'id' => $model->id)); + } + + $this->render('update', array( + 'model' => $model, + )); + } + + /** + * Deletes a particular model. + * If deletion is successful, the browser will be redirected to the 'admin' page. + * @param integer $id the ID of the model to be deleted + */ + public function actionDelete($id) { + if (Yii::app()->request->isPostRequest) { + // we only allow deletion via POST request + + $model = $this->loadModel($id); + + if ($model->delete()) { + $this->borrarDocumento($model); + } + + // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser + if (!isset($_GET['ajax'])) + $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); + } + else + throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); + } + + /** + * Lists all models. + */ + public function actionIndex($cid) { + $this->layout = '//layouts/candidato'; + $candidato = Candidato::model()->findByPk($cid); + + $dataProvider = new CActiveDataProvider('CandidatoDocumento', array( + 'criteria' => array( + 'condition' => 'candidato_id=' . $cid, + ), + )); + + $this->render('index', array( + 'dataProvider' => $dataProvider, + 'candidato' => $candidato, + )); + } + + /** + * Manages all models. + */ + public function actionAdmin() { + $model = new CandidatoDocumento('search'); + $model->unsetAttributes(); // clear any default values + if (isset($_GET['CandidatoDocumento'])) + $model->attributes = $_GET['CandidatoDocumento']; + + $this->render('admin', array( + 'model' => $model, + )); + } + + /** + * 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 the ID of the model to be loaded + */ + public function loadModel($id) { + $model = CandidatoDocumento::model()->findByPk($id); + if ($model === null) + throw new CHttpException(404, 'The requested page does not exist.'); + return $model; + } + + /** + * Performs the AJAX validation. + * @param CModel the model to be validated + */ + protected function performAjaxValidation($model) { + if (isset($_POST['ajax']) && $_POST['ajax'] === 'candidato-documento-form') { + echo CActiveForm::validate($model); + Yii::app()->end(); + } + } + +} diff --git a/www/protected/helpers/FileHelper.php b/www/protected/helpers/FileHelper.php new file mode 100644 index 0000000..f2b66fc --- /dev/null +++ b/www/protected/helpers/FileHelper.php @@ -0,0 +1,46 @@ +; \ No newline at end of file diff --git a/www/protected/helpers/GDownloadHelper.php b/www/protected/helpers/GDownloadHelper.php new file mode 100644 index 0000000..85fbc11 --- /dev/null +++ b/www/protected/helpers/GDownloadHelper.php @@ -0,0 +1,200 @@ +no other output before + * or after calling this method, as this will corrupt the downloaded binary file. + * + * Output buffers will be cleared and disabled, and any active CWebLogRoute instances + * (which might otherwise output logging information at the end of the request) will + * be detected and disabled. + * + * If your application might produce any other output after your action completes, you + * should suppress this by using the exit statement at the end of your action. + * + * This method throws a CException if the specified path does not point to a valid file. + * + * This method throws a CHttpException (416) if the requested range is invalid. + * + * @param string full path to a file on the local filesystem being sent to the client. + * @param string optional, alternative filename as the client will see it (defaults to the local filename specified in $path) + * @return boolean true if the download succeeded, false if the connection was aborted prematurely. + */ + public static function send($path, $name=null) + { + // turn off output buffering + while (ob_get_level()) + ob_end_clean(); + + // disable any CWebLogRoutes to prevent them from outputting at the end of the request + foreach (Yii::app()->log->routes as $route) + if ($route instanceof CWebLogRoute) + $route->enabled = false; + + // obtain headers: + $envs = ''; + foreach ($_ENV as $item => $value) + if (substr($item, 0, 5) == 'HTTP_') + $envs .= $item.' => '.$value."\n"; + if (function_exists('apache_request_headers')) { + $headers = apache_request_headers(); + foreach ($headers as $header => $value) { + $envs .= "apache: $header = $value\n"; + } + } + + // obtain filename, if needed: + if (is_null($name)) + $name = basename($path); + + // verify path and connection status: + if (!is_file($path) || !is_readable($path) || connection_status()!=0) + throw new CException('GDownload::send() : unable to access local file "'.$path.'"'); + + // obtain filesize: + $size = filesize($path); + + // configure download range for multi-threaded / resumed downloads: + if (isset($_ENV['HTTP_RANGE'])) + { + list($a, $range) = explode("=", $_ENV['HTTP_RANGE']); + } + else if (function_exists('apache_request_headers')) + { + $headers = apache_request_headers(); + if (isset($headers['Range'])) { + list($a, $range) = explode("=", $headers['Range']); + } else { + $range = false; + } + } + else + { + $range = false; + } + + // produce required headers for partial downloads: + if ($range) + { + header('HTTP/1.1 206 Partial content'); + list($begin, $end) = explode("-", $range); + if ($begin == '') + { + $begin = $size-$end; + $end = $size-1; + } + else if ($end == '') + { + $end = $size-1; + } + $header = 'Content-Range: bytes '.$begin.'-'.$end.'/'.($size); + $size = $end-$begin+1; + } + else + { + $header = false; + $begin = 0; + $end = $size-1; + } + + // check range: + if (($begin > $size-1) || ($end > $size-1) || ($begin > $end)) + throw new CHttpException(416,'Requested range not satisfiable'); + + // suppress client-side caching: + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); + header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT"); + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + + // send a generic content-type: + header("Content-Type: application/octet-stream"); + + // send content-range header, if present: + if ($header) header($header); + + // send content-length header: + header("Content-Length: ".$size); + + // send content-disposition, with special handling for IE: + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) + { + header("Content-Disposition: inline; filename=".str_replace(' ', '%20', $name)); + } + else + { + header("Content-Disposition: inline; filename=\"$name\""); + } + + // set encoding: + header("Content-Transfer-Encoding: binary\n"); + + // stream out the binary data: + if ($file = fopen($path, 'rb')) + { + fseek($file, $begin); + $sent = 0; + while ($sent < $size) + { + set_time_limit(self::TIME_LIMIT); + $bytes = $end - ftell($file) + 1; + if ($bytes > self::BUFFER_SIZE) + $bytes = self::BUFFER_SIZE; + echo fread($file, $bytes); + $sent += $bytes; + flush(); + if (connection_aborted()) + break; + } + fclose($file); + } + + // check connection status and return: + $status = (connection_status()==0) and !connection_aborted(); + return $status; + } + +} \ No newline at end of file diff --git a/www/protected/migrations/m120504_095056_tbl_candidatos_documentos.php b/www/protected/migrations/m120504_095056_tbl_candidatos_documentos.php new file mode 100644 index 0000000..cb80af8 --- /dev/null +++ b/www/protected/migrations/m120504_095056_tbl_candidatos_documentos.php @@ -0,0 +1,34 @@ +createTable('tbl_candidatos_documentos', array( + 'id' => 'pk', + 'candidato_id' => 'integer NOT NULL', + 'fecha' => 'datetime', + 'tipo' => 'string', + 'nombre_fichero' => 'string', + )); + $this->addForeignKey('fk_candidatos_documentos_1', 'tbl_candidatos_documentos', 'candidato_id', 'tbl_candidatos', 'id', 'CASCADE', 'CASCADE'); + } + + public function down() + { + $this->dropForeignKey('fk_candidatos_documentos_1', 'tbl_candidatos_documentos'); + $this->dropTable('tbl_candidatos_documentos'); + return false; + } + + /* + // Use safeUp/safeDown to do migration with transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} \ No newline at end of file diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index 5f0567d..f242788 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -35,6 +35,7 @@ * @property CandidatoCapacidad[] $capacidades * @property CandidatoIdioma[] $idiomas * @property CandidatoTitulacion[] $titulaciones + * @property CandidatoDocumento[] $documentos */ class Candidato extends CActiveRecord { @@ -204,6 +205,8 @@ class Candidato extends CActiveRecord 'idiomasCount' => array(self::STAT, 'CandidatoIdioma', 'candidato_id'), 'titulaciones' => array(self::HAS_MANY, 'CandidatoTitulacion', 'candidato_id'), 'titulacionesCount' => array(self::STAT, 'CandidatoTitulacion', 'candidato_id'), + 'documentos' => array(self::HAS_MANY, 'CandidatoDocumento', 'candidato_id'), + 'documentosCount' => array(self::STAT, 'CandidatoDocumento', 'candidato_id'), ); } diff --git a/www/protected/models/CandidatoDocumento.php b/www/protected/models/CandidatoDocumento.php new file mode 100644 index 0000000..0b03217 --- /dev/null +++ b/www/protected/models/CandidatoDocumento.php @@ -0,0 +1,145 @@ + 'Interno', + self::TIPO_COMERCIAL => 'Comercial' + ); + } + + public function getReadableFileSize($retstring = null) { + // adapted from code at http://aidanlister.com/repos/v/function.size_readable.php + $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + + if ($retstring === null) { $retstring = '%01.2f %s'; } + + $lastsizestring = end($sizes); + + foreach ($sizes as $sizestring) { + if ($this->size < 1024) { break; } + if ($sizestring != $lastsizestring) { $this->size /= 1024; } + } + if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional + return sprintf($retstring, $this->size, $sizestring); + } + + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return CandidatoDocumento the static model class + */ + public static function model($className=__CLASS__) + { + return parent::model($className); + } + + /** + * @return string the associated database table name + */ + public function tableName() + { + return 'tbl_candidatos_documentos'; + } + + /** + * @return array validation rules for model attributes. + */ + public function rules() + { + // NOTE: you should only define rules for those attributes that + // will receive user inputs. + return array( + array('candidato_id', 'required'), + array('candidato_id', 'numerical', 'integerOnly'=>true), + array('tipo, nombre_fichero', 'length', 'max'=>255), + array('fecha', 'safe'), + + // The following rule is used by search(). + // Please remove those attributes that should not be searched. + array('id, candidato_id, fecha, tipo, nombre_fichero', 'safe', 'on'=>'search'), + ); + } + + + protected function afterConstruct() { + // Valores por defecto + $this->tipo = self::TIPO_INTERNO; + $this->fecha = date('Y-m-d H:i:s', time()); + parent::afterConstruct(); + } + + + /** + * @return array relational rules. + */ + public function relations() + { + // NOTE: you may need to adjust the relation name and the related + // class name for the relations automatically generated below. + return array( + 'candidato' => array(self::BELONGS_TO, 'Candidatos', 'candidato_id'), + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'candidato_id' => 'Candidato', + 'fecha' => 'Fecha', + 'tipo' => 'Tipo', + 'nombre_fichero' => 'Nombre', + 'file' => 'Fichero', + ); + } + + /** + * Retrieves a list of models based on the current search/filter conditions. + * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. + */ + public function search() + { + // Warning: Please modify the following code to remove attributes that + // should not be searched. + + $criteria=new CDbCriteria; + + $criteria->compare('id',$this->id); + $criteria->compare('candidato_id',$this->candidato_id); + $criteria->compare('fecha',$this->fecha,true); + $criteria->compare('tipo',$this->tipo,true); + $criteria->compare('nombre_fichero',$this->nombre_fichero,true); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + +} \ No newline at end of file diff --git a/www/protected/views/candidato/_documentos.php b/www/protected/views/candidato/_documentos.php new file mode 100644 index 0000000..c20be7d --- /dev/null +++ b/www/protected/views/candidato/_documentos.php @@ -0,0 +1,52 @@ + + +
+
+ + +
+ widget('ext.multimodelform.MultiModelForm',array( + 'id' => 'id_capacidad', //the unique widget id + 'addItemText' => '', // no quiero mostrar el enlace de añadir + 'removeText' => 'Eliminar', + 'removeConfirm' => '¿Desea eliminar esta capacidad?', + 'tableHtmlOptions' => array( + 'class' => 'sTable2 lf', + ), + 'tableView' => true, + 'formConfig' => $capacidadFormConfig, //the form configuration array + 'model' => $capacidad, //instance of the form model + + //if submitted not empty from the controller, + //the form will be rendered with validation errors + 'validatedItems' => $capacidadesValidas, + + //array of member instances loaded from db + 'data' => $capacidad->findAll('candidato_id=:candidato_id', array(':candidato_id'=>$model->id)), + + 'removeHtmlOptions' => array( + 'class' => 'button plain', + ), + )); + ?> +
+ +
+
+
+
\ No newline at end of file diff --git a/www/protected/views/candidatoCapacidad/_form.php b/www/protected/views/candidatoCapacidad/_form.php index f080dcc..b255a76 100644 --- a/www/protected/views/candidatoCapacidad/_form.php +++ b/www/protected/views/candidatoCapacidad/_form.php @@ -1,25 +1,5 @@ clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/custom/elements.js'); -/*Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/wysiwyg/jquery.wysiwyg.js'); -Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . 'js/plugins/wysiwyg/wysiwyg.image.js'); -Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . 'js/plugins/wysiwyg/wysiwyg.link.js'); -Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . 'js/plugins/wysiwyg/wysiwyg.table.js'); - -$script=<<clientScript->registerScript('wysiwyg', $script, CClientScript::POS_END);*/ - ?> beginWidget('CActiveForm', array( diff --git a/www/protected/views/candidatoDocumento/_form.php b/www/protected/views/candidatoDocumento/_form.php new file mode 100644 index 0000000..7c9dc25 --- /dev/null +++ b/www/protected/views/candidatoDocumento/_form.php @@ -0,0 +1,52 @@ +clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/custom/elements.js'); +?> + +beginWidget('CActiveForm', array( + 'id'=>'candidato-documento-form', + 'enableAjaxValidation'=>false, + 'htmlOptions' => array('enctype' => 'multipart/form-data'), + //'clientOptions'=>array('validateOnSubmit'=>true, 'validateOnChange'=>true), +)); ?> + +
+
+ +

Los campos marcados con * son obligatorios.

+
+ + errorSummary($model, "", "", array('class'=>"notification msgerror")); ?> +
+
+ + +
+

+ + + +

+
+
+ labelEx($model,'tipo', array('class'=>'nopadding')); ?> +
+ OpcionesTipo, array( + 'template' => '{input}{label}', + 'separator' => '   ', + )); ?> + error($model,'tipo', array('class'=>'errortext')); ?> +
+
+
+ labelEx($model,'file'); ?> +
+ +
+
+
+
+
+
+ +
+endWidget(); ?> diff --git a/www/protected/views/candidatoDocumento/_search.php b/www/protected/views/candidatoDocumento/_search.php new file mode 100644 index 0000000..4209ac5 --- /dev/null +++ b/www/protected/views/candidatoDocumento/_search.php @@ -0,0 +1,39 @@ +
+ +beginWidget('CActiveForm', array( + 'action'=>Yii::app()->createUrl($this->route), + 'method'=>'get', +)); ?> + +
+ label($model,'id'); ?> + textField($model,'id'); ?> +
+ +
+ label($model,'candidato_id'); ?> + textField($model,'candidato_id'); ?> +
+ +
+ label($model,'fecha'); ?> + textField($model,'fecha'); ?> +
+ +
+ label($model,'tipo'); ?> + textField($model,'tipo',array('size'=>60,'maxlength'=>255)); ?> +
+ +
+ label($model,'nombre_fichero'); ?> + textField($model,'nombre_fichero',array('size'=>60,'maxlength'=>255)); ?> +
+ +
+ +
+ +endWidget(); ?> + +
\ No newline at end of file diff --git a/www/protected/views/candidatoDocumento/_view.php b/www/protected/views/candidatoDocumento/_view.php new file mode 100644 index 0000000..1c81969 --- /dev/null +++ b/www/protected/views/candidatoDocumento/_view.php @@ -0,0 +1,24 @@ +
+ + getAttributeLabel('id')); ?>: + id), array('view', 'id'=>$data->id)); ?> +
+ + getAttributeLabel('candidato_id')); ?>: + candidato_id); ?> +
+ + getAttributeLabel('fecha')); ?>: + fecha); ?> +
+ + getAttributeLabel('tipo')); ?>: + tipo); ?> +
+ + getAttributeLabel('nombre_fichero')); ?>: + nombre_fichero); ?> +
+ + +
\ No newline at end of file diff --git a/www/protected/views/candidatoDocumento/admin.php b/www/protected/views/candidatoDocumento/admin.php new file mode 100644 index 0000000..6c3d3c3 --- /dev/null +++ b/www/protected/views/candidatoDocumento/admin.php @@ -0,0 +1,54 @@ +breadcrumbs=array( + 'Candidato Documentos'=>array('index'), + 'Manage', +); + +$this->menu=array( + array('label'=>'List CandidatoDocumento', 'url'=>array('index')), + array('label'=>'Create CandidatoDocumento', 'url'=>array('create')), +); + +Yii::app()->clientScript->registerScript('search', " +$('.search-button').click(function(){ + $('.search-form').toggle(); + return false; +}); +$('.search-form form').submit(function(){ + $.fn.yiiGridView.update('candidato-documento-grid', { + data: $(this).serialize() + }); + return false; +}); +"); +?> + +

Manage Candidato Documentos

+ +

+You may optionally enter a comparison operator (<, <=, >, >=, <> +or =) at the beginning of each of your search values to specify how the comparison should be done. +

+ +'search-button')); ?> + + +widget('zii.widgets.grid.CGridView', array( + 'id'=>'candidato-documento-grid', + 'dataProvider'=>$model->search(), + 'filter'=>$model, + 'columns'=>array( + 'id', + 'candidato_id', + 'fecha', + 'tipo', + 'nombre_fichero', + array( + 'class'=>'CButtonColumn', + ), + ), +)); ?> diff --git a/www/protected/views/candidatoDocumento/create.php b/www/protected/views/candidatoDocumento/create.php new file mode 100644 index 0000000..b6f0064 --- /dev/null +++ b/www/protected/views/candidatoDocumento/create.php @@ -0,0 +1,12 @@ +breadcrumbs=array( + Yii::t('intranet', 'Candidatos') => array('candidato/index'), + $candidato->nombre . ' ' . $candidato->apellidos => $this->createUrl('candidato/view',array('id' => $candidato->id)), + Yii::t('intranet', 'Currículums') => $this->createUrl('candidatoDocumento/index', array('cid'=>$candidato->id)), + Yii::t('intranet', 'Añadir currículum'), +); + +$this->pageTitle=Yii::t('intranet', 'Añadir currículum de candidato'); +?> + +renderPartial('_form', array('model'=>$model)); ?> diff --git a/www/protected/views/candidatoDocumento/index.php b/www/protected/views/candidatoDocumento/index.php new file mode 100644 index 0000000..193b316 --- /dev/null +++ b/www/protected/views/candidatoDocumento/index.php @@ -0,0 +1,90 @@ +breadcrumbs=array( + Yii::t('intranet', 'Candidatos') => array('candidato/index'), + $candidato->nombre . ' ' . $candidato->apellidos => array('candidato/view','id'=>$candidato->id), + Yii::t('intranet', 'Currículums'), +); + +$this->pageTitle = Yii::t('intranet', 'Gestión de currículums de candidato'); + +?> + +createUrl('candidatoDocumento/create', array('cid'=>$candidato->id)), + array( + 'class' => 'anchorbutton button_white', + ) + + ); +?> + +
+
+ +
+
+ 'tipo', + 'headerHtmlOptions'=>array( + 'style' => 'width:75px;', + 'class' => 'head0', + ), + 'cssClassExpression' => '"con1"', + ), + array( + 'type' => 'html', + 'name' => 'nombre_fichero', + 'value' => 'CHtml::link(CHtml::encode($data->nombre_fichero), array("download", "id"=>$data->id));', + 'headerHtmlOptions'=>array( + 'class' => 'head1', + ), + 'cssClassExpression' => '"con0"', + ), + array( + 'type' => 'raw', + 'name' => 'fecha', + 'value' => 'Time::timeAgoInWords($data->fecha);', + 'headerHtmlOptions'=>array( + 'style' => 'width:150px;', + 'class' => 'head0', + ), + 'cssClassExpression' => '"con1"', + ), + array( + 'header'=>Yii::t('intranet', 'Acciones'), + 'class'=>'CButtonColumn', + 'headerHtmlOptions'=>array( + 'style' => 'width:55px;', + 'class' => 'head0', + ), + 'template'=>'{delete}', + 'cssClassExpression' => '"con1"', + ), + ); + + $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']); + $dataProvider->getPagination()->setPageSize($pageSize); + + $this->widget('application.extensions.SelGridView', array( + 'id'=>'documentos-grid', + 'dataProvider'=>$dataProvider, + 'columns'=>$columns, + 'cssFile' => Yii::app()->baseUrl . '/css/gridview3.css', + 'itemsCssClass' => 'sTable3', + 'pagerCssClass' => 'dataTables_paginate', + 'template' => '{items}{pager}', + 'emptyText' => Yii::t('intranet', 'Este candidato no tiene documentos'), + 'selectableRows' => 1, + )); + ?> +
+ +
+ + + + diff --git a/www/protected/views/candidatoDocumento/update.php b/www/protected/views/candidatoDocumento/update.php new file mode 100644 index 0000000..167406a --- /dev/null +++ b/www/protected/views/candidatoDocumento/update.php @@ -0,0 +1,18 @@ +breadcrumbs=array( + 'Candidato Documentos'=>array('index'), + $model->id=>array('view','id'=>$model->id), + 'Update', +); + +$this->menu=array( + array('label'=>'List CandidatoDocumento', 'url'=>array('index')), + array('label'=>'Create CandidatoDocumento', 'url'=>array('create')), + array('label'=>'View CandidatoDocumento', 'url'=>array('view', 'id'=>$model->id)), + array('label'=>'Manage CandidatoDocumento', 'url'=>array('admin')), +); +?> + +

Update CandidatoDocumento id; ?>

+ +renderPartial('_form', array('model'=>$model)); ?> \ No newline at end of file diff --git a/www/protected/views/candidatoDocumento/view.php b/www/protected/views/candidatoDocumento/view.php new file mode 100644 index 0000000..1012c98 --- /dev/null +++ b/www/protected/views/candidatoDocumento/view.php @@ -0,0 +1,27 @@ +breadcrumbs=array( + 'Candidato Documentos'=>array('index'), + $model->id, +); + +$this->menu=array( + array('label'=>'List CandidatoDocumento', 'url'=>array('index')), + array('label'=>'Create CandidatoDocumento', 'url'=>array('create')), + array('label'=>'Update CandidatoDocumento', 'url'=>array('update', 'id'=>$model->id)), + array('label'=>'Delete CandidatoDocumento', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')), + array('label'=>'Manage CandidatoDocumento', 'url'=>array('admin')), +); +?> + +

View CandidatoDocumento #id; ?>

+ +widget('zii.widgets.CDetailView', array( + 'data'=>$model, + 'attributes'=>array( + 'id', + 'candidato_id', + 'fecha', + 'tipo', + 'nombre_fichero', + ), +)); ?> diff --git a/www/protected/views/layouts/candidato.php b/www/protected/views/layouts/candidato.php index 250f054..0d4f931 100644 --- a/www/protected/views/layouts/candidato.php +++ b/www/protected/views/layouts/candidato.php @@ -45,9 +45,9 @@ $pestañas = array( ), array( 'label' => Yii::t('intranet', 'Currículums'), - 'url' => array('/usuario'), + 'url' => $this->createUrl('candidatoDocumento/index', array('cid'=>$candidatoId)), 'linkOptions' => array('class'=>'curriculum'), - 'active' => ($this->id == 'curriculum') + 'active' => ($this->id == 'candidatoDocumento') ), array( 'label' => Yii::t('intranet', 'Historial'),