當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ImportMap::set_get_import_wizard_fields方法代碼示例

本文整理匯總了PHP中ImportMap::set_get_import_wizard_fields方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImportMap::set_get_import_wizard_fields方法的具體用法?PHP ImportMap::set_get_import_wizard_fields怎麽用?PHP ImportMap::set_get_import_wizard_fields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ImportMap的用法示例。


在下文中一共展示了ImportMap::set_get_import_wizard_fields方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user, $sugar_config, $app_list_strings, $locale;
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $has_header = isset($_REQUEST['has_header']) ? 1 : 0;
     $sugar_config['import_max_records_per_file'] = empty($sugar_config['import_max_records_per_file']) ? 1000 : $sugar_config['import_max_records_per_file'];
     $this->ss->assign("CURRENT_STEP", $this->currentStep);
     // attempt to lookup a preexisting field map
     // use the custom one if specfied to do so in step 1
     $mapping_file = new ImportMap();
     $field_map = $mapping_file->set_get_import_wizard_fields();
     $default_values = array();
     $ignored_fields = array();
     if (!empty($_REQUEST['source_id'])) {
         $GLOBALS['log']->fatal("Loading import map properties.");
         $mapping_file = new ImportMap();
         $mapping_file->retrieve($_REQUEST['source_id'], false);
         $_REQUEST['source'] = $mapping_file->source;
         $has_header = $mapping_file->has_header;
         if (isset($mapping_file->delimiter)) {
             $_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
         }
         if (isset($mapping_file->enclosure)) {
             $_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
         }
         $field_map = $mapping_file->getMapping();
         //print_r($field_map);die();
         $default_values = $mapping_file->getDefaultValues();
         $this->ss->assign("MAPNAME", $mapping_file->name);
         $this->ss->assign("CHECKMAP", 'checked="checked" value="on"');
     } else {
         $classname = $this->getMappingClassName(ucfirst($_REQUEST['source']));
         //Set the $_REQUEST['source'] to be 'other' for ImportMapOther special case
         if ($classname == 'ImportMapOther') {
             $_REQUEST['source'] = 'other';
         }
         if (class_exists($classname)) {
             $mapping_file = new $classname();
             $ignored_fields = $mapping_file->getIgnoredFields($_REQUEST['import_module']);
             $field_map2 = $mapping_file->getMapping($_REQUEST['import_module']);
             $field_map = array_merge($field_map, $field_map2);
         }
     }
     $delimiter = $this->getRequestDelimiter();
     $this->ss->assign("CUSTOM_DELIMITER", $delimiter);
     $this->ss->assign("CUSTOM_ENCLOSURE", !empty($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : "");
     //populate import locale  values from import mapping if available, these values will be used througout the rest of the code path
     $uploadFileName = $_REQUEST['file_name'];
     // Now parse the file and look for errors
     $importFile = new ImportFile($uploadFileName, $delimiter, html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), FALSE);
     if (!$importFile->fileExists()) {
         $this->_showImportError($mod_strings['LBL_CANNOT_OPEN'], $_REQUEST['import_module'], 'Step2');
         return;
     }
     $charset = $importFile->autoDetectCharacterSet();
     // retrieve first 3 rows
     $rows = array();
     //Keep track of the largest row count found.
     $maxFieldCount = 0;
     for ($i = 0; $i < 3; $i++) {
         $rows[] = $importFile->getNextRow();
         $maxFieldCount = $importFile->getFieldCount() > $maxFieldCount ? $importFile->getFieldCount() : $maxFieldCount;
     }
     $ret_field_count = $maxFieldCount;
     // Bug 14689 - Parse the first data row to make sure it has non-empty data in it
     $isempty = true;
     if ($rows[(int) $has_header] != false) {
         foreach ($rows[(int) $has_header] as $value) {
             if (strlen(trim($value)) > 0) {
                 $isempty = false;
                 break;
             }
         }
     }
     if ($isempty || $rows[(int) $has_header] == false) {
         $this->_showImportError($mod_strings['LBL_NO_LINES'], $_REQUEST['import_module'], 'Step2');
         return;
     }
     // save first row to send to step 4
     $this->ss->assign("FIRSTROW", base64_encode(serialize($rows[0])));
     // Now build template
     $this->ss->assign("TMP_FILE", $uploadFileName);
     $this->ss->assign("SOURCE", $_REQUEST['source']);
     $this->ss->assign("TYPE", $_REQUEST['type']);
     $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('basic_search', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('advanced_search', 'align="absmiddle" alt="' . $mod_strings['LBL_PUBLISH'] . '" border="0"'));
     $this->instruction = 'LBL_SELECT_MAPPING_INSTRUCTION';
     $this->ss->assign('INSTRUCTION', $this->getInstruction());
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
     $this->ss->assign("STEP4_TITLE", strip_tags(str_replace("\n", "", getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_STEP_4_TITLE']), false))));
     $this->ss->assign("HEADER", $app_strings['LBL_IMPORT'] . " " . $mod_strings['LBL_MODULE_NAME']);
     // we export it as email_address, but import as email1
     $field_map['email_address'] = 'email1';
     // build each row; row count is determined by the the number of fields in the import file
     $columns = array();
     $mappedFields = array();
     // this should be populated if the request comes from a 'Back' button click
//.........這裏部分代碼省略.........
開發者ID:omusico,項目名稱:sugar_work,代碼行數:101,代碼來源:view.step3.php


注:本文中的ImportMap::set_get_import_wizard_fields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。