Esempio n. 1
0
 /**
  * Intercept QF validation and do our own redirection.
  *
  * We use this to send control back to the user for a user formatted page
  * This allows the user to maintain the same state and display the error messages
  * in their own theme along with any modifications
  *
  * This is a first version and will be tweaked over a period of time
  *
  *
  * @return bool
  *   true if no error found
  */
 public function validate()
 {
     $errors = parent::validate();
     if (!$errors && !empty($_POST['errorURL'])) {
         $message = NULL;
         foreach ($this->_errors as $name => $mess) {
             $message .= $mess;
             $message .= '<p>';
         }
         CRM_Utils_System::setUFMessage($message);
         $message = urlencode($message);
         $errorURL = $_POST['errorURL'];
         if (strpos($errorURL, '?') !== FALSE) {
             $errorURL .= '&';
         } else {
             $errorURL .= '?';
         }
         $errorURL .= "gid={$this->_gid}&msg={$message}";
         CRM_Utils_System::redirect($errorURL);
     }
     return $errors;
 }
Esempio n. 2
0
 /**
  * Function to intercept QF validation and do our own redirection
  *
  * We use this to send control back to the user for a user formatted page
  * This allows the user to maintain the same state and display the error messages
  * in their own theme along with any modifications
  *
  * This is a first version and will be tweaked over a period of time
  *
  * @access    public                                                              
  * @return    boolean   true if no error found 
  */
 function validate()
 {
     $errors = parent::validate();
     if (!$errors && CRM_Utils_Array::value('errorURL', $_POST)) {
         $message = null;
         foreach ($this->_errors as $name => $mess) {
             $message .= $mess;
             $message .= '<p>';
         }
         if (function_exists('drupal_set_message')) {
             drupal_set_message($message);
         }
         $message = urlencode($message);
         $errorURL = $_POST['errorURL'];
         if (strpos($errorURL, '?') !== false) {
             $errorURL .= '&';
         } else {
             $errorURL .= '?';
         }
         $errorURL .= "gid={$this->_gid}&msg={$message}";
         CRM_Utils_System::redirect($errorURL);
     }
     return $errors;
 }