function printAdmTools($id) { global $SidebarSuffix2, $admAppend, $MyFav_Edit, $MyFav_Delete; return '<a href="' . text2xml("fav_action.php?action=edit&id=" . $id . $SidebarSuffix2) . '" class="admtool" ' . $admAppend . '>' . $MyFav_Edit . '</a> <a href="' . text2xml("fav_action.php?action=delete&id=" . $id . $SidebarSuffix2) . '" class="admtool" ' . $admAppend . '>' . $MyFav_Delete . '</a>'; }
} else { $catqstr = ""; } $qry = "SELECT * FROM Fav WHERE cat = 0 AND protected = 0 " . $catqstr . " GROUP BY catid,id ORDER BY catid,ord"; $rs = sqlite_query($conn, $qry); $atomDateTime = date('Y-m-d\\TH:i:s\\Z'); echo '<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="atom.xsl" type="text/xsl" media="screen"?> <feed version="0.3" xmlns="http://purl.org/atom/ns#"> <title>' . $homeTitle . '</title> <link rel="alternate" type="text/html" href="' . $homeURL . '"/> <modified>' . $atomDateTime . '</modified> <author> <name>' . $authorName . '</name> </author> <tagline>' . $homeDesc . '</tagline>'; while ($row = sqlite_fetch_array($rs)) { echo '<entry> <title>' . text2xml($row["name"]) . '</title> <link rel="alternate" type="text/html" href="' . text2xml($row["addr"]) . '"/> <id>tag:' . $domainName . ',' . date("Y") . ':' . $row["id"] . '</id> <content>' . text2xml($itemDesc) . '</content> <issued>' . $atomDateTime . '</issued> <modified>' . $atomDateTime . '</modified> </entry>'; } ?> </feed>
$catqstr = ""; } $qry = "SELECT * FROM Fav WHERE cat = 0 AND protected = 0 " . $catqstr . " GROUP BY catid,id ORDER BY catid,ord"; $rs = sqlite_query($conn, $qry); echo '<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="rdf.xsl" type="text/xsl" media="screen"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"> <channel rdf:about="' . $RSS_SELF . '"> <title>' . $homeTitle . '</title> <link>' . $homeURL . '</link> <description>' . $homeDesc . '</description> <items> <rdf:Seq>'; while ($row = sqlite_fetch_array($rs)) { echo ' <rdf:li rdf:resource="' . text2xml($row["addr"]) . '" />'; } sqlite_rewind($rs); echo ' </rdf:Seq> </items> </channel>'; while ($row = sqlite_fetch_array($rs)) { echo ' <item rdf:about="' . text2xml($row["addr"]) . '"> <title>' . text2xml($row["name"]) . '</title> <link>' . text2xml($row["addr"]) . '</link> <description>' . text2xml($itemDesc) . '</description> </item>'; } ?> </rdf:RDF>
public function GetXMLData($product) { $arProp = array("ID" => GetMessage("ACRIT_PROP_ID"), "CODE" => GetMessage("ACRIT_PROP_CODE"), "NAME" => GetMessage("ACRIT_PROP_NAME"), "ACTIVE" => GetMessage("ACRIT_PROP_ACTIVE"), "DATE_CREATE" => GetMessage("ACRIT_PROP_DATE_CREATE"), "CREATED_BY" => GetMessage("ACRIT_PROP_CREATED_BY"), "DETAIL_PAGE_URL" => GetMessage("ACRIT_PROP_DETAIL_PAGE_URL"), "SHOW_COUNTER" => GetMessage("ACRIT_PROP_SHOW_COUNTER"), "QUANTITY" => GetMessage("ACRIT_PROP_QUANTITY")); $params = array(); if (is_array($this->XML_DATA) && sizeof($this->XML_DATA) > 0) { foreach ($this->XML_DATA as $xml) { $tmp1 = explode("-", $xml['ID']); $tmp = explode("_", $tmp1[1]); if ($tmp[0] == "SKU") { $ibl = $this->sku_IBLOCK_ID[$tmp1[0]]; $prop_id = $tmp[1]; $ph = CIBlockElement::GetProperty($ibl, $product["ID"], array("sort" => "asc"), array("ID" => $prop_id)); } elseif ($tmp[0] == "QUANTITY") { if ($this->isCat) { $tr = CCatalogProduct::GetByID($product["ID"]); $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($arProp[$xml["ID"]], true, true, $this->ENCODING), "CODE" => $xml["ID"], "VALUE" => $tr["QUANTITY"]); } $ph = false; continue; } elseif ($tmp[0] == "PRICE") { $dbProductPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $product["ID"], "CATALOG_GROUP_ID" => $tmp[1])); $price = 0; $names = ''; while ($arProductPrice = $dbProductPrices->Fetch()) { if ($arProductPrice["PRICE"] && ($arProductPrice["PRICE"] < $price || !$price)) { $price = $arProductPrice["PRICE"]; } $arDissizeofs = CCatalogDiscount::GetDiscountByProduct($arProductPrice["PRODUCT_ID"], array(), "N", $arProductPrice["CATALOG_GROUP_ID"], $this->LID); foreach ($arDissizeofs as $arDissizeof) { if ($arDissizeof["VALUE_TYPE"] == "P") { $price_buf = $arProductPrice["PRICE"] - $arDissizeof["VALUE"] * $arProductPrice["PRICE"] / 100; } else { $price_buf = $arProductPrice["PRICE"] - $arDissizeof["VALUE"]; } if ($price_buf && ($price_buf < $price || !$price)) { $price = $price_buf; } } $names = $arProductPrice["CATALOG_GROUP_NAME"]; } $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($names, true, true, $this->ENCODING), "CODE" => $xml["ID"], "VALUE" => $price); $ph = false; continue; } else { $ibl = $tmp1[0]; $prop_id = $tmp1[1]; $mxResult = CCatalogSku::GetProductInfo($product["ID"]); if (is_array($mxResult)) { $ph = CIBlockElement::GetProperty($ibl, $mxResult["ID"], array("sort" => "asc"), array("ID" => $prop_id)); } else { $ph = CIBlockElement::GetProperty($ibl, $product["ID"], array("sort" => "asc"), array("ID" => $prop_id)); } } if (is_object($ph)) { while ($ob = $ph->GetNext()) { switch ($ob["PROPERTY_TYPE"]) { case "S": if ($ob["USER_TYPE"] == "UserID") { $rsUser = CUser::GetByID($ob["VALUE"]); $arUser = $rsUser->Fetch(); $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($arUser["LAST_NAME"] . " " . $arUser["FIRST_NAME"], true, true, $this->ENCODING)); } else { $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ob["VALUE"], true, true, $this->ENCODING)); } break; case "L": $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ob["VALUE_ENUM"], true, true, $this->ENCODING)); break; case "E": $res = CIBlockElement::GetByID($ob["VALUE"]); while ($ar_res = $res->GetNext()) { $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ar_res["NAME"], true, true, $this->ENCODING)); } break; case "G": if ($xml['UNIT'] != "product_type") { $res = CIBlockSection::GetByID($ob["VALUE"]); while ($ar_res = $res->GetNext()) { $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ar_res["NAME"], true, true, $this->ENCODING)); } break; } else { $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ob["VALUE"], true, true, $this->ENCODING)); break; } case "F": $db_file = CFile::GetByID($ob["VALUE"]); while ($ar_file = $db_file->Fetch()) { $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => "http://" . $this->DOMAIN_NAME . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/" . $ar_file["SUBDIR"] . "/" . implode("/", array_map("rawurlencode", explode("/", $ar_file["FILE_NAME"])))); } break; case "N": $params[] = array("PARAM" => $xml["UNIT"], "NAME" => text2xml($ob["NAME"], true, true, $this->ENCODING), "CODE" => $ob["CODE"], "VALUE" => text2xml($ob["VALUE"], true, true, $this->ENCODING)); break; default: break; } } } } } return $params; }