本文整理匯總了PHP中umiHierarchy::ignoreSiteMap方法的典型用法代碼示例。如果您正苦於以下問題:PHP umiHierarchy::ignoreSiteMap方法的具體用法?PHP umiHierarchy::ignoreSiteMap怎麽用?PHP umiHierarchy::ignoreSiteMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類umiHierarchy
的用法示例。
在下文中一共展示了umiHierarchy::ignoreSiteMap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: import_do
public function import_do()
{
$this->setDataType("list");
$this->setActionType("view");
$id = getRequest('param0');
$objects = umiObjectsCollection::getInstance();
$settings = $objects->getObject($id);
if (!$settings instanceof umiObject) {
throw new publicException(getLabel("exchange-err-settings_notfound"));
}
$importFile = $settings->file;
if (!$importFile instanceof umiFile || $importFile->getIsBroken()) {
throw new publicException(getLabel("exchange-err-importfile"));
}
$format_id = $settings->format;
$importFormat = $objects->getObject($format_id);
if (!$importFormat instanceof umiObject) {
throw new publicException(getLabel("exchange-err-format_undefined"));
}
$suffix = $importFormat->sid;
$import_offset = (int) getSession("import_offset_" . $id);
$blockSize = mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") ? mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") : 25;
$splitter = umiImportSplitter::get($suffix);
$splitter->load($importFile->getFilePath(), $blockSize, $import_offset);
$doc = $splitter->getDocument();
$dump = $splitter->translate($doc);
$oldIgnoreSiteMap = umiHierarchy::$ignoreSiteMap;
umiHierarchy::$ignoreSiteMap = true;
$importer = new xmlImporter();
$importer->loadXmlString($dump);
$elements = $settings->elements;
if (is_array($elements) && count($elements)) {
$importer->setDestinationElement($elements[0]);
}
$importer->setIgnoreParentGroups($splitter->ignoreParentGroups);
$importer->setAutoGuideCreation($splitter->autoGuideCreation);
$importer->setRenameFiles($splitter->getRenameFiles());
$importer->execute();
umiHierarchy::$ignoreSiteMap = $oldIgnoreSiteMap;
$_SESSION["import_offset_" . $id] = $splitter->getOffset();
if ($splitter->getIsComplete()) {
unset($_SESSION["import_offset_" . $id]);
}
$data = array("attribute:complete" => (int) $splitter->getIsComplete(), "attribute:created" => $importer->created_elements, "attribute:updated" => $importer->updated_elements, "attribute:deleted" => $importer->deleted_elements, "attribute:errors" => $importer->import_errors, "nodes:log" => $importer->getImportLog());
$this->setData($data);
return $this->doData();
}
示例2: importCommerceML
protected function importCommerceML()
{
$file_name = getRequest('filename');
$file_path = self::$importDirectory . $file_name;
if (!is_file($file_path)) {
return "failure\nFile {$file_path} not exists.";
}
$import_offset = (int) getSession("1c_import_offset");
$blockSize = (int) mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit");
if ($blockSize < 0) {
$blockSize = 25;
}
$splitterName = (string) mainConfiguration::getInstance()->get("modules", "exchange.commerceML.splitter");
if (!trim(strlen($splitterName))) {
$splitterName = "commerceML2";
}
$splitter = umiImportSplitter::get($splitterName);
$splitter->load($file_path, $blockSize, $import_offset);
$doc = $splitter->getDocument();
$xml = $splitter->translate($doc);
$oldIgnoreSiteMap = umiHierarchy::$ignoreSiteMap;
umiHierarchy::$ignoreSiteMap = true;
$importer = new xmlImporter();
$importer->loadXmlString($xml);
$importer->setIgnoreParentGroups($splitter->ignoreParentGroups);
$importer->setAutoGuideCreation($splitter->autoGuideCreation);
$importer->setRenameFiles($splitter->getRenameFiles());
$importer->execute();
umiHierarchy::$ignoreSiteMap = $oldIgnoreSiteMap;
$_SESSION['1c_import_offset'] = $splitter->getOffset();
if ($splitter->getIsComplete()) {
$_SESSION['1c_import_offset'] = 0;
return "success\nComplete. Imported elements: " . $splitter->getOffset();
}
return "progress\nImported elements: " . $splitter->getOffset();
}