PageRenderTime 43ms CodeModel.GetById 13ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 0ms

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

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