function getCategoriesArray($cid = 0) { $categories = array(); $query = 'SELECT * FROM ' . TABLE_PREFIX . 'categories WHERE `pid` = ' . mysql_real_escape_string((int) $cid) . ';'; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $subs = getCategoriesArray($row['cid']); if (count($subs) > 0) { $row['subcategories'] = $subs; } $categories[] = $row; } return $categories; }
// Add this id to our array. $ids[] = $id; // Add that result to the items. $flat[] = $this->result[$value->index]; // If this has a child, then. if ($value->children) { // Normalize the children. $this->_getFlat($value, $flat); } } } } } } $url = 'http://www.akkord-tour.com.ua/get-xml.php?get_category=true'; $categories = simplexml_load_file($url); $categories_array = getCategoriesArray($categories); function getCategoriesArray($categories) { $categories_array = array(); foreach ($categories->children() as $category) { $categories_array["{$category->category_id}"] = array(); $categories_array["{$category->category_id}"]['id'] = $category->category_parent_id * 1; $categories_array["{$category->category_id}"]['pid'] = $category->category_parent_id * 1; $categories_array["{$category->category_id}"]['Title'] = "{$category->category_name}"; } return $categories_array; } //var_dump($categories_array); $tree = new ResultTree($categories_array); var_dump($tree->getTree());
if ($count > 0) { foreach ($menus as $menu) { $output[$menu->name] = $menu->slug; } } return $output; } } add_action('init', 'getMenusArray', 3); $slideshows = $portfolios = ''; if (class_exists('DP_Post_Types')) { $slideshows = getSliderArray(); $portfolios = getPortfoliosArray(); } $patterns = getPatternsArray(); $categories = getCategoriesArray(); $menus = getMenusArray(); $add_dp_animation = array("type" => "dropdown", "heading" => __("CSS Animation", DPTPLNAME), "param_name" => "dp_animation", "admin_label" => true, "value" => array("No" => "", "fadeIn " => "fadeIn", "fadeInUp" => "fadeInUp", "fadeInDown" => "fadeInDown", "fadeInLeft" => "fadeInLeft", "fadeInRight" => "fadeInRight", "fadeInUpBig" => "fadeInUpBig", "fadeInDownBig" => "fadeInDownBig", "fadeInLeftBig" => "fadeInLeftBig", "fadeInRightBig" => "fadeInRightBig", "lightSpeedRight" => "lightSpeedRight", "lightSpeedLeft" => "lightSpeedLeft", "bounceIn" => "bounceIn", "bounceInUp" => "bounceInUp", "bounceInDown" => "bounceInDown", "bounceInLeft" => "bounceInLeft", "bounceInRight" => "bounceInRight", "rotateInUpLeft" => "rotateInUpLeft", "rotateInDownLeft" => "rotateInDownLeft", "rotateInUpRight" => "rotateInUpRight", "rotateInDownRight" => "rotateInDownRight", "rollIn" => "rollIn", "pulse" => "pulse", "flipInX" => "flipInX")); $target_arr = array(__('Same window', DPTPLNAME) => '_self', __('New window', DPTPLNAME) => "_blank"); $add_dp_slideshow = array("type" => "dropdown", "heading" => __("Slideshow", DPTPLNAME), "param_name" => "slideshow", "admin_label" => true, "value" => $slideshows, "description" => "Select slideshow from available slideshows list"); $add_dp_category = array("type" => "dropdown", "heading" => __("Category", DPTPLNAME), "param_name" => "category", "admin_label" => true, "value" => $categories, "description" => "Select category from available categories list"); $add_dp_portfolios = array("type" => "dropdown", "heading" => __("Portfolio category", DPTPLNAME), "param_name" => "portfolios", "admin_label" => true, "value" => $portfolios, "description" => "Select portfolio category from available portfolio categories list"); $add_dp_menu = array("type" => "dropdown", "heading" => __("Menu", DPTPLNAME), "param_name" => "menu", "admin_label" => true, "value" => $menus, "description" => "Select menu from available menus list"); function dp_getImageBySize($params = array('post_id' => NULL, 'attach_id' => NULL, 'thumb_size' => 'thumbnail', 'class' => '')) { if ((!isset($params['attach_id']) || $params['attach_id'] == NULL) && (!isset($params['post_id']) || $params['post_id'] == NULL)) { return; } $post_id = isset($params['post_id']) ? $params['post_id'] : 0; if ($post_id) { $attach_id = get_post_thumbnail_id($post_id);
$language_text = 'language'; define('SESSION_LANGUAGE_ID', $_SESSION[$language_text . '_id']); include_once DIR_WS_INCLUDES . 'write_customers_status.php'; define($current_template_text, $vars[$current_template_text]); define('FULL_CURRENT_TEMPLATE', TEMPLATE_PATH . CURRENT_TEMPLATE . SLASH); define('CURRENT_TEMPLATE_BOXES', CURRENT_TEMPLATE . SLASH . 'boxes' . SLASH); } # check if session tab_id exist and use this. if ($active_tab == 0 && isset($_SESSION[$tab_id_text])) { $active_tab = $_SESSION[$tab_id_text]; } else { $_SESSION[$tab_id_text] = $active_tab; } $basecss = "tabcol"; $mouseover_image = EMPTY_STRING; $box_content = getCategoriesArray($basecss, $active_tab); olc_smarty_init($box_smarty, $cache_id); $box_smarty->assign('box_content', $box_content); $box_smarty->assign('navtyp', $navtyp); $box_smarty->assign('active_tab', $active_tab); $box_navigation = $box_smarty->fetch(CURRENT_TEMPLATE_BOXES . 'box_tab_navigation' . HTML_EXT, $cache_id); $smarty->assign('box_TAB_NAVIGATION', $box_navigation); if ($stand_alone) { $smarty->display(INDEX_HTML); } /**----------- * @return array * @param $basecss base style clas * @param $active_tab active clicked tab * @desc create array with categories and subcategories. */
function getTeamBonus($winteam, $loseteam, $isDraw, $winpoints) { // team bonus $msg = ""; $winteamCategory = getCategoryForTeam($winteam); $loseteamCategory = getCategoryForTeam($loseteam); $categories = getCategoriesArray(); $bonusWinner = 0; if ($winteamCategory == 0 || $loseteamCategory == 0) { $msg .= "<p>Uncategorised team(s), no team bonus</p>"; } else { $winteamPoints = $categories[$winteamCategory]; $loseteamPoints = $categories[$loseteamCategory]; $winteamName = getNameForTeam($winteam); $loseteamName = getNameForTeam($loseteam); if ($winteamPoints < $loseteamPoints) { $msg .= "<p>{$winteamName} team points: <b>{$winteamPoints}</b><br>"; $msg .= "{$loseteamName} team points: <b>{$loseteamPoints}</b><br>"; if ($isDraw > 0) { $normalBonus = abs($loseteamPoints - $winteamPoints); $bonusFactor = format2DigitsMax($winpoints / 30); $bonusWinner = round($normalBonus * $bonusFactor); $msg .= "Team draw bonus using {$winteamName}: {$normalBonus}*{$bonusFactor} ~ <b>{$bonusWinner}</b></p>"; } else { $bonusWinnerDifference = $loseteamPoints - $winteamPoints; $bonusFactor = format2DigitsMax($winpoints / 30); $bonusWinner = round($bonusWinnerDifference * $bonusFactor); $msg .= "Team bonus using {$loseteamName}: {$bonusWinnerDifference}*{$bonusFactor} ~ <b>{$bonusWinner}</b></p>"; } } else { if ($winteamPoints == $loseteamPoints) { $msg .= "<p>Equal teams, no team bonus</p>"; } else { if ($isDraw > 0) { $msg .= "<p>No team bonus</p>"; } else { $msg = "<p>Better team won, no team bonus</p>"; } } } } return array('bonusWinner' => $bonusWinner, 'msg' => $msg); }
<?php // the rules and information page header("Cache-Control: no-cache"); header("Pragma: no-cache"); $page = "games"; $subpage = "categories"; require './variables.php'; require './variablesdb.php'; require './functions.php'; require './top.php'; $teamsInstance = getTeamsArray(); $catGlobal = getCategoriesArray(); ?> <?php echo getOuterBoxTop($subNavText . getRaquo() . getSubNavigation($subpage, null), ""); ?> <table> <? foreach ($catGlobal as $category => $catCurrent) { // $category = key($catGlobal); // echo "<!-- cat: ".$category." -->"; $teams = array(); foreach ($teamsInstance as $rowArray) { if ($rowArray[3] == $category) { // put scope, id, name $teams[] = array($rowArray[2], $rowArray[0], $rowArray[1], $rowArray[5], $rowArray[4]); // echo "<!--".$rowArray[2].".". $rowArray[0].".". $rowArray[1].".". $rowArray[4].".".$rowArray[5]."-->"; } }