public function getCustomField($field, $data = array()) { $param = array('title' => $field, 'enabled' => true, 'required' => false, 'input_name' => 'cf_' . $field, 'value' => ''); $customFields = self::getCustomFields(); $config = isset($customFields[$field]) ? $customFields[$field] : null; if (empty($config)) { return $param; } $param['enabled'] = $config['enabled']; $param['required'] = $config['required']; $param['title'] = JText::_($config['title']); switch ($field) { case 'team_city': if (!empty($data['team_id'])) { $row = new JTableTeams($this->db); $row->load((int) $data['team_id']); $param['value'] = $row->t_city; } break; default: $param['value'] = ''; } return $param; }
function getData() { $mainframe = JFactory::getApplication(); $cid = JRequest::getVar('cid', array(0), '', 'array'); $is_id = $cid[0]; $seasf_id = $mainframe->getUserStateFromRequest('com_joomsport.seasf_id', 'seasf_id', 0, 'int'); $row = new JTableTeams($this->db); $row->load($is_id); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } //$this->mainframe->enqueueMessage(JText::_( 'ОШИБКА!!' )); if ($is_id) { $query = "SELECT CONCAT(t.name,' ',s.s_name) as name,s.s_id as id FROM #__bl_season_teams as st, #__bl_seasons as s, #__bl_tournament as t WHERE s.t_id = t.id AND st.season_id=s.s_id AND st.team_id=" . $is_id . " ORDER BY s.s_id"; $query2 = "SELECT COUNT(*) FROM #__bl_season_teams as st, #__bl_seasons as s, #__bl_tournament as t WHERE s.t_id = t.id AND st.season_id=s.s_id AND s.s_id = " . $seasf_id . " AND st.team_id=" . $is_id . " ORDER BY s.s_id"; $this->db->setQuery($query2); if (!$this->db->LoadResult()) { $seasf_id = -1; } $this->db->setQuery($query); $seaspl = $this->db->LoadObjectList(); } else { $seasf_id = -1; $seaspl = array(); } $this->_lists['is_seas'] = $seaspl; $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $javascripts = 'onchange="javascript:document.adminForm.submit();"'; if (count($seaspl) && !$seasf_id) { $seasf_id = $seaspl[0]->id; } if (count($seaspl)) { $query = "SELECT s.s_name,s.s_id as id FROM #__bl_season_teams as st, #__bl_seasons as s, #__bl_tournament as t WHERE s.t_id = t.id AND st.season_id=s.s_id AND st.team_id=" . $is_id . " AND t.id={tourid} ORDER BY s.s_name"; $this->_lists['seasf'] = $this->getSeasDList($seasf_id, $query, false, $javascripts, 0, 'seasf_id'); //JHTML::_('select.genericlist', $seaspl, 'seasf_id', 'class="inputbox" size="1" id="seasf_id" '.$javascripts, 'id', 'name', $seasf_id ); } else { // Set it to friendly season $this->_lists['seasf'] = '<input type="hidden" name="seasf_id" value="-1" />'; //$this->_lists['seasf'] = JHTML::_('input.hidden', 'seasf_id', -1); } $this->_lists['photos'] = array(); $this->_lists['bonuses'] = array(); $this->_lists['ext_fields'] = array(); if (!empty($row->id)) { $this->_lists['photos'] = $this->getPhotos(2, $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_teams as st WHERE s.s_id = st.season_id AND st.team_id=" . $row->id . " "; $this->db->setQuery($query); $this->_lists["bonuses"] = $this->db->loadObjectList(); ///-----EXTRAFIELDS---// $this->_lists['ext_fields'] = $this->getAdditfields(1, $row->id, $seasf_id); } if (!$is_id) { $this->getSeasListNew(); } //venue $is_venue[] = JHTML::_('select.option', 0, JText::_('BLBE_SELVENUE'), 'id', 'v_name'); $query = "SELECT * FROM #__bl_venue ORDER BY v_name"; $this->db->setQuery($query); $venue = $this->db->loadObjectList(); if (count($venue)) { $is_venue = array_merge($is_venue, $venue); } $this->_lists['venue'] = JHTML::_('select.genericlist', $is_venue, 'venue_id', 'class="inputbox" size="1"', 'id', 'v_name', $row->venue_id); // //club $is_club[] = JHTML::_('select.option', 0, JText::_('BLBE_SELCLUB'), 'id', 'c_name'); $query = "SELECT c.* FROM #__bl_club as c ORDER BY c_name"; $this->db->setQuery($query); $club = $this->db->loadObjectList(); if (count($club)) { $is_club = array_merge($is_club, $club); } $this->_lists['club'] = JHTML::_('select.genericlist', $is_club, 'club_id', 'class="inputbox" size="1"', 'id', 'c_name', $row->club_id); // //---Players--/// $this->getTPlayers($row->id, $seasf_id); $this->_lists["post_max_size"] = $this->getValSettingsServ("post_max_size"); $this->_data = $row; }
function getData() { $this->getTeamReg(); // print_r($this->_lists['team_reg']); $this->_params = $this->JS_PageTitle(JText::_('BLFA_TEAM_EDIT')); $this->_lists["post_max_size"] = $this->getValSettingsServ("post_max_size"); if ($this->acl == 1) { //----checking for rights----// if ($this->id) { $query = "SELECT COUNT(*) FROM #__bl_teams as t, #__bl_seasons as s, #__bl_season_teams as st, #__bl_tournament as tr" . " WHERE s.s_id=st.season_id AND st.team_id = t.id AND s.t_id = tr.id AND s.s_id=" . $this->season_id . " AND t.id=" . $this->id; $this->db->setQuery($query); if (!$this->db->loadResult()) { JError::raiseError(403, JText::_('Access Forbidden')); return; } } } else { $this->season_id = $this->mainframe->getUserStateFromRequest('com_joomsport.moderseason', 'moderseason', 0, 'int'); $teamSeasons = $this->getTeamSeasons($this->id); if (!count($teamSeasons) && $this->season_id == 0) { $this->season_id = -1; } else { $isInSeason = false; foreach ($teamSeasons as $season) { if ($this->season_id && $season->id == $this->season_id) { $isInSeason = true; break; } } if (!$isInSeason && count($teamSeasons)) { $this->season_id = $teamSeasons[0]->id; } } $query = "SELECT COUNT(*) FROM #__bl_season_teams WHERE season_id = " . $this->season_id . " AND team_id = " . $this->id; $this->db->setQuery($query); $is_seas = $this->db->loadResult(); if (!$is_seas) { $this->season_id = -1; } $this->_updateUserState(true); $this->getGlobFilters(true, true); } //---------------------------// $row = new JTableTeams($this->db); $row->load($this->id); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } //extra fields $this->_lists['ext_fields'] = $this->getAddFields($row->id, 1, "team"); $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 = 2 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); } if ($this->acl == 2) { $query = "SELECT COUNT(*) FROM #__bl_season_teams as sp, #__bl_matchday as m WHERE m.s_id=sp.season_id AND sp.team_id = " . $row->id; $this->db->setQuery($query); $this->_lists["enmd"] = $this->db->loadResult(); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $mdays = $this->getTeamMatchDays($row->id, $this->season_id); $error = $this->db->getErrorMsg(); if ($error) { return JError::raiseError(500, $error); } $this->_lists['moder_matchday'] = true; if (!count($mdays)) { $this->_lists["enmd"] = 0; $this->_lists['moder_matchday'] = (bool) $this->_getFriendlyMatchdaysCount(); } $this->getInviteOptions(); $this->_lists['moder_addplayer'] = $this->getJS_Config('moder_addplayer'); } $this->getCountPlayersT($row->id); $this->getPlayersT($row->id, $this->season_id); $this->_data = $row; $this->_lists["teams_season"] = $this->teamsToModer(); $this->_lists["panel"] = $this->getePanel($this->_lists["teams_season"], 0, null, 0); $this->_lists['ext_fields'] = $this->getBEAdditfields('1', $row->id, $this->season_id); }