Capacidades profesionales de los candidatos

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@72 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
David Arranz 2012-11-12 11:57:20 +00:00
parent fac28c4a13
commit 636e3e0abd
43 changed files with 14915 additions and 9 deletions

View File

@ -132,6 +132,7 @@ class CandidatoController extends Controller {
*
*/
public function actionIndex() {
Yii::trace(CVarDumper::dumpAsString($_GET));
$candidatos = new Candidato('search');
$candidatos->unsetAttributes(); // clear any default values
@ -142,6 +143,19 @@ class CandidatoController extends Controller {
'candidatos' => $candidatos));
}
/**
* @brief
*
*/
public function darTotalCandidatos() {
$lista = array();
$lista['todos'] = Candidato::model()->count();
$lista['estado_disponibles'] = Candidato::model()->disponibles()->count();
$lista['estado_no_disponibles'] = Candidato::model()->no_disponibles()->count();
return $lista;
}
/**
* @brief Devuelve los datos del candidato con id $id.
* Si el candidato no existe, se lanza una excepción HTTP 404
@ -172,6 +186,26 @@ class CandidatoController extends Controller {
$ficheroFotografia = CUploadedFile::getInstance($candidato, 'ficheroFotografia');
$quitarFotografia = Yii::app()->request->getParam('quitar_fotografia', '0');
// Capacidades del candidato
$listaCapacidadesBorrar = array();
if (isset($_POST['CandidatoCapacidadProfesional'])) {
$listaCapacidades = array();
foreach ($_POST['CandidatoCapacidadProfesional'] as $key => $capacidad) {
if ($capacidad['id'])
$candidatoCapacidad = CandidatoCapacidadProfesional::model()->findByPk($capacidad['id']);
else
$candidatoCapacidad = new CandidatoCapacidadProfesional();
$candidatoCapacidad->attributes = $capacidad;
$candidatoCapacidad->id_candidato = $candidato->id;
if ($capacidad['_borrar'])
$listaCapacidadesBorrar[] = $candidatoCapacidad;
else
$listaCapacidades[] = $candidatoCapacidad;
}
$candidato->capacidadesProfesionales = $listaCapacidades;
}
// Titulaciones del candidato
$listaTitulacionesBorrar = $candidato->titulaciones;
if (isset($_POST['CandidatoTitulacion'])) {
@ -225,6 +259,29 @@ class CandidatoController extends Controller {
$candidato->fotografia->guardarFotografia($ficheroFotografia);
}
// Capacidades
if (!empty($listaCapacidadesBorrar)) {
Yii::trace('Eliminando capacidades marcadas para borrar', 'application.controllers.CandidatoController');
foreach ($listaCapacidadesBorrar as $candidatoCapacidad) {
Yii::trace('Eliminando capacidad... ', 'application.controllers.CandidatoController');
Yii::trace(CVarDumper::dumpAsString($candidatoCapacidad->attributes), 'application.controllers.CandidatoController');
if (!$candidatoCapacidad->delete()) {
$errores = array_merge($errores, $candidatoCapacidad->getErrors());
throw new CException('Error al eliminar una capacidad del candidato');
}
}
$listaCapacidadesBorrar = NULL;
}
if (!empty($candidato->capacidadesProfesionales)) {
Yii::trace('Guardando la lista de capacidades', 'application.controllers.CandidatoController');
foreach ($candidato->capacidadesProfesionales as $candidatoCapacidad) {
if (!$candidatoCapacidad->save()) {
$errores = array_merge($errores, $candidatoCapacidad->getErrors());
throw new CException('Error al guardar una capacidad del candidato');
}
}
}
// Titulaciones
if (!empty($listaTitulacionesBorrar)) {
Yii::trace('Eliminando titulaciones marcadas para borrar', 'application.controllers.CandidatoController');

View File

@ -0,0 +1,44 @@
INSERT INTO `tbl_capacidades_profesionales` (`id_categoria`, `descripcion`) VALUES
(1, 'Analista de Pruebas UNIX/LINUX'),
(1, 'Analista de Pruebas Web'),
(1, 'Analista Pruebas Host'),
(1, 'Diseño Téc.Pruebas UNIX'),
(1, 'Diseño Técnico de Pruebas Host'),
(1, 'Diseño Técnico de Pruebas WEB'),
(1, 'Ejecución de Pruebas'),
(1, 'Ejecución de Pruebas Web'),
(1, 'Jefe de Proyecto Pruebas');
INSERT INTO `tbl_capacidades_profesionales` (`id_categoria`, `descripcion`) VALUES
(2, 'Director Proyectos'),
(2, 'AF Plat Host'),
(2, 'AF Plat Unix'),
(2, 'AF Plat WEB'),
(2, 'AO Plat Host'),
(2, 'AO Plat Unix'),
(2, 'AO Plat WEB'),
(2, 'AP Plat Unix'),
(2, 'AP Plat Host'),
(2, 'AP Plat WEB'),
(2, 'Gerente Proyectos'),
(2, 'JP Plat Host'),
(2, 'JP Plat Host Unix'),
(2, 'JP Plat WEB'),
(2, 'Maquetador WEB'),
(2, 'PGJR Plat Host'),
(2, 'PGJR Plat UNIX'),
(2, 'PGJR Plat WEB'),
(2, 'PGSR Plat Unix'),
(2, 'PGSR Plat Host'),
(2, 'PGSR Plat WEB');
INSERT INTO `tbl_capacidades_profesionales` (`id_categoria`, `descripcion`) VALUES
(3, 'Analista de Pruebas UNIX/LINUX'),
(3, 'Analista de Pruebas Web'),
(3, 'Analista Pruebas Host'),
(3, 'Diseño Téc.Pruebas UNIX'),
(3, 'Diseño Técnico de Pruebas Host'),
(3, 'Diseño Técnico de Pruebas WEB'),
(3, 'Ejecución de Pruebas'),
(3, 'Ejecución de Pruebas Web'),
(3, 'Jefe de Proyecto Pruebas');

View File

@ -0,0 +1,32 @@
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 06-11-2012 a las 11:23:41
-- Versión del servidor: 5.5.16
-- Versión de PHP: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `usuarios_dev`
--
--
-- Volcado de datos para la tabla `tbl_sectores`
--
INSERT INTO `tbl_sectores` (`id`, `descripcion`) VALUES
(1, 'Banca');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -0,0 +1,115 @@
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 06-11-2012 a las 11:23:16
-- Versión del servidor: 5.5.16
-- Versión de PHP: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `usuarios_dev`
--
--
-- Volcado de datos para la tabla `tbl_sectores_areas_funcionales`
--
INSERT INTO `tbl_sectores_areas_funcionales` (`id`, `id_sector`, `descripcion`) VALUES
(4, 1, 'ALHAMBRA CANALES'),
(10, 1, 'ALHAMBRA-INTERNET'),
(11, 1, 'ALHAMBRA-PORTALS'),
(12, 1, 'ALHAMBRA-SELF SERVICES'),
(13, 1, 'ASSET MANAGEMENT'),
(15, 1, 'BANCA PRIVADA'),
(20, 1, 'CANALES-BROKER CANALS'),
(21, 1, 'CANALES-CONTACT CENTER'),
(22, 1, 'CANALES-CROSS CANALS'),
(23, 1, 'CANALES-INTERNET'),
(24, 1, 'CANALES-MOVILIDAD'),
(25, 1, 'CANALES-CIRCUIT.CONTR.'),
(26, 1, 'CANALES-OFICINA'),
(27, 1, 'COMP-GLOB.PAGOS -COMP. DE PAGOS'),
(28, 1, 'COMP-GLOB.PAGOS-COMP. GENERALES'),
(29, 1, 'COMP-GLOB.PAGOS-COMP. DE INVERS'),
(30, 1, 'CONSUMER FINANCE'),
(31, 1, 'CONTROL DE CALIDAD-CALIDAD TECNICA'),
(32, 1, 'CONTROL DE CALIDAD-CALIDAD FUNCIONAL'),
(33, 1, 'CRM-AGENDAS'),
(34, 1, 'CRM-CAMPAÑAS'),
(35, 1, 'CRM-CRM'),
(36, 1, 'CRM-GEST.INF.COMERCI'),
(37, 1, 'CRM-INTEL.COMERCIAL'),
(42, 1, 'CUENTAS PERSONALES-CTAS PERSONALES'),
(43, 1, 'CUENTAS PERSONALES-LIQ.PASIVO'),
(44, 1, 'CUENTAS PERSONALES-SGO'),
(45, 1, 'CUENTAS PERSONALES-PLANES'),
(47, 1, 'CUENTAS PERSONALES-FONDOS'),
(48, 1, 'CUENTAS PERSONALES-DESCUB Y CREDITO'),
(51, 1, 'MIS(SIST.INF.GESTIÓN)-AUDITORIA'),
(52, 1, 'MIS(SIST.INF.GESTIÓN-CUMPLIMIENTO)'),
(53, 1, 'MIS(SIST.INF.GESTIÓN)-SATAMARTS'),
(54, 1, 'MIS(SIST.INF.GESTIÓN-GEST ACT Y PAS)'),
(55, 1, 'MIS(SIST.INF.GESTIÓN)-INTERVENCION'),
(56, 1, 'MIS(SIST.INF.GESTIÓN-POS RIEGO CLIENTE)'),
(57, 1, 'NEGOCIOS GLOBALES-BANCA Y MERC GLOBAL'),
(58, 1, 'NEGOCIOS GLOBALES-GEST ACTIVOS'),
(59, 1, 'NEGOCIOS GLOBALES-SEGUROS'),
(60, 1, 'OTRAS FINANCIACIONES-TITULIZACIONES'),
(61, 1, 'OTRAS FINANCIACIONES-LEASING RENTING'),
(62, 1, 'OTRAS FINANCIACIONES-GEST. TITULIZACIONES'),
(63, 1, 'OTRAS FINANCIACIONES-FACTORING'),
(64, 1, 'OTRAS FINANCIACIONES-CREDITOS EURIBOR'),
(65, 1, 'OTRAS FINANCIACIONES-CONFIRMING'),
(66, 1, 'OTRAS FINANCIACION-AVALES'),
(67, 1, 'OTRAS FINANCIACIONES'),
(69, 1, 'PAGOS TRADICIONALES-TRASF NACIONALES'),
(70, 1, 'PAGOS TRADICIONALES-CARTERA'),
(71, 1, 'PAGOS TRADICIONALES-DOMICILIACIONES'),
(72, 1, 'PAGOS TRADICIONALES-TRASF. INTERNACIONALES'),
(73, 1, 'PAGOS Y COBROS ELECTRONICOS-EBA'),
(74, 1, 'PAGOS Y COBROS ELECTRONICOS-SEG. CAMBIO'),
(75, 1, 'PAGOS Y COBROS ELECTRONICOS'),
(76, 1, 'PRESTAMOS'),
(77, 1, 'PROCESOS'),
(78, 1, 'PROCESOS-PROC.PRESTAMOS'),
(79, 1, 'PROCESOS-PROC.EXTRANJERO'),
(80, 1, 'PROCESOS-PROC.BANCA Y AHO'),
(81, 1, 'PROCESOS-PROC.FAC.LEA'),
(82, 1, 'PROCESOS-PROC. VENTAS'),
(83, 1, 'RIESGOS-ADMISION'),
(84, 1, 'RIESGOS-GEST. COBRO'),
(85, 1, 'RIESGOS-SEGUIMIENTO'),
(86, 1, 'RIESGOS IRREGULARES-CIRBE'),
(87, 1, 'RIESGOS IRREGULARES'),
(88, 1, 'SEGUROS'),
(89, 1, 'SIST. ESTRUCTURALES-ARQ. GESTION'),
(90, 1, 'SIST. ESTRUCTURALES-CATAL. PRODUCTOS'),
(92, 1, 'SIST. ESTRUCTURALES-TABLAS GENERALES'),
(96, 1, 'SIST. ESTRUCTURALES-CONTABILIDAD'),
(97, 1, 'SIST. ESTRUCTURALES-COMP. GENERALES'),
(101, 1, 'SIST. INTERNOS'),
(102, 1, 'SIST. INTERNOS-REMUNERACIONES'),
(106, 1, 'TARJETAS'),
(107, 1, 'MEDIOS DE PAGO-CENTRO AUTORIZADOR'),
(108, 1, 'MEDIOS DE PAGO-TARJETAS'),
(109, 1, 'MEDIOS DE PAGO'),
(110, 1, 'PAGOS Y COBROS DOCUMENTARIOS-AUTORIZACION'),
(112, 1, 'VALORES Y ACT FINANCIEROS'),
(114, 1, 'SWIFT'),
(115, 1, '0.- sin especialidad funcional'),
(116, 1, 'RIESGOS'),
(117, 1, 'CRÉDITOS');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -0,0 +1,32 @@
<?php
/**
* @class m121105_155927_tbl_sectores_tbl_sectores_areas_funcionales
* @var $this CDbMigration
* @package application.migrations
*/
class m121105_155927_tbl_sectores_tbl_sectores_areas_funcionales extends CDbMigration {
public function safeUp() {
$this->createTable('tbl_sectores', array(
'id' => 'pk',
'descripcion' => 'string NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
$this->createTable('tbl_sectores_areas_funcionales', array(
'id' => 'pk',
'id_sector' => 'integer NOT NULL',
'descripcion' => 'string NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
$this->addForeignKey('fk_sectores_areas_funcionales_1', 'tbl_sectores_areas_funcionales', 'id_sector', 'tbl_sectores', 'id', 'CASCADE', 'CASCADE');
}
public function safeDown() {
$this->dropForeignKey('fk_sectores_areas_funcionales_1', 'tbl_sectores_areas_funcionales');
$this->dropTable('tbl_sectores_areas_funcionales');
$this->dropTable('tbl_sectores');
}
}

View File

@ -0,0 +1,21 @@
<?php
/**
* @class m121105_160403_tbl_categorias_profesionales
* @var $this CDbMigration
* @package application.migrations
*/
class m121105_160403_tbl_categorias_profesionales extends CDbMigration {
public function safeUp() {
$this->createTable('tbl_categorias_profesionales', array(
'id' => 'pk',
'descripcion' => 'string NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
}
public function safeDown() {
$this->dropTable('tbl_categorias_profesionales');
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* @class m121105_160412_tbl_capacidades_profesionales
* @var $this CDbMigration
* @package application.migrations
*/
class m121105_160412_tbl_capacidades_profesionales extends CDbMigration {
public function safeUp() {
$this->createTable('tbl_capacidades_profesionales', array(
'id' => 'pk',
'id_categoria' => 'integer NOT NULL',
'descripcion' => 'string NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
$this->addForeignKey('fk_capacidades_profesionales_1', 'tbl_capacidades_profesionales', 'id_categoria', 'tbl_categorias_profesionales', 'id', 'CASCADE', 'CASCADE');
}
public function safeDown() {
$this->dropForeignKey('fk_capacidades_profesionales_1', 'tbl_capacidades_profesionales');
$this->dropTable('tbl_capacidades_profesionales');
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* @class m121105_160716_tbl_candidatos_capacidades_profesionales
* @var $this CDbMigration
* @package application.migrations
*/
class m121105_160716_tbl_candidatos_capacidades_profesionales extends CDbMigration {
public function safeUp() {
$this->createTable('tbl_candidatos_capacidades_profesionales', array(
'id' => 'pk',
'id_candidato' => 'integer NOT NULL',
'id_capacidad' => 'integer NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
$this->addForeignKey('fk_candidatos_capacidades_profesionales_1', 'tbl_candidatos_capacidades_profesionales', 'id_candidato', 'tbl_candidatos', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_candidatos_capacidades_profesionales_2', 'tbl_candidatos_capacidades_profesionales', 'id_capacidad', 'tbl_capacidades_profesionales', 'id', 'CASCADE', 'CASCADE');
}
public function safeDown() {
$this->dropForeignKey('fk_candidatos_capacidades_profesionales_2', 'tbl_candidatos_capacidades_profesionales');
$this->dropForeignKey('fk_candidatos_capacidades_profesionales_1', 'tbl_candidatos_capacidades_profesionales');
$this->dropTable('tbl_candidatos_capacidades_profesionales');
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* @class m121105_160731_tbl_candidatos_areas_funcionales
* @var $this CDbMigration
* @package application.migrations
*/
class m121105_160731_tbl_candidatos_areas_funcionales extends CDbMigration {
public function safeUp() {
$this->createTable('tbl_candidatos_areas_funcionales', array(
'id' => 'pk',
'id_candidato' => 'integer NOT NULL',
'id_area_funcional' => 'integer NOT NULL',
), 'ENGINE=InnoDB CHARSET=utf8');
$this->addForeignKey('fk_candidatos_areas_funcionales_1', 'tbl_candidatos_areas_funcionales', 'id_candidato', 'tbl_candidatos', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_candidatos_areas_funcionales_2', 'tbl_candidatos_areas_funcionales', 'id_area_funcional', 'tbl_sectores_areas_funcionales', 'id', 'CASCADE', 'CASCADE');
}
public function safeDown() {
$this->dropForeignKey('fk_candidatos_areas_funcionales_2', 'tbl_candidatos_areas_funcionales');
$this->dropForeignKey('fk_candidatos_areas_funcionales_1', 'tbl_candidatos_areas_funcionales');
$this->dropTable('tbl_candidatos_areas_funcionales');
}
}

View File

@ -0,0 +1,94 @@
<?php
/**
* @class AreaFuncional
* @brief Modelo de la tabla "tbl_sectores_areas_funcionales".
*
* The followings are the available columns in table 'tbl_sectores_areas_funcionales':
* @property integer $id
* @property integer $id_sector
* @property string $descripcion
*
* The followings are the available model relations:
* @property CandidatoAreaFuncional[] $candidatoAreaFuncional
* @property Sector $sector
*
* @package application.models
*/
class AreaFuncional extends CActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return AreaFuncional 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_sectores_areas_funcionales';
}
/**
* @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('id_sector, descripcion', 'required'),
array('id_sector', 'numerical', 'integerOnly' => true),
array('descripcion', 'length', 'max' => 255),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, id_sector, descripcion', 'safe', 'on' => 'search'),
);
}
/**
* @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(
'candidatoAreaFuncional' => array(self::HAS_MANY, 'CandidatoAreaFuncional', 'id_area_funcional'),
'sector' => array(self::BELONGS_TO, 'Sector', 'id_sector'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'id' => 'ID',
'id_sector' => 'Sector',
'descripcion' => 'Descripción',
);
}
/**
* 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('id_sector', $this->id_sector);
$criteria->compare('descripcion', $this->descripcion, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
}

View File

@ -134,7 +134,7 @@ class Candidato extends CActiveRecord {
array('fecha_nacimiento, observaciones', 'safe'),
array('fecha_nacimiento', 'date', 'format' => 'dd/MM/yyyy'),
array('fecha_nacimiento', 'date', 'format' => 'dd/MM/yyyy'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
@ -306,18 +306,22 @@ class Candidato extends CActiveRecord {
));
}
protected function beforeSave() {
protected function beforeSave() {
$this->fecha_nacimiento = date('Y-m-d', CDateTimeParser::parse($this->fecha_nacimiento, Yii::app()->locale->dateFormat));
if ($this->isNewRecord)
$this->created_time = date("Y-m-d H:i:s");
/*if (($this->id_estado === self::ESTADO_BORRADO) && ($this->deleted_time === NULL))
$this->deleted_time = date("Y-m-d H:i:s");*/
else
$this->modified_time = date("Y-m-d H:i:s");
return parent::beforeSave();
}
protected function afterFind() {
parent::afterFind();
$this->fotografia = new FotografiaPerfil();
$this->fotografia->modelo = $this;
$this->fecha_nacimiento = Yii::app()->dateFormatter->formatDateTime(CDateTimeParser::parse($this->fecha_nacimiento, 'yyyy-MM-dd'), 'medium', null);
return parent::afterFind();
}
protected function afterConstruct() {

View File

@ -0,0 +1,95 @@
<?php
/**
* This is the model class for table "tbl_candidatos_areas_funcionales".
*
* The followings are the available columns in table 'tbl_candidatos_areas_funcionales':
* @property integer $id
* @property integer $id_candidato
* @property integer $id_area_funcional
*
* The followings are the available model relations:
* @property TblSectoresAreasFuncionales $idAreaFuncional
* @property TblCandidatos $idCandidato
*/
class CandidatoAreaFuncional extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return CandidatoAreaFuncional 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_areas_funcionales';
}
/**
* @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('id_candidato, id_area_funcional', 'required'),
array('id_candidato, id_area_funcional', 'numerical', 'integerOnly'=>true),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, id_candidato, id_area_funcional', 'safe', 'on'=>'search'),
);
}
/**
* @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(
'areaFuncional' => array(self::BELONGS_TO, 'AreaFuncional', 'id_area_funcional'),
'candidato' => array(self::BELONGS_TO, 'Candidato', 'id_candidato'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'id_candidato' => 'Candidato',
'id_area_funcional' => 'Área funcional',
);
}
/**
* 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('id_candidato',$this->id_candidato);
$criteria->compare('id_area_funcional',$this->id_area_funcional);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}

View File

@ -0,0 +1,95 @@
<?php
/**
* This is the model class for table "tbl_candidatos_capacidades_profesionales".
*
* The followings are the available columns in table 'tbl_candidatos_capacidades_profesionales':
* @property integer $id
* @property integer $id_candidato
* @property integer $id_capacidad
*
* The followings are the available model relations:
* @property TblCapacidadesProfesionales $idCapacidad
* @property TblCandidatos $idCandidato
*/
class CandidatoCapacidadProfesional extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return CandidatoCapacidadProfesional 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_capacidades_profesionales';
}
/**
* @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('id_candidato, id_capacidad', 'required'),
array('id_candidato, id_capacidad', 'numerical', 'integerOnly'=>true),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, id_candidato, id_capacidad', 'safe', 'on'=>'search'),
);
}
/**
* @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(
'idCapacidad' => array(self::BELONGS_TO, 'TblCapacidadesProfesionales', 'id_capacidad'),
'idCandidato' => array(self::BELONGS_TO, 'TblCandidatos', 'id_candidato'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'id_candidato' => 'Id Candidato',
'id_capacidad' => 'Id Capacidad',
);
}
/**
* 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('id_candidato',$this->id_candidato);
$criteria->compare('id_capacidad',$this->id_capacidad);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}

View File

@ -0,0 +1,94 @@
<?php
/**
* @class CategoriaProfesional
* @brief Modelo de la tabla "tbl_capacidades_profesionales".
*
* The followings are the available columns in table 'tbl_capacidades_profesionales':
* @property integer $id
* @property integer $id_categoria
* @property string $descripcion
*
* The followings are the available model relations:
* @property CandidatoCapacidadProfesional[] $candidatoCapacidadProfesional
* @property CategoriaProfesional $categoriaProfesional
*
* @package application.models
*/
class CapacidadProfesional extends CActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return CapacidadProfesional 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_capacidades_profesionales';
}
/**
* @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('id_categoria, descripcion', 'required'),
array('id_categoria', 'numerical', 'integerOnly' => true),
array('descripcion', 'length', 'max' => 255),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, id_categoria, descripcion', 'safe', 'on' => 'search'),
);
}
/**
* @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(
'candidatoCapacidadProfesional' => array(self::HAS_MANY, 'CandidatoCapacidadProfesional', 'capacidad_id'),
'categoriaProfesional' => array(self::BELONGS_TO, 'CategoriaProfesional', 'id_categoria'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'id' => 'ID',
'id_categoria' => 'Categoría',
'descripcion' => 'Descripción',
);
}
/**
* 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('id_categoria', $this->id_categoria);
$criteria->compare('descripcion', $this->descripcion, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* @class CategoriaProfesional
* @brief Modelo de la tabla "tbl_categorias_profesionales".
*
* The followings are the available columns in table 'tbl_categorias_profesionales':
* @property integer $id
* @property string $descripcion
*
* The followings are the available model relations:
* @property CapacidadProfesional[] $capacidadProfesional
*
* @package application.models
*/
class CategoriaProfesional extends CActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return CategoriaProfesional 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_categorias_profesionales';
}
/**
* @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('descripcion', 'required'),
array('descripcion', 'length', 'max' => 255),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, descripcion', 'safe', 'on' => 'search'),
);
}
/**
* @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(
'capacidadProfesional' => array(self::HAS_MANY, 'CapacidadProfesional', 'id_categoria'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'id' => 'ID',
'descripcion' => 'Descripción',
);
}
/**
* 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('descripcion', $this->descripcion, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* @class Sector
* @brief Modelo de la tabla "tbl_sectores".
*
* The followings are the available columns in table 'tbl_sectores':
* @property integer $id
* @property string $descripcion
*
* The followings are the available model relations:
* @property AreaFuncional[] $areaFuncional
*
* @package application.models
*/
class Sector extends CActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Sector 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_sectores';
}
/**
* @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('descripcion', 'required'),
array('descripcion', 'length', 'max' => 255),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, descripcion', 'safe', 'on' => 'search'),
);
}
/**
* @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(
'areaFuncional' => array(self::HAS_MANY, 'AreaFuncional', 'sector_id'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'id' => 'ID',
'descripcion' => 'Descripción',
);
}
/**
* 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('descripcion', $this->descripcion, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
}

View File

@ -1567,3 +1567,25 @@ label, input, button, select, textarea, select, textarea, input[type="text"], in
opacity: .6;
background: #fff;
}
/* Multiselect */
.ms-container {
background: transparent;
}
.ms-container .ms-selectable, .ms-container .ms-selection {
width: 100%;
}
.ms-container .ms-selectable {
margin-right: 0;
padding-bottom: 25px;
margin-bottom: 5px;
background: transparent url('../images/switch.png') no-repeat bottom center;
}
.ms-container ul.ms-list {
width: 100%;
display: block;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,18 @@
profind_grid = {
init: function() {
profind.fixPaginationPos();
},
fixPaginationPos: function() {
$row = $("<div class=\'row\'/>");
$row.appendTo(".dataTables_wrapper");
$column1 = $("<div class=\'span6\'/>");
$column2 = $("<div class=\'span6\'/>");
$column1.appendTo($row);
$column2.appendTo($row);
$column1.append($(".dataTables_wrapper .dataTables_info"));
$column2.append($(".dataTables_wrapper .pagination"));
}
}

View File

@ -2,7 +2,6 @@
* * This script depends on jquery.format.js
*/
$(document).ready(function() {
profind_template.init();
});

View File

@ -0,0 +1 @@
.DS_Store

View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -0,0 +1,3 @@
# jquery.multi-select.js
Usage and Demos [http://loudev.com](http://loudev.com "jquery.multi-select.js")

View File

@ -0,0 +1,86 @@
.ms-container{
background: transparent url('../img/switch.png') no-repeat 170px 80px;
}
.ms-container:after{
content: "."; display: block; height: 0; line-height: 0; font-size: 0; clear: both; min-height: 0; visibility: hidden;
}
.ms-container .ms-selectable, .ms-container .ms-selection{
background: #fff;
color: #555555;
float: left;
}
.ms-container .ms-list{
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
transition: border linear 0.2s, box-shadow linear 0.2s;
border: 1px solid #cccccc;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.ms-selected{
display:none;
}
.ms-container .ms-selectable{
margin-right: 40px;
}
.ms-container .ms-list.ms-focus{
border-color: rgba(82, 168, 236, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
outline: 0;
outline: thin dotted \9;
}
.ms-container ul{
margin: 0;
list-style-type: none;
}
.ms-container ul.ms-list{
width: 160px;
height: 200px;
padding: 0px 0px;
overflow-y: auto;
}
.ms-container .ms-selectable li.ms-elem-selectable,
.ms-container .ms-selection li.ms-elem-selected{
border-bottom: 1px #eee solid;
padding: 2px 10px;
color: #555;
font-size: 14px;
}
.ms-container .ms-selectable li.disabled,
.ms-container .ms-selection li.disabled{
background-color: #eee;
color: #aaa;
}
.ms-container .ms-optgroup-label{
padding: 5px 0px 0px 5px;
cursor: pointer;
color: #999;
}
.ms-container li.ms-elem-selectable:not(.disabled).ms-hover,
.ms-container .ms-selection li:not(.disabled).ms-hover{
cursor: pointer;
color: #ffffff;
text-decoration: none;
background-color: #0088cc;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,334 @@
/*
* MultiSelect v0.8
* Copyright (c) 2012 Louis Cuny
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
(function($){
var msMethods = {
'init' : function(options){
this.settings = {
disabledClass : 'disabled',
selectCallbackOnInit: false,
keepOrder : false,
dblClick : false
};
if(options) {
this.settings = $.extend(this.settings, options);
}
var multiSelects = this;
multiSelects.css('position', 'absolute').css('left', '-9999px');
return multiSelects.each(function(){
var ms = $(this);
if (ms.next('.ms-container').length == 0){
ms.attr('id', ms.attr('id') ? ms.attr('id') : 'ms-'+Math.ceil(Math.random()*1000));
var container = $('<div id="ms-'+ms.attr('id')+'" class="ms-container"></div>'),
selectableContainer = $('<div class="ms-selectable"></div>'),
selectedContainer = $('<div class="ms-selection"></div>'),
selectableUl = $('<ul class="ms-list"></ul>'),
selectedUl = $('<ul class="ms-list"></ul>');
ms.data('settings', multiSelects.settings);
var optgroupLabel = null,
optgroupId = null,
optgroupCpt = 0,
scroll = 0;
ms.find('optgroup,option').each(function(){
if ($(this).is('optgroup')){
optgroupLabel = $(this).attr('label');
optgroupId = 'ms-'+ms.attr('id')+'-optgroup-'+optgroupCpt;
selectableUl.append($('<li class="ms-optgroup-container" id="'+
optgroupId+'"><ul class="ms-optgroup"><li class="ms-optgroup-label">'+
optgroupLabel+'</li></ul></li>'));
optgroupCpt++;
} else {
var klass = $(this).attr('class') ? ' '+$(this).attr('class') : '';
var selectableLi = $('<li class="ms-elem-selectable'+klass+'" ms-value="'+$(this).val()+'">'+$(this).text()+'</li>');
if ($(this).attr('title'))
selectableLi.attr('title', $(this).attr('title'));
if ($(this).attr('disabled') || ms.attr('disabled')){
selectableLi.attr('disabled', 'disabled');
selectableLi.addClass(multiSelects.settings.disabledClass);
}
if(multiSelects.settings.dblClick) {
selectableLi.dblclick(function(){
ms.multiSelect('select', $(this).attr('ms-value'));
});
} else {
selectableLi.click(function(){
ms.multiSelect('select', $(this).attr('ms-value'));
});
}
var container = optgroupId ? selectableUl.children('#'+optgroupId).find('ul').first() : selectableUl;
container.append(selectableLi);
}
});
if (multiSelects.settings.selectableHeader){
selectableContainer.append(multiSelects.settings.selectableHeader);
}
selectableContainer.append(selectableUl);
if (multiSelects.settings.selectedHeader){
selectedContainer.append(multiSelects.settings.selectedHeader);
}
selectedContainer.append(selectedUl);
container.append(selectableContainer);
container.append(selectedContainer);
ms.after(container);
ms.find('option:selected').each(function(){
ms.multiSelect('select', $(this).val(), 'init');
});
$('.ms-elem-selectable', selectableUl).on('mouseenter', function(){
$('li', container).removeClass('ms-hover');
$(this).addClass('ms-hover');
}).on('mouseout', function(){
$('li', container).removeClass('ms-hover');
});
selectableUl.on('focusin', function(){
$(this).addClass('ms-focus');
selectedUl.focusout();
}).on('focusout', function(){
$(this).removeClass('ms-focus');
$('li', container).removeClass('ms-hover');
});
selectedUl.on('focusin', function(){
$(this).addClass('ms-focus');
}).on('focusout', function(){
$(this).removeClass('ms-focus');
$('li', container).removeClass('ms-hover');
});
ms.on('focusin', function(){
selectableUl.focus();
}).on('focusout', function(){
selectableUl.removeClass('ms-focus');
selectedUl.removeClass('ms-focus');
});
ms.onKeyDown = function(e, keyContainer){
var selectables = $('.'+keyContainer+' li:visible:not(.ms-optgroup-label, .ms-optgroup-container)', container),
selectablesLength = selectables.length,
selectableFocused = $('.'+keyContainer+' li.ms-hover', container),
selectableFocusedIndex = $('.'+keyContainer+' li:visible:not(.ms-optgroup-label, .ms-optgroup-container)', container).index(selectableFocused),
liHeight = selectables.first().outerHeight(),
numberOfItemsDisplayed = Math.ceil(container.outerHeight()/liHeight),
scrollStart = Math.ceil(numberOfItemsDisplayed/4);
selectables.removeClass('ms-hover');
if (e.keyCode == 32){ // space
var method = keyContainer == 'ms-selectable' ? 'select' : 'deselect';
ms.multiSelect(method, selectableFocused.first().attr('ms-value'));
} else if (e.keyCode == 40){ // Down
var nextIndex = (selectableFocusedIndex+1 != selectablesLength) ? selectableFocusedIndex+1 : 0,
nextSelectableLi = selectables.eq(nextIndex);
nextSelectableLi.addClass('ms-hover');
if (nextIndex > scrollStart){
scroll += liHeight;
} else if (nextIndex == 0){
scroll = 0;
}
$('.'+keyContainer+' ul', container).scrollTop(scroll);
} else if (e.keyCode == 38){ // Up
var prevIndex = (selectableFocusedIndex-1 >= 0) ? selectableFocusedIndex-1 : selectablesLength-1,
prevSelectableLi = selectables.eq(prevIndex);
selectables.removeClass('ms-hover');
prevSelectableLi.addClass('ms-hover');
if (selectablesLength-prevIndex+1 < scrollStart){
scroll = liHeight*(selectablesLength-scrollStart);
} else {
scroll -= liHeight;
}
$('.'+keyContainer+' ul', container).scrollTop(scroll);
} else if (e.keyCode == 37 || e.keyCode == 39){ // Right and Left
if (selectableUl.hasClass('ms-focus')){
selectableUl.focusout();
selectedUl.focusin();
} else {
selectableUl.focusin();
selectedUl.focusout();
}
}
}
ms.on('keydown', function(e){
if (ms.is(':focus')){
var keyContainer = selectableUl.hasClass('ms-focus') ? 'ms-selectable' : 'ms-selection';
ms.onKeyDown(e, keyContainer);
}
});
}
});
},
'refresh' : function() {
$("#ms-"+$(this).attr("id")).remove();
$(this).multiSelect("init", $(this).data("settings"));
},
'select' : function(value, method){
var ms = this,
selectedOption = ms.find('option[value="'+value +'"]'),
text = selectedOption.text(),
klass = selectedOption.attr('class'),
titleAttr = selectedOption.attr('title');
var selectedLi = $('<li class="ms-elem-selected'+(klass ? ' '+klass : '')+'" ms-value="'+value+'">'+text+'</li>'),
selectableUl = $('#ms-'+ms.attr('id')+' .ms-selectable ul'),
selectedUl = $('#ms-'+ms.attr('id')+' .ms-selection ul'),
selectableLi = selectableUl.children('li[ms-value="'+value+'"]'),
haveToSelect = null;
if (method == 'init'){
haveToSelect = !selectableLi.hasClass(ms.data('settings').disabledClass) && selectedOption.prop('selected');
} else {
haveToSelect = !selectableLi.hasClass(ms.data('settings').disabledClass);
ms.focus();
}
if (haveToSelect && selectedUl.children('li[ms-value="'+value+'"]').length == 0){
var parentOptgroup = selectableLi.parent('.ms-optgroup');
if (parentOptgroup.length > 0)
if (parentOptgroup.children('.ms-elem-selectable:not(:hidden)').length == 1)
parentOptgroup.children('.ms-optgroup-label').hide();
selectableLi.addClass('ms-selected');
selectableLi.hide();
selectedOption.prop('selected', true);
if(titleAttr){
selectedLi.attr('title', titleAttr)
}
if (selectableLi.hasClass(ms.data('settings').disabledClass)){
selectedLi.addClass(ms.data('settings').disabledClass);
} else {
if(ms.data('settings').dblClick) {
selectedLi.dblclick(function(){
ms.multiSelect('deselect', $(this).attr('ms-value'));
});
} else {
selectedLi.click(function(){
ms.multiSelect('deselect', $(this).attr('ms-value'));
});
}
}
var selectedUlLis = selectedUl.children('.ms-elem-selected');
if (method != 'init' && ms.data('settings').keepOrder && selectedUlLis.length > 0) {
var getIndexOf = function(value) {
elems = selectableUl.children('.ms-elem-selectable');
return(elems.index(elems.closest('[ms-value="'+value+'"]')));
}
var index = getIndexOf(selectedLi.attr('ms-value'));
if (index == 0)
selectedUl.prepend(selectedLi);
else {
for (i = index - 1; i >= 0; i--){
if (selectedUlLis[i] && getIndexOf($(selectedUlLis[i]).attr('ms-value')) < index) {
$(selectedUlLis[i]).after(selectedLi);
break;
} else if (i == 0) {
$(selectedUlLis[i]).before(selectedLi);
}
}
}
} else {
selectedUl.append(selectedLi);
}
selectedLi.on('mouseenter', function(){
$('li', selectedUl).removeClass('ms-hover');
$(this).addClass('ms-hover');
}).on('mouseout', function(){
$('li', selectedUl).removeClass('ms-hover');
});
if (method == "select_all" && parentOptgroup.children('.ms-elem-selectable').length > 0){
parentOptgroup.children('.ms-optgroup-label').hide();
}
if(method != 'init' || ms.data('settings').selectCallbackOnInit){
ms.trigger('change');
selectedUl.trigger('change');
selectableUl.trigger('change');
if (typeof ms.data('settings').afterSelect == 'function' &&
(method != 'init' || ms.data('settings').selectCallbackOnInit)) {
ms.data('settings').afterSelect.call(this, value, text);
}
}
}
},
'deselect' : function(value){
var ms = this,
selectedUl = $('#ms-'+ms.attr('id')+' .ms-selection ul'),
selectedOption = ms.find('option[value="'+value +'"]'),
selectedLi = selectedUl.children('li[ms-value="'+value+'"]');
if(selectedLi){
selectedUl.focusin();
var selectableUl = $('#ms-'+ms.attr('id')+' .ms-selectable ul'),
selectedUl = $('#ms-'+ms.attr('id')+' .ms-selection ul'),
selectableLi = selectableUl.children('li[ms-value="'+value+'"]'),
selectedLi = selectedUl.children('li[ms-value="'+value+'"]');
var parentOptgroup = selectableLi.parent('.ms-optgroup');
if (parentOptgroup.length > 0){
parentOptgroup.children('.ms-optgroup-label').addClass('ms-collapse').show();
parentOptgroup.children('.ms-elem-selectable:not(.ms-selected)').show();
}
selectedOption.prop('selected', false);
selectableLi.show();
selectableLi.removeClass('ms-selected');
selectedLi.remove();
selectedUl.trigger('change');
selectableUl.trigger('change');
ms.trigger('change');
if (typeof ms.data('settings').afterDeselect == 'function') {
ms.data('settings').afterDeselect.call(this, value, selectedLi.text());
}
}
},
'select_all' : function(visible){
var ms = this,
selectableUl = $('#ms-'+ms.attr('id')+' .ms-selectable ul');
ms.find("option:not(:selected)").each(function(){
var value = $(this).val();
if (visible){
var selectableLi = selectableUl.children('li[ms-value="'+value+'"]');
if (selectableLi.filter(':visible').length > 0){
ms.multiSelect('select', value, 'select_all');
}
} else {
ms.multiSelect('select', value, 'select_all');
}
});
},
'deselect_all' : function(){
var ms = this,
selectedUl = $('#ms-'+ms.attr('id')+' .ms-selection ul');
ms.find("option:selected").each(function(){
ms.multiSelect('deselect', $(this).val(), 'deselect_all');
});
}
};
$.fn.multiSelect = function(method){
if ( msMethods[method] ) {
return msMethods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return msMethods.init.apply( this, arguments );
} else {
if(console.log) console.log( 'Method ' + method + ' does not exist on jquery.multiSelect' );
}
return false;
};
})(jQuery);

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Spec Runner</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.2.0/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.2.0/jasmine.css">
<script type="text/javascript" src="src/jquery.js"></script>
<script type="text/javascript" src="lib/jasmine-1.2.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.2.0/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-jquery.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/multiSelectSpec.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="src/jquery.multi-select.js"></script>
<script type="text/javascript">
(function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function() {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,20 @@
Copyright (c) 2008-2011 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,616 @@
jasmine.HtmlReporterHelpers = {};
jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) {
el.appendChild(child);
}
}
}
for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}
return el;
};
jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
var results = child.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}
return status;
};
jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
var parentDiv = this.dom.summary;
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
var parent = child[parentSuite];
if (parent) {
if (typeof this.views.suites[parent.id] == 'undefined') {
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
}
parentDiv = this.views.suites[parent.id].element;
}
parentDiv.appendChild(childElement);
};
jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
for(var fn in jasmine.HtmlReporterHelpers) {
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
}
};
jasmine.HtmlReporter = function(_doc) {
var self = this;
var doc = _doc || window.document;
var reporterView;
var dom = {};
// Jasmine Reporter Public Interface
self.logRunningSpecs = false;
self.reportRunnerStarting = function(runner) {
var specs = runner.specs() || [];
if (specs.length == 0) {
return;
}
createReporterDom(runner.env.versionString());
doc.body.appendChild(dom.reporter);
reporterView = new jasmine.HtmlReporter.ReporterView(dom);
reporterView.addSpecs(specs, self.specFilter);
};
self.reportRunnerResults = function(runner) {
reporterView && reporterView.complete();
};
self.reportSuiteResults = function(suite) {
reporterView.suiteComplete(suite);
};
self.reportSpecStarting = function(spec) {
if (self.logRunningSpecs) {
self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
}
};
self.reportSpecResults = function(spec) {
reporterView.specComplete(spec);
};
self.log = function() {
var console = jasmine.getGlobal().console;
if (console && console.log) {
if (console.log.apply) {
console.log.apply(console, arguments);
} else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
}
}
};
self.specFilter = function(spec) {
if (!focusedSpecName()) {
return true;
}
return spec.getFullName().indexOf(focusedSpecName()) === 0;
};
return self;
function focusedSpecName() {
var specName;
(function memoizeFocusedSpec() {
if (specName) {
return;
}
var paramMap = [];
var params = doc.location.search.substring(1).split('&');
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
specName = paramMap.spec;
})();
return specName;
}
function createReporterDom(version) {
dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
dom.banner = self.createDom('div', { className: 'banner' },
self.createDom('span', { className: 'title' }, "Jasmine "),
self.createDom('span', { className: 'version' }, version)),
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
dom.alert = self.createDom('div', {className: 'alert'}),
dom.results = self.createDom('div', {className: 'results'},
dom.summary = self.createDom('div', { className: 'summary' }),
dom.details = self.createDom('div', { id: 'details' }))
);
}
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporter.ReporterView = function(dom) {
this.startedAt = new Date();
this.runningSpecCount = 0;
this.completeSpecCount = 0;
this.passedCount = 0;
this.failedCount = 0;
this.skippedCount = 0;
this.createResultsMenu = function() {
this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
' | ',
this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
this.summaryMenuItem.onclick = function() {
dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
};
this.detailsMenuItem.onclick = function() {
showDetails();
};
};
this.addSpecs = function(specs, specFilter) {
this.totalSpecCount = specs.length;
this.views = {
specs: {},
suites: {}
};
for (var i = 0; i < specs.length; i++) {
var spec = specs[i];
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
if (specFilter(spec)) {
this.runningSpecCount++;
}
}
};
this.specComplete = function(spec) {
this.completeSpecCount++;
if (isUndefined(this.views.specs[spec.id])) {
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
}
var specView = this.views.specs[spec.id];
switch (specView.status()) {
case 'passed':
this.passedCount++;
break;
case 'failed':
this.failedCount++;
break;
case 'skipped':
this.skippedCount++;
break;
}
specView.refresh();
this.refresh();
};
this.suiteComplete = function(suite) {
var suiteView = this.views.suites[suite.id];
if (isUndefined(suiteView)) {
return;
}
suiteView.refresh();
};
this.refresh = function() {
if (isUndefined(this.resultsMenu)) {
this.createResultsMenu();
}
// currently running UI
if (isUndefined(this.runningAlert)) {
this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
dom.alert.appendChild(this.runningAlert);
}
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
// skipped specs UI
if (isUndefined(this.skippedAlert)) {
this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
}
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
if (this.skippedCount === 1 && isDefined(dom.alert)) {
dom.alert.appendChild(this.skippedAlert);
}
// passing specs UI
if (isUndefined(this.passedAlert)) {
this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
}
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
// failing specs UI
if (isUndefined(this.failedAlert)) {
this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
}
this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
if (this.failedCount === 1 && isDefined(dom.alert)) {
dom.alert.appendChild(this.failedAlert);
dom.alert.appendChild(this.resultsMenu);
}
// summary info
this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
};
this.complete = function() {
dom.alert.removeChild(this.runningAlert);
this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
if (this.failedCount === 0) {
dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
} else {
showDetails();
}
dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
};
return this;
function showDetails() {
if (dom.reporter.className.search(/showDetails/) === -1) {
dom.reporter.className += " showDetails";
}
}
function isUndefined(obj) {
return typeof obj === 'undefined';
}
function isDefined(obj) {
return !isUndefined(obj);
}
function specPluralizedFor(count) {
var str = count + " spec";
if (count > 1) {
str += "s"
}
return str;
}
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
this.spec = spec;
this.dom = dom;
this.views = views;
this.symbol = this.createDom('li', { className: 'pending' });
this.dom.symbolSummary.appendChild(this.symbol);
this.summary = this.createDom('div', { className: 'specSummary' },
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
title: this.spec.getFullName()
}, this.spec.description)
);
this.detail = this.createDom('div', { className: 'specDetail' },
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
title: this.spec.getFullName()
}, this.spec.getFullName())
);
};
jasmine.HtmlReporter.SpecView.prototype.status = function() {
return this.getSpecStatus(this.spec);
};
jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
this.symbol.className = this.status();
switch (this.status()) {
case 'skipped':
break;
case 'passed':
this.appendSummaryToSuiteDiv();
break;
case 'failed':
this.appendSummaryToSuiteDiv();
this.appendFailureDetail();
break;
}
};
jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
this.summary.className += ' ' + this.status();
this.appendToSummary(this.spec, this.summary);
};
jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
this.detail.className += ' ' + this.status();
var resultItems = this.spec.results().getItems();
var messagesDiv = this.createDom('div', { className: 'messages' });
for (var i = 0; i < resultItems.length; i++) {
var result = resultItems[i];
if (result.type == 'log') {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
} else if (result.type == 'expect' && result.passed && !result.passed()) {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
if (result.trace.stack) {
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
}
}
}
if (messagesDiv.childNodes.length > 0) {
this.detail.appendChild(messagesDiv);
this.dom.details.appendChild(this.detail);
}
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
this.suite = suite;
this.dom = dom;
this.views = views;
this.element = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
);
this.appendToSummary(this.suite, this.element);
};
jasmine.HtmlReporter.SuiteView.prototype.status = function() {
return this.getSpecStatus(this.suite);
};
jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
this.element.className += " " + this.status();
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
/* @deprecated Use jasmine.HtmlReporter instead
*/
jasmine.TrivialReporter = function(doc) {
this.document = doc || document;
this.suiteDivs = {};
this.logRunningSpecs = false;
};
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) { el.appendChild(child); }
}
}
for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}
return el;
};
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
var showPassed, showSkipped;
this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
this.createDom('div', { className: 'banner' },
this.createDom('div', { className: 'logo' },
this.createDom('span', { className: 'title' }, "Jasmine"),
this.createDom('span', { className: 'version' }, runner.env.versionString())),
this.createDom('div', { className: 'options' },
"Show ",
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
)
),
this.runnerDiv = this.createDom('div', { className: 'runner running' },
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
);
this.document.body.appendChild(this.outerDiv);
var suites = runner.suites();
for (var i = 0; i < suites.length; i++) {
var suite = suites[i];
var suiteDiv = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
this.suiteDivs[suite.id] = suiteDiv;
var parentDiv = this.outerDiv;
if (suite.parentSuite) {
parentDiv = this.suiteDivs[suite.parentSuite.id];
}
parentDiv.appendChild(suiteDiv);
}
this.startedAt = new Date();
var self = this;
showPassed.onclick = function(evt) {
if (showPassed.checked) {
self.outerDiv.className += ' show-passed';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
}
};
showSkipped.onclick = function(evt) {
if (showSkipped.checked) {
self.outerDiv.className += ' show-skipped';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
}
};
};
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
var results = runner.results();
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
this.runnerDiv.setAttribute("class", className);
//do it twice for IE
this.runnerDiv.setAttribute("className", className);
var specs = runner.specs();
var specCount = 0;
for (var i = 0; i < specs.length; i++) {
if (this.specFilter(specs[i])) {
specCount++;
}
}
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
};
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
var results = suite.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.totalCount === 0) { // todo: change this to check results.skipped
status = 'skipped';
}
this.suiteDivs[suite.id].className += " " + status;
};
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
if (this.logRunningSpecs) {
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
}
};
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
var results = spec.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}
var specDiv = this.createDom('div', { className: 'spec ' + status },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(spec.getFullName()),
title: spec.getFullName()
}, spec.description));
var resultItems = results.getItems();
var messagesDiv = this.createDom('div', { className: 'messages' });
for (var i = 0; i < resultItems.length; i++) {
var result = resultItems[i];
if (result.type == 'log') {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
} else if (result.type == 'expect' && result.passed && !result.passed()) {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
if (result.trace.stack) {
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
}
}
}
if (messagesDiv.childNodes.length > 0) {
specDiv.appendChild(messagesDiv);
}
this.suiteDivs[spec.suite.id].appendChild(specDiv);
};
jasmine.TrivialReporter.prototype.log = function() {
var console = jasmine.getGlobal().console;
if (console && console.log) {
if (console.log.apply) {
console.log.apply(console, arguments);
} else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
}
}
};
jasmine.TrivialReporter.prototype.getLocation = function() {
return this.document.location;
};
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
var paramMap = {};
var params = this.getLocation().search.substring(1).split('&');
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
if (!paramMap.spec) {
return true;
}
return spec.getFullName().indexOf(paramMap.spec) === 0;
};

View File

@ -0,0 +1,81 @@
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
#HTMLReporter .version { color: #aaaaaa; }
#HTMLReporter .banner { margin-top: 14px; }
#HTMLReporter .duration { color: #aaaaaa; float: right; }
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
#HTMLReporter .runningAlert { background-color: #666666; }
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
#HTMLReporter .passingAlert { background-color: #a6b779; }
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
#HTMLReporter .failingAlert { background-color: #cf867e; }
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
#HTMLReporter .results { margin-top: 14px; }
#HTMLReporter #details { display: none; }
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter.showDetails .summary { display: none; }
#HTMLReporter.showDetails #details { display: block; }
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter .summary { margin-top: 14px; }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
#HTMLReporter .description + .suite { margin-top: 0; }
#HTMLReporter .suite { margin-top: 14px; }
#HTMLReporter .suite a { color: #333333; }
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
#HTMLReporter .resultMessage span.result { display: block; }
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
#TrivialReporter .runner.running { background-color: yellow; }
#TrivialReporter .options { text-align: right; font-size: .8em; }
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
#TrivialReporter .suite .suite { margin: 5px; }
#TrivialReporter .suite.passed { background-color: #dfd; }
#TrivialReporter .suite.failed { background-color: #fdd; }
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
#TrivialReporter .spec.skipped { background-color: #bbb; }
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
#TrivialReporter .passed { background-color: #cfc; display: none; }
#TrivialReporter .failed { background-color: #fbb; }
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
#TrivialReporter .resultMessage .mismatch { color: black; }
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,400 @@
var readFixtures = function() {
return jasmine.getFixtures().proxyCallTo_('read', arguments)
}
var preloadFixtures = function() {
jasmine.getFixtures().proxyCallTo_('preload', arguments)
}
var loadFixtures = function() {
jasmine.getFixtures().proxyCallTo_('load', arguments)
}
var appendLoadFixtures = function() {
jasmine.getFixtures().proxyCallTo_('appendLoad', arguments)
}
var setFixtures = function(html) {
jasmine.getFixtures().proxyCallTo_('set', arguments)
}
var appendSetFixtures = function() {
jasmine.getFixtures().proxyCallTo_('appendSet', arguments)
}
var sandbox = function(attributes) {
return jasmine.getFixtures().sandbox(attributes)
}
var spyOnEvent = function(selector, eventName) {
return jasmine.JQuery.events.spyOn($(selector).selector, eventName)
}
jasmine.getFixtures = function() {
return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures()
}
jasmine.Fixtures = function() {
this.containerId = 'jasmine-fixtures'
this.fixturesCache_ = {}
this.fixturesPath = 'spec/javascripts/fixtures'
}
jasmine.Fixtures.prototype.set = function(html) {
this.cleanUp()
this.createContainer_(html)
}
jasmine.Fixtures.prototype.appendSet= function(html) {
this.addToContainer_(html)
}
jasmine.Fixtures.prototype.preload = function() {
this.read.apply(this, arguments)
}
jasmine.Fixtures.prototype.load = function() {
this.cleanUp()
this.createContainer_(this.read.apply(this, arguments))
}
jasmine.Fixtures.prototype.appendLoad = function() {
this.addToContainer_(this.read.apply(this, arguments))
}
jasmine.Fixtures.prototype.read = function() {
var htmlChunks = []
var fixtureUrls = arguments
for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
}
return htmlChunks.join('')
}
jasmine.Fixtures.prototype.clearCache = function() {
this.fixturesCache_ = {}
}
jasmine.Fixtures.prototype.cleanUp = function() {
jQuery('#' + this.containerId).remove()
}
jasmine.Fixtures.prototype.sandbox = function(attributes) {
var attributesToSet = attributes || {}
return jQuery('<div id="sandbox" />').attr(attributesToSet)
}
jasmine.Fixtures.prototype.createContainer_ = function(html) {
var container
if(html instanceof jQuery) {
container = jQuery('<div id="' + this.containerId + '" />')
container.html(html)
} else {
container = '<div id="' + this.containerId + '">' + html + '</div>'
}
jQuery('body').append(container)
}
jasmine.Fixtures.prototype.addToContainer_ = function(html){
var container = jQuery('body').find('#'+this.containerId).append(html)
if(!container.length){
this.createContainer_(html)
}
}
jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
if (typeof this.fixturesCache_[url] === 'undefined') {
this.loadFixtureIntoCache_(url)
}
return this.fixturesCache_[url]
}
jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
var url = this.makeFixtureUrl_(relativeUrl)
var request = new XMLHttpRequest()
request.open("GET", url + "?" + new Date().getTime(), false)
request.send(null)
this.fixturesCache_[relativeUrl] = request.responseText
}
jasmine.Fixtures.prototype.makeFixtureUrl_ = function(relativeUrl){
return this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
}
jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
return this[methodName].apply(this, passedArguments)
}
jasmine.JQuery = function() {}
jasmine.JQuery.browserTagCaseIndependentHtml = function(html) {
return jQuery('<div/>').append(html).html()
}
jasmine.JQuery.elementToString = function(element) {
var domEl = $(element).get(0)
if (domEl == undefined || domEl.cloneNode)
return jQuery('<div />').append($(element).clone()).html()
else
return element.toString()
}
jasmine.JQuery.matchersClass = {};
!function(namespace) {
var data = {
spiedEvents: {},
handlers: []
}
namespace.events = {
spyOn: function(selector, eventName) {
var handler = function(e) {
data.spiedEvents[[selector, eventName]] = e
}
jQuery(selector).bind(eventName, handler)
data.handlers.push(handler)
return {
selector: selector,
eventName: eventName,
handler: handler,
reset: function(){
delete data.spiedEvents[[this.selector, this.eventName]];
}
}
},
wasTriggered: function(selector, eventName) {
return !!(data.spiedEvents[[selector, eventName]])
},
wasPrevented: function(selector, eventName) {
return data.spiedEvents[[selector, eventName]].isDefaultPrevented()
},
cleanUp: function() {
data.spiedEvents = {}
data.handlers = []
}
}
}(jasmine.JQuery)
!function(){
var jQueryMatchers = {
toHaveClass: function(className) {
return this.actual.hasClass(className)
},
toHaveCss: function(css){
for (var prop in css){
if (this.actual.css(prop) !== css[prop]) return false
}
return true
},
toBeVisible: function() {
return this.actual.is(':visible')
},
toBeHidden: function() {
return this.actual.is(':hidden')
},
toBeSelected: function() {
return this.actual.is(':selected')
},
toBeChecked: function() {
return this.actual.is(':checked')
},
toBeEmpty: function() {
return this.actual.is(':empty')
},
toExist: function() {
return $(document).find(this.actual).length
},
toHaveAttr: function(attributeName, expectedAttributeValue) {
return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
},
toHaveProp: function(propertyName, expectedPropertyValue) {
return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
},
toHaveId: function(id) {
return this.actual.attr('id') == id
},
toHaveHtml: function(html) {
return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html)
},
toContainHtml: function(html){
var actualHtml = this.actual.html()
var expectedHtml = jasmine.JQuery.browserTagCaseIndependentHtml(html)
return (actualHtml.indexOf(expectedHtml) >= 0)
},
toHaveText: function(text) {
var trimmedText = $.trim(this.actual.text())
if (text && jQuery.isFunction(text.test)) {
return text.test(trimmedText)
} else {
return trimmedText == text
}
},
toHaveValue: function(value) {
return this.actual.val() == value
},
toHaveData: function(key, expectedValue) {
return hasProperty(this.actual.data(key), expectedValue)
},
toBe: function(selector) {
return this.actual.is(selector)
},
toContain: function(selector) {
return this.actual.find(selector).length
},
toBeDisabled: function(selector){
return this.actual.is(':disabled')
},
toBeFocused: function(selector) {
return this.actual.is(':focus')
},
toHandle: function(event) {
var events = this.actual.data('events')
if(!events || !event || typeof event !== "string") {
return false
}
var namespaces = event.split(".")
var eventType = namespaces.shift()
var sortedNamespaces = namespaces.slice(0).sort()
var namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
if(events[eventType] && namespaces.length) {
for(var i = 0; i < events[eventType].length; i++) {
var namespace = events[eventType][i].namespace
if(namespaceRegExp.test(namespace)) {
return true
}
}
} else {
return events[eventType] && events[eventType].length > 0
}
},
// tests the existence of a specific event binding + handler
toHandleWith: function(eventName, eventHandler) {
var stack = this.actual.data("events")[eventName]
for (var i = 0; i < stack.length; i++) {
if (stack[i].handler == eventHandler) return true
}
return false
}
}
var hasProperty = function(actualValue, expectedValue) {
if (expectedValue === undefined) return actualValue !== undefined
return actualValue == expectedValue
}
var bindMatcher = function(methodName) {
var builtInMatcher = jasmine.Matchers.prototype[methodName]
jasmine.JQuery.matchersClass[methodName] = function() {
if (this.actual
&& (this.actual instanceof jQuery
|| jasmine.isDomNode(this.actual))) {
this.actual = $(this.actual)
var result = jQueryMatchers[methodName].apply(this, arguments)
var element;
if (this.actual.get && (element = this.actual.get()[0]) && !$.isWindow(element) && element.tagName !== "HTML")
this.actual = jasmine.JQuery.elementToString(this.actual)
return result
}
if (builtInMatcher) {
return builtInMatcher.apply(this, arguments)
}
return false
}
}
for(var methodName in jQueryMatchers) {
bindMatcher(methodName)
}
}()
beforeEach(function() {
this.addMatchers(jasmine.JQuery.matchersClass)
this.addMatchers({
toHaveBeenTriggeredOn: function(selector) {
this.message = function() {
return [
"Expected event " + this.actual + " to have been triggered on " + selector,
"Expected event " + this.actual + " not to have been triggered on " + selector
]
}
return jasmine.JQuery.events.wasTriggered($(selector).selector, this.actual)
}
})
this.addMatchers({
toHaveBeenTriggered: function(){
var eventName = this.actual.eventName,
selector = this.actual.selector;
this.message = function() {
return [
"Expected event " + eventName + " to have been triggered on " + selector,
"Expected event " + eventName + " not to have been triggered on " + selector
]
}
return jasmine.JQuery.events.wasTriggered(selector, eventName)
}
})
this.addMatchers({
toHaveBeenPreventedOn: function(selector) {
this.message = function() {
return [
"Expected event " + this.actual + " to have been prevented on " + selector,
"Expected event " + this.actual + " not to have been prevented on " + selector
]
}
return jasmine.JQuery.events.wasPrevented($(selector).selector, this.actual)
}
})
this.addMatchers({
toHaveBeenPrevented: function() {
var eventName = this.actual.eventName,
selector = this.actual.selector;
this.message = function() {
return [
"Expected event " + eventName + " to have been prevented on " + selector,
"Expected event " + eventName + " not to have been prevented on " + selector
]
}
return jasmine.JQuery.events.wasPrevented(selector, eventName)
}
})
})
afterEach(function() {
jasmine.getFixtures().cleanUp()
jasmine.JQuery.events.cleanUp()
})

View File

@ -0,0 +1,9 @@
// beforeEach(function() {
// this.addMatchers({
// toBePlaying: function(expectedSong) {
// var player = this.actual;
// return player.currentlyPlayingSong === expectedSong &&
// player.isPlaying;
// }
// });
// });

View File

@ -0,0 +1,174 @@
describe("multiSelect", function() {
var select;
var msContainer;
beforeEach(function() {
$('<select id="multi-select" multiple="multiple" name="test[]"></select>').appendTo('body');
for (var i=1; i <= 10; i++) {
$('<option value="value'+i+'">text'+i+'</option>').appendTo($("#multi-select"));
};
select = $("#multi-select");
});
describe('init', function(){
it ('should be chainable', function(){
select.multiSelect().addClass('chainable');
expect(select.hasClass('chainable')).toBeTruthy();
});
describe('without options', function(){
beforeEach(function() {
select.multiSelect();
msContainer = select.next();
});
it('should hide the original select', function(){
expect(select.css('position')).toBe('absolute');
expect(select.css('left')).toBe('-9999px');
});
it('should create a container', function(){
expect(msContainer).toBe('div.ms-container');
});
it ('should create a selectable and a selection container', function(){
expect(msContainer).toContain('div.ms-selectable, div.ms-selection');
});
it ('should create a list for both selectable and selection container', function(){
expect(msContainer).toContain('div.ms-selectable ul.ms-list, div.ms-selection ul.ms-list');
});
it ('should populate the selectable list', function(){
expect($('.ms-selectable ul.ms-list li').length).toEqual(10);
});
it ('should not populate the selection list if none of the option is selected', function(){
expect($('.ms-selection ul.ms-list li').length).toEqual(0);
});
});
describe('with pre-selected options', function(){
var selectedValues = [];
beforeEach(function() {
var firstOption = select.children('option').first();
var lastOption = select.children('option').last();
firstOption.prop('selected', true);
lastOption.prop('selected', true);
selectedValues.push(firstOption.val(), lastOption.val());
select.multiSelect();
msContainer = select.next();
});
it ('should select the pre-selected options', function(){
$.each(selectedValues, function(index, value){
expect($('.ms-selectable ul.ms-list li[ms-value="'+value+'"]')).toBe('.ms-selected');
});
expect($('.ms-selectable ul.ms-list li.ms-selected').length).toEqual(2);
});
});
describe('with keepOrder option activated', function(){
beforeEach(function() {
$('#multi-select').multiSelect({ keepOrder: true });
msContainer = select.next();
firstItem = $('.ms-selectable ul.ms-list li').first()
lastItem = $('.ms-selectable ul.ms-list li').last();
lastItem.trigger('click');
firstItem.trigger('click');
});
it('should keep order on selection list', function(){
expect($('.ms-selection li', msContainer).first().attr('ms-value')).toBe('value1');
expect($('.ms-selection li', msContainer).last().attr('ms-value')).toBe('value10');
});
});
});
describe('select', function(){
describe("on click", function(){
var clickedItem;
beforeEach(function() {
$('#multi-select').multiSelect();
clickedItem = $('.ms-selectable ul.ms-list li').first();
spyOnEvent(select, 'change');
spyOnEvent(select, 'focus');
clickedItem.trigger('click');
});
it('should hide selected item', function(){
expect(clickedItem).toBeHidden();
});
it('should add the .ms-selected class to the selected item', function(){
expect(clickedItem.hasClass('ms-selected')).toBeTruthy();
});
it('should select corresponding option', function(){
expect(select.children().first()).toBeSelected();
});
it('should populate the selection ul with the rigth item', function(){
expect($('.ms-selection ul.ms-list li').first()).toBe('li.ms-elem-selected[ms-value="value1"]');
});
it('should trigger the original select change event', function(){
expect('change').toHaveBeenTriggeredOn("#multi-select");
});
it('should trigger the original select focus event', function(){
expect('focus').toHaveBeenTriggeredOn("#multi-select");
});
afterEach(function(){
select.multiSelect('deselect_all');
});
});
});
describe('deselect', function(){
describe("on click", function(){
var clickedItem;
var correspondingSelectableItem;
beforeEach(function() {
$('#multi-select').find('option').first().prop('selected', true);
$('#multi-select').multiSelect();
clickedItem = $('.ms-selection ul.ms-list li').first();
correspondingSelectableItem = $('.ms-selection ul.ms-list li').first();
spyOnEvent(select, 'change');
spyOnEvent(select, 'focus');
clickedItem.trigger('click');
});
it('should remove selected item from the selection list', function(){
expect($('.ms-selection ul.ms-list li').length).toEqual(0);
});
it('should remove the .ms-selected class to the corresponding selectable item', function(){
expect(correspondingSelectableItem.hasClass('ms-selected')).toBeFalsy();
});
it('should deselect corresponding option', function(){
expect(select.children().first()).not.toBeSelected();
});
it('should trigger the original select change event', function(){
expect('change').toHaveBeenTriggeredOn("#multi-select");
});
afterEach(function(){
select.multiSelect('deselect_all');
});
});
});
afterEach(function () {
$("#multi-select, .ms-container").remove();
});
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../../js/jquery.multi-select.js

View File

@ -0,0 +1,89 @@
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/lib/multiselect/js/jquery.multi-select.js', CClientScript::POS_END); ?>
<?php Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/lib/multiselect/css/multi-select.css'); ?>
<?php
$js_multiselect = <<<JS
$(document).ready(function() {
$('.multiselect').multiSelect({
afterSelect: function(value, text){
anadirCapacidad(value);
},
afterDeselect: function(value, text){
quitarCapacidad(value);
}
});
});
function anadirCapacidad(aValue) {
$('.listaCapacidades .add').click();
var i = $('.listaCapacidades .templateContent').find('.rowIndex').filter(':last').val();
$('.listaCapacidades .templateContent input.rowIndex[value=' + i + ']').siblings('input.id_capacidad').val(aValue);
};
function quitarCapacidad(aValue) {
$('.listaCapacidades input.id_capacidad[value=' + aValue + ']').siblings('.remove').click();
};
JS;
Yii::app()->clientScript->registerScript('js_multiselect', $js_multiselect, CClientScript::POS_END);
?>
<?php $categorias = CategoriaProfesional::model()->findAll(); ?>
<?php $idCapacidades = array(); ?>
<div class="row-fluid hidden">
<div class="templateFrame listaCapacidades">
<div class="templateHead"></div>
<div class="templateTarget">
<?php foreach ($candidato->capacidadesProfesionales as $i => $capacidad) : ?>
<?php $idCapacidades[] = $capacidad->id_capacidad; ?>
<div class="templateContent capacidad">
<?php echo CHtml::activeHiddenField($capacidad, "[$i]id_capacidad", array('class' => 'id_capacidad')); ?>
<?php echo CHtml::activeHiddenField($capacidad, "[$i]id", array('class' => 'pk')); ?>
<?php echo CHtml::activeHiddenField($capacidad, "[$i]id_candidato"); ?>
<?php echo CHtml::hiddenField("CandidatoCapacidadProfesional[$i][_borrar]", '0', array('class' => 'to_remove')); ?>
<input type="hidden" class="rowIndex" value="<?php echo $i;?>" />
<a class="btn btn-small remove" href="#"><i class="icon-trash"></i></a>
</div>
<?php endforeach; ?>
</div>
<div>
<a class="btn btn-small add" href="#"><i class="icon-plus"></i> <?php echo Yii::t('profind', 'Añadir una capacidad');?></a>
<textarea class="template">
<div class="templateContent capacidad">
<?php echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][id_capacidad]', '', array('class' => 'id_capacidad')); ?>
<?php echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][id]', '', array('class' => 'pk')); ?>
<?php echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][id_candidato]', $candidato->id); ?>
<?php echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][_borrar]', '0', array('class' => 'to_remove')); ?>
<input type="hidden" class="rowIndex" value="{0}" />
<a class="btn btn-small remove" href="#"><i class="icon-trash"></i></a>
</div>
</textarea>
</div>
</div>
</div>
<div class="row-fluid formSep">
<div class="span12">
<?php foreach ($categorias as $categoria) : ?>
<div class="span2">
<p><span class="label label-inverse"><?php echo $categoria->descripcion; ?></span></p>
<select multiple="multiple" class="multiselect">
<?php $capacidades = CapacidadProfesional::model()->findAll('id_categoria = :id_categoria', array(':id_categoria' => $categoria->id)); ?>
<?php foreach ($capacidades as $capacidad) : ?>
<option value="<?php echo $capacidad->id; ?>" <?php echo (in_array($capacidad->id, $idCapacidades)) ? 'selected' : ''; ?>>
<?php echo $capacidad->descripcion; ?>
</option>
<?php endforeach; ?>
</select>
<?php //echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][id]', '', array('class' => 'pk')); ?>
<?php //echo CHtml::hiddenField('CandidatoCapacidadProfesional[{0}][id_candidato]'); ?>
</div>
<?php endforeach; ?>
</div>
</div>

View File

@ -0,0 +1,65 @@
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/lib/multiselect/js/jquery.multi-select.js', CClientScript::POS_END); ?>
<?php Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/lib/multiselect/css/multi-select.css'); ?>
<?php
$js_multiselect = <<<JS
$(document).ready(function() {
$('.countries').multiSelect();
});
JS;
Yii::app()->clientScript->registerScript('js_multiselect', $js_multiselect, CClientScript::POS_END);
?>
<div class="row-fluid formSep">
<div class="span12">
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
<div class="span2">
<select multiple="multiple" class="countries" name="countries[]">
<option value="fr">France</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="ch">China</option>
</select>
</div>
</div>
</div>

View File

@ -86,12 +86,12 @@ $form = $this->beginWidget('CActiveForm', array(
</div>
<div class="sepH_b">
<?php echo $form->labelEx($candidato, 'fecha_nacimiento', array('class' => 'control-label')); ?>
<div class="controls sepH_b">
<div class="controls sepH_b">
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $candidato,
'attribute' => 'fecha_nacimiento',
'language' => 'es',
'options' => array('showAnim' => 'fold'),
'options' => array('showAnim' => 'fold', 'dateFormat' => 'dd/mm/yy'),
'htmlOptions' => array('class' => 'span6'),
));
?>
@ -167,6 +167,13 @@ $form = $this->beginWidget('CActiveForm', array(
</div>
</fieldset>
<fieldset>
<legend class="control-label" style="text-align: left;"><?php echo Yii::t('profind', 'Capacidades profesionales'); ?></legend>
<?php echo $this->renderPartial('__capacidades_profesionales', array('candidato' => $candidato)); ?>
</fieldset>
<fieldset>
<legend class="control-label" style="text-align: left;"><?php echo Yii::t('profind', 'Datos académicos'); ?></legend>
<?php echo $this->renderPartial('__titulaciones', array('candidato' => $candidato)); ?>

View File

@ -6,6 +6,7 @@
$this->breadcrumbs = array(
Yii::t('profind', 'BD Candidatos') => array('/candidato/index'),
Yii::t('profind', 'Nuevo candidato'),
);
// Sidebar

View File

@ -10,7 +10,7 @@
);
// Sidebar
//echo $this->renderPartial('//sidebars/_menu_candidato');
echo $this->renderPartial('sidebars/_candidatos');
// Contenido
//echo $this->renderPartial('_form', array('model' => $model));

View File

@ -0,0 +1,38 @@
<?php
/**
* @var $this CandidatoController
*/
?>
<?php $this->beginClip('sidebar'); ?>
<?php $cantidades = $this->darTotalCandidatos(); ?>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseFour" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle">
<i class="icon-folder-open"></i> <?php echo Yii::t('profind', 'Carpetas'); ?>
</a>
</div>
<div class="accordion-body in collapse" id="collapseFour">
<div class="accordion-inner">
<ul class="nav nav-list">
<li class="nav-header"><?php echo Yii::t('profind', 'General'); ?></li>
<li class=""><a href=""><?php echo Yii::t('profind', 'Todos los candidatos'); ?> <span class="badge badge-info pull-right"><?php echo $cantidades['todos']; ?></span></a></li>
<li class=""><a href=""><?php echo Yii::t('profind', 'Disponibles'); ?> <span class="badge pull-right"><?php echo $cantidades['estado_disponibles']; ?></span></a></li>
<li class=""><a href=""><?php echo Yii::t('profind', 'No disponibles'); ?> <span class="badge pull-right"><?php echo $cantidades['estado_no_disponibles']; ?></span></a></li>
<li class="nav-header"><?php echo Yii::t('profind', 'General'); ?></li>
<li class=""><a href="javascript:void(0)">Account Settings <span class="badge badge-info pull-right">1</span></a></li>
<li><a href="javascript:void(0)">IP Adress Blocking</a></li>
<li class="nav-header">System</li>
<li><a href="javascript:void(0)">Site information</a></li>
<li><a href="javascript:void(0)">Actions</a></li>
<li><a href="javascript:void(0)">Cron</a></li>
<li class="divider"></li>
<li><a href="javascript:void(0)">Help</a></li>
</ul>
</div>
</div>
</div>
<?php $this->endClip(); ?>

View File

@ -6,6 +6,7 @@
$this->breadcrumbs = array(
Yii::t('profind', 'BD Candidatos') => array('/candidato/index'),
$candidato->nombreCompleto
);
// Sidebar