+ Antworten
Ergebnis 1 bis 2 von 2

Thema: Joomleague Erweiterung für Einzelsportarten

  1. #1
    Neu an Board
    Registriert seit
    08.05.2009
    Beiträge
    1
    Bedankte sich
    0
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard Joomleague Erweiterung für Einzelsportarten

    Hallo ich habe eine Erweiterung für die Einzelsportart Ringen weiterentwickelt diese baut auf einer Erweiterung für Tischtennis auf. Mein Problem ist das Satz Ergebnis wird per JavaScript aus gerechnet das brauch ich aber nicht. Ich will das Ergebnis entweder manuell eingeben oder per Dropdown ich bekomm das aber irgendwie nicht hin. Ich hab zwar gefunden wie ich das Script lösche aber ich weis nicht wie ich dann jetzt Text eingeben kann. Wichtig ist auch das man Text und Zahlen eingeben kann.
    Hat jemand einen Rat für mich?

    Das ist der Code mit dem Script

    Code:
    <?php
    defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
    
    /*
     * global variables used in various places...
     */
    global $setOptions;
    global $set_options;
    global $plays;
    
    /*
     * build HTML options out of config variable set_options
     */
    $setOptions = array();
    $setOptions[] = mosHTML::makeOption('&nbsp;');
    $set_options = explode(';',$match_mode_config['set_options']);
    foreach($set_options as $set_option) {
    	if ($set_option) { // ignore witespaces
    		$setOptions[] = mosHTML::makeOption(trim($set_option));
    	}
    }
    $plays = explode(';',$match_mode_config['plays']);
    for ($i=0; $i < count($plays); $i++) {
    	if ($plays[$i]){
    		$plays[$i] = trim($plays[$i]);
    	} else {
    		unset($plays[$i]);
    	}
    }
    
    function makeSingle ($order,$pos1,$pos2,$playerlist1,$playerlist2,$players,$match_mode_config) {
    	$pid1 = $playerlist1[$pos1-1];
    	$pid2 = $playerlist2[$pos2-1];
    	printf ("<td>%s</td><td>%s</td>",
    		searchPlayer($players[0],$pid1),
    		searchPlayer($players[1],$pid2));
    	createSets($order,$match_mode_config);
    	makeHiddenField ("player1_$order",$pid1);
    	makeHiddenField ("player2_$order",$pid2);
    	makeHiddenField ("pos1_$order",$pos1);
    	makeHiddenField ("pos2_$order",$pos2);
    }
    
    function makeDouble ($order,$double1,$double2,$doubleplayer1,$doubleplayer2,$players,$match_mode_config) {
    	$pid1a = $doubleplayer1[$double1*2-2];
    	$pid1b = $doubleplayer1[$double1*2-1];
    	$pid2a = $doubleplayer2[$double2*2-2];
    	$pid2b = $doubleplayer2[$double2*2-1];
    	printf ("<td>%s<br/>%s</td><td>%s<br/>%s</td>",
    		searchPlayer($players[0],$pid1a),searchPlayer($players[0],$pid1b),
    		searchPlayer($players[1],$pid2a),searchPlayer($players[1],$pid2b));
    	createSets($order,$match_mode_config);
    	makeHiddenField ("player1_$order",$pid1a);
    	makeHiddenField ("player1b_$order",$pid1b);
    	makeHiddenField ("player2_$order",$pid2a);
    	makeHiddenField ("player2b_$order",$pid2b);
    	makeHiddenField ("pos1_$order",$double1);
    	makeHiddenField ("pos2_$order",$double2);
    }
    
    function makeHiddenField($name,$value) {
    	printf ("<td><input type='hidden' name='$name' value='$value' /></td>");
    }
    
    function createSets ($order,$match_mode_config) {
      for($i=1;$i<=$match_mode_config['anz_sets'];$i++) {
    	printf ('<td>%s</td>',createSet($order,$i));
      }
      printf ("<td><input size='1' readonly='readonly' name='sets_%s' onfocus='this.blur()'/></td>",$order);
      printf ("<td><input size='1' readonly='readonly' name='match_%s' onfocus='this.blur()'/></td>",$order);
    }
    
    function createSet ($match,$set) {
    	global $setOptions;
    	return mosHTML::selectList($setOptions,'set_'.$match.'_'.$set,
    		'onchange="checkSet('.$match.','.$set.')"','value','text','-99');
    //	return "<input type='text' name='set_$match_$set_$partner' size='1' maxlength='2'/>";
    //	return "<div name='set_$match_$set_$partner'>11</div>";
    }
    
    // search a player in a list of players by id and return full name
    function searchPlayer($players,$pid) {
    	foreach ($players as $player) {
    		if ($player->id == $pid) {
    			return $player->firstname.' '.$player->lastname;
    		}
    	}
    	return "";
    }
    ?>
    
    <script type="text/javascript"><!--
    function checkForm() {
      var f=document.adminForm;
      var points1=0;
      var points2=0;
      var anz_win_plays=<?=$match_mode_config['anz_win_plays'];?>;
      for (var i=1;i<=<?=count($plays)?>;i++) {
      	var v = f.elements['match_'+i].value;
      	if      (v == '1:0') { points1++; }
      	else if (v == '0:1') { points2++; }
      	else { break; }
      }
      if ((points1 >= anz_win_plays) || (points2 >= anz_win_plays) ||
      	((points1==anz_win_plays-1) && (points2==anz_win_plays-1))) {
      	return true;
      } else {
      	alert ("<?=_JL_TT_NOT_ENOUGH_PLAYS;?>");
      	return false;
      }
    }
    
    function checkSet(play,set) {
      var f=document.adminForm;
      var set1=0;
      var set2=0;
      var anz_sets=<?=$match_mode_config['anz_sets'];?>;
      var anz_win_sets=<?=$match_mode_config['anz_win_sets'];?>;
      for (var i=1;i<=anz_sets;i++) {
      	sel = getSetValue(f,play,i);
      	if (sel.indexOf(":") == -1) {
      		return;
      	}
      	var s=sel.split(':');
      	if (parseInt(s[0]) > parseInt(s[1])) {
    	  set1++;
    	} else {
    	  set2++;
    	}
    	if (set1==anz_win_sets || set2==anz_win_sets) {
    	  f.elements['sets_'+play].value = set1 + ':' + set2;
    	  if (set1 > set2) {
    	    f.elements['match_'+play].value = '1:0';
      	  } else {
    		f.elements['match_'+play].value = '0:1';
    	  }
    	  while (++i<=anz_sets) {
    		getSet(f,play,i).options.selectedIndex=0;
    	  }
    	  getSet(f,play+1,1).focus();
    	  break;
    	}
      }
    }
    
    function getSetValue(f,play,set) {
      var s = getSet(f,play,set);
      return s.options[s.selectedIndex].value;
    }
    
    function getSet(f,play,set) {
      return f.elements['set_'+play+'_'+set];
    }
    //--></script>
    
    <div class="componentheading"><?=$project->name;?></div>
    
    <form action="index.php?option=com_joomleague&amp;func=saveMatchResults&amp;p=<?=$project->id;?>&amp;mid=<?=$mid;?>&amp;Itemid=<?=$Itemid;?>"
    	method="post" name="adminForm" onsubmit="return checkForm()">
    <table width="100%" class="contentpaneopen">
      <tr><td class="contentheading">
      	<?php printf ("%s %s : %s",_JL_TT_RESULT_INPUT,$team[0]->name,$team[1]->name);?>
      </td></tr>
    </table>
    <?php if ($team1withdrawal || $team2withdrawal) {
    	if ($team1withdrawal) {
    		printf (_JL_TT_TEAM_WITHDRAWAL, $team[0]->name);
    		echo '<input type="hidden" name="team1withdrawal" value="1"/>';
    		echo '<input type="hidden" name="team2withdrawal" value="0"/>';
    	} else {
    		printf (_JL_TT_TEAM_WITHDRAWAL, $team[1]->name);
    		echo '<input type="hidden" name="team1withdrawal" value="0"/>';
    		echo '<input type="hidden" name="team2withdrawal" value="1"/>';
    	}
    } else { ?>
    <br/>
    <table width="96%" align="center" border="0" cellpadding="5" cellspacing="0">
    	<thead><tr>
    		<th>&nbsp;</th>
    		<th><?php echo $team[0]->name;?></th>
    		<th><?php echo $team[1]->name;?></th>
    		<?php for ($i=1;$i<=$match_mode_config['anz_sets'];$i++) {
    		  printf("<th>%s.&nbsp;%s</th>",$i,_JL_TT_SET);}
    		?>
    		<th><?php echo _JL_TT_SETS; ?></th>
    		<th><?php echo _JL_TT_PLAYS; ?></th>
    	</tr></thead>
    	<?php
    
    	for ($i=0; $i < count($plays); $i++) {
    		$p = explode(':',$plays[$i]);
    		printf ("<tr><td>%s-%s</td>",$p[0],$p[1]);
    		if (ord($p[0]) == ord('D')) {
    			makeDouble($i+1,$p[0][1],$p[1][1],$doubleplayer1,$doubleplayer2,$players,$match_mode_config);
    		} else {
    			makeSingle($i+1,$p[0],$p[1],$playerlist1,$playerlist2,$players,$match_mode_config);
    		}
    		echo "</tr>";
    	}
    	?>
    </table>
    <?php } ?>
    <br/>
    <center>
      <input type="submit" class="button" name="ok" value="<?=_JL_TT_SAVE_RESULTS;?>"/>
    </center>
    </form>
    
    <!-- Footer -->
    <?php include("show_footer.tpl.php"); ?>
    <!-- Footer Ende -->
    Geändert von tobymacpie (10.02.2010 um 11:28 Uhr)

  2. #2
    Neu an Board
    Registriert seit
    02.06.2005
    Beiträge
    32
    Bedankte sich
    1
    1 Danksagung in 1 Beitrag

    Blinzeln

    Hallo,
    das ist aber lustig, ich bin auch ein Ringer und die Idee mit Datenbank habe ich auch zuerst probiert über Joomleague zu lösen, nach ca. 1 Woche habe ich entsch. das selber mit meinem Kollegen zu erstellen.
    Bei uns schaut es so aus das wir die Ergebnisse von Einzelmeisterschaften sowie Liga alles in PDF bekommen und dann über C# Programm ins Datenbank importieren (c# weil die such möglichkeit besser ist als php und man muss nicht online sein). die Seite findest unter http://www.ringsportaustria.at.
    gerne werde ich dir helfen, die frage ist was genau du machen willst und wie tief du es abspeichern willst. bei uns ist so das:
    Einzelmeisterschaften gehen nur bis Platzierung (da wir keine genauere Ergebnisse bekommen von einzeln Kämpfen), Liga bis zur Punkte.
    woher kommst du eigentlich?

+ Antworten

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein