PageRenderTime 60ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/com_joomleague/administrator/components/com_joomleague/views/jlxmlimports/tmpl/form.php

https://gitlab.com/julienv/joomleague
PHP | 1210 lines | 1143 code | 27 blank | 40 comment | 149 complexity | ae9d4983c50a22f5cb0b9d9f2a129195 MD5 | raw file
  1. <?php defined('_JEXEC') or die('Restricted access');
  2. JHtml::_('behavior.tooltip');
  3. if (isset($this->xml) && is_array($this->xml))
  4. {
  5. {
  6. //echo 'this<pre>'.print_r($this,true).'</pre>';
  7. if (array_key_exists('exportversion',$this->xml))
  8. {
  9. $exportversion =& $this->xml['exportversion'];
  10. }
  11. if (array_key_exists('project',$this->xml))
  12. {
  13. $proj =& $this->xml['project'];
  14. }
  15. if (array_key_exists('team',$this->xml))
  16. {
  17. $teams =& $this->xml['team'];
  18. }
  19. if (array_key_exists('club',$this->xml))
  20. {
  21. $clubs =& $this->xml['club'];
  22. }
  23. if (array_key_exists('playground',$this->xml))
  24. {
  25. $playgrounds =& $this->xml['playground'];
  26. }
  27. if (array_key_exists('league',$this->xml))
  28. {
  29. $league =& $this->xml['league'];
  30. }
  31. if (array_key_exists('season',$this->xml))
  32. {
  33. $season =& $this->xml['season'];
  34. }
  35. if (array_key_exists('sportstype',$this->xml))
  36. {
  37. $sportstype =& $this->xml['sportstype'];
  38. }
  39. if (array_key_exists('person',$this->xml))
  40. {
  41. $persons =& $this->xml['person'];
  42. }
  43. if (array_key_exists('event',$this->xml))
  44. {
  45. $events =& $this->xml['event'];
  46. }
  47. if (array_key_exists('position',$this->xml))
  48. {
  49. $positions =& $this->xml['position'];
  50. }
  51. if (array_key_exists('parentposition',$this->xml))
  52. {
  53. $parentpositions =& $this->xml['parentposition'];
  54. }
  55. if (array_key_exists('statistic',$this->xml))
  56. {
  57. $statistics =& $this->xml['statistic'];
  58. }
  59. }
  60. $xmlProjectImport=true;
  61. $xmlImportType='';
  62. if (!isset($proj))
  63. {
  64. $xmlProjectImport=false;
  65. $xmlImportTitle='';
  66. if (isset($teams))
  67. {
  68. $xmlImportType='teams'; // There shouldn't be any problems with import of teams-xml-export files
  69. $xmlImportTitle='Standard XML-Import of JoomLeague Teams';
  70. $teamsClubs=$teams;
  71. }
  72. elseif (isset($clubs))
  73. {
  74. $xmlImportType='clubs'; // There shouldn't be any problems with import of clubs-xml-export files
  75. $xmlImportTitle='Standard XML-Import of JoomLeague Clubs';
  76. $teamsClubs=$clubs;
  77. }
  78. elseif (isset($events)) // There shouldn't be any problems with import of events-xml-export files
  79. {
  80. $xmlImportType='events';
  81. $xmlImportTitle='Standard XML-Import of JoomLeague Events';
  82. }
  83. elseif (isset($positions)) // There shouldn't be any problems with import of positions-xml-export files
  84. { // maybe the positions export routine should also export position_eventtype and events
  85. $xmlImportType='positions';
  86. $xmlImportTitle='Standard XML-Import of JoomLeague Positions';
  87. }
  88. elseif (isset($parentpositions)) // There shouldn't be any problems with import of positions-xml-export files
  89. { // maybe the positions export routine should also export position_eventtype and events
  90. $xmlImportType='positions';
  91. $xmlImportTitle='Standard XML-Import of JoomLeague Positions';
  92. }
  93. elseif (isset($persons)) // There shouldn't be any problems with import of persons-xml-export files
  94. {
  95. $xmlImportType='persons';
  96. $xmlImportTitle='Standard XML-Import of JoomLeague Persons';
  97. }
  98. elseif (isset($playgrounds)) // There shouldn't be any problems with import of statistics-xml-export files
  99. {
  100. $xmlImportType='playgrounds';
  101. $xmlImportTitle='Standard XML-Import of JoomLeague Playgrounds';
  102. }
  103. elseif (isset($statistics)) // There shouldn't be any problems with import of statistics-xml-export files
  104. { // maybe the statistic export routine should also export position_statistic and positions
  105. $xmlImportType='statistics';
  106. $xmlImportTitle='Standard XML-Import of JoomLeague Statistics';
  107. }
  108. JError::raiseNotice(500,JText::_($xmlImportTitle));
  109. }
  110. else
  111. {
  112. $teamsClubs=$teams;
  113. }
  114. if (!empty($teamsClubs)){$teamsClubsCount=count($teamsClubs);}
  115. ?>
  116. <script><!--
  117. function chkFormular()
  118. {
  119. return true;
  120. var message='';
  121. <?php
  122. if (($xmlProjectImport) || ($xmlImportType=='events') || ($xmlImportType=='positions'))
  123. {
  124. ?>
  125. if ((($('adminForm').sportstype.selectedIndex=='0') && ($('adminForm').sportstypeNew.disabled) &&
  126. (!$('adminForm').newSportsTypeCheck.checked)) ||
  127. (($('adminForm').sportstypeNew.disabled==false) && (trim($('adminForm').sportstypeNew.value)=='')))
  128. {
  129. message+="<?php echo JText::_('Sports type is missing!'); ?>\n";
  130. }
  131. <?php
  132. if ($xmlProjectImport)
  133. {
  134. ?>
  135. if (trim($('adminForm').name.value)=='')
  136. {
  137. message+="<?php echo JText::_('Please select name of this project!'); ?>\n";
  138. }
  139. if ((($('adminForm').league.selectedIndex=='0') && ($('adminForm').leagueNew.disabled)) ||
  140. (($('adminForm').leagueNew.disabled==false) && (trim($('adminForm').leagueNew.value)=='')))
  141. {
  142. message+="<?php echo JText::_('League is missing!'); ?>\n";
  143. }
  144. if ((($('adminForm').season.selectedIndex=='0') && ($('adminForm').seasonNew.disabled)) ||
  145. (($('adminForm').seasonNew.disabled==false) && (trim($('adminForm').seasonNew.value)=='')))
  146. {
  147. message+="<?php echo JText::_('Season is missing!'); ?>\n";
  148. }
  149. <?php
  150. }
  151. }
  152. ?>
  153. <?php
  154. if (isset($teams) && count($teams) > 0)
  155. {
  156. // Perform some checks on teams?
  157. }
  158. ?>
  159. <?php
  160. if (isset($clubs) && count($clubs) > 0)
  161. {
  162. // Perform some checks on clubs?
  163. }
  164. ?>
  165. <?php
  166. if ((isset($playgrounds)) && (count($playgrounds) > 0))
  167. {
  168. for ($counter=0; $counter < count($playgrounds); $counter++)
  169. {
  170. ?>
  171. if ((($('adminForm').choosePlayground_<?php echo $counter; ?>.checked==false) &&
  172. ($('adminForm').createPlayground_<?php echo $counter; ?>.checked==false)) ||
  173. ((trim($('adminForm').playgroundName_<?php echo $counter; ?>.value)=='') ||
  174. (trim($('adminForm').playgroundShortname_<?php echo $counter; ?>.value)=='')))
  175. {
  176. message+='<?php echo JText::sprintf('No data selected for playground [%1$s]',addslashes($playgrounds[$counter]->name)); ?>\n';
  177. }
  178. <?php
  179. }
  180. }
  181. ?>
  182. <?php
  183. if ((isset($events)) && (count($events) > 0))
  184. {
  185. for ($counter=0; $counter < count($events); $counter++)
  186. {
  187. ?>
  188. if ((($('adminForm').chooseEvent_<?php echo $counter; ?>.checked==false) &&
  189. ($('adminForm').createEvent_<?php echo $counter; ?>.checked==false)) ||
  190. (trim($('adminForm').eventName_<?php echo $counter; ?>.value)==''))
  191. {
  192. message+='<?php echo JText::sprintf('No data selected for event [%1$s]',addslashes($events[$counter]->name)); ?>\n';
  193. }
  194. <?php
  195. }
  196. }
  197. ?>
  198. <?php
  199. if ((isset($parentpositions)) && (count($parentpositions) > 0))
  200. {
  201. for ($counter=0; $counter < count($parentpositions); $counter++)
  202. {
  203. ?>
  204. if ((($('adminForm').chooseParentPosition_<?php echo $counter; ?>.checked==false) &&
  205. ($('adminForm').createParentPosition_<?php echo $counter; ?>.checked==false)) ||
  206. (trim($('adminForm').parentPositionName_<?php echo $counter; ?>.value)==''))
  207. {
  208. message+='<?php echo JText::sprintf('No data selected for parentposition [%1$s]',addslashes($parentpositions[$counter]->name)); ?>\n';
  209. }
  210. <?php
  211. }
  212. }
  213. ?>
  214. <?php
  215. if ((isset($positions)) && (count($positions) > 0))
  216. {
  217. for ($counter=0; $counter < count($positions); $counter++)
  218. {
  219. ?>
  220. if ((($('adminForm').choosePosition_<?php echo $counter; ?>.checked==false) &&
  221. ($('adminForm').createPosition_<?php echo $counter; ?>.checked==false)) ||
  222. (trim($('adminForm').positionName_<?php echo $counter; ?>.value)==''))
  223. {
  224. message+='<?php echo JText::sprintf('No data selected for position [%1$s]',addslashes($positions[$counter]->name)); ?>\n';
  225. }
  226. <?php
  227. }
  228. }
  229. ?>
  230. <?php
  231. if ((isset($statistics)) && (count($statistics) > 0))
  232. {
  233. for ($counter=0; $counter < count($statistics); $counter++)
  234. {
  235. ?>
  236. if ((($('adminForm').chooseStatistic_<?php echo $counter; ?>.checked==false) &&
  237. ($('adminForm').createStatistic_<?php echo $counter; ?>.checked==false)) ||
  238. (trim($('adminForm').statisticName_<?php echo $counter; ?>.value)==''))
  239. {
  240. message+='<?php echo JText::sprintf('No data selected for statistic [%1$s]',addslashes($statistics[$counter]->name)); ?>\n';
  241. }
  242. <?php
  243. }
  244. }
  245. ?>
  246. <?php
  247. if ((isset($persons)) && (count($persons) > 0))
  248. {
  249. for ($counter=0; $counter < count($persons); $counter++)
  250. {
  251. ?>
  252. if($('adminForm').choosePerson_<?php echo $counter; ?>.checked==false) {
  253. if (($('adminForm').createPerson_<?php echo $counter; ?>.checked==false)||
  254. ((trim($('adminForm').personLastname_<?php echo $counter; ?>.value)=='') ||
  255. (trim($('adminForm').personFirstname_<?php echo $counter; ?>.value)=='')))
  256. {
  257. message+='<?php echo JText::sprintf('No data selected for person [%1$s,%2$s]',addslashes($persons[$counter]->lastname),addslashes($persons[$counter]->firstname)); ?>\n';
  258. }
  259. }
  260. <?php
  261. }
  262. }
  263. ?>
  264. if (message=='')
  265. {
  266. return true;
  267. }
  268. else
  269. {
  270. alert("<?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_ERROR'); ?>\n\n"+message);
  271. return false;
  272. }
  273. }
  274. //--></script>
  275. <?php
  276. $useExistingEntryColor = "orange";
  277. $useNewEntryColor = "lightgreen";
  278. ?>
  279. <div id='editcell'>
  280. <a name='page_top'></a>
  281. <table class='adminlist'>
  282. <thead><tr><th><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TABLE_TITLE_2'); ?></th></tr></thead>
  283. <tbody>
  284. <tr>
  285. <td style='text-align:center; '>
  286. <p style='text-align:center;'><b style='color:green; '><?php echo JText::sprintf('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_UPLOAD_SUCCESS','<i>'.$this->uploadArray['name'].'</i>'); ?></b></p>
  287. <?php
  288. if ($this->import_version!='OLD')
  289. {
  290. if (isset($exportversion->exportRoutine) &&
  291. strtotime($exportversion->exportRoutine) >= strtotime('2010-09-19 23:00:00'))
  292. {
  293. ?>
  294. <p><?php
  295. echo JText::sprintf('This file was created using JoomLeague-Export-Routine dated: %1$s',$exportversion->exportRoutine).'<br />';
  296. echo JText::sprintf('Date and time of this file is: %1$s - %2$s',$exportversion->exportDate,$exportversion->exportTime).'<br />';
  297. echo JText::sprintf('The name of the Joomla-System where this file was created is: %1$s',$exportversion->exportSystem).'<br />';
  298. ?></p><?php
  299. }
  300. else
  301. {
  302. ?>
  303. <p><?php
  304. echo JText::_('This file was created by an older revision of JoomLeague 1.5.0a!').'<br />';
  305. echo JText::_('As we can not guarantee a correct processing the import routine will STOP here!!!');
  306. ?></p></td></tr></tbody></table></div><?php
  307. return;
  308. }
  309. }
  310. ?>
  311. <p><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_CLUBS_HINT'); ?></p>
  312. </td>
  313. </tr>
  314. </tbody>
  315. </table>
  316. <form id='adminForm' action='<?php echo $this->request_url; ?>' method='post' onsubmit='return chkFormular();' >
  317. <input type='hidden' name='importProject' value="<?php echo $xmlProjectImport; ?>" />
  318. <input type='hidden' name='importType' value="<?php echo $xmlImportType; ?>" />
  319. <input type='hidden' name='sent' value="2" id='sent' />
  320. <input type='hidden' name='task' value="jlxmlimport.insert" />
  321. <?php echo JHtml::_('form.token')."\n"; ?>
  322. <?php
  323. if (($xmlProjectImport) || ($xmlImportType=='events') || ($xmlImportType=='positions'))
  324. {
  325. ?>
  326. <fieldset class="adminform">
  327. <legend><strong><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_GENERAL_DATA_LEGEND'); ?></strong></legend>
  328. <table class='adminlist'>
  329. <?php
  330. if (($xmlImportType!='events') && ($xmlImportType!='positions'))
  331. {
  332. ?>
  333. <tr>
  334. <td style='background-color:#EEEEEE'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_PROJECT_NAME'); ?></td>
  335. <td style='background-color:#EEEEEE'>
  336. <input type='text' name='name' id='name' size='110' maxlength='100' value="<?php echo stripslashes(htmlspecialchars($proj->name)); ?>" />
  337. </td>
  338. </tr>
  339. <?php
  340. }
  341. ?>
  342. <tr>
  343. <td style='background-color:#DDDDDD'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_SPORTSTYPE'); ?></td>
  344. <td style='background-color:#DDDDDD'>
  345. <?php
  346. $foundMatchingSportstype = false;
  347. $dSportsTypeName = "";
  348. if (isset($sportstype->name))
  349. {
  350. $dSportsTypeName=$sportstype->name;
  351. }
  352. if (count($this->sportstypes) > 0)
  353. {
  354. $options = "";
  355. foreach ($this->sportstypes AS $row)
  356. {
  357. $options .= '<option ';
  358. if (($row->name==$dSportsTypeName) ||
  359. ($row->name==JText::_($dSportsTypeName)))
  360. {
  361. $foundMatchingSportstype = true;
  362. $options .= "selected='selected' ";
  363. }
  364. elseif (count($this->sportstypes)==1)
  365. {
  366. $options .= "selected='selected' ";
  367. }
  368. $options .= "value='$row->id;'>";
  369. $options .= JText::_($row->name);
  370. $options .= '</option>';
  371. }
  372. ?>
  373. <select name='sportstype' id='sportstype' <?php if (!$foundMatchingSportstype){echo " disabled='disabled'";}?>>
  374. <option selected value="0"><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_SPORTSTYPE_SELECT'); ?></option>
  375. <?php echo $options;?>
  376. </select>
  377. <br /><br />
  378. <input type='checkbox' name='newSportsTypeCheck' style="float: none !important" value="1" style="float: none !important"
  379. <?php if (!$foundMatchingSportstype){echo " checked='checked'";}?>
  380. onclick="
  381. if (this.checked) {
  382. $('adminForm').sportstype.disabled=true;
  383. $('adminForm').sportstypeNew.disabled=false;
  384. } else {
  385. $('adminForm').sportstype.disabled=false;
  386. $('adminForm').sportstypeNew.disabled=true;
  387. }" />
  388. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  389. <input type='text' name='sportstypeNew' style="float: none !important" size='30' maxlength='25' id='sportstypeNew'
  390. value="<?php echo stripslashes(htmlspecialchars(JText::_($dSportsTypeName))); ?>"
  391. <?php if ($foundMatchingSportstype){echo " disabled='disabled'";}?>/>
  392. <?php
  393. }
  394. else
  395. {
  396. ?>
  397. <input type="hidden" name="newSportsTypeCheck" value="1" />
  398. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  399. <input type='text' name='sportstypeNew' style="float: none !important" size='30' maxlength='25' id='sportstypeNew'
  400. value="<?php echo stripslashes(htmlspecialchars(JText::_($dSportsTypeName))); ?>" />
  401. <?php
  402. }
  403. ?>
  404. </td>
  405. </tr>
  406. <?php
  407. if (($xmlImportType!='events') && ($xmlImportType!='positions'))
  408. {
  409. ?>
  410. <tr>
  411. <td style='background-color:#EEEEEE'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_LEAGUE'); ?></td>
  412. <td style='background-color:#EEEEEE'>
  413. <?php
  414. $foundMatchingLeague = false;
  415. $dLeagueName="";
  416. $leagueCountry="";
  417. if (isset($league->name))
  418. {
  419. $dLeagueName=$league->name;
  420. $leagueCountry=$league->country;
  421. }
  422. $dCountry=$leagueCountry;
  423. if (preg_match('=^[0-9]+$=',$dCountry))
  424. {
  425. $dCountry=$this->OldCountries[(int)$dCountry];
  426. }
  427. if (count($this->leagues) > 0)
  428. {
  429. $options = "";
  430. foreach ($this->leagues AS $row)
  431. {
  432. $options .= '<option ';
  433. if ($row->name==$dLeagueName)
  434. {
  435. $foundMatchingLeague = true;
  436. $options .= "selected='selected' ";
  437. }
  438. elseif (count($this->leagues)==1)
  439. {
  440. $options .= "selected='selected' ";
  441. }
  442. $options .= "value='$row->id;'>";
  443. $options .= $row->name;
  444. $options .= '</option>';
  445. }
  446. ?>
  447. <select name='league' id='league' <?php if (!$foundMatchingLeague){echo " disabled='disabled'";}?>>
  448. <option selected value="0"><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_LEAGUE_SELECT'); ?></option>
  449. <?php echo $options;?>
  450. </select>
  451. <br /><br />
  452. <input type='checkbox' name='newLeagueCheck' style="float: none !important" value="1"
  453. <?php if (!$foundMatchingLeague){echo " checked='checked'";}?>
  454. onclick="
  455. if (this.checked) {
  456. $('adminForm').league.disabled=true;
  457. $('adminForm').leagueNew.disabled=false;
  458. } else {
  459. $('adminForm').league.disabled=false;
  460. $('adminForm').leagueNew.disabled=true;
  461. }" />
  462. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  463. <input type='text' name='leagueNew' style="float: none !important" size='90' maxlength='75' id='leagueNew'
  464. value="<?php echo stripslashes(htmlspecialchars($dLeagueName)); ?>"
  465. <?php if ($foundMatchingLeague){echo " disabled='disabled'";}?>/>
  466. <?php
  467. }
  468. else
  469. {
  470. ?>
  471. <input type="hidden" name="newLeagueCheck" value="1" />
  472. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  473. <input type='text' name='leagueNew' style="float: none !important" size='90' maxlength='75' id='leagueNew'
  474. value="<?php echo stripslashes(htmlspecialchars($dLeagueName)); ?>" />
  475. <?php
  476. }
  477. ?>
  478. </td>
  479. </tr>
  480. <tr>
  481. <td style='background-color:#DDDDDD'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_SEASON'); ?></td>
  482. <td style='background-color:#DDDDDD'>
  483. <?php
  484. $foundMatchingSeason = false;
  485. $dSeasonName = "";
  486. if (isset($season->name))
  487. {
  488. $dSeasonName=$season->name;
  489. }
  490. if (count($this->seasons) > 0)
  491. {
  492. $options = "";
  493. foreach ($this->seasons AS $row)
  494. {
  495. $options .= '<option ';
  496. if ($row->name==$dSeasonName)
  497. {
  498. $foundMatchingSeason = true;
  499. $options .= "selected='selected' ";
  500. }
  501. elseif (count($this->seasons)==1)
  502. {
  503. $options .= "selected='selected' ";
  504. }
  505. $options .= "value='$row->id;'>";
  506. $options .= $row->name;
  507. $options .= '</option>';
  508. }
  509. ?>
  510. <select name='season' id='season' <?php if (!$foundMatchingSeason){echo " disabled='disabled'";}?>>
  511. <option selected value="0"><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_SEASON_SELECT'); ?></option>
  512. <?php echo $options;?>
  513. </select>
  514. <br /><br />
  515. <input type='checkbox' name='newSeasonCheck' style="float: none !important" value="1"
  516. <?php if (!$foundMatchingSeason){echo " checked='checked'";}?>
  517. onclick="
  518. if (this.checked) {
  519. $('adminForm').season.disabled=true;
  520. $('adminForm').seasonNew.disabled=false;
  521. } else {
  522. $('adminForm').season.disabled=false;
  523. $('adminForm').seasonNew.disabled=true;
  524. }" />
  525. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  526. <input type='text' name='seasonNew' style="float: none !important" size='90' maxlength='75' id='seasonNew'
  527. value="<?php echo stripslashes(htmlspecialchars($dSeasonName)); ?>"
  528. <?php if ($foundMatchingSeason){echo " disabled='disabled'";}?>/>
  529. <?php
  530. }
  531. else
  532. {
  533. ?>
  534. <input type="hidden" name="newSeasonCheck" value="1" />
  535. <?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CREATE_NEW'); ?>
  536. <input type='text' name='seasonNew' style="float: none !important" size='90' maxlength='75' id='seasonNew'
  537. value="<?php echo stripslashes(htmlspecialchars($dSeasonName)); ?>" />
  538. <?php
  539. }
  540. ?>
  541. </td>
  542. </tr>
  543. <tr>
  544. <td style='background-color:#EEEEEE'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TEMPLATES'); ?></td>
  545. <td style='background-color:#EEEEEE'>
  546. <select name='copyTemplate' id='copyTemplate'>
  547. <option value="0" selected><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TEMPLATES_USEOWN'); ?></option>
  548. <?php
  549. foreach ($this->templates AS $row)
  550. {
  551. echo "<option value=\"$row->id\">$row->name</option>\n";
  552. }
  553. ?>
  554. </select>
  555. </td>
  556. </tr>
  557. <tr>
  558. <td style='background-color:#DDDDDD'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TIMEZONE'); ?></td>
  559. <td style='background-color:#DDDDDD'>
  560. <?php echo $this->lists['timezone'].'&nbsp;'; ?>
  561. </td>
  562. </tr>
  563. <tr>
  564. <td style='background-color:#EEEEEE'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_PUBLISH'); ?></td>
  565. <td style='background-color:#EEEEEE'>
  566. <fieldset id="published" class="radio inputbox">
  567. <?php echo $this->lists['published'].'&nbsp;'; ?>
  568. </fieldset>
  569. </td>
  570. </tr>
  571. <?php
  572. }
  573. ?>
  574. </table>
  575. </fieldset>
  576. <p style='text-align:right;'><a href='#page_bottom'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_BOTTOM'); ?></a></p>
  577. <?php
  578. }
  579. ?>
  580. <?php
  581. //===============================================================================================================
  582. //
  583. // CLUB AND TEAM IMPORT
  584. //
  585. //===============================================================================================================
  586. if ((isset($clubs) && count($clubs) > 0) || (isset($teams) && count($teams) > 0))
  587. {
  588. ?>
  589. <fieldset>
  590. <legend><strong><?php
  591. if (!empty($clubs) && !empty($teams))
  592. {
  593. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CLUBS_TEAMS_LEGEND');
  594. }
  595. elseif (!empty($clubs))
  596. {
  597. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CLUBS_LEGEND');
  598. }
  599. else
  600. {
  601. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TEAMS_LEGEND');
  602. }
  603. ?></strong></legend>
  604. <table class='adminlist'>
  605. <thead>
  606. <tr>
  607. <th width='5%' nowrap='nowrap'><?php
  608. $checkCount=((isset($clubs) && count($clubs) > 0)) ? count($clubs) : count($teams);
  609. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_ALL_NEW');
  610. echo '<input type="checkbox" name="toggleTeamsClubs" value="" onclick="checkAllNewClubTeam('.$checkCount.')" />';
  611. ?></th>
  612. <th width="20%"><?php echo JText::_('Club and Team import option'); ?></th>
  613. <th width="45%"><?php echo JText::_('Club and Team information'); ?></th>
  614. </tr>
  615. </thead>
  616. <tbody>
  617. <?php
  618. // Some explanation on the used variables
  619. // $teamsClubs : array of xml objects present in the xml import file (containing all fields of the club table)
  620. // In case of a project import it is the list of teams, otherwise if clubs are defined in the
  621. // xml import file then it contains the defined clubs, and if no clubs are defined but teams are
  622. // then it will contain the team definition of the import file.
  623. // $clubs : array of xml objects present in the xml import file (containing all fields of the club table)
  624. // $teams : array of xml objects present in the xml import file (containing all fields of the team table)
  625. // $this->clubs : array of objects with id, name, standard playground and country that are present in the database
  626. // $this->teams : array of objects with id, name, club_id, short name, middle name and info that are present in the database
  627. $i=0;
  628. $color1="#DDDDDD";
  629. $color2="#EEEEEE";
  630. //foreach ($teams AS $key=> $team)
  631. foreach ($teamsClubs AS $key=> $teamClub)
  632. {
  633. $color = ($key % 2 == 1) ? $color1 : $color2;
  634. // Team info from the import file
  635. $importTeam_ID = (int)$teamClub->id;
  636. $importTeam_Name = (string)$teamClub->name;
  637. $importTeam_ShortName = (string)$teamClub->short_name;
  638. $importTeam_MiddleName = (string)$teamClub->middle_name;
  639. $importTeam_Info = (string)(($this->import_version=='OLD') ? $teamClub->description : $teamClub->info);
  640. $importTeam_ClubID = (int)$teamClub->club_id;
  641. // Find club name via the club ID specified for the team in the import file
  642. $importTeam_ClubName = "";
  643. $importTeam_ClubCountry = "";
  644. if (count($clubs) > 0)
  645. {
  646. foreach ($clubs AS $club)
  647. {
  648. if ((int)$club->id == $importTeam_ClubID)
  649. {
  650. $importTeam_ClubName = (string)$club->name;
  651. $importTeam_ClubCountry = (string)$club->country;
  652. if (preg_match('=^[0-9]+$=',$importTeam_ClubCountry))
  653. {
  654. $importTeam_ClubCountry = $this->OldCountries[(int)$importTeam_ClubCountry];
  655. }
  656. break;
  657. }
  658. }
  659. }
  660. // Find in database a team with the name equal to that of the imported team
  661. $matchingTeam_ID = 0;
  662. $matchingTeam_ClubID = 0;
  663. if (count($this->teams) > 0)
  664. {
  665. foreach ($this->teams AS $team)
  666. {
  667. if ((strcasecmp($importTeam_Name,$team->name) == 0) &&
  668. // (strcasecmp($importTeam_ShortName,$team->short_name)==0) &&
  669. // (strcasecmp($importTeam_MiddleName,$team->middle_name)==0) &&
  670. (strcasecmp($importTeam_Info,$team->info)==0))
  671. {
  672. $matchingTeam_ID = $team->id;
  673. $matchingTeam_ClubID = $team->club_id;
  674. break;
  675. }
  676. }
  677. }
  678. // Find in database a club with the name equal to that of the imported club
  679. $matchingClub_ID = 0;
  680. $matchingClub_PlaygroundID = 0;
  681. $matchingClub_Country = 0;
  682. if (count($this->clubs))
  683. {
  684. foreach ($this->clubs as $club)
  685. {
  686. if (strcasecmp($importTeam_ClubName,$club->name)==0)
  687. {
  688. $matchingClub_ID = $club->id;
  689. $matchingClub_PlaygroundID = $club->standard_playground;
  690. $matchingClub_Country = $club->country;
  691. break;
  692. }
  693. }
  694. }
  695. $foundMatchingClubAndTeam = (($matchingClub_ID != 0) && ($matchingTeam_ClubID == $matchingClub_ID));
  696. $foundMatchingClub = ($matchingClub_ID != 0);
  697. if (!$foundMatchingClubAndTeam)
  698. {
  699. $matchingTeam_ID = 0;
  700. $matchingTeam_ClubID = 0;
  701. }
  702. ?>
  703. <tr>
  704. <td nowrap='nowrap' style='text-align:center; vertical-align:middle; background-color:<?php echo $color; ?>'>
  705. &nbsp;
  706. </td>
  707. <?php $color = $foundMatchingClubAndTeam ? $useExistingEntryColor: $useNewEntryColor; ?>
  708. <td style='line-height:200%; text-align:left; vertical-align:middle; background-color:<?php echo $color; ?>' id='tetd<?php echo $key; ?>'>
  709. <?php
  710. if ($foundMatchingClubAndTeam)
  711. {
  712. $checked1 = "checked='checked'";
  713. $checked2 = "";
  714. $checked3 = "";
  715. }
  716. elseif ($foundMatchingClub)
  717. {
  718. $checked1 = "";
  719. $checked2 = "checked='checked'";
  720. $checked3 = "";
  721. }
  722. else
  723. {
  724. $checked1 = "";
  725. $checked2 = "";
  726. $checked3 = "checked='checked'";
  727. }
  728. ?>
  729. <!--
  730. Clicking on the first radio button will show a selector with "club / team" info in a popup window.
  731. The club_id, team_id and location of the database will be coupled to the textual entries.
  732. -->
  733. <input type='radio' name='cto_<?php echo $i; ?>' id='ecet_<?php echo $i; ?>' value='1' <?php echo $checked1; ?>
  734. <?php
  735. if ((count($this->clubs) > 0) && (count($this->teams) > 0))
  736. {
  737. echo "onclick='javascript:openSelectWindow(";
  738. echo $matchingTeam_ID;
  739. echo ",".$key;
  740. echo ',"selector"';
  741. echo ",this";
  742. echo ",9"; // Selection type (club&team)
  743. echo ")' />";
  744. }
  745. else
  746. {
  747. // If there are no clubs/teams to select from, restore the radiobutton to new club/new team
  748. echo "onclick='javascript:alertAndRestore($key, 10, \"".JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_NO_CLUBS_TEAMS_IN_DB')."\")' />";
  749. }
  750. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_EXISTING_CLUB_AND_TEAM');
  751. ?>
  752. <br /><br />
  753. <!--
  754. Clicking on the second radiobutton will show a selector selector with "club" info in a popup window.
  755. The club_id and location of the database will be coupled to the textual entries.
  756. -->
  757. <input type='radio' name='cto_<?php echo $i; ?>' id='ecnt_<?php echo $i; ?>' value='2' <?php echo $checked2; ?>
  758. <?php
  759. if (count($this->clubs) > 0)
  760. {
  761. echo "onclick='javascript:openSelectWindow(";
  762. echo $matchingClub_ID;
  763. echo ",".$key;
  764. echo ',"selector"';
  765. echo ",this";
  766. echo ",10"; // Selection type (club)
  767. echo ")' />";
  768. }
  769. else
  770. {
  771. // If there are no clubs to select from, restore the radiobutton to new club/new team
  772. echo "onclick='javascript:alertAndRestore($key, 10, \"".JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_NO_CLUBS_IN_DB')."\")' />";
  773. }
  774. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_EXISTING_CLUB_NEW_TEAM');
  775. ?>
  776. <br /><br />
  777. <!--
  778. Clicking the third radiobutton will result in the club and team being taken over from the import file.
  779. -->
  780. <input type='radio' name='cto_<?php echo $i; ?>' id='ncnt_<?php echo $i; ?>' value='3' <?php echo $checked3; ?>
  781. <?php
  782. echo "onclick='javascript:resetToImportValues(";
  783. echo $key;
  784. echo ",10"; // Selection type (club)
  785. echo ")' />";
  786. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_NEW_CLUB_NEW_TEAM');
  787. ?>
  788. <br /><br />
  789. </td>
  790. <?php
  791. if ($matchingClub_ID == 0)
  792. {
  793. $ic_disabled = ""; // imported club
  794. $dc_disabled = " disabled='disabled'"; // database club
  795. }
  796. else
  797. {
  798. $ic_disabled = " disabled='disabled'";
  799. $dc_disabled = "";
  800. }
  801. if ($matchingTeam_ID == 0)
  802. {
  803. $it_disabled = ""; // imported team
  804. $dt_disabled = " disabled='disabled'"; // database team
  805. }
  806. else
  807. {
  808. $it_disabled = " disabled='disabled'";
  809. $dt_disabled = "";
  810. }
  811. ?>
  812. <td style='text-align:left; vertical-align:top; background-color:<?php echo $color; ?>'>
  813. <table cellpadding='0' cellspacing='0' style='border-color:<?php echo $color; ?>; border-width:0; border-style:none'>
  814. <thead>
  815. <tr style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; border-style:none'>
  816. <th style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; width:75px'>
  817. &nbsp;
  818. </th>
  819. <th style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  820. <?php echo JText::_('Import File');?>
  821. </th>
  822. <th style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; width:30px; text-align:center'>
  823. &rarr;
  824. </th>
  825. <th style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  826. <?php echo JText::_('Database');?>
  827. </th>
  828. </tr>
  829. </thead>
  830. <tbody>
  831. <tr style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; border-style:none'>
  832. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  833. <b><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CLUBNAME');?></b>
  834. <input type='hidden' name='matching_ClubID_<?php echo $key;?>' value='<?php echo $matchingClub_ID;?>'/>
  835. <input type='hidden' name='clubID_<?php echo $key;?>' value='<?php echo $importTeam_ClubID;?>' <?php echo $ic_disabled;?>/>
  836. <input type='hidden' name='clubName_<?php echo $key; ?>' size='60' maxlength='100'
  837. value='<?php echo stripslashes(htmlspecialchars($importTeam_ClubName));?>' <?php echo $ic_disabled;?>/>
  838. <input type='hidden' name='clubFileID_<?php echo $key;?>' value='<?php echo $importTeam_ClubID;?>'/>
  839. <input type='hidden' name='clubCountry_<?php echo $key; ?>' size='60' maxlength='100'
  840. value='<?php echo stripslashes(htmlspecialchars($importTeam_ClubCountry));?>' <?php echo $ic_disabled;?>/>
  841. <input type='hidden' name='dbClubID_<?php echo $key;?>' value='<?php echo $matchingClub_ID;?>' <?php echo $dc_disabled;?>/>
  842. <input type='hidden' name='dbClubPlaygroundID_<?php echo $key;?>' value='<?php echo $matchingClub_PlaygroundID;?>'/>
  843. </td>
  844. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  845. <input type='text' name='impClubName_<?php echo $key;?>' value='<?php echo $importTeam_ClubName;?>' size='30' maxlength='45' disabled='disabled'>
  846. </td>
  847. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  848. &nbsp;
  849. </td>
  850. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  851. <input type='text' name='dbClubName_<?php echo $key;?>' size='30' maxlength='45' disabled='disabled'
  852. value='<?php echo stripslashes(htmlspecialchars($importTeam_ClubName));?>' />
  853. </td>
  854. </tr>
  855. <tr style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; border-style:none'>
  856. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  857. <b><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_CLUBCOUNTRY');?></b>
  858. </td>
  859. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  860. <input type='text' name='impClubCountry_<?php echo $key;?>' value='<?php echo $importTeam_ClubCountry;?>' size='30' maxlength='45' disabled='disabled'>
  861. </td>
  862. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  863. &nbsp;
  864. </td>
  865. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  866. <input type='text' name='dbClubCountry_<?php echo $key;?>' value='<?php echo $importTeam_ClubCountry; ?>' size='30' maxlength='45' disabled='disabled'>
  867. </td>
  868. </tr>
  869. <tr style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>; border-style:none'>
  870. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  871. <input type='hidden' name='matching_TeamID_<?php echo $key;?>' value='<?php echo $matchingTeam_ID;?>' <?php echo $it_disabled;?>/>
  872. <input type='hidden' name='teamID_<?php echo $key;?>' value='<?php echo $importTeam_ID;?>' <?php echo $it_disabled;?>/>
  873. <input type='hidden' name='teamFileID_<?php echo $key;?>' value='<?php echo $importTeam_ID;?>' <?php echo $it_disabled;?>/>
  874. <input type='hidden' name='teamName_<?php echo $key; ?>' size='60' maxlength='100'
  875. value='<?php echo stripslashes(htmlspecialchars($importTeam_Name));?>' <?php echo $it_disabled;?>/>
  876. <input type='hidden' name='teamShortname_<?php echo $key; ?>' size='60' maxlength='100'
  877. value='<?php echo stripslashes(htmlspecialchars($importTeam_ShortName));?>' <?php echo $it_disabled;?>/>
  878. <input type='hidden' name='teamMiddleName_<?php echo $key; ?>' size='60' maxlength='100'
  879. value='<?php echo stripslashes(htmlspecialchars($importTeam_MiddleName));?>' <?php echo $it_disabled;?>/>
  880. <input type='hidden' name='teamInfo_<?php echo $key; ?>' size='60' maxlength='255'
  881. value='<?php echo stripslashes(htmlspecialchars($importTeam_Info));?>' <?php echo $it_disabled;?>/>
  882. <input type='hidden' name='dbTeamID_<?php echo $key;?>' value='<?php echo $matchingTeam_ID;?>' <?php echo $dt_disabled;?>/>
  883. <b><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TEAMNAME');?></b>
  884. </td>
  885. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  886. <input type='text' name='impTeamName_<?php echo $key;?>' value='<?php echo $importTeam_Name;?>' size='30' maxlength='45' disabled='disabled'/>
  887. </td>
  888. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  889. &nbsp;
  890. </td>
  891. <td style='background-color:<?php echo $color; ?>; border-color:<?php echo $color; ?>'>
  892. <input type='text' name='dbTeamName_<?php echo $key;?>' value='<?php echo $importTeam_Name; ?>' size='30' maxlength='45' disabled='disabled'/>
  893. </td>
  894. </tr>
  895. </tbody>
  896. </table>
  897. </td>
  898. </tr>
  899. <?php
  900. $i++;
  901. }
  902. ?>
  903. </tbody>
  904. </table>
  905. </fieldset>
  906. <p style='text-align:right;'><a href='#page_top'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TOP'); ?></a></p>
  907. <?php
  908. }
  909. ?>
  910. <?php
  911. //===============================================================================================================
  912. //
  913. // PLAYGROUND IMPORT
  914. //
  915. //===============================================================================================================
  916. if (isset($playgrounds) && (is_array($playgrounds) && count($playgrounds) > 0))
  917. {
  918. ?>
  919. <fieldset>
  920. <legend><strong><?php echo JText::_('Playground Assignment'); ?></strong></legend>
  921. <table class='adminlist'>
  922. <thead>
  923. <tr>
  924. <th width='5%' nowrap='nowrap'><?php
  925. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_ALL_NEW');
  926. echo '<input type="checkbox" name="togglePlaygrounds" value="" onclick="checkAllPlaygrounds('.count($playgrounds).')" />';
  927. ?></th>
  928. <th><?php echo JText::_('Playground'); ?></th>
  929. </tr>
  930. </thead>
  931. <tbody>
  932. <?php
  933. $i=0;
  934. $color1="#DDDDDD";
  935. $color2="#EEEEEE";
  936. foreach ($playgrounds AS $key=> $playground)
  937. {
  938. if ($key%2==1){$color=$color1;}else{$color=$color2;}
  939. ?>
  940. <tr>
  941. <td style='text-align:center; vertical-align:middle; background-color:<?php echo $color; ?>'>
  942. <input type='checkbox' value="<?php echo $key; ?>" name='plid[]' id='pl<?php echo $i; ?>' onchange='testPlaygroundData(this,<?php echo $key; ?>)' />
  943. </td>
  944. <?php
  945. // Playground column starts here
  946. $color=$useNewEntryColor;
  947. $foundMatchingPlayground=0;
  948. $foundMatchingPlaygroundName='';
  949. $foundMatchingPlaygroundShortname='';
  950. $playgroundClubID=0;
  951. if (count($this->playgrounds) > 0)
  952. {
  953. foreach ($this->playgrounds AS $row1)
  954. {
  955. if (strcasecmp($playground->name,$row1->name)==0)
  956. {
  957. $color=$useExistingEntryColor;
  958. $foundMatchingPlayground=$row1->id;
  959. $foundMatchingPlaygroundName=$row1->name;
  960. $foundMatchingPlaygroundShortname=$row1->short_name;
  961. $playgroundClubID=$row1->club_id;
  962. break;
  963. }
  964. }
  965. }
  966. ?>
  967. <td width='45%' style='text-align:left; background-color:<?php echo $color; ?>' id='pltd<?php echo $key; ?>'>
  968. <?php
  969. if ($foundMatchingPlayground)
  970. {
  971. $checked=' checked="checked" ';
  972. $disabled='';
  973. }
  974. else
  975. {
  976. $checked='';
  977. $disabled=' disabled="disabled" ';
  978. }
  979. echo '<input type="checkbox" name="choosePlayground_'.$key.'"' . $checked;
  980. echo 'onclick="if(this.checked)
  981. {
  982. $(\'adminForm\').selectPlayground_'.$key.'.checked=false;
  983. $(\'adminForm\').createPlayground_'.$key.'.checked=false;
  984. $(\'adminForm\').playgroundName_'.$key.'.disabled=true;
  985. $(\'adminForm\').playgroundShortname_'.$key.'.disabled=true;
  986. }
  987. else
  988. {
  989. }" '. $disabled ;
  990. echo "/>&nbsp;";
  991. $output1="<input type='text' name='dbPlaygroundName_$key' size='45' maxlength='45' value=\"".stripslashes(htmlspecialchars($foundMatchingPlaygroundName))."\" style='font-weight: bold;' disabled='disabled' />";
  992. $output2="<input type='text' name='dbPaygroundShortname_$key' size='20' maxlength='15' value=\"".stripslashes(htmlspecialchars($foundMatchingPlaygroundShortname))."\" style='font-weight: bold;' disabled='disabled' />";
  993. echo JText::sprintf('Use existing Playground from Database %1$s %2$s',$output1,$output2);
  994. echo "<input type='hidden' name='dbPlaygroundClubID_$key' value=\"$playgroundClubID\" />";
  995. echo "<input type='hidden' name='dbPlaygroundID_$key' value=\"$foundMatchingPlayground\" />";
  996. echo '<br /><br />';
  997. if (count($this->playgrounds) > 0)
  998. {
  999. echo "<input type='checkbox' name='selectPlayground_$key' ";
  1000. echo "onclick='javascript:openSelectWindow(";
  1001. echo $foundMatchingPlayground;
  1002. echo ",".$key;
  1003. echo ',"selector"';
  1004. echo ",this";
  1005. echo ",4";
  1006. echo ")' ";
  1007. echo "/>&nbsp;";
  1008. echo JText::_('Assign other Playground from Database');
  1009. echo '<br /><br />';
  1010. }
  1011. else
  1012. {
  1013. echo "<input type='hidden' name='selectPlayground_$key' />";
  1014. }
  1015. if ($foundMatchingPlayground)
  1016. {
  1017. $checked='';
  1018. //$disabled=' disabled="disabled" ';
  1019. $disabled='';
  1020. }
  1021. else
  1022. {
  1023. $checked=' checked="checked" ';
  1024. $disabled='';
  1025. }
  1026. echo '<input type="checkbox" style="float: none !important" name="createPlayground_'.$key.'"'. $checked;
  1027. echo 'onclick="if(this.checked)
  1028. {
  1029. $(\'adminForm\').choosePlayground_'.$key.'.checked=false;
  1030. $(\'adminForm\').selectPlayground_'.$key.'.checked=false;
  1031. $(\'adminForm\').playgroundName_'.$key.'.disabled=false;
  1032. $(\'adminForm\').playgroundShortname_'.$key.'.disabled=false;
  1033. }
  1034. else
  1035. {
  1036. $(\'adminForm\').playgroundName_'.$key.'.disabled=true;
  1037. $(\'adminForm\').playgroundShortname_'.$key.'.disabled=true;
  1038. }" ' .$disabled;
  1039. echo "/>&nbsp;";
  1040. echo JText::_('Create new Playground');
  1041. ?>
  1042. <br /><br />
  1043. <table cellspacing='0' cellpadding='0'>
  1044. <tr>
  1045. <td>
  1046. <?php echo '<b>'.JText::_('Playgroundname').'</b>'; ?><br >
  1047. <input type='hidden' name='playgroundID_<?php echo $key; ?>' value="<?php echo $key; ?>" />
  1048. <input type='text' style="float: none !important" name='playgroundName_<?php echo $key; ?>' size='45' maxlength='45' value="<?php echo stripslashes(htmlspecialchars($playground->name)); ?>" <?php echo $disabled; ?> />
  1049. </td>
  1050. <td>
  1051. <?php echo '<b>'.JText::_('Shortname').'</b>'; ?><br />
  1052. <input type='text' style="float: none !important" name='playgroundShortname_<?php echo $key; ?>' size='20' maxlength='15' value="<?php echo stripslashes(htmlspecialchars($playground->short_name)); ?>" <?php echo $disabled; ?> />
  1053. </td>
  1054. </tr>
  1055. </table>
  1056. </td>
  1057. </tr>
  1058. <?php
  1059. $i++;
  1060. }
  1061. ?>
  1062. </tbody>
  1063. </table>
  1064. </fieldset>
  1065. <p style='text-align:right;'><a href='#page_top'><?php echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TOP'); ?></a></p>
  1066. <?php
  1067. }
  1068. ?>
  1069. <?php
  1070. //===============================================================================================================
  1071. //
  1072. // EVENT IMPORT
  1073. //
  1074. //===============================================================================================================
  1075. if (isset($events) && (is_array($events) && count($events) > 0))
  1076. {
  1077. ?>
  1078. <fieldset>
  1079. <legend><strong><?php echo JText::_('Event Assignment'); ?></strong></legend>
  1080. <table class='adminlist'>
  1081. <thead>
  1082. <tr>
  1083. <th width='5%' nowrap='nowrap'><?php
  1084. echo JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_ALL_NEW');
  1085. echo '<input type="checkbox" name="toggleEvents" value="" onclick="checkAllEvents('.count($events).')" />';
  1086. ?></th>
  1087. <th><?php echo JText::_('Event'); ?></th>
  1088. </tr>
  1089. </thead>
  1090. <tbody>
  1091. <?php
  1092. $i=0;
  1093. $color1="#DDDDDD";
  1094. $color2="#EEEEEE";
  1095. foreach ($events AS $key=> $event)
  1096. {
  1097. if ($key%2==1){$color=$color1;}else{$color=$color2;}
  1098. ?>
  1099. <tr>
  1100. <td style='text-align:center; vertical-align:middle; background-color:<?php echo $color; ?>'>
  1101. <input type='checkbox' value="<?php echo $key; ?>" name='evid[]' id='ev<?php echo $i; ?>' onchange='testEventsData(this,<?php echo $key; ?>)' />
  1102. </td>
  1103. <?php
  1104. // Event column starts here
  1105. $color=$useNewEntryColor;
  1106. $foundMatchingEvent=0;
  1107. $foundMatchingEventName='';
  1108. if (count($this->events) > 0)
  1109. {
  1110. foreach ($this->events AS $row1)
  1111. {
  1112. if ((strcasecmp($event->name,$row1->name)==0) ||
  1113. (strcasecmp(JText::_($event->name), JText::_($row1->name))==0))
  1114. {
  1115. $color=$useExistingEntryColor;
  1116. $foundMatchingEvent=$row1->id;
  1117. $foundMatchingEventName=$row1->name;
  1118. break;
  1119. }
  1120. }
  1121. }
  1122. ?>
  1123. <td width='45%' style='text-align:left; background-color:<?php echo $color; ?>' id='evtd<?php echo $key; ?>'>
  1124. <?php
  1125. if ($foundMatchingEvent)
  1126. {
  1127. $checked=' checked="checked" ';
  1128. $disabled='';
  1129. }
  1130. else
  1131. {
  1132. $checked='';
  1133. $disabled=' disabled="disabled" ';
  1134. }
  1135. echo '<input type="checkbox" name="chooseEvent_'.$key.'"'. $checked;
  1136. echo 'onclick="if(this.checked)
  1137. {
  1138. $(\'adminForm\').selectEvent_'.$key.'.checked=false;
  1139. $(\'adminForm\').createEvent_'.$key.'.checked=false;
  1140. $(\'adminForm\').eventName_'.$key.'.disabled=true;
  1141. }
  1142. else
  1143. {
  1144. }" ' . $disabled ;
  1145. echo "/>&nbsp;";
  1146. $output1="<input type='text' name='dbEventName_$key' size='45' maxlength='75' value=\"".stripslashes(htmlspecialchars(JText::_($foundMatchingEventName)))."\" style='font-weight: bold;' disabled='disabled' />";
  1147. echo JText::sprintf('Use existing %1$s from Database',$output1);
  1148. echo "<input type='hidden' name='dbEventID_$key' value=\"$foundMatchingEvent\" />";
  1149. echo '<br /><br />';
  1150. if (count($this->events) > 0)
  1151. {
  1152. echo "<input type='checkbox' name='selectEvent_$key' ";
  1153. echo "onclick='javascript:openSelectWindow(";
  1154. echo $foundMatchingEvent;
  1155. echo ",".$key;
  1156. echo ',"selector"';
  1157. echo ",this";
  1158. echo ",5";
  1159. echo ")' ";
  1160. echo "/>&nbsp;";
  1161. echo JText::_('Assign other Event from Database');
  1162. echo '<br /><br />';
  1163. }
  1164. else
  1165. {
  1166. echo "<input type='hidden' name='selectEvent_$key' />";
  1167. }
  1168. if ($foundMatchingEvent)
  1169. {
  1170. $checked='';
  1171. $disabled=' disabled="disabled" ';
  1172. }
  1173. else
  1174. {
  1175. $checked=' checked="checked" ';
  1176. $disabled='';
  1177. }
  1178. echo '<input type="checkbox" name="createEvent_'.$key.'"'. $checked;
  1179. echo 'onclick="if(this.checked)
  1180. {
  1181. $(\'adminForm\').chooseEvent_'.$key.'.checked=false;
  1182. $(\'adminForm\').selectEvent_'.$key.'.checked=false;
  1183. $(\'adminForm\').eventName_'.$key.'.disabled=fal