function display($tpl = null) { $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); $document = JFactory::getDocument(); $params = $mainframe->getParams(); $editor = JFactory::getEditor(); // Page Title $menus =& JSite::getMenu(); $menu = $menus->getActive(); $is_id = 0; $cid = JRequest::getVar('cid', array(0), '', 'array'); $msg = JRequest::getVar('msg', '', 'get', 'string', JREQUEST_ALLOWRAW); JArrayHelper::toInteger($cid, array(0)); if ($cid[0]) { $is_id = $cid[0]; } $db =& JFactory::getDBO(); //----checking for rights----// $s_id = JRequest::getVar('sid', 0, '', 'int'); if ($is_id) { $query = "SELECT COUNT(*) FROM #__esb_players as p, #__esb_players_team as bp, #__esb_teams as t, #__esb_seasons as s, #__esb_season_teams as st, #__esb_tournament as tr WHERE p.id=bp.player_id AND bp.team_id=t.id AND s.s_id=st.season_id AND st.team_id = t.id AND s.t_id = tr.id AND s.s_id=" . $s_id . " AND p.team_id = t.id AND p.id = " . $is_id; $db->setQuery($query); if (!$db->loadResult()) { JError::raiseError(403, JText::_('Access Forbidden')); return; } } //---------------------------// $row = new JTablePlayer($db); $row->load($is_id); $query = "SELECT * FROM #__esb_teams ORDER BY t_name"; $db->setQuery($query); $teams = $db->loadObjectList(); $lists['teams'] = JHTML::_('select.genericlist', $teams, 'team_id', 'class="inputbox" size="1"', 'id', 't_name', $row->team_id); $query = "SELECT p.ph_name as name,p.id as id,p.ph_filename as filename FROM #__esb_assign_photos as ap, #__esb_photos as p WHERE ap.photo_id = p.id AND cat_type = 1 AND cat_id = " . $row->id . ""; $db->setQuery($query); $lists['photos'] = $db->loadObjectList(); $query = "SELECT ef.*,ev.fvalue as fvalue FROM #__esb_extra_filds as ef LEFT JOIN #__esb_extra_values as ev ON ef.id=ev.f_id AND ev.uid=" . intval($row->id) . " WHERE ef.published=1 AND ef.type='0' ORDER BY ef.ordering"; $db->setQuery($query); $lists['ext_fields'] = $db->loadObjectList(); $this->assignRef('params', $params); $this->assignRef('lists', $lists); $this->assignRef('rows', $row); $this->assignRef('s_id', $s_id); $this->assignRef('maz_filesize', $maz_filesize); $this->assignRef('msg', $msg); $this->assignRef('editor', $editor); parent::display($tpl); }
function getData() { $mainframe = JFactory::getApplication(); $cid = JRequest::getVar('cid', array(0), '', 'array'); $is_id = $cid[0]; $row = new JTablePlayer($this->db); $row->load($is_id); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } //echo $is_id; $seasf_id = $mainframe->getUserStateFromRequest('com_joomsport.seasf_id', 'seasf_id', -1, 'int'); $this->_lists['seasf_id'] = $seasf_id; $query = "SELECT CONCAT(t.name,' ',s.s_name) as name,s.s_id as id FROM #__bl_seasons as s, #__bl_tournament as t WHERE s.t_id = t.id AND t.t_single='0' ORDER BY t.name,s.s_name"; $this->db->setQuery($query); /*GROUP*/ $seaspl_g = $this->db->LoadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $this->db->setQuery("SELECT t.t_single FROM #__bl_tournament as t JOIN #__bl_seasons as s ON (s.s_id={$seasf_id} AND s.t_id=t.id)"); $this->_lists["t_single"] = $this->db->loadResult(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } //////////////////////////////////UPDATE //$query = "SELECT DISTINCT CONCAT(t.name,' ',s.s_name) as name,s.s_id as id FROM #__bl_seasons as s, #__bl_tournament as t,#__bl_season_players as sp WHERE s.t_id = t.id AND t.t_single='1' AND sp.player_id = '".$is_id."' AND s.s_id = sp.season_id ORDER BY t.name,s.s_name"; $query = "SELECT CONCAT(t.name,' ',s.s_name) as name,s.s_id as id FROM #__bl_seasons as s, #__bl_tournament as t, #__bl_season_players as sp WHERE sp.player_id = " . ($row->id ? $row->id : -1) . " AND sp.season_id = s.s_id AND s.t_id = t.id AND t.t_single='1' ORDER BY t.name,s.s_name"; $this->db->setQuery($query); /*SINGLE*/ $seaspl_s = $this->db->LoadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $javascripts = 'onchange="javascript:document.adminForm.submit();"'; $seaspl = array_merge($seaspl_g, $seaspl_s); $seaspl_new = '<select name="seasf_id" id="seasf_id" class="inputbox" size="1" ' . $javascripts . '>'; $seaspl_new .= '<option value="-1">' . JText::_('BLBE_NOSEAS') . '</option>'; $seaspl_new .= '<optgroup label="' . JText::_('BLBE_GROUPTOUR') . '">'; for ($g = 0; $g < count($seaspl_g); $g++) { $seaspl_new .= '<option value="' . $seaspl_g[$g]->id . '" ' . ($seaspl_g[$g]->id == $seasf_id ? "selected" : "") . '>' . $seaspl_g[$g]->name . '</option>'; } $seaspl_new .= '</optgroup>'; $seaspl_new .= '<optgroup label="' . JText::_('BLBE_SINGLTOUR') . '">'; for ($g = 0; $g < count($seaspl_s); $g++) { $seaspl_new .= '<option value="' . $seaspl_s[$g]->id . '" ' . ($seaspl_s[$g]->id == $seasf_id ? "selected" : "") . '>' . $seaspl_s[$g]->name . '</option>'; } $seaspl_new .= '</optgroup>'; $seaspl_new .= '</select>'; //$this->_lists['seasf'] = JHTML::_('select.genericlist', $seaspl, 'seasf_id', 'class="inputbox" size="1" id="seasf_id" '.$javascripts, 'id', 'name', $seasf_id ); $isInvalidSeason = count($seaspl) && $seasf_id == 0; $this->_lists['seasf'] = $seaspl_new; if ($isInvalidSeason) { $seasf_id = $seaspl[0]->id; } ///country $this->getPCountry($row); $query = "SELECT usr_id FROM #__bl_players WHERE usr_id != " . intval($row->usr_id); $this->db->setQuery($query); $ex_users = $this->db->loadColumn(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $query = "SELECT * FROM #__users " . (count($ex_users) ? "WHERE id NOT IN (" . implode(',', $ex_users) . ")" : "") . " ORDER BY username"; $this->db->setQuery($query); $f_users = $this->db->loadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $is_player[] = JHTML::_('select.option', 0, JText::_('BLBE_SELUSR'), 'id', 'username'); $f_users = array_merge($is_player, $f_users); $this->_lists['usrid'] = JHTML::_('select.genericlist', $f_users, 'usr_id', 'class="inputbox" size="1"', 'id', 'username', $row->usr_id); $this->_lists['photos'] = $this->getPhotos(1, $row->id); $query = "SELECT st.*,CONCAT(t.name,' ',s.s_name) as name FROM #__bl_seasons as s LEFT JOIN #__bl_tournament as t ON t.id = s.t_id, #__bl_season_players as st WHERE s.s_id = st.season_id AND st.player_id='" . $row->id . "'"; $this->db->setQuery($query); $this->_lists["bonuses"] = $this->db->loadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } ///teamss $this->getPTeams($row, $seasf_id); ///-----EXTRAFIELDS---// $this->_lists['ext_fields'] = $this->getAdditfields(0, $row->id, $seasf_id); $this->_data = $row; $this->_lists["post_max_size"] = $this->getValSettingsServ("post_max_size"); $this->_lists['req_lastname'] = $this->getJS_Config("reg_lastname_rq"); }
function getData() { $this->getPlayer(); $this->_lists["post_max_size"] = $this->getValSettingsServ("post_max_size"); if ($this->acl == 1) { $this->admAccess(); } else { $this->_lists["teams_season"] = $this->teamsToModer(); $all = array(); if (count($this->_lists["teams_season"]) && $this->id) { $query = "SELECT team_id, season_id FROM #__bl_players_team WHERE team_id IN(" . implode(',', $this->_lists["teams_season"]) . ") AND player_id = " . $this->id . " AND season_id > 0"; $this->db->setQuery($query); $all = $this->db->loadObjectList(); if (!$this->season_id && isset($all[0]->season_id)) { $this->season_id = $all[0]->season_id; } } $this->getGlobFilters(false, false, count($all) ? $all : array(0)); /*$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(!$isinseas && count($seass)){ $this->season_id = $seass[0]->id; } }*/ } $this->_params = $this->JS_PageTitle(""); //----checking for rights----// if ($this->acl == 2) { $this->_lists['moder_addplayer'] = $this->getJS_Config('moder_addplayer'); if (!$this->_lists['moder_addplayer']) { JError::raiseError(403, JText::_('Access Forbidden')); return; } } $row = new JTablePlayer($this->db); $row->load($this->id); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $this->getPCountry($row->country_id); $this->getUsers($row->usr_id); //extra fields if ($this->acl == 1) { // $this->_lists['ext_fields'] = $this->getAddFields($row->id,0,"player",$this->season_id); $this->_lists['ext_fields'] = $this->getBEAdditfields('0', $row->id, $this->season_id); //print_r($this->_lists['ext_fields']); //teams $tourn = $this->getTournOpt($this->season_id); if (!$tourn->t_single && !$this->id) { $query = "SELECT * FROM #__bl_teams as t , #__bl_season_teams as st" . " WHERE st.team_id = t.id AND st.season_id = " . $this->season_id . " ORDER BY t.t_name"; $this->db->setQuery($query); $team = $this->db->loadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $is_team[] = JHTML::_('select.option', 0, JText::_('BLFA_SELTEAM'), 'id', 't_name'); if (count($team)) { $is_team = array_merge($is_team, $team); } $this->_lists['teams_seas'] = JHTML::_('select.genericlist', $is_team, 'teams_seas', 'class="styled-long" size="1" id="teams_seas"', 'id', 't_name', 0); } } else { $this->_lists['ext_fields'] = $this->getBEAdditfields('0', $row->id, $this->season_id, true); $this->getCanMore($this->id); } $query = "SELECT p.ph_name as name,p.id as id,p.ph_filename as filename" . " FROM #__bl_assign_photos as ap, #__bl_photos as p" . " WHERE ap.photo_id = p.id AND cat_type = 1 AND cat_id = '" . $row->id . "'"; $this->db->setQuery($query); $this->_lists['photos'] = $this->db->loadObjectList(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $this->_data = $row; $this->_lists["teams_season"] = $this->teamsToModer(); //print_r($this->_lists["teams_season"]); $this->_lists["panel"] = $this->getePanel($this->_lists["teams_season"], 0, null, 0); //$this->_lists['ext_fields'] = $this->getBEAdditfields('0',$row->id,$this->season_id); $this->_lists['reg_lastname_rq'] = $this->getJS_Config('reg_lastname_rq'); $this->_lists['reg_lastname'] = $this->getJS_Config('reg_lastname'); //acl = 2 $this->_lists['nick_reg_rq'] = $this->getJS_Config('nick_reg_rq'); $this->_lists['nick_reg'] = $this->getJS_Config('nick_reg'); $this->_lists['country_reg_rq'] = $this->getJS_Config('country_reg_rq'); $this->_lists['country_reg'] = $this->getJS_Config('country_reg'); //print_r($this->_lists['country_reg_rq']); }