Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modificando el modulo pregunte #14

Merged
merged 2 commits into from
Aug 1, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions apps/admin/modules/respuesta/config/generator.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generator:
class: dmAdminDoctrineGenerator
param:
model_class: respuestab
model_class: respuesta
theme: dmAdmin
non_verbose_templates: true
with_show: false
Expand All @@ -13,9 +13,8 @@ generator:
list:
display:
- '=id'
- busqueda_id
- pregunta_id
- mensaje
- uri
- created_at
- updated_at
sort:
Expand All @@ -27,17 +26,15 @@ generator:
filter:
display:
- id
- mensaje
- busqueda_id
- uri
- pregunta_id
- created_at
- updated_at
form:
display:
NONE: [busqueda_id]
Pregunta: [pregunta_id]
Mensaje: [mensaje]
Others: [uri]
class: respuestabAdminForm

class: respuestaAdminForm
fields: { }
edit: ~
new: ~
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
* @subpackage respuesta
* @author Your name here
*/
class respuestabAdminForm extends BaserespuestabForm
class respuestaAdminForm extends BaserespuestaForm
{
public function configure()
{
parent::configure();
unset($this['created_at'], $this['updated_at']);
}
}
6 changes: 2 additions & 4 deletions apps/admin/modules/respuestaBusqueda/config/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ generator:
filter:
display:
- id
- mensaje
- busqueda_id
- uri
- created_at
- updated_at
form:
display:
NONE: [busqueda_id]
B�squeda: [busqueda_id]
Mensaje: [mensaje]
Others: [uri]
Link al recurso: [uri]
class: respuestabAdminForm
fields: { }
edit: ~
Expand Down
15 changes: 14 additions & 1 deletion apps/front/modules/pregunta/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,22 @@ public function executeFormWidget(dmWebRequest $request)
{
$form = new preguntaForm();

if ($request->hasParameter($form->getName()) && $form->bindAndValid($request))
if ($request->isMethod('post') && $form->bindAndValid($request))
{
$form->save();
$this->getUser()->setFlash('pregunta_form_valid', true);
$user = $this->getUser()->getDmUser();
/*$this->getService('mail')->setTemplate('solicitud_busqueda_especializada')
->addValues(array(
'titulo' => $form->getValue('titulo'),
'email' => $user->getEmail(),
'mensaje' => $form->getValue('mensaje'),
'nombre' => $user->getNombre(),
'apellidos' => $user->getApellidos()

))

->send(); */
$this->redirectBack();
}

Expand Down
5 changes: 4 additions & 1 deletion apps/front/modules/pregunta/templates/_form.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?php // Vars: $form

if ($sf_user->getFlash('pregunta_form_valid'))
{
echo _tag('p.felicitaciones', 'Su solicitud ha sido enviada satisfactoriamente y ser&aacute respondida con la mayor brevedad posible ');
}
echo $form;
2 changes: 1 addition & 1 deletion lib/form/doctrine/BusquedaForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BusquedaForm extends BaseBusquedaForm
public function configure()
{
unset($this['dm_user_id'], $this['created_at'], $this['updated_at'], $this['is_active']);
$this->getObject()->setDmUserId( sfcontext::getInstance()->getUser()->getAttribute( 'dm_user_id', ' ' ,'dmSecurityUser' ));
$this->getObject()->setDmUserId( sfcontext::getInstance()->getUser()->getAttribute( 'user_id', ' ' ,'dmSecurityUser' ));
$years = range(1900, date('Y'));

$today = array(
Expand Down
12 changes: 12 additions & 0 deletions lib/form/doctrine/PreguntaForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,17 @@ class PreguntaForm extends BasePreguntaForm
{
public function configure()
{
unset($this['dm_user_id'], $this['created_at'], $this['updated_at'], $this['is_active']);
$this->getObject()->setDmUserId( sfcontext::getInstance()->getUser()->getAttribute( 'user_id', ' ' ,'dmSecurityUser' ));
$this->setValidators(array(
'titulo' => new sfValidatorString(array('min_length' =>10), array ('required' => 'Debe escribir un titulo sugerente', 'min_length' => 'El titulo debe tener al menos 10 caracteres')),
'mensaje' => new sfValidatorString(array('min_length' => 20), array('required' => 'Por favor describa su pregunta', 'min_length' => 'Por favor describa mejor su pregunta(al menos 20 caracteres) ')),

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




}
}
2 changes: 2 additions & 0 deletions lib/form/doctrine/RespuestaForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ class RespuestaForm extends BaseRespuestaForm
{
public function configure()
{

unset($this['created_at'], $this['updated_at']);
}
}
4 changes: 4 additions & 0 deletions lib/model/doctrine/Pregunta.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
*/
class Pregunta extends BasePregunta
{
public function __toString()
{
return self::getTitulo();
}

}
1 change: 1 addition & 0 deletions web/themeSolutions/css/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,4 @@ background-color: #FFF2C4;
border: 1px solid #FBCB0D;
padding: 2px;
}
/* ----------------------------------------------pregunta form Form -------------------------------------*/