本文整理汇总了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();
}