Example #1
0
 public function executeFormWidget(dmWebRequest $request)
 {
     $form = new PluginCommentForm();
     if ($request->isMethod('post') && $form->bindAndValid($request)) {
         $form->save();
         $this->redirectBack();
     }
     $this->forms['PluginComment'] = $form;
 }
Example #2
0
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['body'] = new sfWidgetFormTextarea(array(), array('cols' => 32));
     // $this->widgetSchema['rating'] = new sfWidgetFormStarRating();
     // $this->validatorSchema['rating'] = new sfValidatorInteger(array('min' => 1, 'max' => 5));
 }
Example #3
0
 public function executeShowWidget(dmWebRequest $request)
 {
     $form = new PluginCommentForm();
     if ($request->isMethod('post') && ($data = $request->getParameter($form->getName()))) {
         if ($form->isCaptchaEnabled()) {
             $data = array_merge($data, array('captcha' => array('recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'))));
         }
         $form->bind($data);
         if ($form->isValid()) {
             $form->save();
             $this->getUser()->setFlash('form_saved', true);
             $this->redirectBack();
         }
     }
     $this->forms['PluginComment'] = $form;
 }