Change Log of Joomsport: [VIEW]晉級圖-主席盃、碟及盾:给match表增加三个字段:grp_id,ordering,level(synchronized with ser

62 篇文章 0 订阅
44 篇文章 0 订阅

Target:


For extended functionalities of [赛事晋级图]. Match table should have at least more 3 fields: grp_id, ordering and level.


grp_id: the match belongs to witch Group: A组, B组...

ordering: the order of the matches within the same group

level: the level of the match, 四分之一决赛(quarterfinal),半决赛(semi-final),决赛(final match)


let's add these fields to database:


grp_id


other-two-fields


sql-creat-two-fields


The type of 'level' is ENUM, which is the first time I use it, just for using it, because never tried.


PHP Change:


/administrator/components/com_joomsport/admin.joomsport.class.php:


note the lines following coment:

class JTableMatch extends JTable
{
	var $id						= null;
	var $m_id 					= null;
	var $team1_id 				= null;
	var $team2_id				= null;
	var $score1 				= null;
	var $score2 				= null;
	var $match_descr			= null;
	var $published				= null;
	var $is_extra				= null;
	var $m_played				= null;
	var $m_date					= null;
	var $m_time					= null;
	var $m_location				= null;
	var $bonus1					= null;
	var $bonus2					= null;
	var $m_remark				= null;

	//added by Vincent 5th Dec 2011
	var $grp_id					= null;
	var $ordering				= null;
	var $level					= null;

	function __construct( &$db )
	{
		parent::__construct( '#__bl_match', 'id', $db );
	}
}


go to: /administrator/components/com_joomsport/admin.joomsport.php


add lines to function 'BL_MatchEdit':


	// added by Vincent Zhang 6th-Dec-2011

	$levels = array();
	$levels[] = JHTML::_('select.option',  0, JText::_('選擇比賽級別'), 'id', 'lev_name' );
	$levels[] = JHTML::_('select.option',  1, JText::_('八強賽'), 'id', 'lev_name' );
	$levels[] = JHTML::_('select.option',  2, JText::_('四強賽'), 'id', 'lev_name' );
	$levels[] = JHTML::_('select.option',  3, JText::_('決賽'), 'id', 'lev_name' );

	$lists['levels'] = $levels;

	// end


and we can leave function 'BL_MatchSave' definition as it be.



/administrator/components/com_joomsport/admin.joomsport.html.php

add lines to function 'bl_editMatch':


<!-- level added by Vincent 6th-Dec-2011 -->
<tr>
	<td>

		<?php echo JText::_( "級別" ); ?>

	</td>
	<td>
		<?php
			echo JHTML::_('select.genericlist',
				$lists['levels'],
				'level',
				'class="inputbox"',
				'id',
				'lev_name',
				( (isset($row->level)) ? $row->level : 0 )
				);


		  ?>
	</td>
</tr>


For 'grp_id', add lines to function 'BL_MatchEdit':


	$is_groups = array();
	$query = "SELECT id, group_name FROM #__bl_groups WHERE s_id = ".$season_id;
	$db->setQuery($query);
	$groups = $db->loadObjectList();
	$is_groups[] = JHTML::_('select.option',  0, JText::_('BLBE_SELGROUP'), 'id', 'group_name' );
	$groupis = array_merge($is_groups, $groups);
	$lists['groups'] = JHTML::_('select.genericlist', $groupis, 'grp_id', 'class="inputbox" size="1"', 'id', 'group_name', ( (isset($row->grp_id)) ? $row->grp_id : 0 ));


Please note that:


1.  the last parameter passed to JHTML::_ is the field name in database table: group_name, otherwise, the drop-down list item doesn't have label;

2. the 3rd parameter passed ot JHTML::_('select.genericlist') is the field name, namely the member variable's name of this match class: 'grp_id', it must be the same, because it is used as this HTML input control's name.


/administrator/components/com_joomsport/admin.joomsport.html.php:


<!-- ordering added by Vincent 6th-Dec-2011 -->
<tr>
	<td width="100">
		<?php echo JText::_( 'BLBE_GROUPNAME' ); ?>
	</td>
	<td>
		<?php echo $lists['groups'];?>
	</td>
</tr>

<!-- ordering added by Vincent 6th-Dec-2011 -->
<tr>
	<td>
		<?php echo JText::_('BLBE_ORDERING');?>

	</td>
	<td>
		<input type="text" maxlength="1" size="2" name="ordering" value="<?php echo htmlspecialchars($row->ordering);?>" />

	</td>
</tr>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值