예제 #1
0
 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 . '&section=' . $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::_('MTURN_ARCHIV'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
         }
         // Keine SL oder Admin
         if ($row->sl !== CLM_ID and CLM_usertype !== 'admin') {
             JError::raiseWarning(500, JText::_('MTURN_STAFFEL'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $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);
     // 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 . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $sllist[] = JHTML::_('select.option', '0', JText::_('MTURN_TL'), '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 . '&section=' . $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 . '&section=' . $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 . 'mturniere.php';
     CLMViewMTurniere::mturnier($row, $lists, $option);
 }
예제 #2
0
 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_teamtournament_edit_detail') === false) {
         $msg = JText::_('Kein Zugriff: ') . JText::_('MTURN_STAFFEL_TOTAL');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
     }
     if ($cid[0] == 0) {
         if ($clmAccess->access('BE_teamtournament_create') === false) {
             JError::raiseWarning(500, JText::_('LIGEN_ADMIN'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $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 $clmAccess->access('BE_teamtournament_edit_detail') === false) {
             JError::raiseWarning(500, JText::_('MTURN_ARCHIV'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
         }
         // Keine SL oder Admin
         $clmAccess->accesspoint = 'BE_teamtournament_edit_detail';
         if ($clmAccess->access('BE_teamtournament_edit_detail') === false) {
             JError::raiseWarning(500, JText::_('MTURN_STAFFEL_TOTAL'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
         }
         if ($row->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_teamtournament_edit_detail') !== true) {
             JError::raiseWarning(500, JText::_('MTURN_STAFFEL'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $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);
     $userlist = $clmAccess->userlist('BE_teamtournament_edit_result', '>0');
     if ($userlist === false) {
         echo "<br>cl: ";
         var_dump($userlist);
         die('clcl');
     }
     $sllist[] = JHtml::_('select.option', '0', JText::_('MTURN_TL'), 'jid', 'name');
     $sllist = array_merge($sllist, $userlist);
     $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 . '&section=' . $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 . '&section=' . $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 . 'mturniere.php';
     CLMViewMTurniere::mturnier($row, $lists, $option, $cid[0] == 0 ? true : false);
 }