<?php 
} else {
    ?>
		<input type='checkbox' id='cb<?php 
    echo $i;
    ?>
' name='cid[]' value='<?php 
    echo $thismatch->id;
    ?>
' />
	</td>
	<!-- Edit match details -->
	<td valign="top">
		<?php 
    JHTML::_('behavior.modal', 'a.mymodal');
    $url = JoomleagueHelperRoute::getEditMatchRoute($this->project->id, $thismatch->id);
    $imgTitle = JText::_('Edit match details');
    $desc = JHTML::image(JURI::root() . 'media/com_joomleague/jl_images/edit.png', $imgTitle, array('id' => 'edit' . $thismatch->id, 'border' => 0, 'title' => $imgTitle));
    ?>
		<a class="mymodal" title="example" href="<?php 
    echo $url;
    ?>
" rel="{handler: 'iframe',size: {x: <?php 
    echo JComponentHelper::getParams('com_joomleague')->get('modal_popup_width', 900);
    ?>
,y: <?php 
    echo JComponentHelper::getParams('com_joomleague')->get('modal_popup_height', 600);
    ?>
}}"> <?php 
    echo $desc;
    ?>
 function savematch()
 {
     JRequest::checkToken() or jexit(JText::_('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN'));
     $msg = '';
     $post = JRequest::get('post');
     $summary = JRequest::getVar('summary', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['summary'] = $summary;
     $preview = JRequest::getVar('preview', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['preview'] = $preview;
     $project_id = JRequest::getInt('p', '', 'post', 'int');
     $round_id = JRequest::getInt('rid', '', 'post', 'int');
     $match_id = JRequest::getInt('mid', '', 'post', 'int');
     if ($post['alt_decision'] == 0) {
         $post['team1_result_decision'] = null;
         $post['team2_result_decision'] = null;
     }
     $model = $this->getModel('editmatch');
     $user = JFactory::getUser();
     $isAllowed = $model->isAllowed() || $model->isMatchAdmin($this->match->id, $user->id);
     if (!$isAllowed) {
         $link = JoomleagueHelperRoute::getResultsRoute($project_id);
         jexit(JText::_('You are not allowed to change matchdata. What are you doing here???'));
         $this->setRedirect($link, JText::_($msg));
     }
     #$post['match_date' . $cid[$x]] = JoomleagueHelper::convertDate( $post['match_date' . $cid[$x]], 0 );
     if ($model->savedetails($post)) {
         //clear ranking cache
         $cache = JFactory::getCache('joomleague.project' . $project_id);
         $cache->clean();
         $msg = 'Changes on selected match were saved';
     } else {
         $msg = 'Error while saving changes on selected match';
     }
     $link = JoomleagueHelperRoute::getEditMatchRoute($project_id, $match_id);
     $this->setRedirect($link, JText::_($msg));
 }