/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
  2. class 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. foreach ($rows AS $key => $row) {
  17. $newrows[$key]['type'] = 'ls';
  18. $newrows[$key]['date'] = $row->mdate;
  19. $newrows[$key]['result'] = 'LIVE!';
  20. $newrows[$key]['headingtitle'] = parent::jl_utf8_convert ('LiveScore', 'iso-8859-1', 'utf-8');
  21. $newrows[$key]['homename'] = parent::jl_utf8_convert ($row->heim, 'iso-8859-1', 'utf-8');
  22. $newrows[$key]['homepic'] = '';
  23. $newrows[$key]['awaypic'] = '';
  24. $newrows[$key]['awayname'] = parent::jl_utf8_convert ($row->gast, 'iso-8859-1', 'utf-8');
  25. $newrows[$key]['matchcode'] = $row->saison;
  26. $newrows[$key]['project_id'] = 'LIVE!';
  27. $matches[] = $newrows[$key];
  28. }
  29. return $newrows;
  30. }
  31. function getRows($caldates, $ordering='ASC'){
  32. $database = JFactory::getDbo();
  33. $query = "SELECT * FROM #__livescore_games";
  34. $where = ' WHERE ';
  35. $where .= " mdate >= '".$caldates['start']."'";
  36. $where .= " AND mdate <= '".$caldates['end']."'";
  37. $where .= ' ORDER BY mdate '.$ordering;
  38. $query = ($this->prefix != '') ? str_replace('#__', $this->prefix, $query) : $query;
  39. $query .= $where;
  40. $database->setQuery($query);
  41. if ( !$result = $database->loadObjectList() ) $result = Array();
  42. return $result;
  43. }
  44. function build_url( &$row ) {
  45. }
  46. }