PageRenderTime 53ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/com_joomleague/components/com_joomleague/modules/mod_joomleague_matches/helper.php

https://gitlab.com/julienv/joomleague
PHP | 526 lines | 483 code | 30 blank | 13 comment | 136 complexity | 80eeb1727d70e7509b83317397f37e70 MD5 | raw file
  1. <?php
  2. /**
  3. * @copyright Copyright (C) 2005-2014 joomleague.at. All rights reserved.
  4. * @license GNU/GPL, see LICENSE.php
  5. * Joomla! is free software. This version may have been modified pursuant
  6. * to the GNU General Public License, and as distributed it includes or
  7. * is derivative of works licensed under the GNU General Public License or
  8. * other free or open source software licenses.
  9. * See COPYRIGHT.php for copyright notices and details.
  10. */
  11. defined('_JEXEC') or die('Restricted access');
  12. class modMatchesHelper {
  13. public function __construct(& $params, $id, $match_id = 0) {
  14. $this->module_id = $id;
  15. $this->params = $params;
  16. $itemid = $this->params->get('Itemid');
  17. $this->itemid = (!empty ($itemid)) ? '&amp;Itemid=' . $itemid : '';
  18. $this->id = $match_id;
  19. $this->usedteams = array (
  20. 0 => array ()
  21. );
  22. $this->addusedprojects();
  23. $this->iconpath = ($params->get('use_icons') != '-1') ? _JLMATCHLISTMODURL . 'assets/images/' .
  24. $params->get('use_icons') . '/' : false;
  25. }
  26. public function arrStrToClean(& $string, $sep = ',') {
  27. if (empty ($string)) {
  28. return $string;
  29. }
  30. $ids = explode($sep, $string);
  31. JArrayHelper :: toInteger($ids);
  32. $string = implode($sep, $ids);
  33. return $string;
  34. }
  35. public function getFromDB($query, $key = "", $type = "objlist") {
  36. $db = JFactory::getDbo();
  37. $db->setQuery($query);
  38. switch ($type) {
  39. case "obj" :
  40. $result = $db->loadObject($key);
  41. break;
  42. case 'arr' :
  43. $result = $db->loadColumn($key);
  44. break;
  45. case 'assc' :
  46. $result = $db->loadAssocList($key);
  47. break;
  48. default :
  49. $result = $db->loadObjectList($key);
  50. break;
  51. }
  52. if ($this->params->get('debug', 0) == 1) {
  53. echo $query . '<br />';
  54. }
  55. return $result;
  56. }
  57. public function jl_utf8_convert($text, $fromenc = 'iso-8859-1', $toenc = 'UTF-8') {
  58. if (!defined('_MODJLML_JOOMLEAGUE_JC'))
  59. return $text;
  60. if (strtolower($fromenc) == strtolower($toenc) || $this->params->get('convert', 1) == 0)
  61. return $text;
  62. elseif (function_exists('iconv')) {
  63. return iconv($fromenc, $toenc, $text);
  64. }
  65. elseif (strtolower($fromenc) == 'iso-8859-1' && strtolower($toenc) == 'utf-8') {
  66. return utf8_encode($text);
  67. }
  68. elseif (strtolower($fromenc) == 'utf-8' && strtolower($toenc) == 'iso-8859-1') {
  69. return utf8_decode($text);
  70. } else
  71. return $text;
  72. }
  73. public function sortObject($array, $comparefunction, $property = '') {
  74. $zcount = count($array);
  75. for ($i = 1; $i < $zcount; $i++) {
  76. for ($a = $zcount -1; $a >= $i; $a--) {
  77. if ($this-> $comparefunction ($array[$a -1]-> $property, $array[$a]-> $property) > 0) {
  78. $tempzal = $array[$a -1];
  79. $array[$a -1] = $array[$a];
  80. $array[$a] = $tempzal;
  81. }
  82. }
  83. }
  84. return $array;
  85. }
  86. public function sortArray($array, $comparefunction, $property = '') {
  87. $zcount = count($array);
  88. for ($i = 1; $i < $zcount; $i++) {
  89. for ($a = $zcount -1; $a >= $i; $a--) {
  90. if ($this-> $comparefunction ($array[$a -1][$property], $array[$a][$property]) > 0) {
  91. $tempzal = $array[$a -1];
  92. $array[$a -1] = $array[$a];
  93. $array[$a] = $tempzal;
  94. }
  95. }
  96. }
  97. return $array;
  98. }
  99. private function asc($a, $b) {
  100. if ($a < $b)
  101. return -1;
  102. if ($a == $b)
  103. return 0;
  104. return 1;
  105. }
  106. private function desc($a, $b) {
  107. if ($a > $b)
  108. return -1;
  109. if ($a == $b)
  110. return 0;
  111. return 1;
  112. }
  113. public function array_trim($a) {
  114. $j = 0;
  115. $b = array ();
  116. for ($i = 0; $i < count($a); $i++) {
  117. if (trim($a[$i]) != "") {
  118. $b[$j++] = $a[$i];
  119. } else
  120. $b[$j++] = '-';
  121. }
  122. return $b;
  123. }
  124. private function addusedprojects() {
  125. $usedp = $this->params->get('project');
  126. if (is_array($usedp)) {
  127. foreach ($usedp AS $p) {
  128. $this->usedteams[$p] = array ();
  129. }
  130. }
  131. elseif (!empty ($usedp)) {
  132. $this->usedteams[$usedp] = array ();
  133. }
  134. }
  135. public function usedteamscheck($team_id, $project_id) {
  136. return ((isset ($this->usedteams[0]) AND is_array($this->usedteams[0]) AND in_array($team_id, $this->usedteams[0])) OR (isset ($this->usedteams[$project_id]) AND is_array($this->usedteams[$project_id]) AND in_array($team_id, $this->usedteams[$project_id]))) ? 1 : 0;
  137. }
  138. public function addteamicon($which) {
  139. $path = ($this->iconpath) ? $this->iconpath . 'teamlinks/' : false;
  140. if ($path) {
  141. return JHtml :: _('image', $path . $which . '.png', $this->params->get($which . '_text'), 'title="' . $this->params->get($which . '_text') . '"');
  142. } else {
  143. return $this->params->get($which . '_text') . '<br />';
  144. }
  145. }
  146. public function getTeamDetails(& $team, $nr) {
  147. if (!is_object($team))
  148. return false;
  149. $usedname = $this->params->get('team_names');
  150. $class = 'jlmlTeamname';
  151. $isusedteam = $this->usedteamscheck($team->id, $team->project_id);
  152. if ($isusedteam) {
  153. $class .= ' jlmlusedteam';
  154. }
  155. if (($this->params->get('link_teams', 0) + $isusedteam) >= 2)
  156. $class .= " jlmhaslinks";
  157. $teamdetails['logo'] = $this->getpix($team); //returns false if logos are not to be shown
  158. $teamdetails['name'] = '<span class="' . $class . '" id="jlmlTeamname' . $team->id . 'mod' . $this->module_id . 'nr' . $nr . '">';
  159. switch ($usedname) {
  160. case "short_name" :
  161. $teamdetails['name'] .= '<acronym title="' .
  162. $this->jl_utf8_convert($team->name, 'iso-8859-1', 'utf-8') . '">' .
  163. $this->jl_utf8_convert($team->short_name, 'iso-8859-1', 'utf-8') .
  164. '</acronym>';
  165. break;
  166. default :
  167. $teamdetails['name'] .= ($team-> $usedname != '') ? $this->jl_utf8_convert($team-> $usedname, 'iso-8859-1', 'utf-8') : $this->jl_utf8_convert($team->name, 'iso-8859-1', 'utf-8');
  168. break;
  169. }
  170. $teamdetails['name'] .= '</span>';
  171. return $teamdetails;
  172. }
  173. public function getpix($team) {
  174. $pt = $this->params->get('picture_type');
  175. if ($this->params->get('show_picture') == 0)
  176. return false;
  177. $appendimage = ' align="middle" ';
  178. $countrycode = $team->country;
  179. if($pt=="country" && strlen($countrycode)==3) {
  180. $pic['src'] = Countries::getIso3Flag($countrycode);
  181. $pic['alt'] = Countries::getCountryName($countrycode);
  182. } else {
  183. $defaultlogos = $this->getDefaultLogos();
  184. $matchpart_pic = (!empty ($team-> $pt) AND file_exists(JPATH_ROOT . DS . $team-> $pt)) ? $team-> $pt : $defaultlogos[$pt];
  185. if (file_exists(JPATH_ROOT . DS . $matchpart_pic)) {
  186. $size = getimagesize(JPATH_ROOT . DS . $matchpart_pic);
  187. $pic_width = $size[0];
  188. $pic_height = $size[1];
  189. $whichparam = ($pic_width > $pic_height) ? ' width' : ' height';
  190. if ($this->params->get('xsize') > 0)
  191. $appendimage .= $whichparam . '="' . $this->params->get('xsize') . '"';
  192. elseif ($this->params->get('ysize') > 0) $appendimage .= $whichparam . '="' . $this->params->get('ysize') . '"';
  193. }
  194. $pic['src'] = (trim($matchpart_pic) != "" && file_exists(JPATH_ROOT . DS . trim($matchpart_pic))) ? JUri :: root(true) .
  195. '/' . $matchpart_pic : JUri :: root(true) . '/' . $defaultlogos[$pt];
  196. $pic['alt'] = $this->jl_utf8_convert($team->name, 'iso-8859-1', 'utf-8');
  197. }
  198. $pic['append'] = $appendimage;
  199. return $pic;
  200. }
  201. public function formatResults(& $row, & $match) {
  202. $live = ($match->live == 'z') ? 0 : 1;
  203. $mrt = array (
  204. 0 => array (
  205. 0 => '',
  206. 1 => ''
  207. ),
  208. 1 => array (
  209. 0 => JText :: _('AET'),
  210. 1 => JText :: _('IET')
  211. ),
  212. 2 => array (
  213. 0 => JText :: _('ONP'),
  214. 1 => JText :: _('INP')
  215. )
  216. );
  217. $partresults = '';
  218. if ($this->params->get('part_result') == 1 AND trim(str_replace(';', '', $match->team1_result_split)) != '') {
  219. $homepartresults = $this->array_trim(explode(";", $match->team1_result_split));
  220. $guestpartresults = $this->array_trim(explode(";", $match->team2_result_split));
  221. $cntmp = ($match->game_parts + $this->params->get('part_result_count'));
  222. for ($x = 0; $x < $cntmp; $x++) {
  223. $highlight_parts = false;
  224. if ($x == ($match->game_parts + $this->params->get('part_result_count')))
  225. break;
  226. if (isset ($homepartresults[$x]) && isset ($guestpartresults[$x])) {
  227. if (is_null($match->team1_result) AND ($x +1) <= $cntmp AND (!isset ($homepartresults[$x +1]) OR $homepartresults[$x +1] == '-') AND $homepartresults[$x] != '-' AND $match->match_result_type == 0) {
  228. $highlight_parts = true;
  229. }
  230. if ($x == 0)
  231. $partresults .= '(';
  232. if ($x != 0)
  233. $partresults .= $this->params->get('part_results_separator');
  234. if ($live != 'z' AND $highlight_parts)
  235. $partresults .= '<span class="jlml_livescore">';
  236. $partresults .= $homepartresults[$x] . ':' . $guestpartresults[$x];
  237. if ($live != 'z' AND $highlight_parts)
  238. $partresults .= '</span>';
  239. } else
  240. break;
  241. }
  242. if (!is_null($match->team1_result_ot)) {
  243. array_push($homepartresults, $match->team1_result_ot);
  244. array_push($guestpartresults, $match->team2_result_ot);
  245. $partresults .= ' - ';
  246. if (is_null($match->team1_result))
  247. $partresults .= '<span class="jlml_livescore">';
  248. $partresults .= JText :: _('IET') . ' ' . $match->team1_result_ot . ':' . $match->team2_result_ot;
  249. if (is_null($match->team1_result))
  250. $partresults .= '</span>';
  251. }
  252. if (trim($partresults) != '')
  253. $partresults .= ')';
  254. }
  255. if ($live != 'z' AND trim(str_replace(';', '', $match->team1_result_split)) != '' AND is_null($match->team1_result)) {
  256. if (isset ($homepartresults) AND count($homepartresults) > 0) {
  257. $row['homescore'] = array_sum($homepartresults);
  258. }
  259. if (isset ($guestpartresults) AND count($guestpartresults) > 0) {
  260. $row['awayscore'] = array_sum($guestpartresults);
  261. }
  262. $row['homescore'] = '<span class="jlml_livescore">' . $row['homescore'] . '</span>';
  263. $row['awayscore'] = '<span class="jlml_livescore">' . $row['awayscore'] . '</span>';
  264. }
  265. $row['partresults'] = $partresults;
  266. $row['result'] = $row['homescore'] . $this->params->get('team_separator') . $row['awayscore'];
  267. if ($live == 0)
  268. $row['result'] .= $mrt[$match->match_result_type][$live];
  269. }
  270. public function createMatchInfo(& $row, $match) {
  271. $row['notice'] = ($match->match_result_detail != '' AND $this->params->get('show_match_notice') == 1) ? $match->match_result_detail : '';
  272. if ($this->params->get('show_referee', 1) == 1 AND $match->refname != '') {
  273. $row['referee'] = '<span style="float:right;">';
  274. $row['referee'] .= ($this->iconpath) ? JHtml :: _('image', $this->iconpath . 'referee.png', 'Referee', array (
  275. 'title' => 'Referee',
  276. 'height' => '16',
  277. 'width' => '16'
  278. )) : 'Referee: ';
  279. $row['referee'] .= $this->jl_utf8_convert($match->refname, 'iso-8859-1', 'utf-8') . '</span>';
  280. } else {
  281. $row['referee'] = '';
  282. }
  283. if ($this->params->get('show_spectators', 1) == 1 AND $match->crowd > 0) {
  284. $row['spectators'] = '<span style="float:left;">';
  285. $row['spectators'] .= ($this->iconpath) ? JHtml :: _('image', $this->iconpath . 'spectators.png', 'Spectators', array (
  286. 'title' => 'Spectators',
  287. 'height' => '16',
  288. 'width' => '16'
  289. )) : 'Spectators: ';
  290. $row['spectators'] .= number_format($match->crowd, 0, ',', '.') . '</span>';
  291. ;
  292. } else {
  293. $row['spectators'] = '';
  294. }
  295. }
  296. public function formatMatches(& $matches) {
  297. if ($this->params->get('lastsortorder') == 'desc') {
  298. $matches = $this->sortObject($matches, 'desc', 'alreadyplayed');
  299. }
  300. if ($this->params->get('upcoming_first', 1) == 1) {
  301. $matches = $this->sortObject($matches, 'asc', 'upcoming');
  302. }
  303. $matches = $this->sortObject($matches, 'asc', 'actplaying');
  304. $matches = $this->sortObject($matches, 'asc', 'live');
  305. $teams = $this->getTeamsFromMatches($matches);
  306. $rows = array ();
  307. $useicons = $this->iconpath;
  308. $cnt = JRequest :: getVar('nr', 0, 'default', 'POST');
  309. $hteam = false;
  310. $ateam = false;
  311. foreach ((array) $matches AS $key => $match) {
  312. //echo 'NOW(): '.JHtml::_('date', $match->currenttime, $this->params->get('dateformat').' '.$this->params->get('timeformat'),0).'<br />';
  313. if ($match->projectteam1_id) {
  314. $hteam = $teams[$match->projectteam1_id];
  315. }
  316. if ($match->projectteam2_id) {
  317. $ateam = $teams[$match->projectteam2_id];
  318. }
  319. //$matches[$key]->live = false;
  320. $rows[$match->match_id]['type'] = 'undefined';
  321. if ($this->params->get('show_status_notice') == 1) {
  322. if ($match->live != 'z') {
  323. $rows[$match->match_id]['type'] = 'live';
  324. }
  325. else {
  326. $matches[$key]->live = false;
  327. if ($match->actplaying != 'z') {
  328. $rows[$match->match_id]['type'] = 'actplaying';
  329. }
  330. elseif ($match->alreadyplayed != 0) {
  331. $rows[$match->match_id]['type'] = 'alreadyplayed';
  332. }
  333. elseif ($match->upcoming != 'z') {
  334. $rows[$match->match_id]['type'] = 'upcoming';
  335. }
  336. }
  337. }
  338. $rows[$match->match_id]['date'] = JoomleagueHelper::getMatchDate($match, JText::_($this->params->get('dateformat')));
  339. if ($useicons) {
  340. $rows[$match->match_id]['date'] = JHtml::_('image', $this->iconpath . 'date.png', 'Datum', array (
  341. 'title' => 'Datum',
  342. 'height' => '16',
  343. 'width' => '16'
  344. )) .
  345. ' ' . $rows[$match->match_id]['date'];
  346. }
  347. $rows[$match->match_id]['time'] = JoomleagueHelper::getMatchTime($match, JText::_($this->params->get('timeformat')));
  348. if ($useicons) {
  349. $rows[$match->match_id]['time'] = JHtml :: _('image', $this->iconpath . 'time.png', 'Beginn', array (
  350. 'title' => 'Beginn',
  351. 'height' => '16',
  352. 'width' => '16'
  353. )) .
  354. ' ' . $rows[$match->match_id]['time'];
  355. }
  356. if (isset ($match->meeting)) {
  357. $rows[$match->match_id]['meeting'] = JHtml :: _('date', $match->meetingtime, $this->params->get('timeformat'), null);
  358. if ($useicons) {
  359. $rows[$match->match_id]['meeting'] = JHtml :: _('image', $this->iconpath . 'time_go.png', 'Treffpunkt', array (
  360. 'title' => 'Treffpunkt',
  361. 'height' => '16',
  362. 'width' => '16'
  363. )) .
  364. ' ' . $rows[$match->match_id]['meeting'];
  365. }
  366. }
  367. $rows[$match->match_id]['project_id'] = $match->project_id;
  368. $rows[$match->match_id]['totaltime'] = $match->totaltime;
  369. $rows[$match->match_id]['round_id'] = $match->round_id;
  370. $rows[$match->match_id]['hometeam'] = $this->getTeamDetails($hteam, $cnt);
  371. $rows[$match->match_id]['homescore'] = (!is_null($match->team1_result)) ? $match->team1_result : '-';
  372. $rows[$match->match_id]['homeover'] = $this->buildTeamLinks($hteam, $cnt);
  373. $rows[$match->match_id]['awayteam'] = $this->getTeamDetails($ateam, $cnt);
  374. $rows[$match->match_id]['awayscore'] = (!is_null($match->team2_result)) ? $match->team2_result : '-';
  375. $rows[$match->match_id]['awayover'] = $this->buildTeamLinks($ateam, $cnt);
  376. $this->createMatchInfo($rows[$match->match_id], $match);
  377. $this->formatHeading($rows[$match->match_id], $match);
  378. $this->formatResults($rows[$match->match_id], $match);
  379. $this->createMatchLinks($rows[$match->match_id], $match);
  380. $this->createLocation($rows[$match->match_id], $match, $hteam);
  381. $this->createAjaxMenu($match, $cnt);
  382. $rows[$match->match_id]['ajax'] = $match->ajax;
  383. $cnt++;
  384. }
  385. return $rows;
  386. }
  387. public function getTimeLimit() {
  388. $livematchestime = "IF((p.allow_add_time > 0), ((p.game_regular_time+(p.game_parts * p.halftime)) + p.add_time), (p.game_regular_time+(p.game_parts * p.halftime)))";
  389. $timeforfirstmatch = "DATE_SUB(" . $this->getDateString() . ", INTERVAL $livematchestime MINUTE) > UTC_TIMESTAMP()";
  390. //$timeforfirstmatch = $this->getDateString() . " > NOW()";
  391. if ($this->params->get('show_played', 0) == 1 AND ($this->params->get('result_add_time', 0)) > 0) {
  392. $timeforfirstmatch = $this->getDateString() . " > DATE_SUB(UTC_TIMESTAMP(), INTERVAL " . intval($this->params->get('result_add_time', 0)) . " " . $this->params->get('result_add_unit') . ")";
  393. }
  394. $timeforlastmatch = ($this->params->get('period_int', 0) > 0) ? $this->getDateString() . " < DATE_ADD(UTC_TIMESTAMP(), INTERVAL " . intval($this->params->get('period_int')) . " " . $this->params->get('period_string') . ")" : '';
  395. $wheretime = "(" . $timeforfirstmatch;
  396. if (!empty ($timeforlastmatch))
  397. $wheretime .= " AND " . $timeforlastmatch;
  398. $wheretime .= ")";
  399. return $wheretime;
  400. }
  401. public function createAjaxMenu(& $row, $cnt) {
  402. if ($this->params->get('next_last', 0) == 0) {
  403. $row->ajax = false;
  404. return false;
  405. }
  406. if ( $this->params->get('nextlast_from_same_project')== 0) {
  407. $this->next_last2($row);
  408. }
  409. else {
  410. $this->next_last($row);
  411. }
  412. $origin = JRequest :: getVar('origin', $row->match_id, 'default', 'POST');
  413. $jsfunc = "jlml_loadMatch('%s', '%s', '" . $this->module_id . "', '" . $cnt . "', '%s')";
  414. $options = array (
  415. 'height' => '16',
  416. 'width' => '16',
  417. 'onclick' => 'alert(\'coming soon...\')',
  418. 'style' => 'cursor:pointer;'
  419. );
  420. // start ajaxifying
  421. $showhome = (($this->params->get('next_last') + $this->usedteamscheck($row->team1_id, $row->project_id)) >= 2);
  422. $showaway = (($this->params->get('next_last') + $this->usedteamscheck($row->team2_id, $row->project_id)) >= 2);
  423. $temp = '<div class="jlmlext_ajaxmenu" style="text-align:center;width:100%;display:block;clear:both;margin-top:10px;">';
  424. if ($showhome AND ($row->lasthome OR $row->nexthome)) {
  425. $temp .= '<span style="float:left">';
  426. if ($row->lasthome) {
  427. $tmp = $options;
  428. $tmp['title'] = 'Previous Match';
  429. $tmp['onclick'] = sprintf($jsfunc, $row->team1_id, $row->lasthome, $origin);
  430. $alt = $tmp['title'];
  431. if ($this->iconpath AND $this->params->get('icons_for_ajax') == 1)
  432. $temp .= JHtml :: _('image', $this->iconpath . 'page_prev.png', $alt, $tmp);
  433. else
  434. $temp .= '<input type="button" class="' . $this->params->get('reset_class') . '" value="' . $this->params->get('last_text') . '" style="cursor:pointer;" onclick="' . $tmp['onclick'] . '" />';
  435. }
  436. if ($row->nexthome) {
  437. $tmp = $options;
  438. $tmp['title'] = 'next Match';
  439. $tmp['onclick'] = sprintf($jsfunc, $row->team1_id, $row->nexthome, $origin);
  440. $alt = $tmp['title'];
  441. if ($this->iconpath AND $this->params->get('icons_for_ajax') == 1)
  442. $temp .= JHtml :: _('image', $this->iconpath . 'page_next.png', $alt, $tmp);
  443. else
  444. $temp .= '<input type="button" class="' . $this->params->get('reset_class') . '" value="' . $this->params->get('next_text') . '" style="cursor:pointer;" onclick="' . $tmp['onclick'] . '" />';
  445. }
  446. $temp .= '</span>';
  447. }
  448. if ($showaway AND ($row->lastaway OR $row->nextaway)) {
  449. $temp .= '<span style="float:right">';
  450. if ($row->lastaway) {
  451. $tmp = $options;
  452. $tmp['title'] = 'Previous Match';
  453. $tmp['onclick'] = sprintf($jsfunc, $row->team2_id, $row->lastaway, $origin);
  454. $alt = $tmp['title'];
  455. if ($this->iconpath AND $this->params->get('icons_for_ajax') == 1)
  456. $temp .= JHtml :: _('image', $this->iconpath . 'page_prev.png', $alt, $tmp);
  457. else
  458. $temp .= '<input type="button" class="' . $this->params->get('reset_class') . '" value="' . $this->params->get('last_text') . '" style="cursor:pointer;" onclick="' . $tmp['onclick'] . '" />';
  459. }
  460. if ($row->nextaway) {
  461. $tmp = $options;
  462. $tmp['title'] = 'next Match';
  463. $tmp['onclick'] = sprintf($jsfunc, $row->team2_id, $row->nextaway, $origin);
  464. $alt = $tmp['title'];
  465. if ($this->iconpath AND $this->params->get('icons_for_ajax') == 1)
  466. $temp .= JHtml :: _('image', $this->iconpath . 'page_next.png', $alt, $tmp);
  467. else
  468. $temp .= '<input type="button" class="' . $this->params->get('reset_class') . '" value="' . $this->params->get('next_text') . '" style="cursor:pointer;" onclick="' . $tmp['onclick'] . '" />';
  469. }
  470. $temp .= '</span>';
  471. }
  472. if ($this->params->get('reset_start_match') == 1 AND $origin != $row->id) {
  473. $temp .= '<span style="float:none;">';
  474. $tmp = $options;
  475. $tmp['title'] = 'Reset';
  476. $tmp['onclick'] = sprintf($jsfunc, '0', $origin, $origin);
  477. $alt = $tmp['title'];
  478. if ($this->iconpath AND $this->params->get('icons_for_ajax') == 1)
  479. $temp .= JHtml :: _('image', $this->iconpath . 'page_reset.png', $alt, $tmp);
  480. else
  481. $temp .= '<input type="button" class="' . $this->params->get('reset_class') . '" value="' . $this->params->get('reset_text') . '" style="cursor:pointer;" onclick="' . $tmp['onclick'] . '" />';
  482. $temp .= '</span>';
  483. }
  484. $temp .= '</div>';
  485. $row->ajax = $temp;
  486. }
  487. public function arrayToUri(& $arr) {
  488. if (!is_array($arr))
  489. return false;
  490. $str = '';
  491. foreach ($arr AS $key => $val) {
  492. $str .= '&amp;' . $key . '=' . $val;
  493. }
  494. return $str;
  495. }
  496. }