コード例 #1
0
ファイル: view.step2.php プロジェクト: stefano6310/SuiteCRM
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map, $import_mod_strings;
     $this->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", "<a href=\"javascript: void(0);\" onclick=\"window.location.href='index.php?entryPoint=export&module=" . $_REQUEST['import_module'] . "&action=index&all=true&sample=true'\" >" . $mod_strings['LBL_EXAMPLE_FILE'] . "</a>");
     $displayBackBttn = isset($_REQUEST['action']) && $_REQUEST['action'] == 'Step2' && isset($_REQUEST['current_step']) && $_REQUEST['current_step'] !== '2' ? TRUE : FALSE;
     //bug 51239
     $this->ss->assign("displayBackBttn", $displayBackBttn);
     // 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');
 }
コード例 #2
0
ファイル: view.step1.php プロジェクト: klr2003/sourceread
 /** 
  * display the form
  */
 public function display()
 {
     global $mod_strings, $app_list_strings, $app_strings, $current_user;
     global $sugar_config;
     $this->ss->assign("MODULE_TITLE", get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . " " . $mod_strings['LBL_STEP_1_TITLE'], true));
     $this->ss->assign("MOD", $mod_strings);
     $this->ss->assign("APP", $app_strings);
     $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('publish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_PUBLISH'] . '" border="0"'));
     $this->ss->assign("UNPUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('unpublish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_UNPUBLISH'] . '" border="0"'));
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $this->ss->assign("JAVASCRIPT", $this->_getJS());
     // handle publishing and deleting import maps
     if (isset($_REQUEST['delete_map_id'])) {
         $import_map = new ImportMap();
         $import_map->mark_deleted($_REQUEST['delete_map_id']);
     }
     if (isset($_REQUEST['publish'])) {
         $import_map = new ImportMap();
         $result = 0;
         $import_map = $import_map->retrieve($_REQUEST['import_map_id'], false);
         if ($_REQUEST['publish'] == 'yes') {
             $result = $import_map->mark_published($current_user->id, true);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH']);
             }
         } elseif ($_REQUEST['publish'] == 'no') {
             // if you don't own this importmap, you do now!
             // unless you have a map by the same name
             $result = $import_map->mark_published($current_user->id, false);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH']);
             }
         }
     }
     // load bean
     $focus = loadImportBean($_REQUEST['import_module']);
     if (!$focus) {
         showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'], $_REQUEST['import_module']);
         return;
     }
     // trigger showing other software packages
     $this->ss->assign("show_salesforce", false);
     $this->ss->assign("show_outlook", false);
     $this->ss->assign("show_act", false);
     $this->ss->assign("show_jigsaw", false);
     switch ($_REQUEST['import_module']) {
         case "Prospects":
             break;
         case "Accounts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_act", true);
             $this->ss->assign("show_jigsaw", true);
             break;
         case "Contacts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_outlook", true);
             $this->ss->assign("show_act", true);
             break;
         default:
             $this->ss->assign("show_salesforce", true);
             break;
     }
     // get user defined import maps
     $this->ss->assign('is_admin', is_admin($current_user));
     $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);
     }
     $this->ss->display('modules/Import/tpls/step1.tpl');
 }
コード例 #3
0
ファイル: view.step1.php プロジェクト: rgauss/sugarcrm_dev
 /** 
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user;
     global $sugar_config;
     $selectedData = $this->_retrieveParams();
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
     $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('publish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_PUBLISH'] . '" border="0"'));
     $this->ss->assign("UNPUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('unpublish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_UNPUBLISH'] . '" border="0"'));
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $this->ss->assign("JAVASCRIPT", $this->_getJS(isset($selectedData->source) ? $selectedData->source : false));
     // handle publishing and deleting import maps
     if (isset($_REQUEST['delete_map_id'])) {
         $import_map = new ImportMap();
         $import_map->mark_deleted($_REQUEST['delete_map_id']);
     }
     if (isset($_REQUEST['publish'])) {
         $import_map = new ImportMap();
         $result = 0;
         $import_map = $import_map->retrieve($_REQUEST['import_map_id'], false);
         if ($_REQUEST['publish'] == 'yes') {
             $result = $import_map->mark_published($current_user->id, true);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH']);
             }
         } elseif ($_REQUEST['publish'] == 'no') {
             // if you don't own this importmap, you do now!
             // unless you have a map by the same name
             $result = $import_map->mark_published($current_user->id, false);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH']);
             }
         }
     }
     // trigger showing other software packages
     $this->ss->assign("show_salesforce", false);
     $this->ss->assign("show_outlook", false);
     $this->ss->assign("show_act", false);
     switch ($_REQUEST['import_module']) {
         case "Prospects":
             break;
         case "Accounts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_act", true);
             break;
         case "Contacts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_outlook", true);
             $this->ss->assign("show_act", true);
             break;
         default:
             $this->ss->assign("show_salesforce", true);
             break;
     }
     // 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
     $this->ss->assign('is_admin', is_admin($current_user));
     $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);
     }
     $this->ss->display('modules/Import/tpls/step1.tpl');
 }
コード例 #4
0
        $xtpl->parse("main.show_salesforce");
        $xtpl->parse("main.show_act");
    } else {
        if ($_REQUEST['module'] == 'Prospects') {
            // does not show salesforce
        } else {
            $xtpl->parse("main.show_salesforce");
        }
    }
}
if (is_admin($current_user)) {
    //	$xtpl->parse("main.create_global_map");
}
$query_arr = array('assigned_user_id' => $current_user->id, 'is_published' => 'no', 'module' => $_REQUEST['module']);
$import_map_seed = new ImportMap();
$custom_imports_arr = $import_map_seed->retrieve_all_by_string_fields($query_arr);
if (count($custom_imports_arr)) {
    foreach ($custom_imports_arr as $import) {
        $xtpl->assign("IMPORT_NAME", $import->name);
        $xtpl->assign("IMPORT_ID", $import->id);
        if (is_admin($current_user)) {
            $xtpl->parse("main.saved.saved_elem.is_admin");
        }
        $xtpl->parse("main.saved.saved_elem");
    }
    $xtpl->parse("main.saved");
}
$query_arr = array('is_published' => 'yes', 'module' => $_REQUEST['module']);
$published_imports_arr = $import_map_seed->retrieve_all_by_string_fields($query_arr);
if (count($published_imports_arr)) {
    foreach ($published_imports_arr as $import) {