true), array('titulo, autor, descripcion_tw, url_issuu, url_issuu_img, url_youtube, archivo', 'length', 'max'=>300), array('descripcion, log, last_update', 'safe'), array('colaboradores', 'length', 'max'=>5000), //array('colaboradores', 'each', 'rule' => ['exist', 'targetClass' => Category::className(), 'targetAttribute' => 'id']), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id_documento, id_tipo, titulo, autor, descripcion, url_issuu, url_youtube, archivo, log, vistas, descargas, activo', '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( 'idTipo' => array(self::BELONGS_TO, 'TiposDocumentos', 'id_tipo'), ); } /** * @return array customized attribute labels (name=>label) */ public function attributeLabels(){ return array( 'id_documento' => 'Documento', 'id_tipo' => 'Tipo de documento', 'titulo' => 'Título', 'autor' => 'Autor', 'descripcion' => 'Descripción', 'url_issuu' => 'Url Issuu', 'url_youtube' => 'Url Youtube', 'archivo' => 'Archivo', 'log' => 'Log', 'last_update' => 'Last Update', 'serie' => 'Orden en la serie', 'vistas' => 'Visitas', 'descargas' => 'Descargas', 'activo' => 'Activo', 'colaboradores' => 'Colaboradores', 'url_issuu_img' => 'Enlace de la Imagen en Ussuu', 'descripcion_tw' => 'Descripción en 150 Caracteres', ); } /** * 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_documento',$this->id_documento); $criteria->compare('id_tipo',$this->id_tipo); $criteria->compare('serie',$this->serie); $criteria->compare('titulo',$this->titulo,true); $criteria->compare('autor',$this->autor,true); $criteria->compare('descripcion',$this->descripcion,true); $criteria->compare('url_issuu',$this->url_issuu,true); $criteria->compare('archivo',$this->archivo,true); $criteria->compare('activo',$this->activo); $criteria->compare('colaboradores',$this->archivo,true); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } }