PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/extensions/jlextdfbnetplayerimport/admin/views/jlextdfbnetplayerimport/view.html.php

https://gitlab.com/julienv/joomleague
PHP | 396 lines | 293 code | 58 blank | 45 comment | 14 complexity | e2d535027b504e201d4451114de29a62 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. /**
  12. * DFBNet Import Extension by diddipoeler
  13. * modified to work with JoomLeague 2.x
  14. */
  15. // Check to ensure this file is included in Joomla!
  16. defined ( '_JEXEC' ) or die ( 'Restricted access' );
  17. jimport ( 'joomla.application.component.view' );
  18. /**
  19. * HTML View class for the Joomleague component
  20. *
  21. * @static
  22. *
  23. * @package Joomleague
  24. * @since 0.1
  25. */
  26. class JoomleagueViewjlextdfbnetplayerimport extends JLGView {
  27. function display($tpl = null) {
  28. global $mainframe;
  29. if ($this->getLayout () == 'default') {
  30. $this->_displayDefault ( $tpl );
  31. return;
  32. }
  33. if ($this->getLayout () == 'default_edit') {
  34. $this->_displayDefaultEdit ( $tpl );
  35. return;
  36. }
  37. if ($this->getLayout () == 'default_update') {
  38. $this->_displayDefaultUpdate ( $tpl );
  39. return;
  40. }
  41. if ($this->getLayout () == 'info') {
  42. $this->_displayInfo ( $tpl );
  43. return;
  44. }
  45. if ($this->getLayout () == 'selectpage') {
  46. $this->_displaySelectpage ( $tpl );
  47. return;
  48. }
  49. // Set toolbar items for the page
  50. JToolBarHelper::title ( JText::_ ( 'COM_JOOMLEAGUE_ADMIN_LMO_IMPORT_TITLE_1_3' ), 'generic.png' );
  51. JToolBarHelper::help ( 'screen.joomleague', true );
  52. $uri = JFactory::getURI ();
  53. $config = JComponentHelper::getParams ( 'com_media' );
  54. $post = JRequest::get ( 'post' );
  55. $files = JRequest::get ( 'files' );
  56. $this->assignRef ( 'request_url', $uri->toString () );
  57. $this->assignRef ( 'config', $config );
  58. $revisionDate = '2011-04-28 - 12:00';
  59. $this->assignRef ( 'revisionDate', $revisionDate );
  60. parent::display ( $tpl );
  61. }
  62. private function _displayInfo($tpl) {
  63. $mtime = microtime ();
  64. $mtime = explode ( " ", $mtime );
  65. $mtime = $mtime [1] + $mtime [0];
  66. $starttime = $mtime;
  67. $mainframe = JFactory::getApplication ();
  68. $db = JFactory::getDBO ();
  69. $post = JRequest::get ( 'post' );
  70. $model = $this->getModel ( 'jlextdfbnetplayerimport' );
  71. // Set toolbar items for the page
  72. // JToolBarHelper::title(JText::_('COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_TITLE_3_3'),'generic.png');
  73. // JToolBarHelper::back();
  74. // JToolBarHelper::help('screen.joomleague',true);
  75. $this->assignRef ( 'starttime', $starttime );
  76. $this->assignRef ( 'importData', $model->importData ( $post ) );
  77. $this->assignRef ( 'postData', $post );
  78. $revisionDate = '2011-04-28 - 12:00';
  79. $this->assignRef ( 'revisionDate', $revisionDate );
  80. /*
  81. * echo 'view.html<br>'; echo '<pre>'; print_r($this->importData); echo '</pre>';
  82. */
  83. parent::display ( $tpl );
  84. }
  85. function _displayDefault($tpl) {
  86. global $option;
  87. $mainframe = JFactory::getApplication ();
  88. $db = JFactory::getDBO ();
  89. $uri = JFactory::getURI ();
  90. $user = JFactory::getUser ();
  91. // $model = $this->getModel('project') ;
  92. // $projectdata = $this->get('Data');
  93. // $this->assignRef( 'name', $projectdata->name);
  94. $model = $this->getModel ();
  95. $project = $mainframe->getUserState ( $option . 'project' );
  96. $this->assignRef ( 'project', $project );
  97. $config = JComponentHelper::getParams ( 'com_media' );
  98. $this->assignRef ( 'request_url', $uri->toString () );
  99. $this->assignRef ( 'config', $config );
  100. $revisionDate = '2011-04-28 - 12:00';
  101. $this->assignRef ( 'revisionDate', $revisionDate );
  102. $import_version = 'NEW';
  103. $this->assignRef ( 'import_version', $import_version );
  104. $this->addToolbar ();
  105. parent::display ( $tpl );
  106. }
  107. function _displayDefaultUpdate($tpl) {
  108. // global $mainframe, $option;
  109. $mainframe = & JFactory::getApplication ();
  110. $option = JRequest::getCmd ( 'option' );
  111. $db = JFactory::getDBO ();
  112. $uri = JFactory::getURI ();
  113. $user = JFactory::getUser ();
  114. $model = $this->getModel ();
  115. $option = 'com_joomleague';
  116. $project = $mainframe->getUserState ( $option . 'project' );
  117. $this->assignRef ( 'project', $project );
  118. $config = JComponentHelper::getParams ( 'com_media' );
  119. $uploadArray = $mainframe->getUserState ( $option . 'uploadArray', array () );
  120. $lmoimportuseteams = $mainframe->getUserState ( $option . 'lmoimportuseteams' );
  121. $whichfile = $mainframe->getUserState ( $option . 'whichfile' );
  122. //$delimiter = $mainframe->getUserState ( $option . 'delimiter' );
  123. $this->assignRef ( 'uploadArray', $uploadArray );
  124. $this->assignRef ( 'importData', $model->getUpdateData () );
  125. // $this->assignRef('xml',$model->getData());
  126. parent::display ( $tpl );
  127. }
  128. function _displayDefaultEdit($tpl) {
  129. // global $mainframe, $option;
  130. $mainframe = & JFactory::getApplication ();
  131. $option = JRequest::getCmd ( 'option' );
  132. $db = JFactory::getDBO ();
  133. $uri = JFactory::getURI ();
  134. $user = JFactory::getUser ();
  135. $model = $this->getModel ();
  136. // $option='com_joomleague';
  137. $project = $mainframe->getUserState ( $option . 'project' );
  138. $this->assignRef ( 'project', $project );
  139. $config = JComponentHelper::getParams ( 'com_media' );
  140. $uploadArray = $mainframe->getUserState ( $option . 'uploadArray', array () );
  141. $lmoimportuseteams = $mainframe->getUserState ( $option . 'lmoimportuseteams' );
  142. $whichfile = $mainframe->getUserState ( $option . 'whichfile' );
  143. //$delimiter = $mainframe->getUserState ( $option . 'delimiter' );
  144. $countries = new Countries ();
  145. $this->assignRef ( 'uploadArray', $uploadArray );
  146. $this->assignRef ( 'countries', $countries->getCountries () );
  147. $this->assignRef ( 'request_url', $uri->toString () );
  148. $this->assignRef ( 'xml', $model->getData () );
  149. $this->assignRef ( 'leagues', $model->getLeagueList () );
  150. $this->assignRef ( 'seasons', $model->getSeasonList () );
  151. $this->assignRef ( 'sportstypes', $model->getSportsTypeList () );
  152. $this->assignRef ( 'admins', $model->getUserList ( true ) );
  153. $this->assignRef ( 'editors', $model->getUserList ( false ) );
  154. $this->assignRef ( 'templates', $model->getTemplateList () );
  155. $this->assignRef ( 'teams', $model->getTeamList () );
  156. $this->assignRef ( 'clubs', $model->getClubList () );
  157. $this->assignRef ( 'persons', $model->getPersonList () );
  158. $this->assignRef ( 'positions', $model->getPositionList () );
  159. $this->assignRef ( 'parentpositions', $model->getParentPositionList () );
  160. if ($whichfile == 'playerfile') {
  161. $this->xml ['project']->name = '';
  162. $this->xml ['team'] = '';
  163. $this->style = ' style="visibility: hidden;" ';
  164. $this->insert_task = 'insertplayer';
  165. } else {
  166. $this->style = '';
  167. $this->insert_task = 'insertmatch';
  168. }
  169. $this->assignRef ( 'playgrounds', $model->getPlaygroundList () );
  170. $this->assignRef ( 'projects', $model->getProjectList () );
  171. // }
  172. $this->assignRef ( 'config', $config );
  173. // LOCALE SETTINGS
  174. $timezones = array (
  175. JHtml::_ ( 'select.option', - 12, JText::_ ( '(UTC -12:00) International Date Line West' ) ),
  176. JHtml::_ ( 'select.option', - 11, JText::_ ( '(UTC -11:00) Midway Island, Samoa' ) ),
  177. JHtml::_ ( 'select.option', - 10, JText::_ ( '(UTC -10:00) Hawaii' ) ),
  178. JHtml::_ ( 'select.option', - 9.5, JText::_ ( '(UTC -09:30) Taiohae, Marquesas Islands' ) ),
  179. JHtml::_ ( 'select.option', - 9, JText::_ ( '(UTC -09:00) Alaska' ) ),
  180. JHtml::_ ( 'select.option', - 8, JText::_ ( '(UTC -08:00) Pacific Time (US &amp; Canada)' ) ),
  181. JHtml::_ ( 'select.option', - 7, JText::_ ( '(UTC -07:00) Mountain Time (US &amp; Canada)' ) ),
  182. JHtml::_ ( 'select.option', - 6, JText::_ ( '(UTC -06:00) Central Time (US &amp; Canada), Mexico City' ) ),
  183. JHtml::_ ( 'select.option', - 5, JText::_ ( '(UTC -05:00) Eastern Time (US &amp; Canada), Bogota, Lima' ) ),
  184. JHtml::_ ( 'select.option', - 4, JText::_ ( '(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz' ) ),
  185. JHtml::_ ( 'select.option', - 4.5, JText::_ ( '(UTC -04:30) Venezuela' ) ),
  186. JHtml::_ ( 'select.option', - 3.5, JText::_ ( '(UTC -03:30) St. John\'s, Newfoundland, Labrador' ) ),
  187. JHtml::_ ( 'select.option', - 3, JText::_ ( '(UTC -03:00) Brazil, Buenos Aires, Georgetown' ) ),
  188. JHtml::_ ( 'select.option', - 2, JText::_ ( '(UTC -02:00) Mid-Atlantic' ) ),
  189. JHtml::_ ( 'select.option', - 1, JText::_ ( '(UTC -01:00) Azores, Cape Verde Islands' ) ),
  190. JHtml::_ ( 'select.option', 0, JText::_ ( '(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca' ) ),
  191. JHtml::_ ( 'select.option', 1, JText::_ ( '(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris' ) ),
  192. JHtml::_ ( 'select.option', 2, JText::_ ( '(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa' ) ),
  193. JHtml::_ ( 'select.option', 3, JText::_ ( '(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg' ) ),
  194. JHtml::_ ( 'select.option', 3.5, JText::_ ( '(UTC +03:30) Tehran' ) ),
  195. JHtml::_ ( 'select.option', 4, JText::_ ( '(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi' ) ),
  196. JHtml::_ ( 'select.option', 4.5, JText::_ ( '(UTC +04:30) Kabul' ) ),
  197. JHtml::_ ( 'select.option', 5, JText::_ ( '(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent' ) ),
  198. JHtml::_ ( 'select.option', 5.5, JText::_ ( '(UTC +05:30) Bombay, Calcutta, Madras, New Delhi, Colombo' ) ),
  199. JHtml::_ ( 'select.option', 5.75, JText::_ ( '(UTC +05:45) Kathmandu' ) ),
  200. JHtml::_ ( 'select.option', 6, JText::_ ( '(UTC +06:00) Almaty, Dhaka' ) ),
  201. JHtml::_ ( 'select.option', 6.5, JText::_ ( '(UTC +06:30) Yagoon' ) ),
  202. JHtml::_ ( 'select.option', 7, JText::_ ( '(UTC +07:00) Bangkok, Hanoi, Jakarta' ) ),
  203. JHtml::_ ( 'select.option', 8, JText::_ ( '(UTC +08:00) Beijing, Perth, Singapore, Hong Kong' ) ),
  204. JHtml::_ ( 'select.option', 8.75, JText::_ ( '(UTC +08:00) Ulaanbaatar, Western Australia' ) ),
  205. JHtml::_ ( 'select.option', 9, JText::_ ( '(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk' ) ),
  206. JHtml::_ ( 'select.option', 9.5, JText::_ ( '(UTC +09:30) Adelaide, Darwin, Yakutsk' ) ),
  207. JHtml::_ ( 'select.option', 10, JText::_ ( '(UTC +10:00) Eastern Australia, Guam, Vladivostok' ) ),
  208. JHtml::_ ( 'select.option', 10.5, JText::_ ( '(UTC +10:30) Lord Howe Island (Australia)' ) ),
  209. JHtml::_ ( 'select.option', 11, JText::_ ( '(UTC +11:00) Magadan, Solomon Islands, New Caledonia' ) ),
  210. JHtml::_ ( 'select.option', 11.5, JText::_ ( '(UTC +11:30) Norfolk Island' ) ),
  211. JHtml::_ ( 'select.option', 12, JText::_ ( '(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka' ) ),
  212. JHtml::_ ( 'select.option', 12.75, JText::_ ( '(UTC +12:45) Chatham Island' ) ),
  213. JHtml::_ ( 'select.option', 13, JText::_ ( '(UTC +13:00) Tonga' ) ),
  214. JHtml::_ ( 'select.option', 14, JText::_ ( '(UTC +14:00) Kiribati' ) )
  215. );
  216. // JToolBarHelper::custom($this->insert_task,'upload','upload',Jtext::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_START_BUTTON'), false);
  217. JLToolBarHelper::custom ( $this->insert_task, 'upload', 'upload', Jtext::_ ( 'COM_JOOMLEAGUE_ADMIN_XML_IMPORT_START_BUTTON' ), false );
  218. $conf = JFactory::getConfig ();
  219. $value = $conf->getValue ( 'config.offset' );
  220. $lists ['serveroffset'] = JHtml::_ ( 'select.genericlist', $timezones, 'serveroffset', ' class="inputbox"', 'value', 'text', $value );
  221. $this->assignRef ( 'lists', $lists );
  222. $revisionDate = '2011-04-28 - 12:00';
  223. $import_version = 'NEW';
  224. $this->assignRef ( 'revisionDate', $revisionDate );
  225. $this->assignRef ( 'import_version', $import_version );
  226. parent::display ( $tpl );
  227. }
  228. private function _displaySelectpage($tpl) {
  229. // $option='com_joomleague';
  230. $mainframe = JFactory::getApplication ();
  231. $option = JRequest::getCmd ( 'option' );
  232. $document = JFactory::getDocument ();
  233. $document->addScript ( '/administrator/components/com_joomleague/assets/js/COM_JOOMLEAGUE_import.js' );
  234. $db = JFactory::getDBO ();
  235. $uri = JFactory::getURI ();
  236. $model = $this->getModel ( 'jlextdfbnetplayerimport' );
  237. $revisionDate = '2011-04-28 - 12:00';
  238. $this->assignRef ( 'revisionDate', $revisionDate );
  239. $lists = array ();
  240. $this->assignRef ( 'request_url', $uri->toString () );
  241. $this->assignRef ( 'selectType', $mainframe->getUserState ( $option . 'selectType' ) );
  242. $this->assignRef ( 'recordID', $mainframe->getUserState ( $option . 'recordID' ) );
  243. switch ($this->selectType) {
  244. case '8' :
  245. { // Select Statistics
  246. $this->assignRef ( 'statistics', $model->getStatisticsListSelect () );
  247. $statisticlist = array ();
  248. $statisticlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_STATISTIC' ) );
  249. $statisticlist = array_merge ( $statisticlist, $this->statistics );
  250. $lists ['statistics'] = JHtml::_ ( 'select.genericlist', $statisticlist, 'statisticID', 'class="inputbox select-statistic" onchange="javascript:insertStatistic()" ' );
  251. unset ( $statisticlist );
  252. }
  253. break;
  254. case '7' :
  255. { // Select ParentPosition
  256. $this->assignRef ( 'parentpositions', $model->getParentPositionListSelect () );
  257. $parentpositionlist = array ();
  258. $parentpositionlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_PARENT_POSITION' ) );
  259. $parentpositionlist = array_merge ( $parentpositionlist, $this->parentpositions );
  260. $lists ['parentpositions'] = JHtml::_ ( 'select.genericlist', $parentpositionlist, 'parentPositionID', 'class="inputbox select-parentposition" onchange="javascript:insertParentPosition()" ' );
  261. unset ( $parentpositionlist );
  262. }
  263. break;
  264. case '6' :
  265. { // Select Position
  266. $this->assignRef ( 'positions', $model->getPositionListSelect () );
  267. $positionlist = array ();
  268. $positionlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_POSITION' ) );
  269. $positionlist = array_merge ( $positionlist, $this->positions );
  270. $lists ['positions'] = JHtml::_ ( 'select.genericlist', $positionlist, 'positionID', 'class="inputbox select-position" onchange="javascript:insertPosition()" ' );
  271. unset ( $positionlist );
  272. }
  273. break;
  274. case '5' :
  275. { // Select Event
  276. $this->assignRef ( 'events', $model->getEventListSelect () );
  277. $eventlist = array ();
  278. $eventlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_EVENT' ) );
  279. $eventlist = array_merge ( $eventlist, $this->events );
  280. $lists ['events'] = JHtml::_ ( 'select.genericlist', $eventlist, 'eventID', 'class="inputbox select-event" onchange="javascript:insertEvent()" ' );
  281. unset ( $eventlist );
  282. }
  283. break;
  284. case '4' :
  285. { // Select Playground
  286. $this->assignRef ( 'playgrounds', $model->getPlaygroundListSelect () );
  287. $playgroundlist = array ();
  288. $playgroundlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_PLAYGROUND' ) );
  289. $playgroundlist = array_merge ( $playgroundlist, $this->playgrounds );
  290. $lists ['playgrounds'] = JHtml::_ ( 'select.genericlist', $playgroundlist, 'playgroundID', 'class="inputbox select-playground" onchange="javascript:insertPlayground()" ' );
  291. unset ( $playgroundlist );
  292. }
  293. break;
  294. case '3' :
  295. { // Select Person
  296. $this->assignRef ( 'persons', $model->getPersonListSelect () );
  297. $personlist = array ();
  298. $personlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_PERSON' ) );
  299. $personlist = array_merge ( $personlist, $this->persons );
  300. $lists ['persons'] = JHtml::_ ( 'select.genericlist', $personlist, 'personID', 'class="inputbox select-person" onchange="javascript:insertPerson()" ' );
  301. unset ( $personlist );
  302. }
  303. break;
  304. case '2' :
  305. { // Select Club
  306. $this->assignRef ( 'clubs', $model->getClubListSelect () );
  307. $clublist = array ();
  308. $clublist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_SELECT_CLUB' ) );
  309. $clublist = array_merge ( $clublist, $this->clubs );
  310. $lists ['clubs'] = JHtml::_ ( 'select.genericlist', $clublist, 'clubID', 'class="inputbox select-club" onchange="javascript:insertClub()" ' );
  311. unset ( $clublist );
  312. }
  313. break;
  314. case '1' :
  315. default :
  316. { // Select Team
  317. $this->assignRef ( 'teams', $model->getTeamListSelect () );
  318. $this->assignRef ( 'clubs', $model->getClubListSelect () );
  319. $teamlist = array ();
  320. $teamlist [] = JHtml::_ ( 'select.option', 0, JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNETIMPORT_SELECT_TEAM' ) );
  321. $teamlist = array_merge ( $teamlist, $this->teams );
  322. $lists ['teams'] = JHtml::_ ( 'select.genericlist', $teamlist, 'teamID', 'class="inputbox select-team" onchange="javascript:insertTeam()" ', 'value', 'text', 0 );
  323. unset ( $teamlist );
  324. }
  325. break;
  326. }
  327. $this->assignRef ( 'lists', $lists );
  328. // Set page title
  329. $pageTitle = JText::_ ( 'COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_ASSIGN_TITLE' );
  330. $document->setTitle ( $pageTitle );
  331. parent::display ( $tpl );
  332. }
  333. protected function addToolbar() {
  334. //JLToolBarHelper::save ( 'jlextdfbnetplayerimport.save' );
  335. JLToolBarHelper::custom('jlextdfbnetplayerimport.save','upload','upload',JText::_('COM_JOOMLEAGUE_ADMIN_DFBNET_IMPORT_UPLOAD_BUTTON'),false);
  336. }
  337. }
  338. ?>