$layout->skinsparams["3"] = array("button" => "button1"); require_once 'include/xtempl.php'; $xt = new Xtempl(); $id = postvalue("id"); $id = $id != "" ? $id : 1; $xt->assign("id", $id); //an array of params for ImportPage constructor $params = array(); $params["id"] = $id; $params["xt"] =& $xt; $params["tName"] = $strTableName; $params["pageType"] = PAGE_IMPORT; $params["needSearchClauseObj"] = false; $params["strOriginalTableName"] = $strOriginalTableName; $pageObject = new ImportPage($params); $pageObject->init(); $action = postvalue("a"); if (!strlen($action)) { $pageObject->removeOldTemporaryFiles(); } if ($action == "importPreview") { $returnJSON = array(); // prepare the temp import file name $rnrTempFileName = $pageObject->getImportTempFileName(); if (postvalue("importType") == "text") { $importText = postvalue("importText"); $returnJSON["previewData"] = $pageObject->getPreviewDataFromText($importText); // prepare the temp file path $rnrTempImportFilePath = getabspath("templates_c/" . $rnrTempFileName . ".csv"); // save file in a temporary directory runner_save_textfile($rnrTempImportFilePath, $importText);