Skip to content

Commit

Permalink
Adding different views to the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
alve89 committed Sep 16, 2021
1 parent 6eb7323 commit 96df626
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 5 deletions.
30 changes: 30 additions & 0 deletions admin/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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');

/**
* General Controller of HelloWorld component
*
* @package Joomla.Administrator
* @subpackage com_tvo
* @since 0.0.10
*/
class TvoController extends JControllerLegacy
{
/**
* The default view for the display method.
*
* @var string
* @since 12.2
*/
//protected $default_view = 'tvo';
protected $default_view = 'tvoteamslist';
}
5 changes: 2 additions & 3 deletions admin/models/tvo.php → admin/models/tvosingleteam.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*
* @since 0.0.1
*/
class TvoModelTvo extends JModelList
{
class TvoModelTvoSingleTeam extends JModelList {
/**
* Method to build an SQL query to load the list data.
*
Expand All @@ -29,7 +28,7 @@ protected function getListQuery()

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

return $query;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/models/tvoteamslist.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function getListQuery()

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

return $query;
}
Expand Down
21 changes: 20 additions & 1 deletion admin/tvo.php
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
Hello World administration
<?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');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('tvo');

// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));

// Redirect if set by the controller
$controller->redirect();
71 changes: 71 additions & 0 deletions admin/tvo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">

<name>TVO</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>September 2021</creationDate>
<author>Stefan Herzog</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://github.com/alve89</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.12</version>
<!-- The description is optional and defaults to the name -->
<description>BESCHREIBUNG DER KOMPONENTE FOLGT</description>

<install> <!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8mb4.sql</file>
</sql>
</install>
<uninstall> <!-- Runs on uninstall -->
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8mb4.sql</file>
</sql>
</uninstall>

<update> <!-- Runs on update; New since J2.5 -->
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>

<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>tvo.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>

<administration>
<!-- Administration Menu Section -->
<menu link='index.php?option=com_tvo'>TV Oberflockenbach</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>tvo.php</filename>
<filename>controller.php</filename>
<!-- SQL files section -->
<folder>sql</folder>
<!-- tables files section -->
<folder>tables</folder>
<!-- models files section -->
<folder>models</folder>
<!-- views files section -->
<folder>views</folder>
</files>
</administration>
<updateservers>
<server type="extension" priority="2" name="com_tvo_updateserver">https://raw.githubusercontent.com/alve89/j_com_tvo/master/updates.xml</server>
</updateservers>
</extension>
Empty file.
69 changes: 69 additions & 0 deletions admin/views/tvoteamslist/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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');
?>
<form action="index.php?option=com_tvo&view=tvoteamslist" method="post" id="adminForm" name="adminForm">
<table class="table table-striped table-hover">
<thead>
<tr>
<th width="1%"><?php echo JText::_('COM_TVO_NUM'); ?></th>
<th width="2%">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="45%">
<?php echo JText::_('COM_TVO_HELLOWORLDS_NAME') ;?>
</th>
<th width="45%">
<?php echo JText::_('COM_TVO_HELLOWORLDS_TITLE') ;?>
</th>
<th width="5%">
<?php echo JText::_('COM_TVO_PUBLISHED'); ?>
</th>
<th width="2%">
<?php echo JText::_('COM_TVO_ID'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php if (!empty($this->items)) : ?>
<?php foreach ($this->items as $i => $row) : ?>

<tr>
<td>
<?php echo $this->pagination->getRowOffset($i); ?>
</td>
<td>
<?php echo JHtml::_('grid.id', $i, $row->id); ?>
</td>
<td>
<?php echo $row->teamName; ?>
</td>
<td>
<?=$row->title;?>
<td align="center">
<?php echo JHtml::_('jgrid.published', $row->published, $i, 'tvoteamslist.', true, 'cb'); ?>
</td>
<td align="center">
<?php echo $row->id; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</form>
Empty file.
44 changes: 44 additions & 0 deletions admin/views/tvoteamslist/view.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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');

/**
* HelloWorlds View
*
* @since 0.0.1
*/
class TvoViewTvoTeamsList extends JViewLegacy
{
/**
* Display the Hello World view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{
// Get data from the model
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');

// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));

return false;
}

// Display the template
parent::display($tpl);
}
}

0 comments on commit 96df626

Please sign in to comment.