Skip to content

Commit

Permalink
Update to 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Jul 2, 2019
1 parent 85a69d0 commit ddd1f10
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 101 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# JUHome
Component for custom FronPage
Component for custom FrontPage
14 changes: 6 additions & 8 deletions controller.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?php
/**
* @package JUHome Component
* @version @version@
* @version 3.x
* @author Denys D. Nosov ([email protected])
* @copyright (C) 2011-2018 by Denys D. Nosov (https://joomla-ua.org)
* @copyright (C) 2011-2019 by Denys D. Nosov (https://joomla-ua.org)
* @license GNU General Public License version 2 or later
*
* @since 3.0
*/

defined('_JEXEC') or die;

jimport('joomla.application.component.controller');

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;

defined('_JEXEC') or die;

/**
* Content Component Controller
*
Expand All @@ -36,14 +34,14 @@ public function display($cachable = false, $urlparams = false)
{
$params = Factory::getApplication()->getParams();

if( $params->get('cache_home', '0') == 1 )
if($params->get('cache_home', '0') == 1)
{
$cachable = true;
}

$vName = $this->input->get('view', 'home');
$this->input->set('view', $vName);

return parent::display($cachable, array( 'Itemid' => 'INT' ));
return parent::display($cachable, [ 'Itemid' => 'INT' ]);
}
}
8 changes: 3 additions & 5 deletions home.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
/**
* @package JUHome Component
* @version @version@
* @version 3.x
* @author Denys D. Nosov ([email protected])
* @copyright (C) 2011-2018 by Denys D. Nosov (https://joomla-ua.org)
* @copyright (C) 2011-2019 by Denys D. Nosov (https://joomla-ua.org)
* @license GNU General Public License version 2 or later
*
* @since 3.0
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;

jimport('joomla.application.component.controller');
defined('_JEXEC') or die;

$controller = BaseController::getInstance('Home');
$controller->execute(Factory::getApplication()->input->get('task'));
Expand Down
7 changes: 3 additions & 4 deletions home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
<extension type="component" version="3.5" method="upgrade">
<name>home</name>
<author>Denys Nosov</author>
<creationDate>14.11.2018</creationDate>
<copyright>(C) 2011-2018 Joomla! Ukraine. All rights reserved.</copyright>
<creationDate>02.17.2019</creationDate>
<copyright>(C) 2011-2019 Joomla! Ukraine. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://joomla-ua.org</authorUrl>
<version>3.1.0</version>
<version>3.2.0</version>
<description>Home - component for display modules and create Home Page</description>
<files>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>metadata.xml</filename>
<filename>router.php</filename>
<filename>home.php</filename>
Expand Down
1 change: 0 additions & 1 deletion index.html

This file was deleted.

80 changes: 68 additions & 12 deletions router.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,94 @@
<?php
/**
* @package JUHome Component
* @version @version@
* @version 3.x
* @author Denys D. Nosov ([email protected])
* @copyright (C) 2011-2018 by Denys D. Nosov (https://joomla-ua.org)
* @copyright (C) 2011-2019 by Denys D. Nosov (https://joomla-ua.org)
* @license GNU General Public License version 2 or later
*
* @since 3.0
*/

use Joomla\CMS\Component\Router\RouterView;

defined('_JEXEC') or die;

function homeBuildRoute($query)
class HomeRouter extends RouterView
{
$segments = array();
protected $noIDs = false;

/**
* HomeRouter constructor.
*
* @param null $app
* @param null $menu
*
* @since 1.0
*/
public function __construct($app = null, $menu = null)
{
parent::__construct($app, $menu);
}

/**
* @param $query
*
* @return array
*
* @since 1.0
*/
public function build(&$query)
{
if(isset($query[ 'view' ]))
{
unset($query[ 'view' ]);
}

return [];
}

if( isset($query[ 'view' ]) )
/**
* @param $segments
*
* @return array
*
* @since 1.0
*/
public function parse(&$segments)
{
unset($query[ 'view' ]);
if($segments[ 0 ] === $this->app->getMenu()->getActive()->alias)
{
return [ 'view' => 'home' ];
}

return [ 'view' => 'homes' ];

}
}

/**
* @param $query
*
* @return array
*
* @since 1.0
*/
function homeBuildRoute(&$query)
{
$router = new HomeRouter($this->app, $this->app->getMenu());

return $segments;
return $router->build($query);
}


/**
* @return array
*
* @since 3.0
* @since 1.0
*/
function homeParseRoute()
{
$vars = array();

$vars[ 'view' ] = 'home';
$router = new HomeRouter($this->app, $this->app->getMenu());

return $vars;
return $router->parse($segments);
}
4 changes: 0 additions & 4 deletions views/home/index.html

This file was deleted.

8 changes: 4 additions & 4 deletions views/home/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* @package JUHome Component
* @version @version@
* @version 3.x
* @author Denys D. Nosov ([email protected])
* @copyright (C) 2011-2018 by Denys D. Nosov (https://joomla-ua.org)
* @copyright (C) 2011-2019 by Denys D. Nosov (https://joomla-ua.org)
* @license GNU General Public License version 2 or later
*
* @since 3.0
Expand All @@ -13,9 +13,9 @@

$load = new HomeViewHome();

if( $params->get('display_title') )
if($this->params->get('display_title'))
{
echo '<h1>' . $params->get('page_title') . '</h1>';
echo '<h1>' . $this->params->get('page_title') . '</h1>';
}

echo $load->LoadPositionForHome($home->mod_name_pref, $style = ($home->style ? : 'raw'));
64 changes: 33 additions & 31 deletions views/home/tmpl/default.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Home" option="Default with select templates">
<layout title="Home"
option="Default with select templates">
<help
key="Menus_Menu_Item_Home"
key="Menus_Menu_Item_Home"
/>
<message>
<![CDATA[COM_HOME_HOME_VIEW_DEFAULT_DESC]]>
Expand All @@ -11,53 +12,54 @@

<fields name="params">

<fieldset name="request" label="COM_MENUS_BASIC_FIELDSET_LABEL">
<fieldset name="request"
label="COM_MENUS_BASIC_FIELDSET_LABEL">

<field
name="cache_home"
type="radio"
default="0"
label="Cache page"
class="btn-group"
name="cache_home"
type="radio"
default="0"
label="Cache page"
class="btn-group"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>

<field
name="mod_name_pref"
type="text"
label="Module name pref."
size="20"
name="mod_name_pref"
type="text"
label="Module name pref."
size="20"
/>

<field
name="style"
type="text"
label="Module style"
size="20"
name="style"
type="text"
label="Module style"
size="20"
/>

<field
name="template"
type="filelist"
default="default.php"
label="Template"
directory="components/com_home/views/home/tmpl"
filter="\.php$"
stripext="0"
hide_none="1"
hide_default="1"
description="Select your template from list. You'll create template and upload to /components/com_home/views/home/tmpl folder"
name="template"
type="filelist"
default="default.php"
label="Template"
directory="components/com_home/views/home/tmpl"
filter="\.php$"
stripext="0"
hide_none="1"
hide_default="1"
description="Select your template from list. You'll create template and upload to /components/com_home/views/home/tmpl folder"
>
</field>

<field
name="display_title"
type="radio"
default="0"
label="Display title"
class="btn-group"
name="display_title"
type="radio"
default="0"
label="Display title"
class="btn-group"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
Expand Down
4 changes: 0 additions & 4 deletions views/home/tmpl/index.html

This file was deleted.

6 changes: 3 additions & 3 deletions views/home/tmpl/none.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* @package JUHome Component
* @version @version@
* @version 3.x
* @author Denys D. Nosov ([email protected])
* @copyright (C) 2011-2018 by Denys D. Nosov (https://joomla-ua.org)
* @copyright (C) 2011-2019 by Denys D. Nosov (https://joomla-ua.org)
* @license GNU General Public License version 2 or later
*
* @since 3.0
Expand All @@ -13,4 +13,4 @@

$load = new HomeViewHome();

echo $load->LoadPositionForHome($home->mod_name_pref, $style = 'raw');
echo $load->LoadPositionForHome($home->mod_name_pref, 'raw');
Loading

0 comments on commit ddd1f10

Please sign in to comment.