// Variables that decides who, what, when, where and how of saving the style. $styledata = $vbulletin->GPC['data']; $styleparentid = $vbulletin->GPC['parentid']; $styletitle = $vbulletin->GPC['name']; $styleanyversion = true; $styledisplayorder = $vbulletin->GPC['displayorder']; $styleuserselectable = $vbulletin->GPC['userselect']; // url response tell us where to save the xml $stylesave = $vbulletin->GPC['save']; if ($stylesave) { $version = ADMIN_VERSION_VBULLETIN; $stylexml = generate_style($styledata, $styleparentid, $styletitle, $styleanyversion, $styledisplayorder, $styleuserselectable, $version); } // Modified version of the "Color Scheme Designer 3" // Copyright (c) 2002-2009, Petr Stanicek, pixy@pixy.cz ("the author") // See your do_not_upload folder for the full license echo "<div id=\"jscheck\"> <h1>" . $vbphrase['style_generator'] . "</h1> <div id=\"load\"> <h4>" . $vbphrase['style_generator_error'] . "</h4> <hr> </div> </div> <script type=\"text/javascript\">
function process_categories($kmlFile, $categories, &$catID_icons, &$kml_styles, &$catID_data, &$cat_to_subcats, $options) { // Iterate through categories... foreach ($categories as $cat) { // Write array of catIDs to icons $cat_icons = array(); // if category image is set, then construct icon URLs using image and add to relevant array if (isset($cat->category_image)) { // if so, use it for the icon $cat_icons["placemark"] = htmlspecialchars(url::base() . 'media/uploads/' . $cat->category_image); $cat_icons["folder"] = htmlspecialchars(url::base() . 'media/uploads/' . $cat->category_image); $cat_icons["cat_string"] = htmlspecialchars(url::base() . 'media/uploads/' . $cat->category_image_thumb); } else { // otherwise, use a color swatch $cat_icons["placemark"] = htmlspecialchars(url::base() . 'swatch/?t=cir&c=' . $cat->category_color . '&b=000000&w=32&h=32'); $cat_icons["folder"] = htmlspecialchars(url::base() . 'swatch/?t=rec&c=' . $cat->category_color . '&b=000000&w=32&h=32'); $cat_icons["cat_string"] = htmlspecialchars(url::base() . 'swatch/?t=rec&c=' . $cat->category_color . '&b=000000&w=10&h=10'); } $catID_icons[$cat->id] = $cat_icons; // Write KML styles for category's placemarks and folder $kml_styles .= generate_style($cat, $catID_icons, $options); $kml_styles .= generate_folder_style($cat, $catID_icons, $options); // Generate/Fill category data array (for easy cat data retrieval by cat id) $catID_data[$cat->id] = $cat; //== Generate & Fill cat to subcat mapping array (index = top-level cat id, value array contains subcats) // check if top-level category if ($cat->parent_id == 0) { // if first time with this top-level category if (!isset($cat_to_subcats[$cat->id])) { // initialize mapping: write blank array for top-level category $cat_to_subcats[$cat->id] = array(); } } else { // if first time with this cat's parent category if (!isset($cat_to_subcats[$cat->parent_id])) { // initialize mapping: write blank array for subcategory $cat_to_subcats[$cat->parent_id] = array(); } // this is a sub-category, map it to its parent category array_push($cat_to_subcats[$cat->parent_id], $cat); } } return true; }