Skip to content

Commit

Permalink
Optimized views einzelteam and teamliste
Browse files Browse the repository at this point in the history
  • Loading branch information
alve89 committed Sep 15, 2021
1 parent a905746 commit 6eb7323
Show file tree
Hide file tree
Showing 14 changed files with 671 additions and 98 deletions.
168 changes: 168 additions & 0 deletions admin/models/fields/listofallteams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

JFormHelper::loadFieldClass('list');




// ######################################
// ############## DROPDOWN ############

// // Liefert ein Dropdown-Feld zur Auswahl eines EINZELNEN Teams
// class JFormFieldListOfAllTeams extends JFormFieldList {
//
// protected $type = 'listOfAllTeams';
//
// public function getOptions() {
// $db = JFactory::getDBO();
// $query = $db->getQuery(true);
// $query->select('id, title');
// $query->from('#__tvo_teams');
// $db->setQuery((string) $query);
// $teams = $db->loadObjectList();
// $options = array();
//
// foreach ($teams as $team) {
// $options[] = JHtml::_('select.option', $team->id, $team->title);
// }
//
// $options = array_merge(parent::getOptions(), $options);
// return $options;
// }
// }













// jimport('joomla.form.helper');
// JFormHelper::loadFieldClass('Radio');
//
// class JFormFieldListOfAllTeams extends JFormFieldRadio {
//
// public function varDump($var)
// {
// echo '<pre>';
// var_dump($var);
// echo '</pre>';
// return;
// }
//
// //The field class must know its own type through the variable $type.
// protected $type = 'listOfAllTeams';
//
// public function getLabel() {
// // code that returns HTML that will be shown as the label
// return 'Teams';
// }
//
//
// public function getInput() {
// // code that returns HTML that will be shown as the form field
// $db = JFactory::getDBO();
// $query = $db->getQuery(true);
// $query->select('id, title');
// $query->from('#__tvo_teams');
// $db->setQuery((string) $query);
// $teams = $db->loadObjectList();
// $options = array();
//
// if ($teams) {
// foreach ($teams as $team) {
// $options[] = JHtml::_('select.option', $team->id, $team->title);
// }
// }
//
// $options = array_merge(parent::getOptions(), $options);
//
//
// return '<fieldset id="team1" class="btn-group btn-group-yesno radio">
// <input type="radio" id="team1_show0" name="teamsList[show]" value="1">
// <label for="team1_show0" class="btn active btn-success">Anzeigen</label>
//
// <input type="radio" id="team1_show1" name="teamsList[show]" value="0">
// <label for="team1_show1" class="btn">Verbergen</label>
// </fieldset>';
//
// }
// }






// //######################################
// //############## CHECKBOXES ############
//
//
// jimport('joomla.form.helper');
// JFormHelper::loadFieldClass('Checkboxes');
//
//
//
// class JFormFieldListOfAllTeams extends JFormFieldCheckboxes {
// public function getOptions() {
// $db = JFactory::getDBO();
// $query = $db->getQuery(true);
// $query->select('id, title');
// $query->from('#__tvo_teams');
// $db->setQuery((string) $query);
// $teams = $db->loadObjectList();
// $options = array();
//
// foreach ($teams as $team) {
// $options[] = JHtml::_('select.option', $team->id, $team->title);
// }
//
// $options = array_merge(parent::getOptions(), $options);
// return $options;
// }
// }





//##############################################
//############## MULTI CHOICE (TAGS) ############

jimport('joomla.form.helper');
JFormHelper::loadFieldClass('Tag');

// $getInput = JFormHelper::loadFieldType('Tag', false);
// $taginput = $tags->getInput();


class JFormFieldListOfAllTeams extends JFormFieldTag {

// protected $type = 'ListOfAllTeams'; // this line causes unknown error while loading page

public function getOptions() {
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('id, title');
$query->from('#__tvo_teams');
$query->where('published = 1');
$db->setQuery((string) $query);
$teams = $db->loadObjectList();
$options = array();

foreach ($teams as $team) {
$options[] = JHtml::_('select.option', $team->id, $team->title);
}


return $options;
}
}
36 changes: 36 additions & 0 deletions admin/models/tvo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_tvo
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
* HelloWorldList Model
*
* @since 0.0.1
*/
class TvoModelTvo extends JModelList
{
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Initialize variables.
$db = JFactory::getDbo();
$query = $db->getQuery(true);

// Create the base select statement.
$query->select('*')
->from($db->quoteName('#__tvo_teams'));

return $query;
}
}
36 changes: 36 additions & 0 deletions admin/models/tvoteamslist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_tvo
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
* HelloWorldList Model
*
* @since 0.0.1
*/
class TvoModelTvoTeamsList extends JModelList
{
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Initialize variables.
$db = JFactory::getDbo();
$query = $db->getQuery(true);

// Create the base select statement.
$query->select('*')
->from($db->quoteName('#__tvo_teams'));

return $query;
}
}
86 changes: 81 additions & 5 deletions admin/sql/install.mysql.utf8mb4.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DROP TABLE IF EXISTS `#__helloworld`;
DROP TABLE IF EXISTS `#__tvo_teams_games`;

CREATE TABLE `#__tvo_teams` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
Expand All @@ -8,9 +9,84 @@ CREATE TABLE `#__tvo_teams` (
PRIMARY KEY (`id`),
UNIQUE (`teamId`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
DEFAULT COLLATE=utf8mb4_unicode_ci;

INSERT INTO `#__tvo_teams` (`teamId`, `title`) VALUES
(123456, 'Team01'),
(345678, 'Team02'),
(567890, 'Team03');
CREATE TABLE `#__tvo_games` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`teamGamesId` INT(10) NOT NULL,
`gamesData` LONGTEXT NULL COLLATE 'utf8mb4_bin',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `teamId` (`teamGamesId`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
DEFAULT COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `#__tvo_tables` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`teamTableId` INT(10) NOT NULL,
`tablesData` LONGTEXT NULL COLLATE 'utf8mb4_unicode_ci',
`lastUpdated` DATETIME NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `teamTableId` (`teamTableId`) USING BTREE
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
DEFAULT COLLATE=utf8mb4_unicode_ci;



INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (732061, 68333, 'M-BzL2 2', 1, 'Herren 1');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (725421, 68361, 'M-BzL4-1 ', 1, 'Herren 2');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (728101, 68533, 'wJA-BWOL-1 ', 0, 'weibliche A-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (725609, 68377, 'F-BzL1', 1, 'Damen 1');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (725733, 68389, 'F-BzL4', 1, 'Damen 2');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (735309, 69769, 'mJB-BzL1', 1, 'männliche B-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (735413, 69789, 'mJC-BzL1', 1, 'männliche C-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (737105, 69997, 'mJD-BzL1', 1, 'männliche D-Jugend 1');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (748645, 70009, 'mJD-BzL3-1', 1, 'männliche D-Jugend 2');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (739293, 70149, 'mJE-BzL2-1', 1, 'männliche E-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (794966, 76366, 'mJE ABR 4 ', 1, 'männliche E-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (739473, 70165, 'wJA-BzL1 ', 1, 'weibliche A-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (739501, 70169, 'wJB-BzL1', 1, 'weibliche B-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (739565, 70177, 'wJC-BzL1-1 ', 1, 'weibliche C-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (740745, 70281, 'wJD-BzL1', 1, 'weibliche D-Jugend');
INSERT INTO `owtxa_tvo_teams` (`teamGamesId`, `teamTableId`, `title`, `published`, `teamName`) VALUES (741257, 70341, 'wJE-BzL1-1', 1, 'weibliche E-Jugend');

INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (725421, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (732061, [])
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (728101, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (725609, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (725733, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (735309, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (735413, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (737105, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (748645, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (739293, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (794966, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (739473, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (739501, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (739565, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (740745, []);
INSERT INTO `owtxa_tvo_games` (`teamGamesId`, `gamesData`) VALUES (741257, []);

INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (68361, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (68333, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (68533, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (68377, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (68389, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (69769, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (69789, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (69997, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70009, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70149, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (76366, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70165, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70169, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70177, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70281, []);
INSERT INTO `owtxa_tvo_tables` (`teamTableId`, `tablesData`) VALUES (70341, []);
Loading

0 comments on commit 6eb7323

Please sign in to comment.