Esempio n. 1
0
 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE)));
     // also add a hidden element for to trick drupal
     $this->addElement('hidden', "edit[civicrm_dummy_field]", "CiviCRM Dummy Field for Drupal");
     parent::buildQuickForm();
     $this->addFormRule(array('CRM_Profile_Form_Dynamic', 'formRule'), $this);
 }
Esempio n. 2
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 function buildQuickForm()
 {
     $this->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => true)));
     // also add a hidden element for to trick drupal
     $this->addElement('hidden', "edit[civicrm_dummy_field]", "CiviCRM Dummy Field for Drupal");
     parent::buildQuickForm();
     if ($this->_mode == CRM_PROFILE_FORM_MODE_REGISTER) {
         $this->addFormRule(array('CRM_Profile_Form_Dynamic', 'formRule'), -1);
     } else {
         $this->addFormRule(array('CRM_Profile_Form_Dynamic', 'formRule'), $this->_id);
     }
 }
Esempio n. 3
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     // Is proximity search enabled for this profile?
     $proxSearch = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->get('gid'), 'is_proximity_search', 'id');
     if ($proxSearch) {
         CRM_Contact_Form_Task_ProximityCommon::buildQuickForm($this, $proxSearch);
     }
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
     parent::buildQuickForm();
 }
Esempio n. 4
0
 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     if (empty($this->_ufGroup['id'])) {
         CRM_Core_Error::fatal();
     }
     // set the title
     if ($this->_multiRecord && $this->_customGroupTitle) {
         $groupTitle = $this->_multiRecord & CRM_Core_Action::UPDATE ? 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle;
     } else {
         $groupTitle = $this->_ufGroup['title'];
     }
     CRM_Utils_System::setTitle($groupTitle);
     $this->assign('recentlyViewed', FALSE);
     if ($this->_context != 'dialog') {
         $this->_postURL = $this->_ufGroup['post_URL'];
         $this->_cancelURL = $this->_ufGroup['cancel_URL'];
         $gidString = $this->_gid;
         if (!empty($this->_profileIds)) {
             $gidString = implode(',', $this->_profileIds);
         }
         if (!$this->_postURL) {
             if ($this->_context == 'Search') {
                 $this->_postURL = CRM_Utils_System::url('civicrm/contact/search');
             } elseif ($this->_id && $this->_gid) {
                 $urlParams = "reset=1&id={$this->_id}&gid={$gidString}";
                 if ($this->_isContactActivityProfile && $this->_activityId) {
                     $urlParams .= "&aid={$this->_activityId}";
                 }
                 // get checksum if present
                 if ($this->get('cs')) {
                     $urlParams .= "&cs=" . $this->get('cs');
                 }
                 $this->_postURL = CRM_Utils_System::url('civicrm/profile/view', $urlParams);
             }
         }
         if (!$this->_cancelURL) {
             $this->_cancelURL = CRM_Utils_System::url('civicrm/profile', "reset=1&gid={$gidString}");
         }
         // we do this gross hack since qf also does entity replacement
         $this->_postURL = str_replace('&', '&', $this->_postURL);
         $this->_cancelURL = str_replace('&', '&', $this->_cancelURL);
         // also retain error URL if set
         $this->_errorURL = CRM_Utils_Array::value('errorURL', $_POST);
         if ($this->_errorURL) {
             // we do this gross hack since qf also does entity replacement
             $this->_errorURL = str_replace('&', '&', $this->_errorURL);
             $this->addElement('hidden', 'errorURL', $this->_errorURL);
         }
         // replace the session stack in case user cancels (and we dont go into postProcess)
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext($this->_postURL);
     }
     parent::buildQuickForm();
     $this->assign('cancelURL', $this->_cancelURL);
     if ($this->_multiRecord & CRM_Core_Action::DELETE && $this->_recordExists) {
         $this->_deleteButtonName = $this->getButtonName('upload', 'delete');
         $this->addElement('submit', $this->_deleteButtonName, ts('Delete'));
         return;
     }
     //get the value from session, this is set if there is any file
     //upload field
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $buttonName = 'upload';
     } else {
         $buttonName = 'next';
     }
     $buttons[] = array('type' => $buttonName, 'name' => ts('Save'), 'isDefault' => TRUE);
     $this->addButtons($buttons);
     $this->addFormRule(array('CRM_Profile_Form', 'formRule'), $this);
 }
Esempio n. 5
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     // add the hidden field to redirect the postProcess from
     require_once 'CRM/UF/Form/Group.php';
     require_once 'CRM/Core/DAO/UFGroup.php';
     $ufGroup =& new CRM_Core_DAO_UFGroup();
     $ufGroup->id = $this->_gid;
     if (!$ufGroup->find(true)) {
         CRM_Core_Error::fatal();
     }
     // set the title
     CRM_Utils_System::setTitle($ufGroup->title);
     $this->assign('recentlyViewed', false);
     if ($this->_context != 'dialog') {
         $this->_postURL = CRM_Utils_Array::value('postURL', $_POST);
         $this->_cancelURL = CRM_Utils_Array::value('cancelURL', $_POST);
         if (!$this->_postURL) {
             $this->_postURL = $ufGroup->post_URL;
         }
         if (!$this->_postURL) {
             if ($this->_context == 'Search') {
                 $this->_postURL = CRM_Utils_System::url('civicrm/contact/search');
             } elseif ($this->_id && $this->_gid) {
                 $this->_postURL = CRM_Utils_System::url('civicrm/profile/view', "reset=1&id={$this->_id}&gid={$this->_gid}");
             }
         }
         if (!$this->_cancelURL) {
             if ($ufGroup->cancel_URL) {
                 $this->_cancelURL = $ufGroup->cancel_URL;
             } else {
                 $this->_cancelURL = CRM_Utils_System::url('civicrm/profile', "reset=1&gid={$this->_gid}");
             }
         }
         // we do this gross hack since qf also does entity replacement
         $this->_postURL = str_replace('&', '&', $this->_postURL);
         $this->_cancelURL = str_replace('&', '&', $this->_cancelURL);
         $this->addElement('hidden', 'postURL', $this->_postURL);
         if ($this->_cancelURL) {
             $this->addElement('hidden', 'cancelURL', $this->_cancelURL);
         }
         // also retain error URL if set
         $this->_errorURL = CRM_Utils_Array::value('errorURL', $_POST);
         if ($this->_errorURL) {
             // we do this gross hack since qf also does entity replacement
             $this->_errorURL = str_replace('&', '&', $this->_errorURL);
             $this->addElement('hidden', 'errorURL', $this->_errorURL);
         }
         // replace the session stack in case user cancels (and we dont go into postProcess)
         $session =& CRM_Core_Session::singleton();
         $session->replaceUserContext($this->_postURL);
     }
     parent::buildQuickForm();
     //get the value from session, this is set if there is any file
     //upload field
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $buttonName = 'upload';
     } else {
         $buttonName = 'next';
     }
     $buttons[] = array('type' => $buttonName, 'name' => ts('Save'), 'isDefault' => true);
     if ($this->_context != 'dialog') {
         $buttons[] = array('type' => 'cancel', 'name' => ts('Cancel'), 'isDefault' => true);
     }
     $this->addButtons($buttons);
     $this->addFormRule(array('CRM_Profile_Form', 'formRule'), $this);
 }
Esempio n. 6
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     // add the hidden field to redirect the postProcess from
     $ufGroup = new CRM_Core_DAO_UFGroup();
     $ufGroup->id = $this->_gid;
     if (!$ufGroup->find(TRUE)) {
         CRM_Core_Error::fatal();
     }
     // set the title
     if ($this->_multiRecord && $this->_customGroupTitle) {
         $groupTitle = $this->_multiRecord & CRM_Core_Action::UPDATE ? 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle;
     } else {
         $groupTitle = $ufGroup->title;
     }
     CRM_Utils_System::setTitle($groupTitle);
     $this->assign('recentlyViewed', FALSE);
     if ($this->_context != 'dialog') {
         $this->_postURL = CRM_Utils_Array::value('postURL', $_POST);
         $this->_cancelURL = CRM_Utils_Array::value('cancelURL', $_POST);
         $gidString = $this->_gid;
         if (!empty($this->_profileIds)) {
             $gidString = implode(',', $this->_profileIds);
         }
         if (!$this->_postURL) {
             $this->_postURL = $ufGroup->post_URL;
         }
         if (!$this->_postURL) {
             if ($this->_context == 'Search') {
                 $this->_postURL = CRM_Utils_System::url('civicrm/contact/search');
             } elseif ($this->_id && $this->_gid) {
                 $urlParams = "reset=1&id={$this->_id}&gid={$gidString}";
                 if ($this->_isContactActivityProfile && $this->_activityId) {
                     $urlParams .= "&aid={$this->_activityId}";
                 }
                 // get checksum if present
                 if ($this->get('cs')) {
                     $urlParams .= "&cs=" . $this->get('cs');
                 }
                 $this->_postURL = CRM_Utils_System::url('civicrm/profile/view', $urlParams);
             }
         }
         if (!$this->_cancelURL) {
             if ($ufGroup->cancel_URL) {
                 $this->_cancelURL = $ufGroup->cancel_URL;
             } else {
                 $this->_cancelURL = CRM_Utils_System::url('civicrm/profile', "reset=1&gid={$gidString}");
             }
         }
         if ($this->_multiRecordProfile) {
             $urlParams = "reset=1&id={$this->_id}&gid={$gidString}";
             // get checksum if present
             if ($this->get('cs')) {
                 $urlParams .= "&cs=" . $this->get('cs');
             }
             $this->_postURL = CRM_Utils_System::url('civicrm/profile/edit', $urlParams);
             $this->_cancelURL = CRM_Utils_System::url('civicrm/profile/edit', $urlParams);
             //passing the post url to template so the popup form does
             //proper redirection and proccess form errors if any
             if (!isset($this->_onPopupClose) || $this->_onPopupClose == 'redirectToProfile') {
                 $popupRedirect = CRM_Utils_System::url('civicrm/profile/edit', $urlParams, FALSE, NULL, FALSE);
             } elseif ($this->_onPopupClose == 'redirectToTab') {
                 $popupRedirect = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_id}&selectedChild=custom_{$this->_customGroupId}", FALSE, NULL, FALSE);
             }
             $this->assign('urlParams', $urlParams);
             $this->assign('postUrl', $popupRedirect);
         }
         // we do this gross hack since qf also does entity replacement
         $this->_postURL = str_replace('&', '&', $this->_postURL);
         $this->_cancelURL = str_replace('&', '&', $this->_cancelURL);
         $this->addElement('hidden', 'postURL', $this->_postURL);
         if ($this->_cancelURL) {
             $this->addElement('hidden', 'cancelURL', $this->_cancelURL);
         }
         // also retain error URL if set
         $this->_errorURL = CRM_Utils_Array::value('errorURL', $_POST);
         if ($this->_errorURL) {
             // we do this gross hack since qf also does entity replacement
             $this->_errorURL = str_replace('&', '&', $this->_errorURL);
             $this->addElement('hidden', 'errorURL', $this->_errorURL);
         }
         // replace the session stack in case user cancels (and we dont go into postProcess)
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext($this->_postURL);
     }
     parent::buildQuickForm();
     if ($this->_multiRecord & CRM_Core_Action::DELETE && $this->_recordExists) {
         $this->_deleteButtonName = $this->getButtonName('upload', 'delete');
         $this->addElement('submit', $this->_deleteButtonName, ts('Delete'));
         $buttons[] = array('type' => 'cancel', 'name' => ts('Cancel'), 'isDefault' => TRUE);
         $this->addButtons($buttons);
         return;
     }
     //get the value from session, this is set if there is any file
     //upload field
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $buttonName = 'upload';
     } else {
         $buttonName = 'next';
     }
     $buttons[] = array('type' => $buttonName, 'name' => ts('Save'), 'isDefault' => TRUE);
     if ($this->_context != 'dialog') {
         $buttons[] = array('type' => 'cancel', 'name' => ts('Cancel'), 'isDefault' => TRUE);
     }
     $this->addButtons($buttons);
     $this->addFormRule(array('CRM_Profile_Form', 'formRule'), $this);
 }
Esempio n. 7
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 function buildQuickForm()
 {
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true)));
     parent::buildQuickForm();
 }