Ejemplo n.º 1
0
 /**
  * Core function that builds the form. We redefine this function
  * here and expect all CRM forms to build their form in the function
  * buildQuickForm.
  *
  */
 function buildForm()
 {
     $this->_formBuilt = true;
     $this->preProcess();
     $this->assign('translatePermission', CRM_Core_Permission::check('translate CiviCRM'));
     if ($this->controller->_key && $this->controller->_print != CRM_Core_Smarty::PRINT_NOFORM) {
         $this->addElement('hidden', 'qfKey', $this->controller->_key);
         $this->assign('qfKey', $this->controller->_key);
     }
     require_once 'CRM/Utils/Hook.php';
     $this->buildQuickForm();
     $defaults =& $this->setDefaultValues();
     unset($defaults['qfKey']);
     if (!empty($defaults)) {
         $this->setDefaults($defaults);
     }
     // call the form hook
     // also call the hook function so any modules can set thier own custom defaults
     // the user can do both the form and set default values with this hook
     CRM_Utils_Hook::buildForm(get_class($this), $this);
     $this->addRules();
 }
Ejemplo n.º 2
0
 /**
  * Core function that builds the form. We redefine this function
  * here and expect all CRM forms to build their form in the function
  * buildQuickForm.
  */
 public function buildForm()
 {
     $this->_formBuilt = TRUE;
     $this->preProcess();
     CRM_Utils_Hook::preProcess(get_class($this), $this);
     $this->assign('translatePermission', CRM_Core_Permission::check('translate CiviCRM'));
     if ($this->controller->_key && $this->controller->_generateQFKey) {
         $this->addElement('hidden', 'qfKey', $this->controller->_key);
         $this->assign('qfKey', $this->controller->_key);
     }
     // _generateQFKey suppresses the qfKey generation on form snippets that
     // are part of other forms, hence we use that to avoid adding entryURL
     if ($this->controller->_generateQFKey && $this->controller->_entryURL) {
         $this->addElement('hidden', 'entryURL', $this->controller->_entryURL);
     }
     $this->buildQuickForm();
     $defaults = $this->setDefaultValues();
     unset($defaults['qfKey']);
     if (!empty($defaults)) {
         $this->setDefaults($defaults);
     }
     // call the form hook
     // also call the hook function so any modules can set their own custom defaults
     // the user can do both the form and set default values with this hook
     CRM_Utils_Hook::buildForm(get_class($this), $this);
     $this->addRules();
     //Set html data-attribute to enable warning user of unsaved changes
     if ($this->unsavedChangesWarn === TRUE || !isset($this->unsavedChangesWarn) && ($this->_action & CRM_Core_Action::ADD || $this->_action & CRM_Core_Action::UPDATE)) {
         $this->setAttribute('data-warn-changes', 'true');
     }
 }
Ejemplo n.º 3
0
 /**
  * Core function that builds the form. We redefine this function
  * here and expect all CRM forms to build their form in the function
  * buildQuickForm.
  *
  */
 function buildForm()
 {
     $this->_formBuilt = TRUE;
     $this->preProcess();
     $this->assign('translatePermission', CRM_Core_Permission::check('translate CiviCRM'));
     if ($this->controller->_key && $this->controller->_generateQFKey) {
         $this->addElement('hidden', 'qfKey', $this->controller->_key);
         $this->assign('qfKey', $this->controller->_key);
     }
     // _generateQFKey suppresses the qfKey generation on form snippets that
     // are part of other forms, hence we use that to avoid adding entryURL
     if ($this->controller->_generateQFKey && $this->controller->_entryURL) {
         $this->addElement('hidden', 'entryURL', $this->controller->_entryURL);
     }
     $this->buildQuickForm();
     $defaults = $this->setDefaultValues();
     unset($defaults['qfKey']);
     if (!empty($defaults)) {
         $this->setDefaults($defaults);
     }
     // call the form hook
     // also call the hook function so any modules can set thier own custom defaults
     // the user can do both the form and set default values with this hook
     CRM_Utils_Hook::buildForm(get_class($this), $this);
     $this->addRules();
 }