",
"".$mod_strings['LBL_MODULE_NAME']."",
$mod_strings['LBL_STEP_2_TITLE'],
);
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map;
global $import_mod_strings;
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP", $app_strings);
$this->ss->assign("IMP", $import_mod_strings);
$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());
// load bean
$focus = loadImportBean($_REQUEST['import_module']);
if ( !$focus ) {
showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],$_REQUEST['import_module']);
return;
}
// special for importing from Outlook
if ($_REQUEST['source'] == "outlook") {
$this->ss->assign("SOURCE", $_REQUEST['source']);
$this->ss->assign("SOURCE_NAME","Outlook ");
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
}
// see if the source starts with 'custom'
// if so, pull off the id, load that map, and get the name
elseif ( strncasecmp("custom:",$_REQUEST['source'],7) == 0) {
$id = substr($_REQUEST['source'],7);
$import_map_seed = new ImportMap();
$import_map_seed->retrieve($id, false);
$this->ss->assign("SOURCE_ID", $import_map_seed->id);
$this->ss->assign("SOURCE_NAME", $import_map_seed->name);
$this->ss->assign("SOURCE", $import_map_seed->source);
if (isset($import_map_seed->delimiter))
$this->ss->assign("CUSTOM_DELIMITER", $import_map_seed->delimiter);
if (isset($import_map_seed->enclosure))
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($import_map_seed->enclosure));
if ($import_map_seed->has_header)
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
}
else {
$classname = 'ImportMap' . ucfirst($_REQUEST['source']);
require("modules/Import/{$classname}.php");
$import_map_seed = new $classname;
if (isset($import_map_seed->delimiter))
$this->ss->assign("CUSTOM_DELIMITER", $import_map_seed->delimiter);
if (isset($import_map_seed->enclosure))
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($import_map_seed->enclosure));
if ($import_map_seed->has_header)
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
$this->ss->assign("SOURCE", $_REQUEST['source']);
}
// add instructions for anything other than custom_delimited
if ($_REQUEST['source'] != 'other')
{
$instructions = array();
$lang_key = '';
switch($_REQUEST['source']) {
case "act":
$lang_key = "ACT";
break;
case "outlook":
$lang_key = "OUTLOOK";
break;
case "salesforce":
$lang_key = "SF";
break;
case "tab":
$lang_key = "TAB";
break;
case "csv":
$lang_key = "CUSTOM";
break;
}
if ( $lang_key != '' ) {
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);
}
}
$this->ss->display('modules/Import/tpls/step2.tpl');
}
/**
* Returns JS used in this view
*/
private function _getJS()
{
global $mod_strings;
return <<
EOJAVASCRIPT;
}
}