Exemple #1
0
 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');
     $row = JTable::getInstance('runden', 'TableCLM');
     JArrayHelper::toInteger($cid, array(0));
     // load the row from the db table
     $row->load($cid[0]);
     $liga = JTable::getInstance('ligen', 'TableCLM');
     $liga->load($row->liga);
     if ($liga->liga_mt == "0") {
         $mppoint = 'league';
         $csection = 'ligen';
     } else {
         $mppoint = 'teamtournament';
         $csection = 'mturniere';
     }
     $clmAccess = clm_core::$access;
     if ($clmAccess->access('BE_' . $mppoint . '_edit_round') === false) {
         $section = $csection;
         $msg = JText::_('Kein Zugriff: ') . JText::_('RUNDE_STAFFEL_TOTAL1');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
     }
     if ($task == 'edit') {
         // illegaler Einbruchversuch über URL !
         // evtl. mitschneiden !?!
         $saison = JTable::getInstance('saisons', 'TableCLM');
         $saison->load($row->sid);
         if ($saison->archiv == "1" and $clmAccess->access('BE_' . $mppoint . '_create') !== true) {
             JError::raiseWarning(100, JText::_('RUNDE_ARCHIV'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
         }
         // Prüfen ob User Berechtigung zum editieren hat
         if ($liga->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_round') !== true) {
             JError::raiseWarning(500, JText::_('RUNDE_STAFFEL'));
             $link = 'index.php?option=' . $option . '&section=' . $section;
             $mainframe->redirect($link);
         }
         // do stuff for existing records
         $row->checkout($user->get('id'));
     } else {
         // do stuff for new records
         // Prüfen ob User Berechtigung zum Bearbeiten hat
         if ($liga->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_round') !== true) {
             JError::raiseWarning(500, JText::_('RUNDE_STAFFEL'));
             $section = $csection;
             $link = 'index.php?option=' . $option . '&section=' . $section;
             $mainframe->redirect($link);
         }
         $row->published = 0;
     }
     // Ligaliste
     $sql = " SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 AND a.sl = " . clm_core::$access->getJid();
     // wenn User Admin
     //if ( clm_core::$access->getType() === 'admin') {
     if ($clmAccess->access('BE_' . $mppoint . '_edit_result') === true) {
         $sql = "SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 ";
     }
     $db->setQuery($sql);
     if (!$db->query()) {
         $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $ligalist[] = JHtml::_('select.option', '0', JText::_('RUNDE_LIGA_WAE'), 'liga', 'name');
     $ligalist = array_merge($ligalist, $db->loadObjectList());
     $lists['liga'] = JHtml::_('select.genericlist', $ligalist, 'liga', 'class="inputbox" size="1"', 'liga', 'name', $row->liga);
     $lists['published'] = JHtml::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // 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 . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $saisonlist[] = JHtml::_('select.option', '0', JText::_('RUNDE_SAISON_WAE'), 'sid', 'name');
     $saisonlist = array_merge($saisonlist, $db->loadObjectList());
     $lists['saison'] = JHtml::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid);
     // Liste Meldung
     $lists['complete'] = JHtml::_('select.booleanlist', 'meldung', 'class="inputbox"', $row->meldung);
     // Liste SL OK
     $lists['slok'] = JHtml::_('select.booleanlist', 'sl_ok', 'class="inputbox"', $row->sl_ok);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::runde($row, $lists, $option);
 }
 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('runden', 'TableCLM');
     JArrayHelper::toInteger($cid, array(0));
     // load the row from the db table
     $row->load($cid[0]);
     $liga =& JTable::getInstance('ligen', 'TableCLM');
     $liga->load($row->liga);
     if ($task == 'edit') {
         // illegaler Einbruchversuch über URL !
         // evtl. mitschneiden !?!
         $saison =& JTable::getInstance('saisons', 'TableCLM');
         $saison->load($row->sid);
         if ($saison->archiv == "1" and CLM_usertype !== 'admin') {
             JError::raiseWarning(500, JText::_('RUNDE_ARCHIV'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
         }
         // Prüfen ob User Berechtigung zum editieren hat
         if ($liga->sl !== CLM_ID and CLM_usertype !== 'admin') {
             JError::raiseWarning(500, JText::_('RUNDE_STAFFEL'));
             $link = 'index.php?option=' . $option . '&section=' . $section;
             $mainframe->redirect($link);
         }
         // do stuff for existing records
         $row->checkout($user->get('id'));
     } else {
         // do stuff for new records
         $row->published = 0;
     }
     // Ligaliste
     $sql = " SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 AND a.sl = " . CLM_ID;
     // wenn User Admin
     if (CLM_usertype === 'admin') {
         $sql = "SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 ";
     }
     $db->setQuery($sql);
     if (!$db->query()) {
         $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $ligalist[] = JHTML::_('select.option', '0', JText::_('RUNDE_LIGA_WAE'), 'liga', 'name');
     $ligalist = array_merge($ligalist, $db->loadObjectList());
     $lists['liga'] = JHTML::_('select.genericlist', $ligalist, 'liga', 'class="inputbox" size="1"', 'liga', 'name', $row->liga);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // 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 . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $saisonlist[] = JHTML::_('select.option', '0', JText::_('RUNDE_SAISON_WAE'), 'sid', 'name');
     $saisonlist = array_merge($saisonlist, $db->loadObjectList());
     $lists['saison'] = JHTML::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid);
     // Liste Meldung
     $lists['complete'] = JHTML::_('select.booleanlist', 'meldung', 'class="inputbox"', $row->meldung);
     // Liste SL OK
     $lists['slok'] = JHTML::_('select.booleanlist', 'sl_ok', 'class="inputbox"', $row->sl_ok);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::runde($row, $lists, $option);
 }