/**
  * Mandatory execute method...
  *
  * @param block_BlockContext $context
  * @param block_BlockRequest $request
  */
 public function execute($context, $request)
 {
     FormHelper::addScriptsAndStyles($context);
     $form = $this->getParameter('form');
     $this->setTemplateName('markup/' . $form->getMarkup() . '/Form');
     $this->setAttribute('form', $form);
     $contents = array();
     form_FormService::getInstance()->buildContentsFromRequest($form->getDocumentNode()->getChildren(), $contents, $request, $form);
     $this->setAttribute('elements', $contents);
     if ($this->hasParameter('errors')) {
         $this->setAttribute('errors', $this->getParameter('errors'));
     }
     $this->setAttribute('selfUrl', $_SERVER['REQUEST_URI']);
     if ($request->getParameter(form_FormConstants::BACK_URL_PARAMETER)) {
         $backUrl = $request->getParameter(form_FormConstants::BACK_URL_PARAMETER);
     } else {
         if (isset($_SERVER['HTTP_REFERER'])) {
             $backUrl = $_SERVER['HTTP_REFERER'];
         } else {
             $backUrl = website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
         }
     }
     $this->setAttribute("receiverLabels", $this->getParameter("receiverLabels"));
     $this->setAttribute('requestParameters', $request->getParameters());
     $this->setAttribute('backUrl', $backUrl);
     $this->setAttribute('useCaptcha', $form->getDocumentService()->hasToUseCaptcha($form));
     $this->setAttribute('jQueryConditionalElement', $form->getDocumentService()->getJQueryForConditionalElementsOf($form));
 }
 /**
  * @param form_persistentdocument_hidden $field
  * @param DOMElement $fieldElm
  * @param mixed $rawValue
  * @return string
  */
 public function buildXmlElementResponse($field, $fieldElm, $rawValue)
 {
     switch ($field->getIsRecommand()) {
         case 'site':
             return website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
             break;
         case 'page':
             try {
                 return LinkHelper::getUrl(DocumentHelper::getDocumentInstance($rawValue));
             } catch (Exception $e) {
                 Framework::exception($e);
             }
             return website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
     }
     return parent::buildXmlElementResponse($field, $fieldElm, $rawValue);
 }
 /**
  * Returns the URL of the page tagged with the following contextual tag:
  * contextual_website_website_modules_form_recommand-page
  * @return String
  * @deprecated use sharethis module instead.
  */
 public function getRecommandFormUrl()
 {
     try {
         $page = TagService::getInstance()->getDocumentByContextualTag('contextual_website_website_modules_form_recommand-page', website_WebsiteModuleService::getInstance()->getCurrentWebsite());
         $parameters = array('formParam[recommandFeature]' => website_WebsiteModuleService::getInstance()->getCurrentPageId());
         return LinkHelper::getUrl($page, null, $parameters);
     } catch (Exception $e) {
         Framework::exception($e);
     }
     return null;
 }
 /**
  * @param form_persistentdocument_form $form
  * @param f_mvc_Request $request
  * @return String
  */
 protected function getInputView($form, $request)
 {
     $context = $this->getContext();
     FormHelper::addScriptsAndStyles($context);
     $previousModuleName = FormHelper::getModuleName();
     $moduleName = $this->getModuleName();
     FormHelper::setModuleName($moduleName);
     $contents = $this->getContentsFromRequest($form->getDocumentNode()->getChildren(), $request, $form);
     FormHelper::setModuleName($previousModuleName);
     $request->setAttribute('elements', $contents);
     $request->setAttribute('selfUrl', $_SERVER['REQUEST_URI']);
     if ($request->getParameter('backUrl')) {
         $backUrl = $request->getParameter('backUrl');
     } else {
         if (isset($_SERVER['HTTP_REFERER'])) {
             $backUrl = $_SERVER['HTTP_REFERER'];
         } else {
             $backUrl = website_WebsiteModuleService::getInstance()->getCurrentWebsite()->getUrl();
         }
     }
     $request->setAttribute('requestParameters', $request->getParameters());
     $request->setAttribute('backUrl', $backUrl);
     $request->setAttribute('useCaptcha', $form->getDocumentService()->hasToUseCaptcha($form));
     $request->setAttribute('jQueryConditionalElement', $form->getDocumentService()->getJQueryForConditionalElementsOf($form));
     return $this->getInputTemplateByFullName($form);
 }