instruction = 'LBL_SELECT_UPLOAD_INSTRUCTION'; $this->ss->assign('INSTRUCTION', $this->getInstruction()); $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false)); $this->ss->assign("IMP", $import_mod_strings); $this->ss->assign("CURRENT_STEP", $this->currentStep); $this->ss->assign("TYPE",( !empty($_REQUEST['type']) ? $_REQUEST['type'] : "import" )); $this->ss->assign("CUSTOM_DELIMITER", ( !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : "," )); $this->ss->assign("CUSTOM_ENCLOSURE",htmlentities( ( !empty($_REQUEST['custom_enclosure']) && $_REQUEST['custom_enclosure'] != 'other' ? $_REQUEST['custom_enclosure'] : ( !empty($_REQUEST['custom_enclosure_other']) ? $_REQUEST['custom_enclosure_other'] : "" ) ))); $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']); $this->ss->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']); $this->ss->assign("JAVASCRIPT", $this->_getJS()); $this->ss->assign("SAMPLE_URL", "".$mod_strings['LBL_EXAMPLE_FILE'].""); $displayBackBttn = isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != 'index'? TRUE : FALSE; $this->ss->assign("displayBackBttn", $displayBackBttn); $importSource = isset($_REQUEST['source']) ? $_REQUEST['source'] : 'csv' ; //Start custom mapping // show any custom mappings if (sugar_is_dir('custom/modules/Import') && $dir = opendir('custom/modules/Import')) { while (($file = readdir($dir)) !== false) { if (sugar_is_file("custom/modules/Import/{$file}") && strpos($file,".php") !== false) { require_once("custom/modules/Import/{$file}"); $classname = str_replace('.php','',$file); $mappingClass = new $classname; $custom_mappings[] = $mappingClass->name; } } } // get user defined import maps $is_admin = is_admin($current_user); if($is_admin) $savedMappingHelpText = $mod_strings['LBL_MY_SAVED_ADMIN_HELP']; else $savedMappingHelpText = $mod_strings['LBL_MY_SAVED_HELP']; $this->ss->assign('savedMappingHelpText',$savedMappingHelpText); $this->ss->assign('is_admin',$is_admin); $import_map_seed = new ImportMap(); $custom_imports_arr = $import_map_seed->retrieve_all_by_string_fields( array('assigned_user_id' => $current_user->id, 'is_published' => 'no','module' => $_REQUEST['import_module'])); if( count($custom_imports_arr) ) { $custom = array(); foreach ( $custom_imports_arr as $import) { $custom[] = array( "IMPORT_NAME" => $import->name,"IMPORT_ID" => $import->id); } $this->ss->assign('custom_imports',$custom); } // get globally defined import maps $published_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('is_published' => 'yes', 'module' => $_REQUEST['import_module'],) ); if ( count($published_imports_arr) ) { $published = array(); foreach ( $published_imports_arr as $import) { $published[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id); } $this->ss->assign('published_imports',$published); } //End custom mapping // add instructions for anything other than custom_delimited $instructions = array(); $lang_key = "CUSTOM"; for ($i = 1; isset($mod_strings["LBL_{$lang_key}_NUM_$i"]);$i++) { $instructions[] = array( "STEP_NUM" => $mod_strings["LBL_NUM_$i"], "INSTRUCTION_STEP" => $mod_strings["LBL_{$lang_key}_NUM_$i"], ); } $this->ss->assign("INSTRUCTIONS_TITLE",$mod_strings["LBL_IMPORT_{$lang_key}_TITLE"]); $this->ss->assign("instructions",$instructions); $content = $this->ss->fetch('modules/Import/tpls/step2.tpl'); $this->ss->assign("CONTENT",$content); $this->ss->display('modules/Import/tpls/wizardWrapper.tpl'); } /** * Returns JS used in this view */ private function _getJS() { global $mod_strings; return <<