예제 #1
0
 public static function getIcalRoute($projectid, $teamid = null, $pgid = null)
 {
     $params = array("option" => "com_joomleague", "view" => "ical", "p" => $projectid);
     if (!is_null($pgid)) {
         $params["pgid"] = $pgid;
     }
     if (!is_null($teamid)) {
         $params["teamid"] = $teamid;
     }
     $query = JoomleagueHelperRoute::buildQuery($params);
     $link = JRoute::_("index.php?" . $query, false);
     return $link;
 }
 function addtipp()
 {
     JRequest::checkToken() or jexit(JText::_('JL_PRED_ENTRY_INVALID_TOKEN_PREDICTIONS_NOT_SAVED'));
     $option = JRequest::getCmd('option');
     $optiontext = strtoupper(JRequest::getCmd('option') . '_');
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $msg = '';
     $link = '';
     $predictionGameID = JRequest::getVar('prediction_id', '', 'post', 'int');
     $joomlaUserID = JRequest::getVar('user_id', '', 'post', 'int');
     $memberID = JRequest::getVar('memberID', '', 'post', 'int');
     $round_id = JRequest::getVar('round_id', '', 'post', 'int');
     $pjID = JRequest::getVar('pjID', '', 'post', 'int');
     $set_r = JRequest::getVar('set_r', '', 'post', 'int');
     $set_pj = JRequest::getVar('set_pj', '', 'post', 'int');
     $model = $this->getModel('predictionentry');
     $user =& JFactory::getUser();
     $isMember = $model->checkPredictionMembership();
     $allowedAdmin = $model->getAllowed();
     if ($user->id != $joomlaUserID && !$allowedAdmin) {
         $msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_1');
         $link = JFactory::getURI()->toString();
     } else {
         if (!$isMember && !$allowedAdmin) {
             $msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_2');
             $link = JFactory::getURI()->toString();
         } else {
             if ($pjID != $set_pj) {
                 $params = array('option' => 'com_joomleague', 'view' => 'predictionentry', 'prediction_id' => $predictionGameID, 'pj' => $set_pj);
                 $query = JoomleagueHelperRoute::buildQuery($params);
                 $link = JRoute::_('index.php?' . $query, false);
                 $this->setRedirect($link);
             }
             if ($round_id != $set_r) {
                 $params = array('option' => 'com_joomleague', 'view' => 'predictionentry', 'prediction_id' => $predictionGameID, 'r' => $set_r, 'pj' => $pjID);
                 $query = JoomleagueHelperRoute::buildQuery($params);
                 $link = JRoute::_('index.php?' . $query, false);
                 $this->setRedirect($link);
             }
             if (!$model->savePredictions($allowedAdmin)) {
                 $msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_ERROR_3');
                 $link = JFactory::getURI()->toString();
             } else {
                 $msg .= JText::_('COM_JOOMLEAGUE_PRED_ENTRY_CONTROLLER_MSG_1');
                 $link = JFactory::getURI()->toString();
             }
         }
     }
     //echo '<br />' . $link . '<br />';
     //echo '<br />' . $msg . '<br />';
     $this->setRedirect($link, $msg);
 }