/** * build the form elements * * @return void * @access public */ public function buildQuickForm() { parent::buildQuickForm(); // Build contact type specific fields $class = 'CRM_Contact_Form_Edit_' . $this->_contactType; $class::buildQuickForm($this, 1); }
/** * Set defaults for the form. * * @return array */ public function setDefaultValues() { $defaults = parent::setDefaultValues(); if (!empty($defaults['preferred_language'])) { $languages = CRM_Contact_BAO_Contact::buildOptions('preferred_language'); $defaults['preferred_language'] = CRM_Utils_Array::key($defaults['preferred_language'], $languages); } // CRM-7119: set preferred_language to default if unset if (empty($defaults['preferred_language'])) { $config = CRM_Core_Config::singleton(); $defaults['preferred_language'] = $config->lcMessages; } // CRM-19135: where CRM_Core_BAO_Contact::getValues() set label as a default value instead of reserved 'value', // the code is to ensure we always set default to value instead of label if (!empty($defaults['preferred_mail_format'])) { $defaults['preferred_mail_format'] = array_search($defaults['preferred_mail_format'], CRM_Core_SelectValues::pmf()); } if (empty($defaults['communication_style_id'])) { $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1')); } foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { $name = "{$greeting}_display"; $this->assign($name, CRM_Utils_Array::value($name, $defaults)); } return $defaults; }
/** * Build the form object elements. */ public function buildQuickForm() { parent::buildQuickForm(); // Build contact type specific fields $class = 'CRM_Contact_Form_Edit_' . $this->_contactType; $class::buildQuickForm($this, 1); $this->addFormRule(array('CRM_Contact_Form_Inline_ContactName', 'formRule'), $this); }
/** * set defaults for the form * * @return array * @access public */ public function setDefaultValues() { $defaults = parent::setDefaultValues(); if ($this->_contactType == 'Individual') { // set current employer details $currentEmployer = CRM_Contact_BAO_Relationship::getCurrentEmployer(array($this->_contactId)); $defaults['current_employer_id'] = CRM_Utils_Array::value('org_id', $currentEmployer[$this->_contactId]); $this->assign('currentEmployer', CRM_Utils_Array::value('current_employer_id', $defaults)); } return $defaults; }
/** * set defaults for the form * * @return array * @access public */ public function setDefaultValues() { $defaults = parent::setDefaultValues(); if (!empty($defaults['preferred_language'])) { $languages = CRM_Contact_BAO_Contact::buildOptions('preferred_language'); $defaults['preferred_language'] = CRM_Utils_Array::key($defaults['preferred_language'], $languages); } // CRM-7119: set preferred_language to default if unset if (empty($defaults['preferred_language'])) { $config = CRM_Core_Config::singleton(); $defaults['preferred_language'] = $config->lcMessages; } foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { $name = "{$greeting}_display"; $this->assign($name, CRM_Utils_Array::value($name, $defaults)); } return $defaults; }
/** * build the form elements for website object * * @return void * @access public */ public function buildQuickForm() { parent::buildQuickForm(); $totalBlocks = $this->_blockCount; $actualBlockCount = 1; if (count($this->_websites) > 1) { $actualBlockCount = $totalBlocks = count($this->_websites); if ($totalBlocks < $this->_blockCount) { $additionalBlocks = $this->_blockCount - $totalBlocks; $totalBlocks += $additionalBlocks; } else { $actualBlockCount++; $totalBlocks++; } } $this->assign('actualBlockCount', $actualBlockCount); $this->assign('totalBlocks', $totalBlocks); $this->applyFilter('__ALL__', 'trim'); for ($blockId = 1; $blockId < $totalBlocks; $blockId++) { CRM_Contact_Form_Edit_Website::buildQuickForm($this, $blockId, TRUE); } }
/** * Build the form object elements for openID object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); $totalBlocks = $this->_blockCount; $actualBlockCount = 1; if (count($this->_openids) > 1) { $actualBlockCount = $totalBlocks = count($this->_openids); if ($totalBlocks < $this->_blockCount) { $additionalBlocks = $this->_blockCount - $totalBlocks; $totalBlocks += $additionalBlocks; } else { $actualBlockCount++; $totalBlocks++; } } $this->assign('actualBlockCount', $actualBlockCount); $this->assign('totalBlocks', $totalBlocks); $this->applyFilter('__ALL__', 'trim'); for ($blockId = 1; $blockId < $totalBlocks; $blockId++) { CRM_Contact_Form_Edit_OpenID::buildQuickForm($this, $blockId, TRUE); } $this->addFormRule(array('CRM_Contact_Form_Inline_OpenID', 'formRule')); }
/** * called when action is browse. * * @return null */ public function browse() { $loggingReport = CRM_Core_BAO_Log::useLoggingReport(); $this->assign('useLogging', $loggingReport); if ($loggingReport) { $this->assign('instanceUrl', CRM_Utils_System::url("civicrm/report/instance/{$loggingReport}", "reset=1&force=1&snippet=4§ion=2&altered_contact_id_op=eq&altered_contact_id_value={$this->_contactId}&cid={$this->_contactId}", FALSE, NULL, FALSE)); return NULL; } $log = new CRM_Core_DAO_Log(); $log->entity_table = 'civicrm_contact'; $log->entity_id = $this->_contactId; $log->orderBy('modified_date desc'); $log->find(); $logEntries = array(); while ($log->fetch()) { list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id); $logEntries[] = array('id' => $log->modified_id, 'name' => $displayName, 'image' => $contactImage, 'date' => $log->modified_date); } $this->assign('logCount', count($logEntries)); $this->ajaxResponse['tabCount'] = count($logEntries); $this->ajaxResponse += CRM_Contact_Form_Inline::renderFooter($this->_contactId, FALSE); $this->assign_by_ref('log', $logEntries); }
/** * Build the form object elements for an address object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); CRM_Contact_Form_Edit_Address::buildQuickForm($this, $this->_locBlockNo, TRUE, TRUE); }
/** * Process the user submitted custom data values. */ public function postProcess() { // Get the form values and groupTree //CRM-18183 $params = $this->controller->exportValues($this->_name); CRM_Core_BAO_CustomValueTable::postProcess($params, 'civicrm_contact', $this->_tableID, $this->_entityType); $table = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_groupID, 'table_name'); $cgcount = CRM_Core_BAO_CustomGroup::customGroupDataExistsForEntity($this->_tableID, $table, TRUE); $cgcount += 1; $buttonName = $this->controller->getButtonName(); if ($buttonName == $this->getButtonName('upload', 'new')) { CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/cd/edit', "reset=1&type={$this->_contactType}&groupID={$this->_groupID}&entityID={$this->_tableID}&cgcount={$cgcount}&multiRecordDisplay=single&mode=add")); } // Add entry in the log table CRM_Core_BAO_Log::register($this->_tableID, 'civicrm_contact', $this->_tableID); if (CRM_Core_Resources::isAjaxMode()) { $this->ajaxResponse += CRM_Contact_Form_Inline::renderFooter($this->_tableID); } // reset the group contact cache for this group CRM_Contact_BAO_GroupContactCache::remove(); }
/** * Build the form object elements for custom data. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); CRM_Custom_Form_CustomData::buildQuickForm($this); }
/** * build the form elements * * @return void * @access public */ public function buildQuickForm() { parent::buildQuickForm(); CRM_Contact_Form_Edit_Demographics::buildQuickForm($this); }
/** * set defaults for the form * * @return array * @access public */ public function setDefaultValues() { return parent::setDefaultValues(); }
/** * Build the form object elements for an address object. */ public function buildQuickForm() { parent::buildQuickForm(); CRM_Contact_Form_Edit_Address::buildQuickForm($this, $this->_locBlockNo, TRUE, TRUE); $this->addFormRule(array('CRM_Contact_Form_Edit_Address', 'formRule'), $this); }