function edit() { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $task = JRequest::getVar('task'); $cid = JRequest::getVar('cid', array(0), '', 'array'); $option = JRequest::getCmd('option'); $section = JRequest::getVar('section'); JArrayHelper::toInteger($cid, array(0)); $row = JTable::getInstance('vereine', 'TableCLM'); // load the row from the db table $row->load($cid[0]); $sid = $row->sid; // Userberechtigung abfragen $clmAccess = clm_core::$access; if ($clmAccess->access('BE_club_create') === false and $task == 'add') { //if (clm_core::$access->getType() !== 'admin' AND $task =='add') { JError::raiseWarning(500, JText::_('VEREINE_ADMIN')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } if ($task == 'edit') { // illegaler Einbruchversuch über URL ! // evtl. mitschneiden !?! $saison = JTable::getInstance('saisons', 'TableCLM'); $saison->load($sid); if ($saison->archiv == "1") { //AND clm_core::$access->getType() !== 'admin') { JError::raiseWarning(500, JText::_('VEREINE_NO_ARCHIV')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } if ($cid[0] == "") { // AND $task =='edit') { JError::raiseWarning(500, JText::_('VEREINE_FALSCH')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } // do stuff for existing records $row->checkout($user->get('id')); } else { // do stuff for new records $row->published = 0; } if ($clmAccess->access('BE_club_create') === false) { //if ( clm_core::$access->getType() !== 'sl' AND clm_core::$access->getType() !== 'admin' AND clm_core::$access->getType() !== 'dv' AND clm_core::$access->getType() !== 'dwz') { JError::raiseWarning(500, JText::_('VEREINE_NO_BEARBEITEN')); $link = 'index.php?option=' . $option . '§ion=' . $section; $mainframe->redirect($link); } $sql = 'SELECT id FROM #__clm_saison WHERE archiv = 0 and published = 1'; $db->setQuery($sql); $sid = $db->loadResult(); // Vereinefilter laden // 1 = Auswahl DB obwohl manuell aktiviert wurde ! $vereinlist = CLMFilterVerein::vereine_filter(1); $lists['verein'] = JHTML::_('select.genericlist', $vereinlist, 'zps', 'class="inputbox" size="1" onchange="Tausch(this.id)"', 'zps', 'name', $row->zps); // Vereinsleiterliste if ($task == 'edit') { $where = "WHERE ZPS = '" . $row->zps . "'"; } else { $where = 'WHERE ZPS IS NULL'; } $sql = 'SELECT Spielername as name, Mgl_Nr as vl' . ' FROM #__clm_dwz_spieler ' . $where . ' AND sid =' . $sid; $db->setQuery($sql); if (!$db->query()) { $this->setRedirect('index.php?option=' . $option . '§ion=' . $section); return JError::raiseWarning(500, $db->getErrorMsg()); } $vllist[] = JHTML::_('select.option', '0', JText::_('VEREINE_VEREINSLEITER'), 'vl', 'name'); $vllist = array_merge($vllist, $db->loadObjectList()); $lists['vl'] = JHTML::_('select.genericlist', $vllist, 'vl', 'class="inputbox" size="1" onchange="VSTausch(this.id)"', 'vl', 'name', $row->vl); // Saisonliste if ($task == "edit") { $sql = 'SELECT id as sid, name FROM #__clm_saison WHERE id=' . $sid; } else { $sql = 'SELECT id as sid, name FROM #__clm_saison WHERE archiv =0'; } $db->setQuery($sql); if (!$db->query()) { $this->setRedirect('index.php?option=' . $option . '§ion=' . $section); return JError::raiseWarning(500, $db->getErrorMsg()); } if ($task != "edit") { $saisonlist[] = JHTML::_('select.option', '0', JText::_('VEREINE_SAISON'), 'sid', 'name'); $saisonlist = array_merge($saisonlist, $db->loadObjectList()); } else { $saisonlist = $db->loadObjectList(); } $lists['saison'] = JHTML::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published); require_once JPATH_COMPONENT . DS . 'views' . DS . 'vereine.php'; CLMViewVereine::verein($row, $lists, $option); }