<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * This class gets the name of the file to upload
+ * This class gets the name of the file to upload.
*/
class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
$this->_mapperFields = $this->get('fields');
if ($skipColumnHeader) {
$this->assign('skipColumnHeader', $skipColumnHeader);
$this->assign('rowDisplayCount', 3);
- /* if we had a column header to skip, stash it for later */
+ // If we had a column header to skip, stash it for later.
$this->_columnHeaders = $this->_dataValues[0];
}
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
- //to save the current mappings
+ // To save the current mappings.
if (!$this->get('savedMapping')) {
$saveDetailsName = ts('Save this field mapping');
$this->applyFilter('saveMappingName', 'trim');
}
else {
$savedMapping = $this->get('savedMapping');
- //mapping is to be loaded from database
+ // Mapping is to be loaded from database.
list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
- //get loaded Mapping Fields
+ // Get loaded Mapping Fields.
$mappingName = CRM_Utils_Array::value('1', $mappingName);
$mappingContactType = CRM_Utils_Array::value('1', $mappingContactType);
$mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
$dataPatterns = $this->get('dataPatterns');
$hasLocationTypes = $this->get('fieldTypes');
- /* Initialize all field usages to false */
+ // Initialize all field usages to false.
foreach ($mapperKeys as $key) {
$this->_fieldUsed[$key] = FALSE;
$js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $this->_name;
- //used to warn for mismatch column count or mismatch mapping
+ // Used to warn for mismatch column count or mismatch mapping.
$warning = 0;
for ($i = 0; $i < $this->_columnCount; $i++) {
$defaults["mapper[$i]"] = array($this->defaultFromData($dataPatterns, $i));
}
}
- //end of load mapping
+ // End of load mapping.
}
else {
$js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_" . $i . "_');\n";
$this->defaultFromHeader($this->_columnHeaders[$i],
$headerPatterns
),
- // $defaultLocationType->id
0,
);
}
// Otherwise guess the default from the form of the data
$defaults["mapper[$i]"] = array(
$this->defaultFromData($dataPatterns, $i),
- // $defaultLocationType->id
0,
);
}
$js .= "</script>\n";
$this->assign('initHideBoxes', $js);
- //set warning if mismatch in more than
+ // Set warning if mismatch in more than.
if (isset($mappingName)) {
if (($this->_columnCount != count($mappingName))) {
$warning++;
/**
* Process the mapped fields and map it into the uploaded file.
- * preview the file and extract some summary statistics
*
- * @return void
+ * Preview the file and extract some summary statistics
*/
public function postProcess() {
$params = $this->controller->exportValues('MapField');
- //reload the mapfield if load mapping is pressed
+ // Reload the mapfield if load mapping is pressed.
if (!empty($params['savedMapping'])) {
$this->set('savedMapping', $params['savedMapping']);
$this->controller->resetPage($this->_name);
$this->set('loadMappingId', $params['mappingId']);
}
- //Updating Mapping Records
+ // Updating Mapping Records.
if (!empty($params['updateMapping'])) {
$mappingFields = new CRM_Core_DAO_MappingField();
}
}
- //Saving Mapping Details and Records
+ // Saving Mapping Details and Records.
if (!empty($params['saveMapping'])) {
$mappingParams = array(
'name' => $params['saveMappingName'],