// query the list of the desired import if ($_GET['export-tags'] === "ALL") { $stmt = $db->prepare('SELECT * FROM fdata WHERE status >= :minstate AND status <= :maxstate ORDER BY id ASC'); } else { $stmt = $db->prepare('SELECT * FROM fdata WHERE import_id = :import_id AND status >= :minstate AND status <= :maxstate ORDER BY id ASC'); $stmt->bindValue(":import_id", urldecode($_GET['export-tags'])); } $stmt->bindValue(":minstate", $minstate); $stmt->bindValue(":maxstate", $maxstate); $stmt->execute(); $fdata = $stmt->fetchAll(); // initialize array with column headings $column_headings = array("tagGroupingUid", "tagGroupingName de_DE", "tagGroupingDescription de_DE", "tagGroupingAutoTagNameCreation de_DE", "tagGroupingTagNumericalRequired", "tagGroupingGpcId", "tagUid", "tagName de_DE", "tagDescription de_DE", "tagSearchText de_DE", "tagNumericalValueRangeStart", "tagNumericalValueRangeEnd", "tagType", "tagGpcId", "tagGoogleTaxonomyId"); $taglist = array(); foreach ($fdata as $row) { $taglist = array_merge($taglist, getAllTagsForRow($row)); } // http://www.jonasjohn.de/snippets/php/trim-array.htm function trim_r($arr) { return is_array($arr) ? array_map('trim_r', $arr) : trim($arr); } // trim all values $taglist = trim_r($taglist); // eliminate all duplicate tags $taglist = array_map("unserialize", array_unique(array_map("serialize", $taglist))); // eliminate grouping properties for each grouping which occures more than once $taglist = tagGroupingFilterRemoveDuplicate($taglist); $resempty = function ($array, $key) { if (array_key_exists($key, $array)) { return $array[$key];
/** * Returns all Tag IDs as array (numerical index) for a given row. */ function getTagIDsForRow($row) { $alltags = getAllTagsForRow($row); $tagids = array(); foreach ($alltags as $t) { array_push($tagids, $t["tagUid"]); } return $tagids; }