function display($cachable = false, $urlparams = array()) { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $cid = JRequest::getVar('cid', array(0), '', 'array'); $option = JRequest::getCmd('option'); $section = JRequest::getVar('section'); $row = JTable::getInstance('ligen', 'TableCLM'); JArrayHelper::toInteger($cid, array(0)); // load the row from the db table $row->load($cid[0]); $clmAccess = clm_core::$access; if ($clmAccess->access('BE_league_edit_detail') === false) { $msg = JText::_('Kein Zugriff: ') . JText::_('LIGEN_STAFFEL_TOTAL'); //JText::_( $clmAccess->checkpoint ); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } if ($cid[0] == 0) { if ($clmAccess->access('BE_league_create') === false) { JError::raiseWarning(500, JText::_('LIGEN_ADMIN')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } // Neue ID $row->published = 0; } else { // Prüfen ob User Berechtigung zum editieren hat $saison = JTable::getInstance('saisons', 'TableCLM'); $saison->load($row->sid); // illegaler Einbruchversuch über URL ! // evtl. mitschneiden !?! //if ($saison->archiv == "1" AND clm_core::$access->getType() !== 'admin') { if ($saison->archiv == "1" and $clmAccess->access('BE_league_edit_detail') === false) { JError::raiseWarning(500, JText::_('LIGEN_ARCHIV')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } // Keine SL oder Admin //if ( $row->sl !== clm_core::$access->getJid() AND clm_core::$access->getType() !== 'admin') { //echo "<br>clmAccess->accesspoint: " if ($clmAccess->access('BE_league_edit_detail') === false) { JError::raiseWarning(500, JText::_('LIGEN_STAFFEL_TOTAL')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } if ($row->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_league_edit_detail') !== true) { JError::raiseWarning(500, JText::_('LIGEN_STAFFEL')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg, "message"); } // do stuff for existing records $row->checkout($user->get('id')); } // Listen // Heimrecht vertauscht $lists['heim'] = JHTML::_('select.booleanlist', 'heim', 'class="inputbox"', $row->heim); // Published $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published); // Anzeige Mannschaftsaufstellung $lists['anzeige_ma'] = JHTML::_('select.booleanlist', 'anzeige_ma', 'class="inputbox"', $row->anzeige_ma); // automat. Mail $lists['mail'] = JHTML::_('select.booleanlist', 'mail', 'class="inputbox"', $row->mail); // Staffelleitermail als BCC $lists['sl_mail'] = JHTML::_('select.booleanlist', 'sl_mail', 'class="inputbox"', $row->sl_mail); // Ordering für Rangliste $lists['order'] = JHTML::_('select.booleanlist', 'order', 'class="inputbox"', $row->order); // SL Liste // $tql = " SELECT a.jid,a.name FROM #__clm_user as a" // ." LEFT JOIN #__clm_saison as s ON s.id = a.sid" // ." WHERE (a.usertype = 'sl' OR a.usertype = 'dv' OR a.usertype = 'dwz' OR a.usertype = 'admin' )" // ." AND a.published = 1 AND s.published = 1 AND s.archiv =0" // ; //$db->setQuery($tql); //if (!$db->query()){ $this->setRedirect( 'index.php?option='.$option.'§ion='.$section ); // return JError::raiseWarning( 500, $db->getErrorMsg() ); } //$sllist[] = JHTML::_('select.option', '0', JText::_( 'LIGEN_SL' ), 'jid', 'name' ); //$sllist = array_merge( $sllist, $db->loadObjectList() ); // //für alle ligen oder nur ausgewählte $out = $clmAccess->userlist('BE_league_edit_result', '>0'); if ($out === false) { echo "<br>cl: "; var_dump($clmAccess->userlist()); die('clcl'); } $sllist[] = JHTML::_('select.option', '0', JText::_('LIGEN_SL'), 'jid', 'name'); $sllist = array_merge($sllist, $out); $lists['sl'] = JHTML::_('select.genericlist', $sllist, 'sl', 'class="inputbox" size="1"', 'jid', 'name', $row->sl); // Saisonliste $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()); } $saisonlist[] = JHTML::_('select.option', '0', JText::_('LIGEN_SAISON'), 'sid', 'name'); $saisonlist = array_merge($saisonlist, $db->loadObjectList()); $lists['saison'] = JHTML::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid); // Rangliste $query = " SELECT id, Gruppe FROM #__clm_rangliste_name "; $db->setQuery($query); if (!$db->query()) { $this->setRedirect('index.php?option=' . $option . '§ion=' . $section); return JError::raiseWarning(500, $db->getErrorMsg()); } $glist[] = JHTML::_('select.option', '0', JText::_('LIGEN_ML'), 'id', 'Gruppe'); $glist = array_merge($glist, $db->loadObjectList()); $lists['gruppe'] = JHTML::_('select.genericlist', $glist, 'rang', 'class="inputbox" size="1"', 'id', 'Gruppe', $row->rang); require_once JPATH_COMPONENT . DS . 'views' . DS . 'ligen.php'; CLMViewLigen::liga($row, $lists, $option, $cid[0] == 0 ? true : false); }
function edit() { global $mainframe, $option; $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'); $row =& JTable::getInstance('ligen', 'TableCLM'); JArrayHelper::toInteger($cid, array(0)); // load the row from the db table $row->load($cid[0]); if (CLM_usertype !== 'admin' and $task == 'add') { JError::raiseWarning(500, JText::_('LIGEN_ADMIN')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg); } if ($task == 'edit') { // Prüfen ob User Berechtigung zum editieren hat $saison =& JTable::getInstance('saisons', 'TableCLM'); $saison->load($row->sid); // illegaler Einbruchversuch über URL ! // evtl. mitschneiden !?! if ($saison->archiv == "1" and CLM_usertype !== 'admin') { JError::raiseWarning(500, JText::_('LIGEN_ARCHIV')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg); } // Keine SL oder Admin if ($row->sl !== CLM_ID and CLM_usertype !== 'admin') { JError::raiseWarning(500, JText::_('LIGEN_STAFFEL')); $mainframe->redirect('index.php?option=' . $option . '§ion=' . $section, $msg); } // do stuff for existing records $row->checkout($user->get('id')); } else { // Neue ID $row->published = 0; } // Listen // Heimrecht vertauscht $lists['heim'] = JHTML::_('select.booleanlist', 'heim', 'class="inputbox"', $row->heim); // Published $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published); // Anzeige Mannschaftsaufstellung $lists['anzeige_ma'] = JHTML::_('select.booleanlist', 'anzeige_ma', 'class="inputbox"', $row->anzeige_ma); // automat. Mail $lists['mail'] = JHTML::_('select.booleanlist', 'mail', 'class="inputbox"', $row->mail); // Staffelleitermail als BCC $lists['sl_mail'] = JHTML::_('select.booleanlist', 'sl_mail', 'class="inputbox"', $row->sl_mail); // Ordering für Rangliste $lists['order'] = JHTML::_('select.booleanlist', 'order', 'class="inputbox"', $row->order); // SL Liste $tql = " SELECT a.jid,a.name FROM #__clm_user as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid" . " WHERE (a.usertype = 'sl' OR a.usertype = 'dv' OR a.usertype = 'dwz' OR a.usertype = 'admin' )" . " AND a.published = 1 AND s.published = 1 AND s.archiv =0"; $db->setQuery($tql); if (!$db->query()) { $this->setRedirect('index.php?option=' . $option . '§ion=' . $section); return JError::raiseWarning(500, $db->getErrorMsg()); } $sllist[] = JHTML::_('select.option', '0', JText::_('LIGEN_SL'), 'jid', 'name'); $sllist = array_merge($sllist, $db->loadObjectList()); $lists['sl'] = JHTML::_('select.genericlist', $sllist, 'sl', 'class="inputbox" size="1"', 'jid', 'name', $row->sl); // Saisonliste $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()); } $saisonlist[] = JHTML::_('select.option', '0', JText::_('LIGEN_SAISON'), 'sid', 'name'); $saisonlist = array_merge($saisonlist, $db->loadObjectList()); $lists['saison'] = JHTML::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid); // Rangliste $query = " SELECT id, Gruppe FROM #__clm_rangliste_name "; $db->setQuery($query); if (!$db->query()) { $this->setRedirect('index.php?option=' . $option . '§ion=' . $section); return JError::raiseWarning(500, $db->getErrorMsg()); } $glist[] = JHTML::_('select.option', '0', JText::_('LIGEN_ML'), 'id', 'Gruppe'); $glist = array_merge($glist, $db->loadObjectList()); $lists['gruppe'] = JHTML::_('select.genericlist', $glist, 'rang', 'class="inputbox" size="1"', 'id', 'Gruppe', $row->rang); require_once JPATH_COMPONENT . DS . 'views' . DS . 'ligen.php'; CLMViewLigen::liga($row, $lists, $option); }