Bracket Competitor API Functions

Functions

 bracket_api_get_competitors ($node)
 bracket_api_set_seed (&$node, $comp_index, $seed, $seed_desc=FALSE)
 bracket_api_set_seeding (&$node, $seeds)
 bracket_api_set_competitors (&$node, $competitors)
 bracket_api_seed_competitors (&$node, $comp)
 bracket_api_get_seed_index (&$node, $seed)
 bracket_api_clear_competitors (&$node)
 bracket_api_clear_competitor_seeding (&$node)
 bracket_api_locate_competitor ($node, $name)

Detailed Description

Competitors and seeding

Bracket competitors are numbered from 1 to the number of competitors in the bracket. For instance, in an 8 competitor, single-elimination bracket, competitors are numbered from 1 to 8. Each competitors entry position into the bracket is fixed. For this example bracket, competitors 1 and 2 are placed in match 1; competitors 3 and 4 are placed in match 2, and so on...

  (Match 1)
 Competitor 1--+
               |-----+ 
 Competitor 2--+     |
                     |
                     +------
  (Match 2)          |
 Competitor 3--+     |
               |-----+ 
 Competitor 4--+

  (Match 3)
 Competitor 5--+
               |-----+ 
 Competitor 6--+     |
                     |
                     +------
  (Match 4)          |
 Competitor 7--+     |
               |-----+ 
 Competitor 8--+

So, in its simpliest form, in order to seed the bracket, competitors are supplied in a list in the same order as listed on the bracket.

However, in order to provide for more seeding arrangements a seeding "key" is also available for each competitor. A unique key is assigned each competitor slot. Using this key, competitors can be assigned to the correct slot by matching the corresponding key.


Function Documentation

bracket_api_clear_competitor_seeding ( &$  node  ) 

Clear bracket competitor seeding

Parameters:
$node the bracket node
bracket_api_clear_competitors ( &$  node  ) 

Clear bracket competitors

Parameters:
$node the bracket node
bracket_api_get_competitors ( node  ) 

Return an associative array of competitors

Parameters:
$node the bracket node
Returns:
the array of competitors
bracket_api_get_seed_index ( &$  node,
seed 
)

Get competitor index with matching seed

Parameters:
$node the bracket node
$seed the seed key
Returns:
the competitor index or FALSE if seed not found
bracket_api_locate_competitor ( node,
name 
)

Locate a competitor by name

Parameters:
$node the bracket node
$name the competitor name to locate
Returns:
the index or the competitor or FALSE if not found
bracket_api_seed_competitors ( &$  node,
comp 
)

Seed bracket competitors

Parameters:
$node the bracket node
$comp an array of competitors where key is seed and value is name bracket must already contain seed values
bracket_api_set_competitors ( &$  node,
competitors 
)

Update bracket competitors

Parameters:
$node the bracket node
$competitors an array of competitor names - competitors are placed in the bracket in the same order as given
bracket_api_set_seed ( &$  node,
comp_index,
seed,
seed_desc = FALSE 
)

Set the seeding for a competitor

Parameters:
$node the bracket node
$comp_index the index of the competitor in the bracket
$seed the competitor seed key
$seed_desc optional - the competitor seed description - stored as the competitor comment in the first round of the bracket
Returns:
the array of competitors
bracket_api_set_seeding ( &$  node,
seeds 
)

Set bracket seeding

Parameters:
$node the bracket node
$seeds an array of seeding that either contains a list of seeds for cooresponding competitors or contains nested arrays with keys of 'seed' and 'desc' - 'seed' is the seed key that is used when matching competitor seeds. 'desc' is the seed description - it is placed in the competitor's match comment slot in the first round of the bracket.
 All Data Structures Files Functions Variables
Generated on Sat Jul 10 15:07:40 2010 by  doxygen 1.6.3