This modules sounds really interesting. What I would love to be able to do is have CCK user reference for the competitors.

CommentFileSizeAuthor
#11 bracket-7-use-uid.patch90.83 KBjacob.embree

Comments

magnus’s picture

Maybe it would be easier to input all competitors before you add the result and then it would optionally match the competitors fields for the matches.
Would be great if you could add the final result as a CCK field for each competitor as well. Then you could output a view of the individual result in every tournament.

jimbullington’s picture

Yes, I think something needs to be done to the results so they are easier to work with. I will try to come up with something based on your suggestions.

janis_lv’s picture

I'm still building things up, but I'd love to use Organic Groups for "teams" if it's a team tournament, or users (maybe the user has to create a group(team) with himself only).

I'm waiting to see how LeagueSite will work out this with this module.

Thank you for your effort!

junro’s picture

Title: User referenced competitors » Node reference for competitors

Hello, great module! The only one in fact like this... Could become very hudge with more fonctionnalities :)

We should use cck node reference field to choose competitors.

We could create a node type "players" and be able to choose amond those nodes :)

magnus’s picture

Title: Node reference for competitors » User referenced competitors

Please create another issue if you want a node reference.

MasterChief’s picture

Just a message to have some news about this issue :)

mattcasey’s picture

Has any work been done on this feature? I am interested in developing this within the next month or so, and I don't know which would be better: linking to users or their content profiles. I imagine using 'player' nodes would be an unnecessary extra step.

mattcasey’s picture

Well, I could not figure out how to use CCK User Reference field, since the competitor fields are generated in the module and not registered under a content type. It would be better to use CCK for views, but I found a solution that includes an autocomplete field and that links the competitors to their user profiles. I am using 2.x-dev in Drupal 6.

First, adjust lines 52-77 of bracket_seed.inc:

    $form[$match]['comp' . $i] = array(
      '#type' => 'textfield',
      '#title' => t('Competitor') . ' #1',
      '#size' => 50,
      '#maxlength' => 50,
      '#default_value' => $c->name,
      '#autocomplete_path' => 'user/autocomplete', // Trigger Drupal autocomplete on this field
    );
    $form[$match]['seed' . $i] = array(
      '#type' => 'textfield',
      '#title' => t('Competitor') . ' #1' . ' ' . t('Seed'),
      '#size' => 10,
      '#maxlength' => 50,
      '#default_value' => $c->seedin,
    );

    $c = $node->comp[$i+1];

    $form[$match]['comp' . ($i+1)] = array(
      '#type' => 'textfield',
      '#title' => t('Competitor') . ' #2',
      '#size' => 50,
      '#maxlength' => 50,
      '#default_value' => $c->name,
      '#autocomplete_path' => 'user/autocomplete', // Trigger Drupal autocomplete on this field
    );

Second, duplicate the bracket-match.tpl.php and put it in your theme folder. You can copy this code, which links to the profile if the user name exists.

<?php
// $Id:

/**
 * @file
 * Template for bracket match
 *
 * Available variables:
 *  $node: the node object for the bracket to be rendered.
 *  $round_index: the round index
 *  $match_index: the match index
 *  $orientation: the orientation of the match in the bracket - 'left' or 'right'
 */
?>
<div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>" class="bracket-match round-<?php print $round_index ?>-match-block">
  <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1-block" class="bracket-match-competitor-block">
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1" class="bracket-match-competitor bracket-match-competitor-<?php print $orientation ?><?php if ($node->round[$round_index]->match[$match_index]->win[1]) print ' bracket-match-winner' ?>">
	<?php
	$competitor = '&nbsp';
	if($competitor_name = $node->round[$round_index]->match[$match_index]->cname[1]) {
	  if($competitor_id = user_load(array('name' => $competitor_name))) {
	    $competitor = l($competitor_name, 'user/' . $competitor_id->uid);
	  } else {
	    $competitor = filter_xss_admin($competitor_name);
	  }
	}
	print $competitor;
	?></div>
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1-score" class="bracket-match-score bracket-match-score-<?php print $orientation ?>"><?php print filter_xss_admin($node->round[$round_index]->match[$match_index]->score[1]) ?></div>
  </div>
  <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-block" class="bracket-match-block bracket-match-block-<?php print $orientation ?> round-<?php print $round_index ?>-match">
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1-comment-block" class="bracket-match-competitor-comment-block">
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1-comment" class="bracket-match-competitor-comment bracket-match-competitor-comment-<?php print $orientation ?>"><?php print $node->round[$round_index]->match[$match_index]->comp_comment[1] ? filter_xss_admin($node->round[$round_index]->match[$match_index]->comp_comment[1]) : '&nbsp;' ?></div>                
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-1-home" class="bracket-match-home bracket-match-home-<?php print $orientation ?>"><?php print $node->round[$round_index]->match[$match_index]->home[1] ? 'H' : '&nbsp;' ?></div>
    </div>
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-comment-block" class="bracket-match-comment-block round-<?php print $round_index ?>-match-comment-block">
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-comment-1" class="bracket-match-comment bracket-match-comment-<?php print $orientation ?>"><?php print filter_xss_admin($node->round[$round_index]->match[$match_index]->comment[1]) ?></div>
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-comment-2" class="bracket-match-comment bracket-match-comment-<?php print $orientation ?>"><?php print filter_xss_admin($node->round[$round_index]->match[$match_index]->comment[2]) ?></div>
    </div>
    <?php if ($node->options['show_match_id']) { ?>
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-id" class="bracket-match-id bracket-match-id-<?php print $orientation ?>">#<?php print $node->round[$round_index]->match[$match_index]->id ?></div>
    <?php } ?>
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2-block" class="bracket-match-competitor-block bracket-match-bottom-competitor-block">
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2" class="bracket-match-competitor bracket-match-competitor-<?php print $orientation ?><?php if ($node->round[$round_index]->match[$match_index]->win[2]) print " bracket-match-winner" ?>">
	<?php
	$competitor = '&nbsp';
	if($competitor_name = $node->round[$round_index]->match[$match_index]->cname[2]) {
	  if($competitor_id = user_load(array('name' => $competitor_name))) {
	    $competitor = l($competitor_name, 'user/' . $competitor_id->uid);
	  } else {
	    $competitor = filter_xss_admin($competitor_name);
	  }
	}
	print $competitor;
	?></div>
      <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2-score" class="bracket-match-score bracket-match-score-<?php print $orientation ?>"><?php print filter_xss_admin($node->round[$round_index]->match[$match_index]->score[2]) ?></div>
    </div>
  </div>
  <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2-comment-block" class="bracket-match-competitor-comment-block">
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2-score" class="bracket-match-competitor-comment bracket-match-competitor-comment-<?php print $orientation ?>"><?php print $node->round[$round_index]->match[$match_index]->comp_comment[2] ? filter_xss_admin($node->round[$round_index]->match[$match_index]->comp_comment[2]) : '&nbsp;' ?></div>                
    <div id="round-<?php print $round_index ?>-match-<?php print $match_index ?>-competitor-2-home" class="bracket-match-home bracket-match-home-<?php print $orientation ?>"><?php print $node->round[$round_index]->match[$match_index]->home[2] ? 'H' : '&nbsp;' ?></div>
  </div>
</div>

jimbullington’s picture

Thank you for posting this patch - I'm sure it will be useful!

janis_lv’s picture

following :P

jacob.embree’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
StatusFileSize
new90.83 KB

This is some early work on using Drupal user ID's instead of names.