Target
The system should be able to discriminate three different type of competition systems:
Round-robin;
Knock-out;
Champion
Database Change
Table: jos_bl_tournament
PHP Change
/administrator/components/com_joomsport/admin.joomsport.class.php
Change 'JTableTourn' class defination
From:
class JTableTourn extends JTable
{
var $id = null;
var $name = null;
var $descr = null;
var $published = null;
var $logo = null;
function __construct( &$db )
{
parent::__construct( '#__bl_tournament', 'id', $db );
}
}
To:
class JTableTourn extends JTable
{
var $id = null;
var $name = null;
var $descr = null;
var $published = null;
var $logo = null;
var $t_type = null;
function __construct( &$db )
{
parent::__construct( '#__bl_tournament', 'id', $db );
}
}
/administrator/components/com_joomsport/admin.joomsport.php
Change 'BL_TourEdit' function defination
From:
function BL_TourEdit($is_id, $option)
{
$db =& JFactory::getDBO();
$row = new JTableTourn( $db);
$row->load($is_id);
$published = ($row->id) ? $row->published : 1;
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published );
joomsport_html::bl_editTourn($row, $lists, $option);
}
To:
function BL_TourEdit($is_id, $option)
{
$db =& JFactory::getDBO();
$row = new JTableTourn( $db);
$row->load($is_id);
$published = ($row->id) ? $row->published : 1;
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published );
// added by Vincent 22-Oct-2011
$tourtypes = array();
$tourtypes[] = JHTML::_('select.option', 1, JText::_('Round-robin'), 'id', 'name' );
$tourtypes[] = JHTML::_('select.option', 2, JText::_('Knock-out'), 'id', 'name' );
$tourtypes[] = JHTML::_('select.option', 3, JText::_('Champion'), 'id', 'name' );
$lists['tourtypes'] = $tourtypes;
// end
joomsport_html::bl_editTourn($row, $lists, $option);
}
Change 'BL_TourSave' function defination
From:
function BL_TourSave($option)
{
$mainframe = JFactory::getApplication();
$db =& JFactory::getDBO();
$post = JRequest::get( 'post' );
$row = new JTableTourn($db);
$post['descr'] = '';
if (!$row->bind( $post ))
{
JError::raiseError(500, $row->getError() );
}
if (!$row->check())
{
JError::raiseError(500, $row->getError() );
}
// if new item order last in appropriate group
if (!$row->store())
{
JError::raiseError(500, $row->getError() );
}
$row->checkin();
if (JRequest::getCmd('task') == 'tour_apply')
{
$mainframe->redirect( 'index.php?option='.$option.'&task=tour_edit&cid[]='.$row->id);
}
else
{
$mainframe->redirect( 'index.php?option='.$option);
}
}
To:
function BL_TourSave($option)
{
$mainframe = JFactory::getApplication();
$db =& JFactory::getDBO();
$post = JRequest::get( 'post' );
$row = new JTableTourn($db);
$post['descr'] = '';
// added by Vincent 22-Oct-2011
$post['t_type'] = JRequest::getVar('t_type', 0, 'post', 'int');
if (!$row->bind( $post ))
{
JError::raiseError(500, $row->getError() );
}
if (!$row->check())
{
JError::raiseError(500, $row->getError() );
}
// if new item order last in appropriate group
if (!$row->store())
{
JError::raiseError(500, $row->getError() );
}
$row->checkin();
if (JRequest::getCmd('task') == 'tour_apply')
{
$mainframe->redirect( 'index.php?option='.$option.'&task=tour_edit&cid[]='.$row->id);
}
else
{
$mainframe->redirect( 'index.php?option='.$option);
}
}
Change 'bl_editTourn' function defination
From:
function bl_editTourn($row, $lists, $option)
{
$editor =& JFactory::getEditor();
JHTML::_('behavior.tooltip');
joomsport_html::JS_getObj();
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
submitbutton(task);
}
function submitbutton(pressbutton)
{
var form = document.adminForm;
if(pressbutton == 'tour_apply' || pressbutton == 'tour_save')
{
if(form.name.value != '')
{
submitform( pressbutton );
return;
}
else
{
getObj('trname').style.border = "1px solid red";
alert("<?php echo JText::_('BLBE_JSMDNOT1');?>");
}
}
else
{
submitform( pressbutton );
return;
}
}
function delete_logo()
{
getObj("logoiddiv").innerHTML = '';
}
</script>
<form action="index.php?option=<?php echo $option?>" method="post" name="adminForm" enctype="multipart/form-data">
<table>
<tr>
<td width="120">
<?php echo JText::_( 'BLBE_TOURNAMENTNAME' ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'BLBE_TOURNAMENTNAME' ); ?>::<?php echo JText::_( '' );?>"><img src="components/com_joomsport/img/quest.jpg" border="0" /></span>
</td>
<td>
<input type="text" maxlength="255" size="60" name="name" id="trname" value="<?php echo $row->name?>" />
</td>
</tr>
<tr>
<td width="100">
<?php echo JText::_( 'Publish' ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Publish' ); ?>::<?php echo JText::_( 'Publishing' );?>"><img src="components/com_joomsport/img/quest.jpg" border="0" /></span>
</td>
<td>
<?php echo $lists['published'];?>
</td>
</tr>
<!-- tournment logo -->
<!-- about tournment TEXT editor -->
</table>
<input type="hidden" name="option" value="<?php echo $option?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $row->id?>" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php
}
To:
function bl_editTourn($row, $lists, $option)
{
$editor =& JFactory::getEditor();
JHTML::_('behavior.tooltip');
joomsport_html::JS_getObj();
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
submitbutton(task);
}
function submitbutton(pressbutton)
{
var form = document.adminForm;
if(pressbutton == 'tour_apply' || pressbutton == 'tour_save')
{
if(form.name.value != '')
{
submitform( pressbutton );
return;
}
else
{
getObj('trname').style.border = "1px solid red";
alert("<?php echo JText::_('BLBE_JSMDNOT1');?>");
}
}
else
{
submitform( pressbutton );
return;
}
}
function delete_logo()
{
getObj("logoiddiv").innerHTML = '';
}
</script>
<form action="index.php?option=<?php echo $option?>" method="post" name="adminForm" enctype="multipart/form-data">
<table>
<tr>
<td width="120">
<?php echo JText::_( 'BLBE_TOURNAMENTNAME' ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'BLBE_TOURNAMENTNAME' ); ?>::<?php echo JText::_( '' );?>"><img src="components/com_joomsport/img/quest.jpg" border="0" /></span>
</td>
<td>
<input type="text" maxlength="255" size="60" name="name" id="trname" value="<?php echo $row->name?>" />
</td>
</tr>
<tr>
<td width="100">
<?php echo JText::_( 'Publish' ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Publish' ); ?>::<?php echo JText::_( 'Publishing' );?>"><img src="components/com_joomsport/img/quest.jpg" border="0" /></span>
</td>
<td>
<?php echo $lists['published'];?>
</td>
</tr>
<!-- tournment logo -->
<!-- about tournment TEXT editor -->
<!-- Select type added by Vincent 22-Oct-2011 -->
<tr>
<td>
<?php echo JText::_( "賽制" ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( '賽制' );/**/ ?>::<?php echo JText::_( '目前支持的賽制包括:雙循環賽制,分組淘汰賽制以及錦標賽制' );/**/ ?>"><img src="components/com_joomsport/img/quest.jpg" border="0" /></span>
</td>
<td>
<?php
echo JHTML::_('select.genericlist',
$lists['tourtypes'],
't_type',
'class="inputbox"',
'id',
'name',
( (isset($row->t_type)) ? $row->t_type : 1 )
);
?>
</td>
</tr>
</table>
<input type="hidden" name="option" value="<?php echo $option?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $row->id?>" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php
}
Remove All 'ORDER BY NAME' in SQL Queries