PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/com_joomleague/components/com_joomleague/modules/mod_joomleague_calendar/connectors/livescore.php

https://gitlab.com/volleyuisp/joomleague
PHP | 51 lines | 44 code | 5 blank | 2 comment | 2 complexity | cc27431aa919d32f265ee5322db23729 MD5 | raw file
 1<?php
 2class LivescoreConnector extends JLCalendar{
 3  //var $database = JFactory::getDbo();
 4  var $xparams;
 5  var $prefix;
 6  function getMatches ( &$caldates, &$params, &$matches ) {
 7    $this->xparams = $params;
 8    $this->prefix = $params->prefix;
 9    $rows = LivescoreConnector::getRows($caldates);
10    $output = LivescoreConnector::formatRows($rows, $matches);
11    //print_r($output);
12    return $output;
13  }
14  function formatRows( $rows, &$matches ) {
15    $newrows = array();
16    
17    foreach ($rows AS $key => $row) {
18      $newrows[$key]['type'] = 'ls';
19      $newrows[$key]['date'] = $row->mdate;
20      $newrows[$key]['result'] = 'LIVE!';
21      $newrows[$key]['headingtitle'] = parent::jl_utf8_convert ('LiveScore', 'iso-8859-1', 'utf-8');
22      $newrows[$key]['homename'] = parent::jl_utf8_convert ($row->heim, 'iso-8859-1', 'utf-8');
23      $newrows[$key]['homepic'] = '';
24      $newrows[$key]['awaypic'] = '';
25      $newrows[$key]['awayname'] = parent::jl_utf8_convert ($row->gast, 'iso-8859-1', 'utf-8');
26		  $newrows[$key]['matchcode'] = $row->saison;
27		  $newrows[$key]['project_id'] = 'LIVE!';
28		  $matches[] = $newrows[$key];
29		}
30		return $newrows;
31  }
32  function getRows($caldates, $ordering='ASC'){
33    $database = JFactory::getDbo();
34      $query = "SELECT  * FROM #__livescore_games";
35      $where = ' WHERE ';
36      $where .= " mdate >= '".$caldates['start']."'";
37      $where .= " AND mdate <= '".$caldates['end']."'";
38      $where .= ' ORDER BY mdate '.$ordering;
39      $query = ($this->prefix != '') ? str_replace('#__', $this->prefix, $query) : $query;
40      $query .= $where;
41      $database->setQuery($query);
42      if ( !$result = $database->loadObjectList() ) $result = Array();
43      
44      return $result;
45  }
46  
47  function build_url( &$row ) {
48    
49  }
50  
51}