/** * pre processing work done here. * * @param * @return void * * @access public * */ function preProcess() { if ($this->get('register')) { $this->_mode = CRM_PROFILE_FORM_MODE_REGISTER; } else { $this->_mode = CRM_PROFILE_FORM_MODE_EDIT; } parent::preProcess(); }
/** * Pre processing work done here. * * @param * * @return void */ public function preProcess() { if ($this->get('register')) { $this->_mode = CRM_Profile_Form::MODE_REGISTER; } else { $this->_mode = CRM_Profile_Form::MODE_EDIT; } if ($this->get('skipPermission')) { $this->_skipPermission = TRUE; } // also allow dupes to be updated for edit in my account (CRM-2232) $this->_isUpdateDupe = TRUE; parent::preProcess(); }
/** * pre processing work done here. * * @param * @return void * * @access public * */ function preProcess() { $this->_mode = CRM_Profile_Form::MODE_CREATE; //set the context for the profile $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if ($this->_context) { $this->assign('context', $this->_context); } if ($this->get('skipPermission')) { $this->_skipPermission = true; } if ($this->get('edit')) { // make sure we have right permission to edit this user $session =& CRM_Core_Session::singleton(); $userID = $session->get('userID'); $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, $userID); require_once 'CRM/Contact/BAO/Contact/Utils.php'; if ($id != $userID) { // do not allow edit for anon users in joomla frontend, CRM-4668, unless u have checksum CRM-5228 require_once 'CRM/Contact/BAO/Contact/Permission.php'; $config =& CRM_Core_Config::singleton(); if ($config->userFrameworkFrontend) { CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($id, $this); } else { CRM_Contact_BAO_Contact_Permission::validateChecksumContact($id, $this); } } } parent::preProcess(); // make sure the gid is set and valid if (!$this->_gid) { CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) is disabled, OR there is no Profile with that ID, OR a valid \'gid=\' integer value is missing from the URL. Contact the site administrator if you need assistance.', array(1 => $this->_gid))); } // and also the profile is of type 'Profile' $query = "\nSELECT module\n FROM civicrm_uf_join\n WHERE module = 'Profile'\n AND uf_group_id = %1\n"; $params = array(1 => array($this->_gid, 'Integer')); $dao =& CRM_Core_DAO::executeQuery($query, $params); if (!$dao->fetch()) { CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) is not configured to be used for \'Profile\' edit and view forms in its Settings. Contact the site administrator if you need assistance.', array(1 => $this->_gid))); } }
/** * Pre processing work done here. */ public function preProcess() { $this->_mode = CRM_Profile_Form::MODE_SEARCH; parent::preProcess(); }
/** * Pre processing work done here. * * @param * * @return void */ public function preProcess() { $this->_mode = CRM_Profile_Form::MODE_CREATE; $this->_onPopupClose = CRM_Utils_Request::retrieve('onPopupClose', 'String', $this); $this->assign('onPopupClose', $this->_onPopupClose); //set the context for the profile $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); //set the block no $this->_blockNo = CRM_Utils_Request::retrieve('blockNo', 'String', $this); //set the prefix $this->_prefix = CRM_Utils_Request::retrieve('prefix', 'String', $this); $this->assign('context', $this->_context); if ($this->_blockNo) { $this->assign('blockNo', $this->_blockNo); $this->assign('prefix', $this->_prefix); } $this->assign('createCallback', CRM_Utils_Request::retrieve('createCallback', 'String', $this)); if ($this->get('skipPermission')) { $this->_skipPermission = TRUE; } if ($this->get('edit')) { // make sure we have right permission to edit this user $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); // Set the ID from the query string, otherwise default to the current user $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, $userID); if ($id) { // this is edit mode. $this->_mode = CRM_Profile_Form::MODE_EDIT; if ($id != $userID) { // do not allow edit for anon users in joomla frontend, CRM-4668, unless u have checksum CRM-5228 $config = CRM_Core_Config::singleton(); if ($config->userFrameworkFrontend) { CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($id, $this); } else { CRM_Contact_BAO_Contact_Permission::validateChecksumContact($id, $this); } $this->_isPermissionedChecksum = TRUE; } } else { CRM_Core_Error::fatal(ts('No user/contact ID was specified, so the Profile cannot be used in edit mode.')); } } parent::preProcess(); // and also the profile is of type 'Profile' $query = "\nSELECT module,is_reserved\n FROM civicrm_uf_group\n LEFT JOIN civicrm_uf_join ON uf_group_id = civicrm_uf_group.id\n WHERE civicrm_uf_group.id = %1\n"; $params = array(1 => array($this->_gid, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); $isProfile = FALSE; while ($dao->fetch()) { $isProfile = $isProfile || $dao->module == "Profile"; } //Check that the user has the "add contacts" Permission $canAdd = CRM_Core_Permission::check("add contacts"); //Remove need for Profile module type when using reserved profiles [CRM-14488] if (!$dao->N || !$isProfile && !($dao->is_reserved && $canAdd)) { CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) is not configured to be used for \'Profile\' edit and view forms in its Settings. Contact the site administrator if you need assistance.', array(1 => $this->_gid))); } }
/** * pre processing work done here. * * @param * @return void * * @access public * */ function preProcess() { $this->_mode = CRM_PROFILE_FORM_MODE_SEARCH; parent::preProcess(); }