Skip to content

Commit

Permalink
resuelto el error underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloRN committed Aug 15, 2011
1 parent ebece12 commit 9984236
Show file tree
Hide file tree
Showing 23 changed files with 3,183 additions and 296 deletions.
101 changes: 33 additions & 68 deletions apps/admin/modules/dmUserAdmin/lib/DmUserAdminForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,83 +10,48 @@
*/
class DmUserAdminForm extends BaseDmUserAdminForm
{
/*protected function createMediaFormForFotoIdForm()


public function configure()
{
$this->validatorSchema['username'] = new sfValidatorString(array('min_length' =>5), array ('required' => 'Debe escribir apodo para identificarlo en la red', 'min_length' => 'El apodo debe tener al menos 5 caracteres'));
$this->validatorSchema['password'] = new sfValidatorString(array('min_length' =>5, 'max_length' => 10), array ('required' => 'Debe escribir una contrase&ntildea', 'min_length' => 'La contrase&ntildea debe tener al menos 5 caracteres', 'max_length' => 'La contrase&ntildea no debe exceder los 10 caracteres'));
$this->validatorSchema['email'] = new sfValidatorEmail(array(), array ('invalid' => 'Por favor escriba un email v&aacutelido'));
$this->validatorSchema['solapin'] = new sfValidatorRegex(array ('pattern' => '(^[0-9]{4}$)'));
$this->validatorSchema['penalizado'] = new sfValidatorBoolean();

$this->validatorSchema->setPostValidator( new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('email')), array('invalid' => 'El email ya existe, por favor contacte al administrador si es el suyo'))
);

$this->mergePostValidator( new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('username')), array('invalid' => 'Este apodo ya existe, por favor escoja otro'))
);

$this->mergePostValidator( new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('solapin')), array('invalid' => 'Este solapin ya existe, por favor escoja otro, si es el suyo contacte al administrador'))
);
$this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again',
array(),
array('invalid' => 'Por favor, verifique que coincidan las contrase&ntildeas.')
)
);


}

protected function createMediaFormForFotoId()
{
// get the DmMedia form
$form = parent::createMediaFormForFotoIdForm();
$form = parent::createMediaFormForFotoId();

// choose mime types allowed
$form->setMimeTypeWhiteList(array(
'image/jpeg',
'image/png'
));

return $form;
} */
public function configure()
{

// remove unnecessary fields
unset($form['legend'], $form['author'], $form['license']);


$this->widgetSchema['foto_id_form'] = new sfWidgetFormInputFileEditable(array(
'label' => 'imagen',
'file_src' => '/uploads/dm-user/',
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => '<div>%file%<br />%input%<br /></div>'
));
$this->validatorSchema['foto_id_form'] = new sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir') . '/dm_user/',
'mime_types' => 'web_images'
));

/*$this->validatorSchema['foto_id_form'] = new sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir').'/dm_user/',
'mime_types' => array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif','application/x-shockwave-flash')
)
);*/
$this->setValidators(array(
'username' => new sfValidatorString(array('min_length' =>5), array ('required' => 'Debe escribir apodo para identificarlo en la red', 'min_length' => 'El apodo debe tener al menos 5 caracteres')),
'email' => new sfValidatorEmail(array('required' => false), array('invalid' => 'Por favor escriba un email v&aacutelido')),
/*'password' => new sfValidatorRegex(array(
'pattern' => '(^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\w{5,8}$)'), array (
'invalid' => 'El password debe tener al menos una letra min&uacutescula, una may&uacutescula, un n&uacutemero, no debe contener espacios y debe tener de 5 a 8 letras')),*/
'password' => new sfValidatorString(array('min_length' =>5, 'max_length' => 10), array ('required' => 'Debe escribir una contrase&ntildea', 'min_length' => 'La contrase&ntildea debe tener al menos 5 caracteres', 'max_length' => 'La contraseña no debe exceder los 10 caracteres')),
'password_again' => new sfValidatorPass(array(), array('required' => true)),
'fecha_despues' => new sfValidatorDate(array('required' => false)),
'titulo' => new sfValidatorString(),
'nombre' => new sfValidatorString(array('min_length' =>3), array ('required' => 'Debe escribir el nombre', 'min_length' => 'El nombre debe tener al menos 3 caracteres')),
'departamento' => new sfValidatorString(array('min_length' =>3), array ('required' => 'Debe escribir el departamento', 'min_length' => 'El departamento debe tener al menos 3 caracteres')),
'apellidos' => new sfValidatorString(array('min_length' =>3), array ('required' => 'Debe escribir sus apellidos', 'min_length' => 'Sus apellidos deben tener al menos 3 caracteres')),
'solapin' => new sfValidatorRegex(array ('pattern' => '(^[0-9]{4}$)')),
'is_active' => new sfValidatorBoolean(),
'groups_list' => new sfValidatorBoolean(array('required' => 'false')),


'id' => new sfValidatorDoctrineChoice(array('model' => 'DmUser', 'column' => 'id', 'required' => false))
));

$this->validatorSchema->setPostValidator(
new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again',
array(),
array('invalid' => 'Por favor, verifique que coincidan las contraseñas.')
)
);


$this->validatorSchema->setPostValidator(
new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('email')), array('invalid' => 'El email ya existe, por favor contacte al administrador si es el suyo '))
);

$this->mergePostValidator(
new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('username')), array('invalid' => 'Este apodo ya existe, por favor escoja otro'))
);

$this->mergePostValidator(
new sfValidatorDoctrineUnique(array('model' => 'DmUser', 'column' => array('solapin')), array('invalid' => 'Este solapin ya existe, por favor escoja otro, si es el'))
);

return $form;
}
}

10 changes: 5 additions & 5 deletions apps/admin/modules/recurso/config/generator.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generator:
class: dmAdminDoctrineGenerator
param:
model_class: recurso
model_class: Recurso
theme: dmAdmin
non_verbose_templates: true
with_show: false
Expand All @@ -21,7 +21,7 @@ generator:
list:
display:
- '=id'

- slide_id
- created_by
- updated_by
- autors_list
Expand Down Expand Up @@ -76,8 +76,8 @@ generator:
- anno
- resumen
- idioma

- palabras_claves
- slide_id
- type
- pais
- institucion
Expand Down Expand Up @@ -108,10 +108,10 @@ generator:
form:
display:
NONE: [aprobado, is_active, formato_duro, created_by, updated_by]

Slide: [slide_id_form, slide_id_view]
Users: [dm_users_list]
Others: [titulo, anno, resumen, idioma, palabras_claves, type, pais, institucion, total_paginas, num_internacional, organismo, tipo_dc, cant_registros, fecha_inicial, fecha_final, ciudad_pub, editorial, isbn, volumen, num_revista, pagina_inicial, pagina_final, issn, num_diapositivas, departamento, ciudad, tutor, tipo]
class: recursoAdminForm
class: RecursoAdminForm
fields: { }
edit: ~
new: ~
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
* @subpackage recurso
* @author Your name here
*/
class recursoAdminExport extends myDoctrineTableExport
class RecursoAdminExport extends myDoctrineTableExport
{
}
19 changes: 1 addition & 18 deletions apps/admin/modules/recurso/lib/recursoAdminForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,10 @@
* @subpackage recurso
* @author Your name here
*/
class recursoAdminForm extends BaserecursoForm
class RecursoAdminForm extends BaseRecursoForm
{
public function configure()
{
parent::configure();

$this->widgetSchema['pdf'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Pdf',
'file_src' => '/uploads/docpdf/pdf-logo.jpg',
'is_image' => false,
'with_delete' => true,
'edit_mode' => !$this->isNew(),
'template' => '<div>%file%<br />%input%<br /></div>'
));
$this->validatorSchema['pdf'] = new sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir') . '/docpdf',
'mime_types' => 'application/pdf'

));

}

}
12 changes: 12 additions & 0 deletions apps/admin/modules/respuesta/lib/respuestabAdminExport.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

/**
* respuesta admin export
*
* @package bibliocnic
* @subpackage respuesta
* @author Your name here
*/
class respuestabAdminExport extends myDoctrineTableExport
{
}
16 changes: 16 additions & 0 deletions apps/admin/modules/respuesta/lib/respuestabAdminForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* respuesta admin form
*
* @package bibliocnic
* @subpackage respuesta
* @author Your name here
*/
class respuestabAdminForm extends BaserespuestabForm
{
public function configure()
{
parent::configure();
}
}
14 changes: 8 additions & 6 deletions apps/admin/modules/tesis/config/generator.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generator:
class: dmAdminDoctrineGenerator
param:
model_class: tesis
model_class: Tesis
theme: dmAdmin
non_verbose_templates: true
with_show: false
Expand All @@ -11,16 +11,17 @@ generator:
actions: ~
fields:
autors_list:
label: Autor
label: Autors
tematicas_list:
label: Tematica
label: Tematicas
dm_users_list:
label: Users
is_active:
label: Active
list:
display:
- '=id'
- slide_id
- created_by
- updated_by
- autors_list
Expand Down Expand Up @@ -75,6 +76,7 @@ generator:
- resumen
- idioma
- palabras_claves
- slide_id
- pais
- institucion
- total_paginas
Expand Down Expand Up @@ -104,10 +106,10 @@ generator:
form:
display:
NONE: [aprobado, is_active, formato_duro, created_by, updated_by]

Slide: [slide_id_form, slide_id_view]
Users: [dm_users_list]
Others: [titulo]
class: tesisAdminForm
Others: [titulo, anno, resumen, idioma, palabras_claves, pais, institucion, total_paginas, num_internacional, organismo, tipo_dc, cant_registros, fecha_inicial, fecha_final, ciudad_pub, editorial, isbn, volumen, num_revista, pagina_inicial, pagina_final, issn, num_diapositivas, departamento, ciudad, tutor, tipo]
class: TesisAdminForm
fields: { }
edit: ~
new: ~
2 changes: 1 addition & 1 deletion apps/admin/modules/tesis/lib/tesisAdminExport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
* @subpackage tesis
* @author Your name here
*/
class tesisAdminExport extends myDoctrineTableExport
class TesisAdminExport extends myDoctrineTableExport
{
}
17 changes: 2 additions & 15 deletions apps/admin/modules/tesis/lib/tesisAdminForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,8 @@
* @subpackage tesis
* @author Your name here
*/
class tesisAdminForm extends BasetesisForm
{

protected function createMediaFormForPdf()
{
// get the DmMedia form
$form = parent::createMediaFormForPdf();

// choose mime types allowed
$form->setMimeTypeWhiteList(array(
'application/pdf',
));

return $form;
}
class TesisAdminForm extends BaseTesisForm
{
public function configure()
{
parent::configure();
Expand Down
13 changes: 0 additions & 13 deletions apps/front/modules/recurso/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,5 @@
class recursoActions extends myFrontModuleActions
{

public function executeFormWidget(dmWebRequest $request)
{
$form = new recursoForm();

if ($request->hasParameter($form->getName()) && $form->bindAndValid($request))
{
$form->save();
$this->redirectBack();
}

$this->forms['recurso'] = $form;
}


}
5 changes: 0 additions & 5 deletions apps/front/modules/recurso/actions/components.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ public function executeList()
$this->recursoPager = $this->getPager($query);
}

public function executeForm()
{
$this->form = $this->forms['recurso'];
}

public function executeShow()
{
$query = $this->getShowQuery();
Expand Down
2 changes: 1 addition & 1 deletion apps/front/modules/recurso/templates/_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
echo _open('li.element');

echo $recurso;
echo _link($recurso);

echo _close('li');
}
Expand Down
27 changes: 0 additions & 27 deletions apps/front/modules/tesis/actions/actions.class.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
<?php
/**
* Tesis actions
*
*/
class tesisActions extends myFrontModuleActions
{

public function executeFormWidget(dmWebRequest $request)
{
$form = new tesisForm();

if ($request->hasParameter($form->getName()) && $form->bindAndValid($request))
{
$form->save();
$this->redirectBack();
}

$this->forms['tesis'] = $form;
}

public function executeFormUploadWidget(dmWebRequest $request)
{
$form = new tesisForm();

if ($request->hasParameter($form->getName()) && $form->bindAndValid($request))
{
$form->save();
$this->redirectBack();
}

$this->forms['tesis'] = $form;
}


}
Loading

0 comments on commit 9984236

Please sign in to comment.