Bracket Match API Functions

Functions

 bracket_api_get_matches ($node)
 bracket_api_get_match_index ($node, $matchid)
 bracket_api_get_match ($node, $matchid)
 bracket_api_get_match_by_index ($node, $round_index, $match_index)
 bracket_api_set_match_comment (&$node, $matchid, $comment_index, $comment)
 bracket_api_set_match_competitor_comment (&$node, $matchid, $comp_index, $comment)
 bracket_api_set_match_home_competitor (&$node, $matchid, $comp_index)
 bracket_api_set_match_winner (&$node, $matchid, $winner_index, $winner_score='', $loser_score='')
 bracket_api_locate_match_competitor ($node, $matchid, $comp_name)
 bracket_api_clear_results (&$node)

Detailed Description

Matches

Bracket matches are organized under bracket rounds, but each match also has a unique id. The routing of match winners and losers is established at bracket creation time.

An example of match id numbering:

 -----------+
  (Match 1) |-----------+ 
 -----------+           |
              (Match 5) +-----------+
 -----------+           |           |
  (Match 2) |-----------+           |
 -----------+                       |
                          (Match 7) +----------------+
 -----------+                       |                |  
  (Match 3) |-----------+           |                |
 -----------+           |           |                | 
              (Match 6) +-----------+                |
 -----------+           |                            |
  (Match 4) |-----------+                  (Match 8) |--------------+ 
 -----------+                                        |              |
                                                     |              
                                                     |              |
                                                     |               
                                                     |              |
                                     -----------+    |  (Match 9)   + - - - -
             -----------+                       |    |              |
 -----------+ (Match 12)|-----------+ (Match 15)+----+              
  (Match 10)|-----------+           |           |                   |
 -----------+             (Match 14)+-----------+                   
             -----------+           |                               |
 -----------+ (Match 13)|-----------+                 - - - - - - - +
  (Match 11)|-----------+           
 -----------+                       

Function Documentation

bracket_api_clear_results ( &$  node  ) 

Clear bracket results

Parameters:
$node the bracket node
bracket_api_get_match ( node,
matchid 
)

Return an array containing the information in the match object with the given id

Parameters:
$node the bracket node
$matchid the id of the match to return
Returns:
an array containing match information or NULL if match id does not exist
bracket_api_get_match_by_index ( node,
round_index,
match_index 
)

Return an array containing the information in the match object at the given index

Parameters:
$node the bracket node
$round_index the index of the round that contains the match
$match_index the index of the match
Returns:
an array containing match information or FALSE if round or match index does not exist
bracket_api_get_match_index ( node,
matchid 
)

Return an array containing the round and match index of the given match id

Parameters:
$node the bracket node
$matchid the id of the match to return
Returns:
an array containing match indexes (key 'round' contains the round index and key 'match' contains the match index) or FALSE if match id does not exist
bracket_api_get_matches ( node  ) 

Return an associative array of all matches in the bracket

Parameters:
$node the bracket node
Returns:
the array of matches
bracket_api_locate_match_competitor ( node,
matchid,
comp_name 
)

Get a match competitor index given competitor name

Parameters:
$node the bracket node
$matchid the match id to search
$comp_name the competitor name to location
Returns:
the index of the competitor in the given match or FALSE if competitor was not found
bracket_api_set_match_comment ( &$  node,
matchid,
comment_index,
comment 
)

Set a match comment

Parameters:
$node the bracket node
$matchid the match id to update
$comment_index the comment index that should be updated (1 or 2)
$comment the new comment for the match
bracket_api_set_match_competitor_comment ( &$  node,
matchid,
comp_index,
comment 
)

Set a match competitor comment

Parameters:
$node the bracket node
$matchid the match id to update
$comp_index the competitor index that should be updated (1 or 2)
$comment the new comment for the competitor
bracket_api_set_match_home_competitor ( &$  node,
matchid,
comp_index 
)

Set a match home competitor

Parameters:
$node the bracket node
$matchid the match id to update
$comp_index the competitor index that should be updated (1 or 2)
bracket_api_set_match_winner ( &$  node,
matchid,
winner_index,
winner_score = '',
loser_score = '' 
)

Set a match winner

Parameters:
$node the bracket node
$matchid the match id to update
$winner_index the competitor index that should be indicated as the winner (1 or 2) or 0 to reset results
$winner_score the winning score of the match (optional)
$loser_score the losing score of the match (optional)
 All Data Structures Files Functions Variables
Generated on Sat Jul 10 15:07:40 2010 by  doxygen 1.6.3