Example #1
0
 function save()
 {
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $section = JRequest::getVar('section');
     $db = JFactory::getDBO();
     $task = JRequest::getVar('task');
     $row = JTable::getInstance('saisons', 'TableCLM');
     if (!$row->bind(JRequest::get('post'))) {
         JError::raiseError(500, $row->getError());
     }
     // pre-save checks
     if (!$row->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$row->id) {
         $id = -1;
     } else {
         $id = $row->id;
     }
     $out = clm_core::$api->db_season_save($id, $row->published, $row->archiv, $row->name, $row->bemerkungen, $row->bem_int, $row->datum);
     if ($task == 'save' && $out[0]) {
         $link = 'index.php?option=' . $option . '&section=' . $section;
     } else {
         if ($out[0]) {
             $link = 'index.php?option=' . $option . '&section=' . $section . '&task=edit&cid[]=' . $out[2];
         } else {
             $message = clm_core::$load->load_view("notification", array($out[1], false));
             $message = $message[0];
             // array dereferencing fix php 5.3
             $mainframe->enqueueMessage($message[0], $message[1]);
             $option = JRequest::getCmd('option');
             $lists['archiv'] = JHtml::_('select.booleanlist', 'archiv', 'class="inputbox"', $row->archiv);
             $lists['published'] = JHtml::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
             require_once JPATH_COMPONENT . DS . 'views' . DS . 'saisons.php';
             CLMViewSaisons::saison($row, $lists, $option);
             return;
         }
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = $aktion;
     $clmLog->params = array('sid' => $out[2]);
     $clmLog->write();
     $message = clm_core::$load->load_view("notification", array($out[1], false));
     $message = $message[0];
     // array dereferencing fix php 5.3
     $mainframe->redirect($link, $message[0], $message[1]);
 }
 function edit()
 {
     global $mainframe, $option;
     // Check for request forgeries
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $task = JRequest::getVar('task');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     JArrayHelper::toInteger($cid, array(0));
     $row =& JTable::getInstance('saisons', 'TableCLM');
     // load the row from the db table //
     $row->load($cid[0]);
     if ($task == 'edit') {
         // do stuff for existing records
         $row->checkout($user->get('id'));
     } else {
         // do stuff for new records  //
         $row->published = 0;
     }
     // Archiv
     $lists['archiv'] = JHTML::_('select.booleanlist', 'archiv', 'class="inputbox"', $row->archiv);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'saisons.php';
     CLMViewSaisons::saison($row, $lists, $option);
 }