/** * Build the form object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); $multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup(); $this->add('select', 'multipleCustomData', ts('Multi-value Custom Data'), array('' => ts('- select -')) + $multipleCustomData, TRUE); $this->addContactTypeSelector(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup(); $this->add('select', 'multipleCustomData', ts('Multi-value Custom Data'), array('' => ts('- select -')) + $multipleCustomData, TRUE); //Setting Upload File Size $config = CRM_Core_Config::singleton(); if ($config->maxImportFileSize >= 8388608) { $uploadFileSize = 8388608; } else { $uploadFileSize = $config->maxImportFileSize; } $uploadSize = round($uploadFileSize / (1024 * 1024), 2); $this->assign('uploadSize', $uploadSize); $this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE); $this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile'); $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize); $this->setMaxFileSize($uploadFileSize); $this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File'); $this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers')); //get the saved mapping details $mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Multi value custom data', 'name')); $this->assign('savedMapping', $mappingArray); $this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray); if ($loadeMapping = $this->get('loadedMapping')) { $this->assign('loadedMapping', $loadeMapping); $this->setDefaults(array('savedMapping' => $loadeMapping)); } //contact types option $contactOptions = array(); if (CRM_Contact_BAO_ContactType::isActive('Individual')) { $contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL); } if (CRM_Contact_BAO_ContactType::isActive('Household')) { $contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD); } if (CRM_Contact_BAO_ContactType::isActive('Organization')) { $contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION); } $this->addGroup($contactOptions, 'contactType', ts('Contact Type')); $this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL)); //build date formats CRM_Core_Form_Date::buildAllowedDateFormats($this); $this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); }
function hrui_civicrm_navigationMenu(&$params) { $maxKey = max(array_keys($params)); $jobNavId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'jobImport', 'id', 'name'); $contactNavId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Contacts', 'id', 'name'); if ($jobNavId) { $i = 1; // Degrade gracefully on 4.4 if (is_callable(array('CRM_Core_BAO_CustomGroup', 'getMultipleFieldGroup'))) { // Get the maximum key of $params $multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup(); $multiValuedData[$maxKey + 1] = array('attributes' => array('label' => ts('Jobs'), 'name' => 'jobs', 'url' => 'civicrm/job/import', 'permission' => 'access HRJobs', 'operator' => null, 'separator' => null, 'parentID' => $jobNavId, 'navID' => $maxKey + 1, 'weight' => 1, 'active' => 1)); foreach ($multipleCustomData as $key => $value) { $i++; $i = $maxKey + $i; $multiValuedData[$i] = array('attributes' => array('label' => $value, 'name' => $value, 'url' => 'civicrm/import/custom?reset=1&id=' . $key, 'permission' => 'access HRJobs', 'operator' => null, 'separator' => null, 'parentID' => $jobNavId, 'navID' => $i, 'active' => 1), 'child' => null); } $params[$contactNavId]['child'][$jobNavId]['child'] = $multiValuedData; } } }