本文整理汇总了PHP中CRM_Utils_Request::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Request::retrieve方法的具体用法?PHP CRM_Utils_Request::retrieve怎么用?PHP CRM_Utils_Request::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Request
的用法示例。
在下文中一共展示了CRM_Utils_Request::retrieve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* @param $entityTable
*/
public static function preProcess($entityTable)
{
self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');
self::$_entityTable = $entityTable;
if (self::$_entityId && $entityTable) {
$checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, $entityTable);
if ($checkParentExistsForThisId) {
self::$_hasParent = TRUE;
self::$_parentEntityId = $checkParentExistsForThisId;
self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityTable);
} else {
self::$_parentEntityId = self::$_entityId;
self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId(self::$_entityId, $entityTable);
}
if (property_exists(self::$_scheduleReminderDetails, 'id')) {
self::$_scheduleReminderID = self::$_scheduleReminderDetails->id;
}
}
CRM_Core_OptionValue::getValues(array('name' => $entityTable . '_repeat_exclude_dates_' . self::$_parentEntityId), $optionValue);
$excludeOptionValues = array();
if (!empty($optionValue)) {
foreach ($optionValue as $key => $val) {
$excludeOptionValues[$val['value']] = substr(CRM_Utils_Date::mysqlToIso($val['value']), 0, 10);
}
self::$_excludeDateInfo = $excludeOptionValues;
}
// Assign variables
$entityType = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($entityTable));
$tpl = CRM_Core_Smarty::singleton();
$tpl->assign('recurringEntityType', ts($entityType));
$tpl->assign('currentEntityId', self::$_entityId);
$tpl->assign('entityTable', self::$_entityTable);
$tpl->assign('scheduleReminderId', self::$_scheduleReminderID);
$tpl->assign('hasParent', self::$_hasParent);
}
示例2: __construct
/**
* Class constructor.
*/
public function __construct()
{
// don’t display the ‘Add these Contacts to Group’ button
$this->_add2groupSupported = FALSE;
$dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
$this->loggingDB = $dsn['database'];
// used for redirect back to contact summary
$this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$this->_logTables = array('log_civicrm_contact' => array('fk' => 'id'), 'log_civicrm_email' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_phone' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_address' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_note' => array('fk' => 'entity_id', 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_note_comment' => array('fk' => 'entity_id', 'table_name' => 'log_civicrm_note', 'joins' => array('table' => 'log_civicrm_note', 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'"), 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_group_contact' => array('fk' => 'contact_id', 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'), 'action_column' => 'status', 'log_type' => 'Group'), 'log_civicrm_entity_tag' => array('fk' => 'entity_id', 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'), 'entity_table' => TRUE), 'log_civicrm_relationship' => array('fk' => 'contact_id_a', 'bracket_info' => array('entity_column' => 'relationship_type_id', 'table' => 'log_civicrm_relationship_type', 'column' => 'label_a_b')), 'log_civicrm_activity_for_target' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_assignee' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_source' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_case' => array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_case_contact', 'join' => 'entity_log_civireport.id = fk_table.case_id'), 'bracket_info' => array('entity_column' => 'case_type_id', 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE))));
$logging = new CRM_Logging_Schema();
// build _logTables for contact custom tables
$customTables = $logging->entityCustomDataLogTables('Contact');
foreach ($customTables as $table) {
$this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
}
// build _logTables for address custom tables
$customTables = $logging->entityCustomDataLogTables('Address');
foreach ($customTables as $table) {
$this->_logTables[$table] = array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_address', 'join' => 'entity_log_civireport.entity_id = fk_table.id'), 'log_type' => 'Contact');
}
// Allow log tables to be extended via report hooks.
CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
parent::__construct();
}
示例3: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
$this->_mailingID = $this->get('mailing_id');
if (!$this->_mailingID) {
$this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, TRUE);
}
}
示例4: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($this->_surveyId) {
$this->_single = TRUE;
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
$this->_surveyTitle = $surveyInfo['title'];
$this->assign('surveyTitle', $this->_surveyTitle);
CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle)));
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('entityId', $this->_surveyId);
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// CRM-11480, CRM-11682
// Preload libraries required by the "Questions" tab
CRM_UF_Page_ProfileEditor::registerProfileScripts();
CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel'));
CRM_Campaign_Form_Survey_TabHeader::build($this);
}
示例5: preProcess
/**
* Function to pre processing
*
* @return None
* @access public
*/
function preProcess()
{
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
$this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, false, 0);
if ($this->_rgid) {
$rgDao =& new CRM_Dedupe_DAO_RuleGroup();
$rgDao->id = $this->_rgid;
$rgDao->find(true);
$this->_defaults['threshold'] = $rgDao->threshold;
$this->_contactType = $rgDao->contact_type;
$this->_defaults['level'] = $rgDao->level;
$this->_defaults['name'] = $rgDao->name;
$ruleDao =& new CRM_Dedupe_DAO_Rule();
$ruleDao->dedupe_rule_group_id = $this->_rgid;
$ruleDao->find();
$count = 0;
while ($ruleDao->fetch()) {
$this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
$this->_defaults["length_{$count}"] = $ruleDao->rule_length;
$this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
$count++;
}
}
$supported =& CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
if (is_array($supported)) {
foreach ($supported as $table => $fields) {
foreach ($fields as $field => $title) {
$this->_fields["{$table}.{$field}"] = $title;
}
}
}
asort($this->_fields);
}
示例6: addSearchContactIdsToSession
/**
* @return $this
*/
private function addSearchContactIdsToSession()
{
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
$cacheKey = "civicrm search {$qfKey}";
$selectedCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey);
$contactIds = array();
// Set contact IDs to the IDs of contacts selected (ticked) on the search result
foreach ($selectedCids[$cacheKey] as $selectedCid => $ignore) {
$contactIds[$selectedCid] = $selectedCid;
}
// So a bit of magic happens here
// When you instantiate a CRM_Contract_Controller_Search object, it checks to see if a qfKey is passed in the $_REQUEST
// in our case you should see it in the GET
// If this is passed in, the controller tries to create itself using data from the SESSION
// that means your controller is automatically populated with search data from a previous page
$searchController = new CRM_Contact_Controller_Search();
$totalContacts = count($contactIds);
if ($totalContacts <= 0) {
$totalContacts = $searchController->get('rowCount');
}
// CS: This needs to be commented out because the contact IDs are irrelevant at this point.
// If the user hasn't ticked any users then this code would just give you back the first 50 contacts
// Better to leave the contactIds empty which tells us that nothing is actually selected
if (!$contactIds) {
foreach ($this->get('rows') as $contact) {
$contactIds[$contact['contact_id']] = $contact['contact_id'];
}
}
simplemail_civicrm_addToSessionScope('contactCountFromSearch', $totalContacts);
simplemail_civicrm_addToSessionScope('contactIds', $contactIds);
return $this;
}
开发者ID:jaapjansma,项目名称:uk.co.compucorp.civicrm.simplemail,代码行数:35,代码来源:SimpleMailRecipientsFromSearch.php
示例7: preProcess
/**
* Call preprocess.
*/
public function preProcess()
{
parent::preProcess();
$this->_locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', $this, TRUE, NULL, $_REQUEST);
$this->assign('blockId', $this->_locBlockNo);
$addressSequence = CRM_Core_BAO_Address::addressSequence();
$this->assign('addressSequence', $addressSequence);
$this->_values = array();
$this->_addressId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, NULL, $_REQUEST);
$this->_action = CRM_Core_Action::ADD;
if ($this->_addressId) {
$params = array('id' => $this->_addressId);
$address = CRM_Core_BAO_Address::getValues($params, FALSE, 'id');
$this->_values['address'][$this->_locBlockNo] = array_pop($address);
$this->_action = CRM_Core_Action::UPDATE;
} else {
$this->_addressId = 0;
}
$this->assign('action', $this->_action);
$this->assign('addressId', $this->_addressId);
// parse street address, CRM-5450
$this->_parseStreetAddress = $this->get('parseStreetAddress');
if (!isset($this->_parseStreetAddress)) {
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options');
$this->_parseStreetAddress = FALSE;
if (!empty($addressOptions['street_address']) && !empty($addressOptions['street_address_parsing'])) {
$this->_parseStreetAddress = TRUE;
}
$this->set('parseStreetAddress', $this->_parseStreetAddress);
}
$this->assign('parseStreetAddress', $this->_parseStreetAddress);
}
示例8: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
// reset action from the session
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'update');
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
$rcid = $rcid ? "&id={$rcid}" : '';
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}"));
if ($this->_contactId) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_contactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
}
$this->_contactType = $contact->contact_type;
// check for permissions
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
}
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
} else {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
}
}
示例9: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//get current client name.
$this->assign('currentClientName', CRM_Contact_BAO_Contact::displayName($cid));
//set the context.
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$cid}&selectedChild=case");
if ($context == 'search') {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/case/search', $urlParams);
} elseif ($context == 'dashboard') {
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
} elseif (in_array($context, array('dashlet', 'dashletFullscreen'))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
示例10: preProcess
public function preProcess()
{
$this->_type = 'unsubscribe';
$this->_job_id = $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', $this);
$this->_queue_id = $queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', $this);
$this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this);
if (!$job_id || !$queue_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing Parameters"));
}
// verify that the three numbers above match
$q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
if (!$q) {
CRM_Core_Error::fatal(ts("There was an error in your request"));
}
list($displayName, $email) = CRM_Mailing_Event_BAO_Queue::getContactInfo($queue_id);
$this->assign('display_name', $displayName);
$emailMasked = CRM_Utils_String::maskEmail($email);
$this->assign('email_masked', $emailMasked);
$this->assign('email', $email);
$this->_email = $email;
$groups = CRM_Mailing_Event_BAO_Unsubscribe::unsub_from_mailing($job_id, $queue_id, $hash, TRUE);
$this->assign('groups', $groups);
$groupExist = NULL;
foreach ($groups as $key => $value) {
if ($value) {
$groupExist = TRUE;
}
}
if (!$groupExist) {
$statusMsg = ts('Email: %1 has been successfully unsubscribed from this Mailing List/Group.', array(1 => $email));
CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
$this->assign('groupExist', $groupExist);
}
示例11: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (!$this->_id && $this->_action & CRM_Core_Action::UPDATE) {
$this->_id = CRM_Utils_Type::escape($this->_id, 'Positive');
}
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$this->_aid}");
$this->_BAOName = 'CRM_Financial_BAO_FinancialTypeAccount';
if ($this->_aid && $this->_action & CRM_Core_Action::ADD) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_aid, 'name');
CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Financial Accounts'));
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
// CRM-12492
if (!($this->_action & CRM_Core_Action::ADD)) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$accountRelationship = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $this->_id, 'account_relationship');
if ($accountRelationship == $relationTypeId) {
$this->_isARFlag = TRUE;
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_Session::setStatus(ts("Selected financial type account with 'Accounts Receivable Account is' account relationship cannot be deleted."), '', 'error');
CRM_Utils_System::redirect($url);
}
}
}
if ($this->_id) {
$financialAccount = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $this->_id, 'financial_account_id');
$fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $financialAccount, 'name');
CRM_Utils_System::setTitle($fieldTitle . ' - ' . ts('Financial Type Accounts'));
}
$breadCrumb = array(array('title' => ts('Financial Type Accounts'), 'url' => $url));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
示例12: preProcess
public function preProcess()
{
$this->set('searchFormName', 'Custom');
$this->set('context', 'custom');
$csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this);
$ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this);
$gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this);
list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
if (!$this->_customSearchID) {
CRM_Core_Error::fatal('Could not get details for custom search.');
}
// stash this as a hidden element so we can potentially go there if the session
// is reset but this is available in the POST
$this->addElement('hidden', 'csid', $csID);
if (!empty($formValues)) {
$this->_formValues = $formValues;
}
// set breadcrumb to return to Custom Search listings page
$breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
// use the custom selector
self::$_selectorName = 'CRM_Contact_Selector_Custom';
$this->set('customSearchID', $this->_customSearchID);
$this->set('customSearchClass', $this->_customSearchClass);
parent::preProcess();
// instantiate the new class
$this->_customClass = new $this->_customSearchClass($this->_formValues);
// CRM-12747
if (isset($this->_customClass->_permissionedComponent) && !self::isPermissioned($this->_customClass->_permissionedComponent)) {
CRM_Utils_System::permissionDenied();
}
}
示例13: preProcess
/**
* set up variables to build the form
*
* @return void
* @acess protected
*/
function preProcess()
{
$this->_srcFID = CRM_Utils_Request::retrieve('fid', 'Positive', $this, true);
$this->_srcGID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'custom_group_id');
$this->_label = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'label');
CRM_Utils_System::setTitle(ts('Custom Field Move: %1', array(1 => $this->_label)));
}
示例14: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->_noteId = null;
if ($this->_id) {
require_once 'CRM/Core/BAO/Note.php';
$noteDAO = new CRM_Core_BAO_Note();
$noteDAO->entity_table = 'civicrm_grant';
$noteDAO->entity_id = $this->_id;
if ($noteDAO->find(true)) {
$this->_noteId = $noteDAO->id;
}
}
//build custom data
CRM_Custom_Form_Customdata::preProcess($this, null, null, 1, 'Grant', $this->_id);
}
示例15: preProcess
/**
* This function is called prior to building and submitting the form
*/
function preProcess()
{
// check contact_id
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if (empty($this->_contactId)) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// check for permissions
$session = CRM_Core_Session::singleton();
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// get request
$this->_request = CRM_Utils_Request::retrieve('request', 'String', $this, FALSE, 'choose');
// get session
$session = CRM_Core_Session::singleton();
// get values
$this->_configRelationship = CRM_Lidmaatschapwijziging_ConfigRelationship::singleton($this->_contactId);
$this->_values = $this->_configRelationship->getContact();
// set contact id
$this->_values['contact_id'] = $this->_contactId;
// set display name
$this->_display_name = $this->_values['display_name'];
// set request
$this->_values['request'] = $this->_request;
// set title
CRM_Utils_System::setTitle('LidmaatschapWijziging - Relatie - ' . $this->_values['display_name']);
// request
if ('empty' == $this->_request) {
}
if ('choose' == $this->_request) {
// if there is no relatiosnhips then the options are empty, we
// show a message that there are no memebrships and a submit butten to
// go to the relationship, first we redirect them to request empty
$relationships = $this->_configRelationship->getRelationships();
if (empty($relationships)) {
// redirect user
$url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/relationship', 'reset=1&request=empty&cid=' . $this->_contactId);
CRM_Utils_System::redirect($url);
}
}
if ('update' == $this->_request) {
// get relationship id
$this->_relationshipId = CRM_Utils_Request::retrieve('relationship_id', 'Positive', $this);
$this->_values['relationship_id'] = $this->_relationshipId;
// get relationship
$this->_values = array_merge($this->_values, $this->_configRelationship->getRelationship($this->_relationshipId));
if (!empty($this->_values['contact_a']['display_name'])) {
$this->assign('sort_name_a', $this->_values['contact_a']['display_name']);
}
if (!empty($this->_values['contact_b']['display_name'])) {
$this->assign('sort_name_b', $this->_values['contact_b']['display_name']);
}
// note
$this->_values['note_id'] = $this->_values['notes']['id'];
$this->_values['note'] = $this->_values['notes']['note'];
}
}