Пример #1
0
 function __construct()
 {
     parent::__construct();
     $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     $this->title = JFactory::getDocument()->title;
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->tid = $this->mainframe->getUserStateFromRequest('com_joomsport.ftid' . $this->s_id, 'ftid', 0, 'int');
     $this->mid = $this->mainframe->getUserStateFromRequest('com_joomsport.fmid' . $this->s_id, 'fmid', 0, 'int');
     $this->teamhm = $this->mainframe->getUserStateFromRequest('com_joomsport.fteamhm' . $this->s_id, 'fteamhm', 0, '', 'int');
     $this->fromdate = $this->mainframe->getUserStateFromRequest('com_joomsport.ffromdate' . $this->s_id, 'ffromdate', '', 'string');
     $this->todate = $this->mainframe->getUserStateFromRequest('com_joomsport.ftodate' . $this->s_id, 'ftodate', '', 'string');
     /*if(!$this->s_id){
     			JError::raiseError( 403, JText::_('Access Forbidden') );
     			return; 
     		}*/
     $query = "SELECT COUNT(*) FROM #__bl_seasons as s, #__bl_tournament as t WHERE t.published='1' AND s.published='1' AND t.id = s.t_id AND s.s_id = " . $this->s_id;
     $this->db->setQuery($query);
     if (!$this->s_id || !$this->db->loadResult()) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     //get tiurnament type
     $tourn = $this->getTournOpt($this->s_id);
     $this->t_single = $tourn->t_single;
     $this->t_type = 0;
     //$tourn->t_type;
     $this->_lists["t_type"] = $this->t_type;
     $this->getPagination();
 }
Пример #2
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->title = JFactory::getDocument()->getTitle();
     $this->id = JRequest::getVar('id', 0, '', 'int');
     $query = "SELECT COUNT(*) FROM  #__bl_tournament as t WHERE t.published='1' AND t.id = " . $this->id;
     $this->db->setQuery($query);
     if (!$this->id || !$this->db->loadResult()) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // Get the pagination request variables
     //$this->limit		= $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
     //$this->limitstart	= $mainframe->getUserStateFromRequest( 'com_joomsport.limitstart', 'limitstart', 0, 'int' );
     //$this->limitstart	= JRequest::getVar( 'limitstart', 0,'', 'int' );
     // In case limit has been changed, adjust limitstart accordingly
     //$this->limitstart = ($this->limit != 0 ? (floor($this->limitstart / $this->limit) * $this->limit) : 0);
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->getPagination();
     $this->getData();
     $this->getTournInfo();
     //$this->_params = $this->JS_PageTitle($this->_tinfo->name);
     $this->p_title = $this->_tinfo->name;
     $this->_params = $this->JS_PageTitle($this->title ? $this->title : $this->p_title);
     $this->_lists["teams_season"] = $this->teamsToModer();
     $this->_lists["panel"] = $this->getePanel($this->_lists["teams_season"], 0, null, 0);
 }
Пример #3
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     // Get the pagination request variables
     $this->season_id = $mainframe->getUserStateFromRequest('com_joomsport.sid', 'sid', 0, 'int');
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart_pl' . $this->season_id, 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $return_url = $_SERVER['REQUEST_URI'];
         $return_url = base64_encode($return_url);
         if (getVer() >= '1.6') {
             $uopt = "com_users";
         } else {
             $uopt = "com_user";
         }
         $return = 'index.php?option=' . $uopt . '&view=login&return=' . $return_url;
         $this->mainframe->redirect($return, JText::_('BLMESS_NOT_LOGIN'));
     }
     if (!$this->season_id) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #4
0
 function __construct()
 {
     parent::__construct();
     $this->team_id = JRequest::getVar('tid', 0, '', 'int');
     $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->limit2 = JRequest::getVar('jslimit2', 20, '', 'int');
     $this->limitstart2 = JRequest::getVar('page2', 1, '', 'int');
     $this->limitstart2 = intval($this->limitstart2) > 1 ? $this->limitstart2 : 1;
     $this->_lists['jscurtab'] = JRequest::getVar('jscurtab', 'etab_team', '', 'string');
     $this->sortfield = $this->mainframe->getUserStateFromRequest('com_joomsport.sortfield', 'sortfield', '', 'string');
     $this->sortdest = $this->mainframe->getUserStateFromRequest('com_joomsport.sortdest', 'sortdest', 0, 'string');
     $this->_lists['s_id'] = $this->s_id;
     //print_r($this->s_id);
     if (isset($_REQUEST['limitstart'])) {
         if ($_REQUEST['limitstart'] != 0) {
             $this->_lists['jscurtab'] = 'etab_match';
         }
     }
     $query = "SELECT t_name FROM #__bl_teams WHERE id = " . $this->team_id;
     $this->db->setQuery($query);
     $team_id = $this->db->loadResult();
     if (!$team_id) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #5
0
 function __construct()
 {
     parent::__construct();
     $Itemid = JRequest::getInt('Itemid');
     $this->title = JFactory::getDocument()->getTitle();
     $this->s_id = $this->mainframe->getUserStateFromRequest('com_joomsport.sidsel' . $Itemid, 'sidsel', -1, 'int');
     //print_r($sidsel);
     //if($this->s_id){
     $this->mainframe->setUserState('com_joomsport.sidsel' . $Itemid, -1);
     //}
     //echo $this->s_id;
     if ($this->s_id == '-1') {
         $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     }
     // Get the pagination request variables
     $this->limit = $this->mainframe->getUserStateFromRequest('com_joomsport.pl_jslimit', 'jslimit', 20, 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->sortfield = $this->mainframe->getUserStateFromRequest('com_joomsport.sortfield', 'sortfield', 'name', 'string');
     $this->sortdest = $this->mainframe->getUserStateFromRequest('com_joomsport.sortdest', 'sortdest', 0, 'string');
     //get tournament type
     if ($this->s_id) {
         $tourn = $this->getTournOpt($this->s_id);
         $this->t_single = $tourn->t_single;
         $this->t_type = 0;
     }
     $this->getPagination();
 }
Пример #6
0
 function __construct()
 {
     parent::__construct();
     $this->_user = JFactory::getUser();
     $this->title = JFactory::getDocument()->getTitle();
     $this->_enmd = 0;
     $this->sid = $this->mainframe->getUserStateFromRequest('com_joomsport.sid', 'sid', 0, 'int');
 }
Пример #7
0
 function __construct()
 {
     parent::__construct();
     $this->_user = JFactory::getUser();
     $this->_enmd = 0;
     $this->session = JFactory::getSession();
     $this->title = JFactory::getDocument()->getTitle();
 }
Пример #8
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->limit = $mainframe->getUserStateFromRequest('com_joomsport.tm_jslimit', 'jslimit', 20, 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->season_id = $mainframe->getUserStateFromRequest('com_joomsport.sid', 'sid', 0, 'int');
 }
Пример #9
0
 function __construct()
 {
     parent::__construct();
     $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     $this->_user = JFactory::getUser();
     if (!$this->s_id) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #10
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     // Get the pagination request variables
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart_venues', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $this->getPagination();
     $this->getData();
 }
Пример #11
0
 function __construct()
 {
     parent::__construct();
     $this->club_id = JRequest::getVar('id', 0, '', 'int');
     $this->title = JFactory::getDocument()->getTitle();
     $query = "SELECT c_name FROM #__bl_club WHERE id = " . $this->club_id;
     $this->db->setQuery($query);
     $club_id = $this->db->loadResult();
     if (!$club_id) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #12
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->title = JFactory::getDocument()->getTitle();
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->getPagination();
     $this->getData();
     $this->p_title = JText::_('BLFA_CLUBLIST');
     $this->_params = $this->JS_PageTitle($this->title ? $this->title : $this->p_title);
     $this->_lists["teams_season"] = $this->teamsToModer();
     $this->_lists["panel"] = $this->getePanel($this->_lists["teams_season"], 0, null, 0);
 }
Пример #13
0
 function __construct()
 {
     parent::__construct();
     $this->gr_id = JRequest::getVar('gr_id', 0, '', 'int');
     $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     $this->_lists["table_n"] = JRequest::getVar('tab_n', '', '', 'string');
     //print_r($this->_lists["table_n"]);
     $this->title = JFactory::getDocument()->getTitle();
     $query = "SELECT COUNT(*) FROM #__bl_seasons as s, #__bl_tournament as t WHERE t.published='1' AND s.published='1' AND t.id = s.t_id AND s.s_id = " . $this->s_id;
     $this->db->setQuery($query);
     if (!$this->s_id || !$this->db->loadResult()) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #14
0
 function __construct()
 {
     parent::__construct();
     $this->m_id = JRequest::getVar('id', 0, '', 'int');
     $this->title = JFactory::getDocument()->getTitle();
     $query = "SELECT COUNT(*) FROM #__bl_seasons as s, #__bl_tournament as t, #__bl_matchday as md, #__bl_match as m WHERE t.published='1' AND s.published='1' AND t.id = s.t_id AND s.s_id = md.s_id AND md.id=m.m_id AND m.id = '" . $this->m_id . "'";
     $this->db->setQuery($query);
     if (!$this->db->loadResult()) {
         $query = "SELECT COUNT(*) FROM   #__bl_matchday as md, #__bl_match as m WHERE md.s_id = '-1' AND md.id=m.m_id AND m.id = '" . $this->m_id . "'";
         $this->db->setQuery($query);
     }
     if (!$this->m_id or !$this->db->loadResult()) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
 }
Пример #15
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     // Get the pagination request variables
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = 0;
     if (!$mainframe->input->getInt('is_search')) {
         $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart_players', 'limitstart', 0, 'int');
     }
     $f_team = $this->mainframe->getUserStateFromRequest('com_joomsport.filter_team', 'f_team', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $this->getPagination($f_team);
     $this->getData($f_team);
     $this->getPTeamList($f_team);
 }
Пример #16
0
 function __construct($acl)
 {
     parent::__construct();
     $this->acl = $acl;
     $this->_lists['jscurtab'] = JRequest::getVar('jscurtab', 'etab_team', '', 'string');
     if ($this->acl == 1) {
         $cid = JRequest::getVar('cid', array(0), '', 'array');
         JArrayHelper::toInteger($cid, array(0));
         if ($cid[0]) {
             $is_id = $cid[0];
             $this->id = $is_id;
         }
         $s_id = JRequest::getVar('sid', 0, '', 'int');
         $this->season_id = $s_id;
     } else {
         $this->id = JRequest::getVar('tid', 0, '', 'int');
     }
 }
Пример #17
0
 function __construct()
 {
     parent::__construct();
     $this->s_id = $this->mainframe->getUserStateFromRequest('com_joomsport.sidselt', 'sidselt', -1, 'int');
     $this->title = JFactory::getDocument()->getTitle();
     //if($this->s_id){
     $this->mainframe->setUserState('com_joomsport.sidselt', -1);
     //}
     if ($this->s_id == '-1') {
         $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     }
     // Get the pagination request variables
     $this->limit = $this->mainframe->getUserStateFromRequest('com_joomsport.tl_jslimit', 'jslimit', 20, 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->getPagination();
     $this->getData();
 }
Пример #18
0
 function __construct($acl)
 {
     $this->acl = $acl;
     parent::__construct();
     if ($this->acl == 1) {
         $this->season_id = $this->mainframe->getUserStateFromRequest('com_joomsport.sid', 'sid', 0, 'int');
     } elseif ($this->acl == 2) {
         $this->season_id = $this->mainframe->getUserStateFromRequest('com_joomsport.moderseason', 'moderseason', 0, 'int');
     } elseif ($this->acl == 3) {
         $this->_user = JFactory::getUser();
         if ($this->_user->get('guest')) {
             $return_url = $_SERVER['REQUEST_URI'];
             $return_url = base64_encode($return_url);
             if (getVer() >= '1.6') {
                 $uopt = "com_users";
             } else {
                 $uopt = "com_user";
             }
             $return = 'index.php?option=' . $uopt . '&view=login&return=' . $return_url;
             // Redirect to a login form
             $this->mainframe->redirect($return, JText::_('BLFA_MSGLOGIN'));
         }
         $cid = JRequest::getVar('cid', array(0), '', 'array');
         JArrayHelper::toInteger($cid, array(0));
         if ($cid[0]) {
             $this->id = $cid[0];
         } else {
             JError::raiseError(403, JText::_('Access Forbidden'));
             return;
         }
     }
     if ($this->acl != 1) {
         $this->_lists['jsmr_mark_played'] = $this->getJS_Config('jsmr_mark_played');
         $this->_lists['jsmr_editresult_yours'] = $this->getJS_Config('jsmr_editresult_yours');
         $this->_lists['jsmr_editresult_opposite'] = $this->getJS_Config('jsmr_editresult_opposite');
         $this->_lists['jsmr_edit_playerevent_yours'] = $this->getJS_Config('jsmr_edit_playerevent_yours');
         $this->_lists['jsmr_edit_playerevent_opposite'] = $this->getJS_Config('jsmr_edit_playerevent_opposite');
         $this->_lists['jsmr_edit_matchevent_yours'] = $this->getJS_Config('jsmr_edit_matchevent_yours');
         $this->_lists['jsmr_edit_matchevent_opposite'] = $this->getJS_Config('jsmr_edit_matchevent_opposite');
         $this->_lists['jsmr_edit_squad_yours'] = $this->getJS_Config('jsmr_edit_squad_yours');
         $this->_lists['jsmr_edit_squad_opposite'] = $this->getJS_Config('jsmr_edit_squad_opposite');
     }
 }
Пример #19
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->m_id = JRequest::getVar('id', 0, '', 'int');
     $this->title = JFactory::getDocument()->getTitle();
     $query = "SELECT COUNT(*) FROM #__bl_seasons as s, #__bl_tournament as t, #__bl_matchday as md WHERE t.published='1' AND s.published='1' AND t.id = s.t_id AND s.s_id = md.s_id AND md.id='" . $this->m_id . "'";
     $this->db->setQuery($query);
     if (!$this->db->loadResult()) {
         $query = "SELECT COUNT(*) FROM   #__bl_matchday as md WHERE md.s_id = '-1' AND md.id = '" . $this->m_id . "'";
         $this->db->setQuery($query);
     }
     if (!$this->m_id || !$this->db->loadResult()) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     $this->limit = $mainframe->getUserStateFromRequest('com_joomsport.mdl_jslimit', 'jslimit', 20, 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
 }
Пример #20
0
 function __construct()
 {
     parent::__construct();
     JHtml::_('behavior.framework');
     $mainframe = JFactory::getApplication();
     $this->seas_id = JRequest::getVar('seas_id', null, 'get', 'int');
     $this->session = JFactory::getSession();
     if (!empty($this->seas_id) or $this->seas_id == '0') {
         $this->session->set('sid_pl', $this->seas_id);
     } else {
         $this->seas_id = $this->session->get('sid_pl');
     }
     // Get the pagination request variables
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $this->getPagination();
     $this->getData();
 }
Пример #21
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->title = JFactory::getDocument()->getTitle();
     $this->filtr_tourn = $mainframe->getUserStateFromRequest('global.list.filtr_tourn', 'filtr_tourn', 0, 'int');
     // Get the pagination request variables
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->oreg = JRequest::getVar('oreg', 0, '', 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->getPagination();
     $this->getData();
     $this->getnewData();
     $this->p_title = JText::_('BLFA_SEAS_LIST');
     $this->_params = $this->JS_PageTitle($this->title ? $this->title : $this->p_title);
     $this->_lists["teams_season"] = $this->teamsToModer();
     $this->_lists["panel"] = $this->getePanel($this->_lists["teams_season"], 0, null, 1);
     $this->getTourList();
 }
Пример #22
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     // Get the pagination request variables
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart_mdays', 'limitstart', 0, 'int');
     $season_id = $mainframe->getUserStateFromRequest('com_joomsport.s_id', 's_id', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $this->getPagination($season_id);
     $this->getData($season_id);
     $this->getSlist($season_id);
     $type_tourn = array();
     $type_tourn[] = JHTML::_('select.option', 0, JText::_('BLBE_GROUP'), 'id', 'name');
     if ($season_id != -1) {
         $type_tourn[] = JHTML::_('select.option', 1, JText::_('BLBE_KNOCK'), 'id', 'name');
         $type_tourn[] = JHTML::_('select.option', 2, JText::_('BLBE_DOUBLE'), 'id', 'name');
     }
     $this->_lists['t_type'] = JHTML::_('select.genericlist', $type_tourn, 't_type', 'class="inputbox" size="1"', 'id', 'name');
 }
Пример #23
0
 function __construct($acl)
 {
     $this->acl = $acl;
     parent::__construct();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     if ($cid[0]) {
         $is_id = $cid[0];
         $this->id = $is_id;
     }
     if ($this->acl == 1) {
         $s_id = JRequest::getVar('sid', 0, '', 'int');
         $this->season_id = $s_id;
     } else {
         $this->season_id = JRequest::getVar('moderseason', 0, 'int');
         //$this->season_id	= $this->mainframe->getUserStateFromRequest( 'com_joomsport.moderseason', 'moderseason', 0, 'int' );
     }
     if ($this->acl == 2) {
         $this->tid = JRequest::getVar('tid', 0, '', 'int');
     }
 }
Пример #24
0
 function __construct()
 {
     parent::__construct();
     $this->player_id = JRequest::getVar('id', 0, '', 'int');
     $this->s_id = JRequest::getVar('sid', 0, '', 'int');
     $this->limit = JRequest::getVar('jslimit', 20, '', 'int');
     $this->limitstart = JRequest::getVar('page', 1, '', 'int');
     $this->limitstart = intval($this->limitstart) > 1 ? $this->limitstart : 1;
     $this->_lists['jscurtab'] = JRequest::getVar('jscurtab', 'etab_player', '', 'string');
     $this->title = JFactory::getDocument()->getTitle();
     if (isset($_REQUEST['limitstart']) && $this->_lists['jscurtab'] == 'etab_player') {
         $this->_lists['jscurtab'] = 'etab_match';
     }
     $query = "SELECT first_name FROM #__bl_players WHERE id = " . $this->player_id;
     $this->db->setQuery($query);
     $player_id = $this->db->loadResult();
     if (!$player_id) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     $this->getPagination();
 }
Пример #25
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     JHtml::_('behavior.framework');
     // Get the pagination request variables
     $this->limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $this->limitstart = $mainframe->getUserStateFromRequest('com_joomsport.limitstart', 'limitstart', 0, 'int');
     $this->_season_id = $mainframe->getUserStateFromRequest('com_joomsport.s_id', 's_id', 0, 'int');
     $is_tourn = array();
     $javascript = 'onchange = "document.adminForm.submit();"';
     $query = "SELECT s.s_id as id, CONCAT(t.name,' ',s.s_name) as name FROM #__bl_tournament as t, #__bl_seasons as s WHERE t.published='1' AND s.published='1' AND s.t_id = t.id ORDER BY t.name, s.s_name";
     $this->db->setQuery($query);
     $tourn = $this->db->loadObjectList();
     $is_tourn[] = JHTML::_('select.option', 0, JText::_('BLBE_SELTOURNAMENT'), 'id', 'name');
     $is_tourn[] = JHTML::_('select.option', -1, JText::_('BLBE_FRIENDLYMATCH'), 'id', 'name');
     $tourn_is = array_merge($is_tourn, $tourn);
     $this->_lists['tourn'] = JHTML::_('select.genericlist', $tourn_is, 's_id', 'class="inputbox" size="1" ' . $javascript, 'id', 'name', $this->_season_id);
     // In case limit has been changed, adjust limitstart accordingly
     $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0;
     $this->getPagination();
     $this->getData();
 }
Пример #26
0
 function __construct()
 {
     parent::__construct();
     $this->getData();
 }
Пример #27
0
 function __construct()
 {
     parent::__construct();
     $mainframe = JFactory::getApplication();
     $this->getData();
 }
Пример #28
0
 function __construct()
 {
     parent::__construct();
 }
Пример #29
0
 function __construct($acl)
 {
     parent::__construct();
     $this->acl = $acl;
     $this->mid = JRequest::getVar('mid', 0, '', 'int');
     if ($this->acl == 2) {
         $this->tid = JRequest::getVar('tid', 0, '', 'int');
         $this->season_id = $this->mainframe->getUserStateFromRequest('com_joomsport.moderseason', 'moderseason', 0, 'int');
         $query = "SELECT CONCAT(tr.name,' ',s.s_name) as t_name,s.s_id as id FROM #__bl_season_teams as t,#__bl_seasons as s,#__bl_tournament as tr WHERE s.published=1 AND tr.id=s.t_id AND s.s_id=t.season_id AND t.team_id=" . $this->tid . " ORDER BY s.s_id desc";
         $this->db->setQuery($query);
         $seass = $this->db->loadObjectList();
         if (!$this->season_id) {
             $this->season_id = $seass[0]->id;
         }
         $isinseas = false;
         for ($j = 0; $j < count($seass); $j++) {
             if ($this->season_id == $seass[$j]->id) {
                 $isinseas = true;
             }
         }
         if ($this->season_id == -1) {
             $isinseas = true;
         }
         if (!$isinseas && count($seass)) {
             $this->season_id = $seass[0]->id;
         }
     } elseif ($this->acl == 3) {
         $this->_user = JFactory::getUser();
         if ($this->_user->get('guest')) {
             $return_url = $_SERVER['REQUEST_URI'];
             $return_url = base64_encode($return_url);
             if ($this->getVer() >= '1.6') {
                 $uopt = "com_users";
             } else {
                 $uopt = "com_user";
             }
             $return = 'index.php?option=' . $uopt . '&view=login&return=' . $return_url;
             // Redirect to a login form
             $this->mainframe->redirect($return, JText::_('BLFA_MSGLOGIN'));
         }
         $this->season_id = $this->mainframe->getUserStateFromRequest('com_joomsport.sid', 'sid', $this->season_id, 'int');
         $query = "SELECT s.s_id as id,CONCAT(tr.name,' ',s.s_name) as t_name" . " FROM #__bl_season_players as t,#__bl_players as p,#__bl_seasons as s,#__bl_tournament as tr" . " WHERE s.published=1 AND tr.id=s.t_id AND s.s_id=t.season_id AND t.player_id=p.id AND p.usr_id=" . $this->_user->id . " ORDER BY s.s_id desc";
         $this->db->setQuery($query);
         $seass = $this->db->loadObjectList();
         $error = $this->db->getErrorMsg();
         if ($error) {
             return JError::raiseError(500, $error);
         }
         if (!$this->season_id) {
             $this->season_id = $seass[0]->id;
         }
         $isinseas = false;
         for ($j = 0; $j < count($seass); $j++) {
             if ($this->season_id == $seass[$j]->id) {
                 $isinseas = true;
             }
         }
         if ($this->season_id == -1) {
             $isinseas = true;
         }
         if (!$isinseas && count($seass)) {
             $this->season_id = $seass[0]->id;
         }
     }
 }
Пример #30
0
    function HorKnViewDE($mxl, $match, $matchDE, $k_format, $Itemid, $t_single, $s_id)
    {
        if ($mxl) {
            $reslng = $mxl * 7 + 20;
        } else {
            $reslng = 120;
        }
        if ($reslng < 200) {
            $reslng = 120;
        }
        $models = new JSPRO_Models();
        $cfg = new stdClass();
        $cfg->wdth = $reslng + 70;
        $cfg->height = 60;
        $cfg->step = 70;
        $cfg->top_next = 50;
        $kl = '<br />';
        $zz = 2;
        $p = 0;
        $wdth = $cfg->wdth;
        $height = $cfg->height;
        $step = $cfg->step;
        $top_next = $cfg->top_next;
        $fid = $k_format;
        $kl .= '<div id="js-wrapper-top-' . $match[0]->m_id . '" class="js-wrapper-top">
            <div id="js-div-top-scroll-' . $match[0]->m_id . '" class="js-div-top-scroll" style="overflow: auto;"></div>
        </div>';
        $kl .= <<<JS

        <script>
            jQuery(function(){
                jQuery('#js-div-top-scroll-{$match[0]->m_id}').css({'width': jQuery('#js-wrapper-md-{$match[0]->m_id}')[0].scrollWidth+'px'});

                jQuery("#js-wrapper-top-{$match[0]->m_id}").scroll(function(){
                  jQuery("#js-wrapper-md-{$match[0]->m_id}").scrollLeft(jQuery("#js-wrapper-top-{$match[0]->m_id}").scrollLeft());
                });

                jQuery("#js-wrapper-md-{$match[0]->m_id}").scroll(function(){
                  jQuery("#js-wrapper-top-{$match[0]->m_id}").scrollLeft(jQuery("#js-wrapper-md-{$match[0]->m_id}").scrollLeft());
                });
            });
        </script>
JS;
        $kl .= '<div id="js-wrapper-md-' . $match[0]->m_id . '" class="combine-box-new" style="height:' . ($fid / 2 * ($height + $step + 50) + 360 + ($fid / 32 >= 1 ? 200 : 0)) . 'px;position:relative;overflow-x:auto;overflow-y:hidden;border:1px solid #ccc;">';
        $link = '';
        while (floor($fid / $zz) >= 1) {
            for ($i = 0; $i < floor($fid / $zz); $i++) {
                $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border:1px solid #aaa; border-left:0px; top:' . ($i * ($height + $step) + $top_next) . 'px; left:' . (20 + $p * $wdth) . 'px;"></div>';
                if ($t_single && isset($match[$i])) {
                    $match[$i]->home = $models->selectPlayerName($match[$i]);
                    $match[$i]->away = $models->selectPlayerName($match[$i], "fn2", "ln2", "nick2");
                }
                if ($p == 0) {
                    if (isset($match[$i]->hm_id)) {
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $match[$i]->hm_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $match[$i]->hm_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    $winclass = "";
                    if ($match[$i]->team2_id == -1 && $match[$i]->team1_id != -1 || $match[$i]->m_played && ($match[$i]->score1 > $match[$i]->score2 || $match[$i]->score1 == $match[$i]->score2 && $match[$i]->aet1 > $match[$i]->aet2 || $match[$i]->score1 == $match[$i]->score2 && $match[$i]->aet1 == $match[$i]->aet2 && $match[$i]->p_winner == $match[$i]->hm_id)) {
                        $winclass = " knwinner";
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 14) . 'px; left:' . (20 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($match[$i]->score1) && $match[$i]->m_played ? $match[$i]->score1 . ($match[$i]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $match[$i]->aet1 . "</abbr>)" : "") : '') . '</span>';
                    //if(isset($match[$i]->home)){
                    $kl .= $match[$i]->team1_id != -1 ? "<a href='" . $link . "' title='" . $match[$i]->home . "'>" . $match[$i]->home . "</a>" : JText::_('BLFA_BYE');
                    //}else{
                    //$kl .="&nbsp;";
                    //}
                    $kl .= '</div>';
                    if (isset($match[$i]->aw_id) && $match[$i]->team2_id != -1) {
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $match[$i]->aw_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $match[$i]->aw_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (($match[$i]->m_played || $match[$i]->team1_id == -1 && $match[$i]->team2_id != -1) && $winclass == '') {
                        $winclass = " knwinner";
                    } else {
                        $winclass = "";
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 13) . 'px; left:' . (20 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($match[$i]->score2) && $match[$i]->m_played ? $match[$i]->score2 . ($match[$i]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $match[$i]->aet2 . "</abbr>)" : "") : '') . '</span>';
                    !($kl .= $match[$i]->team2_id != -1 ? "<a href='" . $link . "' title='" . $match[$i]->away . "'>" . $match[$i]->away . "</a>" : JText::_('BLFA_BYE'));
                    //}
                    //else{
                    //$kl .="&nbsp;";
                    //}
                    $kl .= '</div>';
                    /////////////////
                    $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($match[$i]->id) ? $match[$i]->id : '') . '&amp;Itemid=' . $Itemid;
                    $kl .= isset($match[$i]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10) . 'px; left:' . (-20 + ($p + 1) * $wdth) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                    if ($match[$i]->m_played == 0 && $match[$i]->team1_id && $match[$i]->team2_id) {
                        $arr_prev_pl[$p][] = $i;
                    }
                    if (!$match[$i]->team1_id || !$match[$i]->team2_id) {
                        $vetks_null[$p][] = $i;
                    }
                } else {
                    $firstchld_ind = $i * 2 + $fid / 2 * ((pow(2, $p - 1) - 1) / pow(2, $p - 2));
                    //$match[$firstchld_ind]->winner = ($pln && $match[$firstchld_ind]->winner_nick)?($match[$firstchld_ind]->winner_nick):($match[$firstchld_ind]->winner);
                    //$match[$firstchld_ind+1]->winner = ($pln && $match[$firstchld_ind+1]->winner_nick)?$match[$firstchld_ind+1]->winner_nick:$match[$firstchld_ind+1]->winner;
                    $cur_ind = $i + $fid / 2 * ((pow(2, $p) - 1) / pow(2, $p - 1));
                    if ($t_single) {
                        if (isset($match[$firstchld_ind])) {
                            $match[$firstchld_ind]->home = $models->selectPlayerName($match[$firstchld_ind]);
                            $match[$firstchld_ind]->winner = $models->selectPlayerName($match[$firstchld_ind], "winner", "", "winner_nick");
                            $match[$firstchld_ind]->away = $models->selectPlayerName($match[$firstchld_ind], "fn2", "ln2", "nick2");
                        }
                        if (isset($match[$firstchld_ind + 1])) {
                            $match[$firstchld_ind + 1]->home = $models->selectPlayerName($match[$firstchld_ind + 1]);
                            $match[$firstchld_ind + 1]->away = $models->selectPlayerName($match[$firstchld_ind + 1], "fn2", "ln2", "nick2");
                            $match[$firstchld_ind + 1]->winner = $models->selectPlayerName($match[$firstchld_ind + 1], "winner", "", "winner_nick");
                        }
                    }
                    if (isset($match[$firstchld_ind])) {
                        if ($match[$firstchld_ind]->score1 == $match[$firstchld_ind]->score2 && isset($match[$firstchld_ind]->winner)) {
                            if ($match[$firstchld_ind]->aet1 > $match[$firstchld_ind]->aet2) {
                                $match[$firstchld_ind]->winner = $match[$firstchld_ind]->home;
                                $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team1_id;
                            } elseif ($match[$firstchld_ind]->aet1 < $match[$firstchld_ind]->aet2) {
                                $match[$firstchld_ind]->winner = $match[$firstchld_ind]->away;
                                $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team2_id;
                            } else {
                                if ($match[$firstchld_ind]->p_winner && $match[$firstchld_ind]->p_winner == $match[$firstchld_ind]->team1_id) {
                                    $match[$firstchld_ind]->winner = $match[$firstchld_ind]->home;
                                    $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team1_id;
                                } elseif ($match[$firstchld_ind]->p_winner && $match[$firstchld_ind]->p_winner == $match[$firstchld_ind]->team2_id) {
                                    $match[$firstchld_ind]->winner = $match[$firstchld_ind]->away;
                                    $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team2_id;
                                } else {
                                    $match[$firstchld_ind]->m_played = 0;
                                }
                            }
                        }
                    }
                    if (isset($match[$firstchld_ind + 1])) {
                        if ($match[$firstchld_ind + 1]->score1 == $match[$firstchld_ind + 1]->score2 && isset($match[$firstchld_ind + 1]->winner)) {
                            if ($match[$firstchld_ind + 1]->aet1 > $match[$firstchld_ind + 1]->aet2) {
                                $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->home;
                                $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team1_id;
                            } elseif ($match[$firstchld_ind + 1]->aet1 < $match[$firstchld_ind + 1]->aet2) {
                                $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->away;
                                $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team2_id;
                            } else {
                                if ($match[$firstchld_ind + 1]->p_winner && $match[$firstchld_ind + 1]->p_winner == $match[$firstchld_ind + 1]->team1_id) {
                                    $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->home;
                                    $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team1_id;
                                } elseif ($match[$firstchld_ind + 1]->p_winner && $match[$firstchld_ind + 1]->p_winner == $match[$firstchld_ind + 1]->team2_id) {
                                    $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->away;
                                    $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team2_id;
                                } else {
                                    $match[$firstchld_ind + 1]->m_played = 0;
                                }
                            }
                        }
                    }
                    if (isset($match[$firstchld_ind]) && $match[$firstchld_ind]->team1_id == -1 && $match[$firstchld_ind]->away) {
                        $match[$firstchld_ind]->winner = $match[$firstchld_ind]->away;
                        $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team2_id;
                        $match[$firstchld_ind]->m_played = 1;
                    }
                    if (isset($match[$firstchld_ind]) && $match[$firstchld_ind]->team2_id == -1 && $match[$firstchld_ind]->home) {
                        $match[$firstchld_ind]->winner = $match[$firstchld_ind]->home;
                        $match[$firstchld_ind]->winnerid = $match[$firstchld_ind]->team1_id;
                        $match[$firstchld_ind]->m_played = 1;
                    }
                    if (isset($match[$firstchld_ind + 1]) && $match[$firstchld_ind + 1]->team1_id == -1 && $match[$firstchld_ind + 1]->away) {
                        $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->away;
                        $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team2_id;
                        $match[$firstchld_ind + 1]->m_played = 1;
                    }
                    if (isset($match[$firstchld_ind + 1]) && $match[$firstchld_ind + 1]->team2_id == -1 && $match[$firstchld_ind + 1]->home) {
                        $match[$firstchld_ind + 1]->winner = $match[$firstchld_ind + 1]->home;
                        $match[$firstchld_ind + 1]->winnerid = $match[$firstchld_ind + 1]->team1_id;
                        $match[$firstchld_ind + 1]->m_played = 1;
                    }
                    if (isset($match[$firstchld_ind]) && $match[$firstchld_ind]->team1_id == -1 && $match[$firstchld_ind]->team2_id == -1) {
                        $match[$firstchld_ind]->winner = JText::_("BLFA_BYE");
                        $match[$firstchld_ind]->winnerid = -1;
                        $match[$firstchld_ind]->m_played = 1;
                    }
                    if (isset($match[$firstchld_ind + 1]) && $match[$firstchld_ind + 1]->team1_id == -1 && $match[$firstchld_ind + 1]->team2_id == -1) {
                        $match[$firstchld_ind + 1]->winner = JText::_("BLFA_BYE");
                        $match[$firstchld_ind + 1]->winnerid = -1;
                        $match[$firstchld_ind + 1]->m_played = 1;
                    }
                    $winclass = "";
                    if (isset($match[$cur_ind]) && ($match[$cur_ind]->team2_id == -1 && $match[$cur_ind]->team1_id != -1 || $match[$cur_ind]->m_played && ($match[$cur_ind]->score1 > $match[$cur_ind]->score2 || $match[$cur_ind]->score1 == $match[$cur_ind]->score2 && $match[$cur_ind]->aet1 > $match[$cur_ind]->aet2 || $match[$cur_ind]->score1 == $match[$cur_ind]->score2 && $match[$cur_ind]->aet1 == $match[$cur_ind]->aet2 && $match[$cur_ind]->p_winner == $match[$cur_ind]->hm_id))) {
                        $winclass = " knwinner";
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 15) . 'px; left:' . (25 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($match[$cur_ind]->score1) && $match[$cur_ind]->m_played ? $match[$cur_ind]->score1 . ($match[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $match[$cur_ind]->aet1 . "</abbr>)" : "") : "") . '</span>';
                    if (isset($match[$firstchld_ind]->winnerid)) {
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $match[$firstchld_ind]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $match[$firstchld_ind]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (isset($match[$firstchld_ind]->winner) && $match[$firstchld_ind]->m_played) {
                        $kl .= $match[$firstchld_ind]->winner != JText::_("BLFA_BYE") ? "<a href='" . $link . "' title='" . $match[$firstchld_ind]->winner . "'>" . $match[$firstchld_ind]->winner . "</a>" : $match[$firstchld_ind]->winner;
                    }
                    //$kl .= (isset($match[$firstchld_ind]->winner) && $match[$firstchld_ind]->m_played)?("<a href='".$link."' title='".$match[$firstchld_ind]->winner."'>".$match[$firstchld_ind]->winner."</a>"):"";
                    $kl .= '</div>';
                    if (isset($match[$cur_ind]) && ($match[$cur_ind]->m_played || $match[$cur_ind]->team1_id == -1 && $match[$cur_ind]->team2_id != -1) && $winclass == '') {
                        $winclass = " knwinner";
                    } else {
                        $winclass = "";
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 15) . 'px; left:' . (25 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($match[$cur_ind]->score2) && $match[$cur_ind]->m_played ? $match[$cur_ind]->score2 . ($match[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $match[$cur_ind]->aet2 . "</abbr>)" : "") : "") . '</span>';
                    if (isset($match[$firstchld_ind + 1]->winnerid)) {
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $match[$firstchld_ind + 1]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $match[$firstchld_ind + 1]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (isset($match[$firstchld_ind + 1]->winner) && $match[$firstchld_ind + 1]->m_played) {
                        $kl .= $match[$firstchld_ind + 1]->winner != JText::_("BLFA_BYE") ? "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->winner . "'>" . $match[$firstchld_ind + 1]->winner . "</a>" : $match[$firstchld_ind + 1]->winner;
                    }
                    //$kl .= (isset($match[$firstchld_ind + 1]->winner) && $match[$firstchld_ind + 1]->m_played)?("<a href='".$link."' title='".$match[$firstchld_ind+1]->winner."'>".$match[$firstchld_ind+1]->winner."</a>"):"";
                    $kl .= '</div>';
                    $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($match[$cur_ind]->id) ? $match[$cur_ind]->id : '');
                    $kl .= isset($match[$cur_ind]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10) . 'px; left:' . (-20 + ($p + 1) * $wdth) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                }
            }
            $top_next += $height / 2;
            $height = $height + $step;
            $step = $height;
            $zz *= 2;
            $p++;
        }
        $winmd_id = $fid - 2;
        $wiinn = '';
        $w_st = $p != 2 ? 200 * ($p - 2) : 0;
        $h_st = 60 * ($height / 240);
        $res = $p == 4 ? 15 : ($p == 5 ? 315 : ($p == 6 ? 735 : 0));
        if ($t_single) {
            if (isset($match[$winmd_id])) {
                $match[$winmd_id]->winner = $models->selectPlayerName($match[$winmd_id], "winner", "", "winner_nick");
            }
        }
        //if(isset($match[$winmd_id]->winner) && $match[$winmd_id]->winner && $match[$winmd_id]->score1 != $match[$winmd_id]->score2 && $match[$winmd_id]->m_played)
        //{
        $link_id = '';
        if (isset($match[$winmd_id]->p_winner) && !$match[$winmd_id]->is_extra && !$match[$winmd_id]->p_winner) {
            $link_id = $match[$winmd_id]->winnerid;
        }
        if (isset($match[$winmd_id]->score1) && $match[$winmd_id]->score1 == $match[$winmd_id]->score2 && $match[$winmd_id]->aet1 != $match[$winmd_id]->aet2) {
            $link_id = $match[$winmd_id]->aet1 > $match[$winmd_id]->aet2 ? $match[$winmd_id]->team1_id : $match[$winmd_id]->team2_id;
        }
        if (!empty($match[$winmd_id]->p_winner)) {
            $link_id = $match[$winmd_id]->p_winner == $match[$winmd_id]->team1_id ? $match[$winmd_id]->team1_id : $match[$winmd_id]->team2_id;
        }
        if ($t_single) {
            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        } else {
            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        }
        //print_r($match[$winmd_id+1]); +1 -- delete
        if (isset($match[$winmd_id]->winner) && $match[$winmd_id]->winner && $match[$winmd_id]->score1 != $match[$winmd_id]->score2 && $match[$winmd_id]->m_played) {
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score1) && $match[$winmd_id]->m_played && isset($match[$winmd_id + 1]->score1) ? $match[$winmd_id + 1]->score1 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet1 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $match[$winmd_id]->winner . "'>" . $match[$winmd_id]->winner . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        if (isset($match[$winmd_id]->score1) && $match[$winmd_id]->score1 == $match[$winmd_id]->score2 && $match[$winmd_id]->aet1 != $match[$winmd_id]->aet2) {
            $win_player = $match[$winmd_id]->aet1 > $match[$winmd_id]->aet2 ? $match[$winmd_id]->home : $match[$winmd_id]->away;
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score1) && $match[$winmd_id]->m_played ? $match[$winmd_id]->score1 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet1 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $win_player . "'>" . $win_player . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        if (!empty($match[$winmd_id]->p_winner)) {
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score1) && $match[$winmd_id]->m_played ? $match[$winmd_id]->score1 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet1 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $match[$winmd_id]->winner . "'>" . $match[$winmd_id]->winner . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        //}
        if ($fid) {
            $kl .= '<div style="position:absolute;width:' . ($wdth + 30 + $w_st) . 'px;height:' . ($height - $h_st + 30 * ($fid / 4) - ($fid / 4 == 1 ? 15 : 25 * ($fid / 2)) - $res) . 'px; border-top:1px solid #aaa;border-right:1px solid #aaa; top:' . $top_next . 'px; left:' . (20 + $p * $wdth) . 'px;">' . $wiinn . '</div>';
        }
        //$kl .=  '</div>';
        //if($mxl){
        //    $reslng = ($mxl)*7+20;
        //}else{
        //   $reslng = 120;
        //}
        //if($reslng<120) $reslng=120;
        $cfg = new stdClass();
        $cfg->wdth = $reslng + 70;
        $cfg->height = 60;
        $cfg->step = 70;
        $cfg->top_next = 50;
        $wdth = $cfg->wdth;
        $height = $cfg->height;
        $step = $cfg->step;
        $top_next = $cfg->top_next;
        $zz = 4;
        $fid = $k_format;
        $p_last = $p + 1;
        $p = 0;
        $top = 0;
        $p_step = 0;
        $top_step = 60;
        $all_step = 120 * ($fid / 2) + 50 * ($fid / 4 > 4 ? $fid / 8 : $fid / 4);
        $step_block = $fid / $zz > 2 ? 200 : 0;
        $strafe = 0;
        $first = 0;
        $marg = 30;
        $marg1 = 100;
        $m = -1;
        if ($t_single) {
            foreach ($matchDE as $i => $tmp) {
                $matchDE[$i]->home = $models->selectPlayerName($matchDE[$i], 'first_name', 'last_name', 'nick');
                $matchDE[$i]->away = $models->selectPlayerName($matchDE[$i], "fn2", "ln2", "nick2");
                $matchDE[$i]->winner = $matchDE[$i]->hm_id == $matchDE[$i]->winnerid ? $models->selectPlayerName($matchDE[$i], 'first_name', 'last_name', 'nick') : $models->selectPlayerName($matchDE[$i], "fn2", "ln2", "nick2");
                $matchDE[$i]->looser = $matchDE[$i]->hm_id == $matchDE[$i]->looserid ? $models->selectPlayerName($match[$i], 'first_name', 'last_name', 'nick') : $models->selectPlayerName($matchDE[$i], "fn2", "ln2", "nick2");
            }
            foreach ($match as $i => $tmp) {
                $match[$i]->home = $models->selectPlayerName($match[$i], 'first_name', 'last_name', 'nick');
                $match[$i]->away = $models->selectPlayerName($match[$i], "fn2", "ln2", "nick2");
                $match[$i]->winner = $match[$i]->hm_id == $match[$i]->winnerid ? $models->selectPlayerName($match[$i], 'first_name', 'last_name', 'nick') : $models->selectPlayerName($match[$i], "fn2", "ln2", "nick2");
                $match[$i]->looser = $match[$i]->hm_id == $match[$i]->looserid ? $models->selectPlayerName($match[$i], 'first_name', 'last_name', 'nick') : $models->selectPlayerName($match[$i], "fn2", "ln2", "nick2");
            }
        }
        while (floor($fid / $zz) >= 1) {
            $p_step = $p >= 2 ? $p_step + 1 : $p_step + 0;
            $strafe++;
            if ($p == 3 || $p == 4) {
                $top = $p == 3 ? $top + 60 : $top + 210;
            }
            $top_step = $p == 0 || $p == 1 ? $top_step + 0 : $top_step + 60;
            for ($i = 0; $i < floor($fid / $zz); $i++) {
                ////
                if ($t_single && isset($match[$i])) {
                    $match[$i]->home = $models->selectPlayerName($match[$i]);
                    $match[$i]->away = $models->selectPlayerName($match[$i], "fn2", "ln2", "nick2");
                }
                ////
                if ($p == 0) {
                    $firstchld_ind = $i * 2 + $fid / 2 * ((pow(2, $p) - 1) / pow(2, $p - 1));
                    $cur_ind = $i + $fid / 2 * ((pow(2, $p) - 1) / pow(2, $p - 1));
                    if (isset($matchDE[$cur_ind])) {
                        $matchDE[$cur_ind] = $this->getMBy($matchDE[$cur_ind]);
                    }
                    if (isset($match[$firstchld_ind])) {
                        $match[$firstchld_ind] = $this->getMBy($match[$firstchld_ind]);
                    }
                    $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border:1px solid #aaa; border-left:0px; top:' . ($i * ($height + $step) + $top_next + $all_step) . 'px; left:' . (20 + $p * $wdth) . 'px;"></div>';
                    ///1
                    if (isset($match[$firstchld_ind]->hm_id)) {
                        if (!$match[$firstchld_ind]->is_extra && !$match[$firstchld_ind]->p_winner && $match[$firstchld_ind]->score1 != $match[$firstchld_ind]->score2) {
                            $link_id = $match[$firstchld_ind]->looserid;
                        }
                        if ($match[$firstchld_ind]->score1 == $match[$firstchld_ind]->score2 && $match[$firstchld_ind]->aet1 != $match[$firstchld_ind]->aet2) {
                            $link_id = $match[$firstchld_ind]->aet1 > $match[$firstchld_ind]->aet2 ? $match[$firstchld_ind]->team2_id : $match[$firstchld_ind]->team1_id;
                        }
                        if ($match[$firstchld_ind]->p_winner) {
                            $link_id = $match[$firstchld_ind]->p_winner == $match[$firstchld_ind]->team1_id ? $match[$firstchld_ind]->team2_id : $match[$firstchld_ind]->team1_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    $winclass = "";
                    ////----
                    if (isset($matchDE[$cur_ind])) {
                        if ($matchDE[$cur_ind]->team2_id == -1 && $matchDE[$cur_ind]->team1_id != -1 || $matchDE[$cur_ind]->m_played && ($matchDE[$cur_ind]->score1 > $matchDE[$cur_ind]->score2 || $matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 > $matchDE[$cur_ind]->aet2 || $matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 == $matchDE[$cur_ind]->aet2 && $matchDE[$cur_ind]->p_winner == $matchDE[$cur_ind]->hm_id)) {
                            $winclass = " knwinner";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 20 + $all_step) . 'px; left:' . (20 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind]->score1) && $matchDE[$cur_ind]->m_played ? $matchDE[$cur_ind]->score1 . ($matchDE[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind]->aet1 . "</abbr>)" : "") : '') . '</span>';
                    //if($match[$firstchld_ind]->m_played){
                    // $kl .= ($match[$firstchld_ind]->team1_id != -1 && $match[$firstchld_ind]->looser != JText::_('BLFA_BYE'))?("<a href='".$link."' title='".$match[$firstchld_ind]->looser."'>".$match[$firstchld_ind]->looser."</a>"):(JText::_('BLFA_BYE'));
                    //}
                    if (!$match[$firstchld_ind]->is_extra && $match[$firstchld_ind]->m_played && !$match[$firstchld_ind]->p_winner && $match[$firstchld_ind]->score1 != $match[$firstchld_ind]->score2 || ($match[$firstchld_ind]->team1_id == -1 || $match[$firstchld_ind]->team2_id == -1)) {
                        $kl .= $match[$firstchld_ind]->team1_id != -1 && $match[$firstchld_ind]->looser != JText::_('BLFA_BYE') ? "<a href='" . $link . "' title='" . $match[$firstchld_ind]->looser . "'>" . $match[$firstchld_ind]->looser . "</a>" : JText::_('BLFA_BYE');
                    }
                    if ($match[$firstchld_ind]->score1 == $match[$firstchld_ind]->score2 && $match[$firstchld_ind]->aet1 != $match[$firstchld_ind]->aet2) {
                        $kl .= $match[$firstchld_ind]->aet1 > $match[$firstchld_ind]->aet2 ? "<a href='" . $link . "' title='" . $match[$firstchld_ind]->away . "'>" . $match[$firstchld_ind]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind]->home . "'>" . $match[$firstchld_ind]->home . "</a>";
                    }
                    if ($match[$firstchld_ind]->p_winner) {
                        $kl .= $match[$firstchld_ind]->p_winner == $match[$firstchld_ind]->team1_id ? "<a href='" . $link . "' title='" . $match[$firstchld_ind]->away . "'>" . $match[$firstchld_ind]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind]->home . "'>" . $match[$firstchld_ind]->home . "</a>";
                    }
                    $kl .= '</div>';
                    ////2
                    if (isset($match[$firstchld_ind + 1]->aw_id) && $match[$firstchld_ind + 1]->team2_id != -1) {
                        if (!$match[$firstchld_ind + 1]->is_extra && !$match[$firstchld_ind + 1]->p_winner && $match[$firstchld_ind + 1]->score1 != $match[$firstchld_ind + 1]->score2) {
                            $link_id = $match[$firstchld_ind + 1]->looserid;
                        }
                        if ($match[$firstchld_ind + 1]->score1 == $match[$firstchld_ind + 1]->score2 && $match[$firstchld_ind + 1]->aet1 != $match[$firstchld_ind + 1]->aet2) {
                            $link_id = $match[$firstchld_ind + 1]->aet1 > $match[$firstchld_ind + 1]->aet2 ? $match[$firstchld_ind + 1]->team2_id : $match[$firstchld_ind + 1]->team1_id;
                        }
                        if ($match[$firstchld_ind + 1]->p_winner) {
                            $link_id = $match[$firstchld_ind + 1]->p_winner == $match[$firstchld_ind + 1]->team1_id ? $match[$firstchld_ind + 1]->team2_id : $match[$firstchld_ind + 1]->team1_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (isset($matchDE[$cur_ind])) {
                        if (($matchDE[$cur_ind]->m_played || $matchDE[$cur_ind]->team1_id == -1 && $matchDE[$cur_ind]->team2_id != -1) && $winclass == '') {
                            $winclass = " knwinner";
                        } else {
                            $winclass = "";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 7 + $all_step) . 'px; left:' . (20 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind]->score2) && $matchDE[$cur_ind]->m_played ? $matchDE[$cur_ind]->score2 . ($matchDE[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind]->aet2 . "</abbr>)" : "") : '') . '</span>';
                    if (!$match[$firstchld_ind + 1]->is_extra && !$match[$firstchld_ind + 1]->p_winner && $match[$firstchld_ind + 1]->score1 != $match[$firstchld_ind + 1]->score2 || ($match[$firstchld_ind + 1]->team1_id == -1 || $match[$firstchld_ind + 1]->team2_id == -1)) {
                        $kl .= $match[$firstchld_ind + 1]->looser != JText::_('BLFA_BYE') && ($match[$firstchld_ind + 1]->team1_id != -1 && $match[$firstchld_ind + 1]->team2_id != -1) ? "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->looser . "'>" . $match[$firstchld_ind + 1]->looser . "</a>" : JText::_('BLFA_BYE');
                    }
                    if ($match[$firstchld_ind + 1]->score1 == $match[$firstchld_ind + 1]->score2 && $match[$firstchld_ind + 1]->aet1 != $match[$firstchld_ind + 1]->aet2) {
                        $kl .= $match[$firstchld_ind + 1]->aet1 > $match[$firstchld_ind + 1]->aet2 ? "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->away . "'>" . $match[$firstchld_ind + 1]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->home . "'>" . $match[$firstchld_ind + 1]->home . "</a>";
                    }
                    if ($match[$firstchld_ind + 1]->p_winner) {
                        $kl .= $match[$firstchld_ind + 1]->p_winner == $match[$firstchld_ind + 1]->team1_id ? "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->away . "'>" . $match[$firstchld_ind + 1]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind + 1]->home . "'>" . $match[$firstchld_ind + 1]->home . "</a>";
                    }
                    $kl .= '</div>';
                    $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($matchDE[$cur_ind]->id) ? $matchDE[$cur_ind]->id : '') . '&amp;Itemid=' . $Itemid;
                    $kl .= isset($matchDE[$cur_ind]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10 + $all_step) . 'px; left:' . (30 + ($p + 1) * $wdth - 50) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                    ////////second
                    if ($fid / 4 != 1) {
                        $firstchld_indDE = $fid / 4 + $i + (floor($fid / 8) == 1 ? 0 : floor($fid / 8));
                        $first = $fid % 16 == 0 && $fid / 16 != 1 ? $fid / 16 : 0;
                        if ($first == 4) {
                            $first = 6;
                        }
                        $tm_step = ceil($fid / 16);
                        $cur_indDE = $cur_ind + floor($fid / 8) + floor($fid / 16);
                    } else {
                        $cur_indDE = $cur_ind;
                        $firstchld_indDE = $firstchld_ind;
                        $tm_step = 1;
                    }
                    $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border:1px solid #aaa; border-left:0px; top:' . ($i * ($height + $step) + $top_next + $all_step - 30) . 'px; left:' . (220 + $p * $wdth) . 'px;"></div>';
                    ///1
                    if (isset($match[$firstchld_indDE + 2 + $first]->aw_id) && $match[$firstchld_indDE + 2 + $first]->team2_id != -1) {
                        if (!$match[$firstchld_indDE + 2 + $first]->is_extra && !$match[$firstchld_indDE + 2 + $first]->p_winner && $match[$firstchld_indDE + 2 + $first]->score1 != $match[$firstchld_indDE + 2 + $first]->score2) {
                            $link_id = $match[$firstchld_indDE + 2 + $first]->looserid;
                        }
                        if ($match[$firstchld_indDE + 2 + $first]->score1 == $match[$firstchld_indDE + 2 + $first]->score2 && $match[$firstchld_indDE + 2 + $first]->aet1 != $match[$firstchld_indDE + 2 + $first]->aet2) {
                            $link_id = $match[$firstchld_indDE + 2 + $first]->aet1 > $match[$firstchld_indDE + 2 + $first]->aet2 ? $match[$firstchld_indDE + 2 + $first]->team2_id : $match[$firstchld_indDE + 2 + $first]->team1_id;
                        }
                        if ($match[$firstchld_indDE + 2 + $first]->p_winner) {
                            $link_id = $match[$firstchld_indDE + 2 + $first]->p_winner == $match[$firstchld_indDE + 2 + $first]->team1_id ? $match[$firstchld_indDE + 2 + $first]->team2_id : $match[$firstchld_indDE + 2 + $first]->team1_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (isset($matchDE[$cur_indDE + $tm_step])) {
                        if ($matchDE[$cur_indDE + $tm_step]->score1 > $matchDE[$cur_indDE + $tm_step]->score2 || ($matchDE[$cur_indDE + $tm_step]->m_played || $matchDE[$cur_indDE + $tm_step]->team1_id == -1 && $matchDE[$cur_indDE + $tm_step]->team2_id != -1) && $winclass == '') {
                            $winclass = " knwinner";
                        } else {
                            $winclass = "";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 20 + $all_step - 30) . 'px; left:' . (220 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_indDE + $tm_step]->score2) && $matchDE[$cur_indDE + $tm_step]->m_played ? $matchDE[$cur_indDE + $tm_step]->score1 . ($matchDE[$cur_indDE + $tm_step]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_indDE + $tm_step]->aet2 . "</abbr>)" : "") : '') . '</span>';
                    //if(isset($match[$firstchld_indDE + 2+$first])){
                    //$kl .= ($match[$firstchld_indDE + 2+$first]->team2_id != -1)?("<a href='".$link."' title='".$match[$firstchld_indDE + 2+$first]->looser."'>".(($match[$firstchld_indDE + 2+$first]->m_played)?$match[$firstchld_indDE + 2+$first]->looser:'')."</a>"):(JText::_('BLFA_BYE'));
                    //}
                    if (isset($match[$firstchld_indDE + 2 + $first]->p_winner) && !$match[$firstchld_indDE + 2 + $first]->is_extra && !$match[$firstchld_indDE + 2 + $first]->p_winner && $match[$firstchld_indDE + 2 + $first]->score1 != $match[$firstchld_indDE + 2 + $first]->score2) {
                        $kl .= $match[$firstchld_indDE + 2 + $first]->team1_id != -1 && $match[$firstchld_indDE + 2 + $first]->looser != JText::_('BLFA_BYE') ? "<a href='" . $link . "' title='" . $match[$firstchld_indDE + 2 + $first]->looser . "'>" . $match[$firstchld_indDE + 2 + $first]->looser . "</a>" : JText::_('BLFA_BYE');
                    }
                    if (isset($match[$firstchld_indDE + 2 + $first]->score1) && $match[$firstchld_indDE + 2 + $first]->score1 == $match[$firstchld_indDE + 2 + $first]->score2 && $match[$firstchld_indDE + 2 + $first]->aet1 != $match[$firstchld_indDE + 2 + $first]->aet2) {
                        $kl .= $match[$firstchld_indDE + 2 + $first]->aet1 > $match[$firstchld_indDE + 2 + $first]->aet2 ? "<a href='" . $link . "' title='" . $match[$firstchld_indDE + 2 + $first]->away . "'>" . $match[$firstchld_indDE + 2 + $first]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_indDE + 2 + $first]->home . "'>" . $match[$firstchld_indDE + 2 + $first]->home . "</a>";
                    }
                    if (!empty($match[$firstchld_indDE + 2 + $first]->p_winner)) {
                        $kl .= $match[$firstchld_indDE + 2 + $first]->p_winner == $match[$firstchld_indDE + 2 + $first]->team1_id ? "<a href='" . $link . "' title='" . $match[$firstchld_indDE + 2 + $first]->away . "'>" . $match[$firstchld_indDE + 2 + $first]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_indDE + 2 + $first]->home . "'>" . $match[$firstchld_indDE + 2 + $first]->home . "</a>";
                    }
                    $kl .= '</div>';
                    ///2
                    if (isset($matchDE[$cur_ind]->aw_id) && $matchDE[$cur_ind]->team2_id != -1) {
                        //$link_id = '';
                        if (!$matchDE[$cur_ind]->is_extra && !$matchDE[$cur_ind]->p_winner && $matchDE[$cur_ind]->score1 != $matchDE[$cur_ind]->score2 || ($matchDE[$cur_ind]->team1_id == -1 || $matchDE[$cur_ind]->team2_id == -1)) {
                            $link_id = $match[$firstchld_ind]->team1_id != -1 || $match[$firstchld_ind]->team2_id != -1 ? $matchDE[$cur_ind]->winnerid : '-1';
                        }
                        if ($matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 != $matchDE[$cur_ind]->aet2) {
                            $link_id = $matchDE[$cur_ind]->aet1 > $matchDE[$cur_ind]->aet2 ? $matchDE[$cur_ind]->team1_id : $matchDE[$cur_ind]->team2_id;
                        }
                        if ($matchDE[$cur_ind]->p_winner) {
                            $link_id = $matchDE[$cur_ind]->p_winner == $matchDE[$cur_ind]->team1_id ? $matchDE[$cur_ind]->team1_id : $matchDE[$cur_ind]->team2_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    $winclass = "";
                    if (isset($matchDE[$cur_indDE + $tm_step])) {
                        if ($matchDE[$cur_indDE + $tm_step]->score1 < $matchDE[$cur_indDE + $tm_step]->score2 || $matchDE[$cur_indDE + $tm_step]->team2_id == -1 && $matchDE[$cur_indDE + $tm_step]->team1_id != -1 || $matchDE[$cur_indDE + $tm_step]->m_played && ($matchDE[$cur_indDE + $tm_step]->score1 == $matchDE[$cur_indDE + $tm_step]->score2 && $matchDE[$cur_indDE + $tm_step]->aet1 > $matchDE[$cur_indDE + $tm_step]->aet2 || $matchDE[$cur_indDE + $tm_step]->score1 == $matchDE[$cur_indDE + $tm_step]->score2 && $matchDE[$cur_indDE + $tm_step]->aet1 == $matchDE[$cur_indDE + $tm_step]->aet2 && $matchDE[$cur_indDE + $tm_step]->p_winner == $matchDE[$cur_indDE + $tm_step]->hm_id)) {
                            $winclass = " knwinner";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 10 + $all_step - 30) . 'px; left:' . (220 + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_indDE + $tm_step]->score1) && $matchDE[$cur_indDE + $tm_step]->m_played ? $matchDE[$cur_indDE + $tm_step]->score2 . ($matchDE[$cur_indDE + $tm_step]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_indDE + $tm_step]->aet1 . "</abbr>)" : "") : '') . '</span>';
                    //if(isset($match[$firstchld_ind]) && isset($matchDE[$cur_ind])){ //////----
                    //$kl .= ($match[$firstchld_ind]->team1_id != -1)?("<a href='".$link."' title='".$matchDE[$cur_ind]->winner."'>".(($matchDE[$cur_ind]->m_played)?$matchDE[$cur_ind]->winner:'')."</a>"):(JText::_('BLFA_BYE'));
                    //}
                    //print_r($match[$cur_ind]);
                    if (isset($matchDE[$cur_ind]->is_extra)) {
                        if (!$matchDE[$cur_ind]->is_extra && !$matchDE[$cur_ind]->p_winner && $matchDE[$cur_ind]->score1 != $matchDE[$cur_ind]->score2 || ($matchDE[$cur_ind]->team1_id == -1 || $matchDE[$cur_ind]->team2_id == -1)) {
                            $kl .= $match[$firstchld_ind]->team1_id != -1 || $match[$firstchld_ind]->team2_id != -1 ? "<a href='" . $link . "' title='" . $matchDE[$cur_ind]->winner . "'>" . ($matchDE[$cur_ind]->m_played ? $matchDE[$cur_ind]->winner : '') . "</a>" : JText::_('BLFA_BYE');
                        }
                    }
                    if (isset($matchDE[$cur_ind]->score1) && $matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 != $matchDE[$cur_ind]->aet2) {
                        $kl .= $matchDE[$cur_ind]->aet1 > $matchDE[$cur_ind]->aet2 ? "<a href='" . $link . "' title='" . $matchDE[$cur_ind]->home . "'>" . $matchDE[$cur_ind]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$cur_ind]->away . "'>" . $matchDE[$cur_ind]->away . "</a>";
                    }
                    if (!empty($matchDE[$cur_ind]->p_winner)) {
                        $kl .= $matchDE[$cur_ind]->p_winner == $matchDE[$cur_ind]->team1_id ? "<a href='" . $link . "' title='" . $matchDE[$cur_ind]->home . "'>" . $matchDE[$cur_ind]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$cur_ind]->away . "'>" . $matchDE[$cur_ind]->away . "</a>";
                    }
                    $kl .= '</div>';
                    $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($matchDE[$cur_indDE + $tm_step]->id) ? $matchDE[$cur_indDE + $tm_step]->id : '') . '&amp;Itemid=' . $Itemid;
                    $kl .= isset($matchDE[$cur_ind]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10 + $all_step - 30) . 'px; left:' . (-5 + ($p + 1) * $wdth + 180) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                } else {
                    $firstchld_ind = $i * 2 + $fid / 4 * ((pow(2, $p - 1) - 1) / pow(2, $p - 2));
                    $cur_ind = $i + $fid / 2 * ((pow(2, $p) - 1) / pow(2, $p - 1));
                    $firstchld_ind += floor($fid / 8) == 1 ? 0 : floor($fid / 8);
                    $step_block1 = $p == 3 || $p == 4 ? $step_block + ($p == 4 ? 400 : 200) : 0;
                    if ($m != $p) {
                        $marg *= $p;
                        $marg1 *= $p;
                        if ($p > 1) {
                            $marg = $marg + $height / 8 - ($p == 3 ? 30 * $p : ($p == 4 ? 90 * $p + 265 : 0));
                            $marg1 = $marg1 + $height / 8 - ($p == 3 ? 50 * $p + 98 : ($p == 4 ? 200 * $p + 350 : 0));
                            //$p==3?$marg1 = $marg1-(75):"";
                            //$p==4?$marg1 = $marg1-(375):"";
                        }
                    }
                    $m = $p;
                    $f_num = $fid / 8 > 2 ? $fid / 8 : 2;
                    if ($fid == 64 && $strafe == 4) {
                        $f_num += 4;
                    }
                    $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border:1px solid #aaa; border-left:0px; top:' . ($i * ($height + $step) + $top_next + $all_step - $marg) . 'px; left:' . (220 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;"></div>';
                    if (isset($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->hm_id)) {
                        if (!$matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->is_extra && !$matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner && $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 != $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2) {
                            $link_id = $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winnerid;
                        }
                        if ($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 == $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2 && $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 != $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2) {
                            $link_id = $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 > $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2 ? $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id : $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id;
                        }
                        if ($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) {
                            $link_id = $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner == $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id ? $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id : $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    $winclass = "";
                    ////----
                    if (isset($matchDE[$cur_ind])) {
                        if ($matchDE[$cur_ind]->team2_id == -1 && $matchDE[$cur_ind]->team1_id != -1 || $matchDE[$cur_ind]->m_played && ($matchDE[$cur_ind]->score1 > $matchDE[$cur_ind]->score2 || $matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 > $matchDE[$cur_ind]->aet2 || $matchDE[$cur_ind]->score1 == $matchDE[$cur_ind]->score2 && $matchDE[$cur_ind]->aet1 == $matchDE[$cur_ind]->aet2 && $matchDE[$cur_ind]->p_winner == $matchDE[$cur_ind]->hm_id)) {
                            $winclass = " knwinner";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 20 + $all_step - $marg) . 'px; left:' . (225 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind]->score1) && $matchDE[$cur_ind]->m_played ? $matchDE[$cur_ind]->score1 . ($matchDE[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind]->aet1 . "</abbr>)" : "") : '') . '</span>';
                    //if(isset($matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))])){
                    //$kl .= ($matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->team1_id != -1)?("<a href='".$link."' title='".$matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->winner."'>".(($matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->m_played)?$matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->winner:' ')."</a>"):(JText::_('BLFA_BYE'));
                    //}
                    if (isset($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) && !$matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->is_extra && !$matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) {
                        //&& $matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->score1 == $matchDE[$firstchld_ind+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->score2
                        $kl .= $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id != -1 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winner . "'>" . ($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->m_played ? $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winner : ' ') . "</a>" : JText::_('BLFA_BYE');
                    }
                    if (isset($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1) && $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 == $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2 && $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 != $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2) {
                        $kl .= $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 > $matchDE[${$firstchld_ind} + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "'>" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "'>" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "</a>";
                    }
                    if (!empty($matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner)) {
                        $kl .= $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner == $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "'>" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "'>" . $matchDE[$firstchld_ind + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "</a>";
                    }
                    $kl .= '</div>';
                    //2
                    if (isset($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aw_id) && $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id != -1) {
                        if (!$matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->is_extra && !$matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner && $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 != $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2) {
                            $link_id = $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winnerid;
                        }
                        if ($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 == $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2 && $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 != $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2) {
                            $link_id = $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 > $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2 ? $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id : $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id;
                        }
                        if ($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) {
                            $link_id = $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner == $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id ? $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id : $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id;
                        }
                        if ($t_single) {
                            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        } else {
                            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                        }
                    }
                    if (isset($matchDE[$cur_ind])) {
                        if (($matchDE[$cur_ind]->m_played || $matchDE[$cur_ind]->team1_id == -1 && $matchDE[$cur_ind]->team2_id != -1) && $winclass == '') {
                            $winclass = " knwinner";
                        } else {
                            $winclass = "";
                        }
                    }
                    $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 20 + $all_step - $marg) . 'px; left:' . (225 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind]->score2) && $matchDE[$cur_ind]->m_played ? $matchDE[$cur_ind]->score2 . ($matchDE[$cur_ind]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind]->aet2 . "</abbr>)" : "") : '') . '</span>';
                    //if(isset($matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))])){
                    //$kl .= ($matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->team2_id != -1)?("<a href='".$link."' title='".$matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->winner."'>".(($matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->m_played)?$matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->winner:' ')."</a>"):(JText::_('BLFA_BYE'));
                    //}
                    if (isset($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) && !$matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->is_extra && !$matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner) {
                        // && $matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->score1 == $matchDE[$firstchld_ind + 1+$f_num+($strafe%3==0?($fid/8):0)+($strafe==4?($strafe+($fid/16)):($strafe==4?14:0))]->score2
                        $kl .= $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team2_id != -1 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winner . "'>" . ($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->m_played ? $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->winner : ' ') . "</a>" : JText::_('BLFA_BYE');
                    }
                    if (isset($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1) && $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score1 == $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->score2 && $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 != $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2) {
                        $kl .= $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet1 > $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->aet2 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "'>" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "'>" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "</a>";
                    }
                    if (!empty($matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner)) {
                        $kl .= $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->p_winner == $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->team1_id ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "'>" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "'>" . $matchDE[$firstchld_ind + 1 + $f_num + ($strafe % 3 == 0 ? $fid / 8 : 0) + ($strafe == 4 ? $strafe + $fid / 16 : ($strafe == 4 ? 14 : 0))]->away . "</a>";
                    }
                    $kl .= '</div>';
                    $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($matchDE[$cur_ind]->id) ? $matchDE[$cur_ind]->id : '') . '&amp;Itemid=' . $Itemid;
                    $kl .= isset($matchDE[$cur_ind]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10 + $all_step - $marg) . 'px; left:' . (50 + ($p + 1) * $wdth - 50 + 180 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1)) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                    /////---------------------
                    /////////////
                    ///////////////////////////////////
                    //////////////////////////////////////////////
                    $firstchld_ind_end = $i + $fid / 4 * ((pow(2, $p) - 1) / pow(2, $p - 1));
                    if ($p != 0) {
                        $win_pl = 0;
                        $tab_b = 0;
                        if ($fid == 32 && $strafe == 4) {
                            $win_pl = 6;
                            $tab_b = 3;
                        } else {
                            if ($fid == 64 && $strafe == 4) {
                                $win_pl = 12;
                                $tab_b = 6;
                            } else {
                                if ($fid == 64 && $strafe == 5) {
                                    $win_pl = 14;
                                    $tab_b = 7;
                                }
                            }
                        }
                        $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border:1px solid #aaa; border-left:0px; top:' . ($i * ($height + $step) + $top_next + $all_step - $marg1) . 'px; left:' . (420 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;"></div>';
                        //1
                        if (isset($match[$firstchld_ind_end + $fid / 2]->hm_id)) {
                            if (!$match[$firstchld_ind_end + $fid / 2]->is_extra && !$match[$firstchld_ind_end + $fid / 2]->p_winner && $match[$firstchld_ind_end + $fid / 2]->score1 != $match[$firstchld_ind_end + $fid / 2]->score2) {
                                $link_id = $match[$firstchld_ind_end + $fid / 2]->looserid;
                            }
                            if ($match[$firstchld_ind_end + $fid / 2]->score1 == $match[$firstchld_ind_end + $fid / 2]->score2 && $match[$firstchld_ind_end + $fid / 2]->aet1 != $match[$firstchld_ind_end + $fid / 2]->aet2) {
                                $link_id = $match[$firstchld_ind_end + $fid / 2]->aet1 > $match[$firstchld_ind_end + $fid / 2]->aet2 ? $match[$firstchld_ind_end + $fid / 2]->team2_id : $match[$firstchld_ind_end + $fid / 2]->team1_id;
                            }
                            if ($match[$firstchld_ind_end + $fid / 2]->p_winner) {
                                $link_id = $match[$firstchld_ind_end + $fid / 2]->p_winner == $match[$firstchld_ind_end + $fid / 2]->team1_id ? $match[$firstchld_ind_end + $fid / 2]->team2_id : $match[$firstchld_ind_end + $fid / 2]->team1_id;
                            }
                            if ($t_single) {
                                $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                            } else {
                                $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                            }
                        }
                        $winclass = "";
                        ////----
                        if (isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)])) {
                            if ($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->team2_id == -1 && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->team1_id != -1 || $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->m_played && ($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score1 > $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score2 || $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score1 == $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score2 && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->aet1 > $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->aet2 || $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score1 == $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score2 && $matchDE[$cur_ind]->aet1 == $matchDE[$cur_ind]->aet2 && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->p_winner == $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->hm_id)) {
                                $winclass = " knwinner";
                            }
                        }
                        $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $top_next - 20 + $all_step - $marg1) . 'px; left:' . (425 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score1) && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->m_played ? $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score1 . ($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->aet1 . "</abbr>)" : "") : '') . '</span>';
                        //if(isset($match[$firstchld_ind_end+($fid/2)])){
                        // $kl .= ($match[$firstchld_ind_end+($fid/2)]->team1_id != -1)?("<a href='".$link."' title='".$match[$firstchld_ind_end+($fid/2)]->looser."'>".(($match[$firstchld_ind_end+($fid/2)]->m_played)?$match[$firstchld_ind_end+($fid/2)]->looser:' ')."</a>"):(JText::_('BLFA_BYE'));
                        //}
                        if (isset($match[$firstchld_ind_end + $fid / 2]->p_winner) && !$match[$firstchld_ind_end + $fid / 2]->is_extra && !$match[$firstchld_ind_end + $fid / 2]->p_winner && $match[$firstchld_ind_end + $fid / 2]->score1 != $match[$firstchld_ind_end + $fid / 2]->score2) {
                            $kl .= $match[$firstchld_ind_end + $fid / 2]->team1_id != -1 ? "<a href='" . $link . "' title='" . $match[$firstchld_ind_end + $fid / 2]->looser . "'>" . ($match[$firstchld_ind_end + $fid / 2]->m_played ? $match[$firstchld_ind_end + $fid / 2]->looser : ' ') . "</a>" : JText::_('BLFA_BYE');
                        }
                        if (isset($match[$firstchld_ind_end + $fid / 2]->score1) && $match[$firstchld_ind_end + $fid / 2]->score1 == $match[$firstchld_ind_end + $fid / 2]->score2 && $match[$firstchld_ind_end + $fid / 2]->aet1 != $match[$firstchld_ind_end + $fid / 2]->aet2) {
                            $kl .= $match[$firstchld_ind_end + $fid / 2]->aet1 > $match[$firstchld_ind_end + $fid / 2]->aet2 ? "<a href='" . $link . "' title='" . $match[$firstchld_ind_end + $fid / 2]->away . "'>" . $match[$firstchld_ind_end + $fid / 2]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind_end + $fid / 2]->home . "'>" . $match[$firstchld_ind_end + $fid / 2]->home . "</a>";
                        }
                        if (!empty($match[$firstchld_ind_end + $fid / 2]->p_winner)) {
                            $kl .= $match[$firstchld_ind_end + $fid / 2]->p_winner == $match[$firstchld_ind_end + $fid / 2]->team1_id ? "<a href='" . $link . "' title='" . $match[$firstchld_ind_end + $fid / 2]->away . "'>" . $match[$firstchld_ind_end + $fid / 2]->away . "</a>" : "<a href='" . $link . "' title='" . $match[$firstchld_ind_end + $fid / 2]->home . "'>" . $match[$firstchld_ind_end + $fid / 2]->home . "</a>";
                        }
                        $kl .= '</div>';
                        //2
                        if (isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)])) {
                            if (isset($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aw_id) && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team2_id != -1) {
                                if (!$matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->is_extra && !$matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score1 != $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score2) {
                                    $link_id = $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->winnerid;
                                }
                                if ($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score1 == $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score2 && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet1 != $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet2) {
                                    $link_id = $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet1 > $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet2 ? $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team2_id : $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team1_id;
                                }
                                if ($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner) {
                                    $link_id = $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner == $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team1_id ? $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team2_id : $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team1_id;
                                }
                                if ($t_single) {
                                    $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                                } else {
                                    $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->winnerid . '&sid=' . $s_id . '&Itemid=' . $Itemid);
                                }
                            }
                            if (($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->m_played || $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->team1_id == -1 && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->team2_id != -1) && $winclass == '') {
                                $winclass = " knwinner";
                            } else {
                                $winclass = "";
                            }
                        }
                        $kl .= '<div class="field-comb' . $winclass . '" style="position:absolute; top:' . ($i * ($height + $step) + $height + $top_next - 20 + $all_step - $marg1) . 'px; left:' . (425 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1) + $p * $wdth) . 'px;width:' . ($reslng + 40) . 'px;"><span>' . (isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score2) && $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->m_played ? $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->score2 . ($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->is_extra ? " (<abbr title='" . JText::_("BLFA_TT_AET") . "'>" . $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->aet2 . "</abbr>)" : "") : '') . '</span>';
                        //if(isset($matchDE[$firstchld_ind_end+($fid/4)+($strafe%3==0?($fid/8):0)+$win_pl])){
                        //$kl .= ($matchDE[$firstchld_ind_end+($fid/4)+($strafe%3==0?($fid/8):0)+$win_pl]->team2_id != -1)?("<a href='".$link."' title='".$matchDE[$firstchld_ind_end+($fid/4)+($strafe%3==0?($fid/8):0)+$win_pl]->winner."'>".(($matchDE[$firstchld_ind_end+($fid/4)+($strafe%3==0?($fid/8):0)+$win_pl]->m_played)?$matchDE[$firstchld_ind_end+($fid/4)+($strafe%3==0?($fid/8):0)+$win_pl]->winner:' ')."</a>"):(JText::_('BLFA_BYE'));
                        //}
                        if (isset($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner) && !$matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->is_extra && !$matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score1 != $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score2) {
                            $kl .= $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team2_id != -1 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->winner . "'>" . ($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->m_played ? $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->winner : ' ') . "</a>" : JText::_('BLFA_BYE');
                        }
                        if (isset($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score1) && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score1 == $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->score2 && $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet1 != $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet2) {
                            $kl .= $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet1 > $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->aet2 ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->home . "'>" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->away . "'>" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->away . "</a>";
                        }
                        if (!empty($matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner)) {
                            $kl .= $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->p_winner == $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->team1_id ? "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->home . "'>" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->home . "</a>" : "<a href='" . $link . "' title='" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->away . "'>" . $matchDE[$firstchld_ind_end + $fid / 4 + ($strafe % 3 == 0 ? $fid / 8 : 0) + $win_pl]->away . "</a>";
                        }
                        $kl .= '</div>';
                        $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->id) ? $matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->id : '') . '&amp;Itemid=' . $Itemid;
                        $kl .= isset($matchDE[$cur_ind + $fid / 8 - ($strafe % 3 == 0 ? $fid / 16 : $tab_b)]->id) ? '<div style="position:absolute; top:' . ($i * ($height + $step) + $top_next + $height / 2 - 10 + $all_step - $marg1) . 'px; left:' . (50 + ($p + 1) * $wdth - 50 + 380 + ($p != 1 && $p != 3 && $p != 4 ? $step_block : $step_block1)) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>' : "";
                    }
                }
            }
            $top_next += $height / 2;
            $height = $height + $step;
            $step = $height;
            $zz *= 2;
            $p++;
        }
        //echo $fid;
        $winmd_id = $fid - 3;
        $wiinn = '';
        $res = $p == 3 ? 15 : ($p == 4 ? 115 : ($p == 5 ? 335 : 0));
        if ($fid) {
            $step_line = 100 * ($zz / $fid) * $p;
        }
        if ($t_single) {
            if (isset($matchDE[$winmd_id])) {
                $matchDE[$winmd_id]->winner = $models->selectPlayerName($matchDE[$winmd_id], "winner", "", "winner_nick");
            }
        }
        // if(isset($matchDE[$winmd_id]->winner) && $matchDE[$winmd_id]->winner && $matchDE[$winmd_id]->score1 != $matchDE[$winmd_id]->score2 && $matchDE[$winmd_id]->m_played)
        //{
        ///////////////////////////////
        ////////////////////
        ////////////////
        //////////
        if (isset($matchDE[$winmd_id]->p_winner) && !$matchDE[$winmd_id]->is_extra && !$matchDE[$winmd_id]->p_winner) {
            $link_id = $matchDE[$winmd_id]->winnerid;
        }
        if (isset($matchDE[$winmd_id]->score1) && $matchDE[$winmd_id]->score1 == $matchDE[$winmd_id]->score2 && $matchDE[$winmd_id]->aet1 != $matchDE[$winmd_id]->aet2) {
            $link_id = $matchDE[$winmd_id]->aet1 > $matchDE[$winmd_id]->aet2 ? $matchDE[$winmd_id]->team1_id : $matchDE[$winmd_id]->team2_id;
        }
        if (!empty($matchDE[$winmd_id]->p_winner)) {
            $link_id = $matchDE[$winmd_id]->p_winner == $matchDE[$winmd_id]->team1_id ? $matchDE[$winmd_id]->team1_id : $matchDE[$winmd_id]->team2_id;
        }
        if ($t_single) {
            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        } else {
            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        }
        // $wiinn .="<span>".((isset($match[$winmd_id+2]->score2) && $match[$winmd_id+2]->m_played)?$match[$winmd_id+2]->score2.($match[$winmd_id+2]->is_extra?' (<abbr title="'.JText::_("BLFA_TT_AET").'">'.$match[$winmd_id+2]->aet2.'</abbr>)':''):"")."</span>";
        //print_R($matchDE[$winmd_id]);
        if (isset($match[$winmd_id]->winner) && $match[$winmd_id]->winner && !empty($matchDE[$winmd_id]->m_played)) {
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score2) && $match[$winmd_id]->m_played ? $match[$winmd_id + 2]->score2 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet2 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $matchDE[$winmd_id]->winner . "'>" . $matchDE[$winmd_id]->winner . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        if (isset($match[$winmd_id]->score1) && $match[$winmd_id]->score1 == $match[$winmd_id]->score2 && $match[$winmd_id]->aet1 != $match[$winmd_id]->aet2) {
            $win_player = $match[$winmd_id]->aet1 > $match[$winmd_id]->aet2 ? $match[$winmd_id]->away : $match[$winmd_id]->home;
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score2) && $match[$winmd_id]->m_played ? $match[$winmd_id]->score2 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet2 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $win_player . "'>" . $win_player . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        if (!empty($match[$winmd_id]->p_winner)) {
            $wiinn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:5px !important;margin-top:-17px !important;'>\r\r\n               <span>" . (isset($match[$winmd_id]->score2) && $match[$winmd_id]->m_played ? $match[$winmd_id]->score2 . ($match[$winmd_id]->is_extra ? ' (<abbr title="' . JText::_("BLFA_TT_AET") . '">' . $match[$winmd_id]->aet2 . '</abbr>)' : '') : "") . "</span>\r\r\n                <div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $matchDE[$winmd_id]->winner . "'>" . $matchDE[$winmd_id]->winner . "</a></div></div></div></div></div>\r\r\n            </div>";
        }
        //}
        if ($fid) {
            $match_link = 'index.php?option=com_joomsport&amp;task=view_match&amp;id=' . (isset($match[$winmd_id + 2]->id) ? $match[$winmd_id + 2]->id : '') . '&amp;Itemid=' . $Itemid;
            $kl .= '<div style="position:absolute; top:' . (($top_next + $all_step) / 2 + $height / 2 - $height / 4 + 10 * $p) . 'px; left:' . ($step_line + $p * $wdth + $wdth) . 'px;"><a href="' . $match_link . '" title="' . JText::_('BL_LINK_DETAILMATCH') . '"><span class="module-menu-editor"><!-- --></span></a></div>';
            $kl .= '<div style="position:absolute;width:' . ($wdth + 20) . 'px;height:' . $height . 'px; border-top:1px solid #aaa; top:' . ($top_next + $all_step - ($fid / 4 == 1 ? 15 : 25 * ($fid / 2)) - $res) . 'px; left:' . (20 + $step_line + $p * $wdth) . 'px;">' . $wiinn . '</div>';
        }
        //$kl .= '<div style="position:absolute;width:'.$wdth.'px;height:'.($height).'px; border-bottom:1px solid #aaa; top:'.( ($top_next+$all_step)/3).'px; left:'.($step_line + ($p)*$wdth+$wdth).'px;"><div style="margin-left:45px; margin-top:'.((($top_next+$all_step+($fid/4>1?(($fid/8>1)?60*(($fid/4)-1):60):0))/3)).'px;">'.(($match[$winmd_id+2]->m_played)?$match[$winmd_id+2]->winner:'').'</div></div>';
        //if(isset($match[$winmd_id+2]->winner)){
        // $wiiinnn = "<div class='field-comb' style='width:".($reslng+40)."px;margin-left:-35px !important;margin-top:-17px !important;'><div><div><div class='knres'></div><div class='knlink' style='width:".$reslng."px;'><div><div><a href='".$link."' title='".$match[$winmd_id+2]->winner."'>".$match[$winmd_id+2]->winner."</a></div></div></div></div></div></div>";
        //}
        ////////////////////WINER!!!!
        if (isset($match[$winmd_id + 2]->p_winner) && !$match[$winmd_id + 2]->is_extra && !$match[$winmd_id + 2]->p_winner && $match[$winmd_id + 2]->score1 != $match[$winmd_id + 2]->score2) {
            $link_id = $match[$winmd_id + 2]->winnerid;
        }
        if (isset($match[$winmd_id + 2]->score1) && $match[$winmd_id + 2]->score1 == $match[$winmd_id + 2]->score2 && $match[$winmd_id + 2]->aet1 != $match[$winmd_id + 2]->aet2) {
            $link_id = $match[$winmd_id + 2]->aet1 > $match[$winmd_id + 2]->aet2 ? $match[$winmd_id + 2]->team1_id : $match[$winmd_id + 2]->team2_id;
        }
        if (!empty($match[$winmd_id + 2]->p_winner)) {
            $link_id = $match[$winmd_id + 2]->p_winner == $match[$winmd_id + 2]->team1_id ? $match[$winmd_id + 2]->team1_id : $match[$winmd_id + 2]->team2_id;
        }
        if ($t_single) {
            $link = JRoute::_('index.php?option=com_joomsport&task=player&id=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        } else {
            $link = JRoute::_('index.php?option=com_joomsport&task=team&tid=' . $link_id . '&sid=' . $s_id . '&Itemid=' . $Itemid);
        }
        //////
        if (isset($match[$winmd_id + 2]->winner) && $match[$winmd_id + 2]->winner && $match[$winmd_id + 2]->score1 != $match[$winmd_id + 2]->score2 && $match[$winmd_id + 2]->m_played) {
            $wiiinnn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:-35px !important;margin-top:-17px !important;'><div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $match[$winmd_id + 2]->winner . "'>" . $match[$winmd_id + 2]->winner . "</a></div></div></div></div></div></div>";
        }
        if (isset($match[$winmd_id + 2]->score1) && $match[$winmd_id + 2]->score1 == $match[$winmd_id + 2]->score2 && $match[$winmd_id + 2]->aet1 != $match[$winmd_id + 2]->aet2) {
            $win_player = $match[$winmd_id + 2]->aet1 > $match[$winmd_id + 2]->aet2 ? $match[$winmd_id + 2]->home : $match[$winmd_id + 2]->away;
            $wiiinnn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:-35px !important;margin-top:-17px !important;'><div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $win_player . "'>" . $win_player . "</a></div></div></div></div></div></div>";
        }
        if (!empty($match[$winmd_id + 2]->p_winner)) {
            $win_player = $match[$winmd_id + 2]->p_winner == $match[$winmd_id + 2]->team1_id ? $match[$winmd_id + 2]->home : $match[$winmd_id + 2]->away;
            $wiiinnn = "<div class='field-comb' style='width:" . ($reslng + 40) . "px;margin-left:-35px !important;margin-top:-17px !important;'><div><div><div class='knres'></div><div class='knlink' style='width:" . $reslng . "px;'><div><div><a href='" . $link . "' title='" . $win_player . "'>" . $win_player . "</a></div></div></div></div></div></div>";
        }
        //$kl .= '<div style="position:absolute;width:'.$wdth.'px;height:'.($height).'px; border-top:1px solid #aaa; top:'.( ($top_next+$all_step)/2).'px; left:'.($step_line + ($p)*$wdth+$wdth).'px;">'.$wiiinnn.'</div>';
        $kl .= '<div style="position:absolute;width:' . $wdth . 'px;height:' . $height . 'px; border-bottom:1px solid #aaa; top:' . (($top_next + $all_step) / 3 - ($fid / 4 == 2 ? 25 : 15 * ($fid / 4)) - $res - 10 * $p) . 'px; left:' . (40 + $step_line + $p * $wdth + $wdth) . 'px;"><div style="margin-left:45px; margin-top:' . ($top_next + $all_step + ($fid / 4 > 1 ? $fid / 8 > 1 ? 60 * ($fid / 4 - 1) : 60 : 0)) / 3 . 'px;">' . (isset($match[$winmd_id + 2]->m_played) ? $match[$winmd_id + 2]->m_played ? $wiiinnn : '' : '') . '</div></div>';
        $kl .= '</div>';
        return $kl;
    }