function display($tpl = null)
 {
     JHTML::_('behavior.mootools');
     $mainframe = JFactory::getApplication();
     $params =& $mainframe->getParams();
     // get a reference of the page instance in joomla
     $document = JFactory::getDocument();
     $uri = JFactory::getURI();
     // add the css files
     $version = urlencode(JoomleagueHelper::getVersion());
     $css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version;
     $document->addStyleSheet($css);
     // add some javascript
     $version = urlencode(JoomleagueHelper::getVersion());
     $document->addScript(JURI::base(true) . '/components/com_joomleague/assets/js/results.js?v=' . $version);
     // add the ranking model
     $rankingmodel = new JoomleagueModelRanking();
     $project = $rankingmodel->getProject();
     // add the ranking config file
     $rankingconfig = $rankingmodel->getTemplateConfig('ranking');
     $rankingmodel->computeRanking();
     // add the results model
     $resultsmodel = new JoomleagueModelResults();
     // add the results config file
     $mdlRound = JModel::getInstance("Round", "JoomleagueModel");
     $roundcode = $mdlRound->getRoundcode($rankingmodel->round);
     $rounds = JoomleagueHelper::getRoundsOptions($project->id, 'ASC', true);
     $resultsconfig = $resultsmodel->getTemplateConfig('results');
     if (!isset($resultsconfig['switch_home_guest'])) {
         $resultsconfig['switch_home_guest'] = 0;
     }
     if (!isset($resultsconfig['show_dnp_teams_icons'])) {
         $resultsconfig['show_dnp_teams_icons'] = 0;
     }
     if (!isset($resultsconfig['show_results_ranking'])) {
         $resultsconfig['show_results_ranking'] = 0;
     }
     // merge the 2 config files
     $config = array_merge($rankingconfig, $resultsconfig);
     $this->assignRef('project', $resultsmodel->getProject());
     $this->assignRef('overallconfig', $resultsmodel->getOverallConfig());
     $this->assignRef('config', array_merge($this->overallconfig, $config));
     $this->assignRef('tableconfig', $rankingconfig);
     $this->assignRef('params', $params);
     $this->assignRef('showediticon', $resultsmodel->getShowEditIcon());
     $this->assignRef('division', $resultsmodel->getDivision());
     $this->assignRef('divisions', $rankingmodel->getDivisions());
     $this->assignRef('divLevel', $rankingmodel->divLevel);
     $this->assignRef('matches', $resultsmodel->getMatches());
     $this->assignRef('round', $resultsmodel->roundid);
     $this->assignRef('roundid', $resultsmodel->roundid);
     $this->assignRef('roundcode', $roundcode);
     $rounds = $resultsmodel->getRoundOptions();
     $options = $this->getRoundSelectNavigation($rounds);
     $this->assignRef('matchdaysoptions', $options);
     $this->assignRef('currenturl', JoomleagueHelperRoute::getResultsRankingRoute($resultsmodel->getProject()->slug, $this->round));
     $this->assignRef('rounds', $resultsmodel->getRounds());
     $this->assignRef('favteams', $resultsmodel->getFavTeams($this->project));
     $this->assignRef('projectevents', $resultsmodel->getProjectEvents());
     $this->assignRef('model', $resultsmodel);
     $this->assignRef('isAllowed', $resultsmodel->isAllowed());
     $this->assignRef('type', $rankingmodel->type);
     $this->assignRef('from', $rankingmodel->from);
     $this->assignRef('to', $rankingmodel->to);
     $this->assignRef('currentRanking', $rankingmodel->currentRanking);
     $this->assignRef('previousRanking', $rankingmodel->previousRanking);
     $this->assignRef('homeRank', $rankingmodel->homeRank);
     $this->assignRef('awayRank', $rankingmodel->awayRank);
     $this->assignRef('current_round', $rankingmodel->current_round);
     $this->assignRef('teams', $rankingmodel->getTeamsIndexedByPtid());
     $this->assignRef('previousgames', $rankingmodel->getPreviousGames());
     $this->assign('action', $uri->toString());
     //rankingcolors
     if (!isset($this->config['colors'])) {
         $this->config['colors'] = "";
     }
     $this->assignRef('colors', $rankingmodel->getColors($this->config['colors']));
     $this->assign('show_debug_info', JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0));
     $this->assign('use_joomlaworks', JComponentHelper::getParams('com_joomleague')->get('use_joomlaworks', 0));
     // Set page title
     $pageTitle = $this->params->get('what_to_show_first', 0) == 0 ? JText::_('COM_JOOMLEAGUE_RESULTS_PAGE_TITLE') . ' & ' . JText::_('COM_JOOMLEAGUE_RANKING_PAGE_TITLE') : JText::_('COM_JOOMLEAGUE_RANKING_PAGE_TITLE') . ' & ' . JText::_('COM_JOOMLEAGUE_RESULTS_PAGE_TITLE');
     if (isset($this->project->name)) {
         $pageTitle .= ' - ' . $this->project->name;
     }
     $document->setTitle($pageTitle);
     /*
     //build feed links
     $feed = 'index.php?option=com_joomleague&view=results&p='.$this->project->id.'&format=feed';
     $rss = array('type' => 'application/rss+xml', 'title' => JText::_('COM_JOOMLEAGUE_RESULTS_RSSFEED'));
     
     // add the links
     $document->addHeadLink(JRoute::_($feed.'&type=rss'), 'alternate', 'rel', $rss);
     */
     JLGView::display($tpl);
 }
Exemple #2
0
 function display($tpl = null)
 {
     JHtml::_('behavior.framework');
     $mainframe = JFactory::getApplication();
     $params =& $mainframe->getParams();
     // get a reference of the page instance in joomla
     $document = JFactory::getDocument();
     $uri = JFactory::getURI();
     // add the css files
     $version = urlencode(JoomleagueHelper::getVersion());
     $css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version;
     $document->addStyleSheet($css);
     // add some javascript
     $version = urlencode(JoomleagueHelper::getVersion());
     $document->addScript(JUri::base(true) . '/components/com_joomleague/assets/js/results.js?v=' . $version);
     // add the ranking model
     $rankingmodel = new JoomleagueModelRanking();
     $project = $rankingmodel->getProject();
     // add the ranking config file
     $rankingconfig = $rankingmodel->getTemplateConfig('ranking');
     $rankingmodel->computeRanking();
     // add the results model
     $resultsmodel = new JoomleagueModelResults();
     // add the results config file
     $mdlRound = JModelLegacy::getInstance("Round", "JoomleagueModel");
     $roundcode = $mdlRound->getRoundcode($rankingmodel->round);
     $rounds = JoomleagueHelper::getRoundsOptions($project->id, 'ASC', true);
     $resultsconfig = $resultsmodel->getTemplateConfig('results');
     if (!isset($resultsconfig['switch_home_guest'])) {
         $resultsconfig['switch_home_guest'] = 0;
     }
     if (!isset($resultsconfig['show_dnp_teams_icons'])) {
         $resultsconfig['show_dnp_teams_icons'] = 0;
     }
     if (!isset($resultsconfig['show_results_ranking'])) {
         $resultsconfig['show_results_ranking'] = 0;
     }
     // merge the 2 config files
     $config = array_merge($rankingconfig, $resultsconfig);
     $this->model = $rankingmodel;
     $this->project = $resultsmodel->getProject();
     $this->overallconfig = $resultsmodel->getOverallConfig();
     $this->config = array_merge($this->overallconfig, $config);
     $this->tableconfig = $rankingconfig;
     $this->params = $params;
     $this->showediticon = $resultsmodel->getShowEditIcon();
     $this->division = $resultsmodel->getDivision();
     $this->divisions = $rankingmodel->getDivisions();
     $this->divLevel = $rankingmodel->divLevel;
     $this->matches = $resultsmodel->getMatches();
     $this->round = $resultsmodel->roundid;
     $this->roundid = $resultsmodel->roundid;
     $this->roundcode = $roundcode;
     $rounds = $resultsmodel->getRoundOptions();
     $options = $this->getRoundSelectNavigation($rounds);
     $this->matchdaysoptions = $options;
     $this->currenturl = JoomleagueHelperRoute::getResultsRankingRoute($resultsmodel->getProject()->slug, $this->round);
     $this->rounds = $resultsmodel->getRounds();
     $this->favteams = $resultsmodel->getFavTeams($this->project);
     $this->projectevents = $resultsmodel->getProjectEvents();
     $this->model = $resultsmodel;
     $this->isAllowed = $resultsmodel->isAllowed();
     $this->type = $rankingmodel->type;
     $this->from = $rankingmodel->from;
     $this->to = $rankingmodel->to;
     $this->currentRanking = $rankingmodel->currentRanking;
     $this->previousRanking = $rankingmodel->previousRanking;
     $this->homeRanking = $rankingmodel->homeRank;
     $this->awayRanking = $rankingmodel->awayRank;
     $this->current_round = $rankingmodel->current_round;
     $this->teams = $rankingmodel->getTeamsIndexedByPtid($resultsmodel->getDivisionID());
     $this->previousgames = $rankingmodel->getPreviousGames();
     $this->action = $uri->toString();
     //rankingcolors
     if (!isset($this->config['colors'])) {
         $this->config['colors'] = "";
     }
     $this->colors = $rankingmodel->getColors($this->config['colors']);
     // Set page title
     if ($this->params->get('what_to_show_first', 0) == 0) {
         $prefix = JText::_('COM_JOOMLEAGUE_RESULTS_PAGE_TITLE') . ' & ' . JText::_('COM_JOOMLEAGUE_RANKING_PAGE_TITLE');
         $pageTitleFormat = $resultsconfig["page_title_format"];
     } else {
         $prefix = JText::_('COM_JOOMLEAGUE_RANKING_PAGE_TITLE') . ' & ' . JText::_('COM_JOOMLEAGUE_RESULTS_PAGE_TITLE');
         $pageTitleFormat = $rankingconfig["page_title_format"];
     }
     $titleInfo = JoomleagueHelper::createTitleInfo($prefix);
     if (!empty($this->project)) {
         $titleInfo->projectName = $this->project->name;
         $titleInfo->leagueName = $this->project->league_name;
         $titleInfo->seasonName = $this->project->season_name;
     }
     if (!empty($this->division) && $this->division->id != 0) {
         $titleInfo->divisionName = $this->division->name;
     }
     $this->pagetitle = JoomleagueHelper::formatTitle($titleInfo, $pageTitleFormat);
     $document->setTitle($this->pagetitle);
     /*
     //build feed links
     $feed = 'index.php?option=com_joomleague&view=results&p='.$this->project->id.'&format=feed';
     $rss = array('type' => 'application/rss+xml', 'title' => JText::_('COM_JOOMLEAGUE_RESULTS_RSSFEED'));
     
     // add the links
     $document->addHeadLink(JRoute::_($feed.'&type=rss'), 'alternate', 'rel', $rss);
     */
     JLGView::display($tpl);
 }