Skip to content

Commit

Permalink
add module files
Browse files Browse the repository at this point in the history
  • Loading branch information
n9iels committed Jul 3, 2015
0 parents commit ef2ea78
Show file tree
Hide file tree
Showing 23 changed files with 1,058 additions and 0 deletions.
Empty file added README.md
Empty file.
1 change: 1 addition & 0 deletions css/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
29 changes: 29 additions & 0 deletions css/responsivemenu.colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
nav.mmenu {
background-color:#708EA4;
}
nav.mmenu ul li {
border-color:#486D88;
}
nav.mmenu ul li:first-child {
border-color:#486D88;
}
nav.mmenu ul li a {
color:#fff;
}
nav.mmenu ul.submenu {
background-color:#29516E;
}

/* Buttons */
a.mmenu-open {
background-color:#ccc;
}
nav.mmenu a.menu-close {
color:#123752;
}
nav.mmenu a.sub-toggle:after {
border-color:#486D88;
}
nav.mmenu li.submenu-open a.sub-toggle::after {
background-color:#29516E;
}
147 changes: 147 additions & 0 deletions css/responsivemenu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/* Base menu structure */
nav.mmenu {
min-width: 270px;
height: 100%;
position: fixed;
top: 0;
left: -100%;
border-right: 1px solid #d6d6d6;
overflow-y: scroll;
z-index: 999;
transitoin: left 2s;
-webkit-transition: left 0.5s;
}
nav.mmenu ul {
padding: 0;
}
nav.mmenu ul li {
list-style: none;
border-bottom: 1px solid;
border-color:#d6d6d6;
}
nav.mmenu ul li:first-child {
border-top: 1px solid;
border-color:#d6d6d6;
}
nav.mmenu ul li a {
padding: 14px;
display: inline-block;
width: 82%;
}
nav.mmenu ul li.deeper > a:first-child {
border-right: 1px solid #ccc;
}
nav.mmenu ul li ul.submenu {
margin: 0;
display: none;
}
nav.mmenu ul li ul.submenu li:last-child {
border-bottom: 0px;
}
nav.mmenu ul li ul.submenu li a:first-child {
padding-left: 30px;
}
nav.mmenu ul li ul.submenu-open {
display: block;
}
nav.mmenu-open {
left: 0;
transitoin: left 2s;
-webkit-transition: left 0.5s;
}
/* Buttons */
nav.mmenu a.menu-close {
font-size: 24px;
line-height: 1;
text-align: right;
text-decoration: none;
display: block;
margin: 15px 10px;
}
nav.mmenu a.sub-toggle {
display: inline-block;
padding: 0;
position: absolute;
width: 17%;
height: 100%;
text-decoration: none;
}
nav.mmenu li.submenu-open a.sub-toggle {
height: 56px;
}
nav.mmenu a.sub-toggle::after {
font-size: 34px;
content: '\002B';
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
nav.mmenu li.submenu-open > a.sub-toggle::after {
content: '\002D';
}

/* Menu toggle */
a.mmenu-open {
height: 40px;
padding: 12px;
font-size: 17px;
width: 100%;
text-decoration: none;
z-index:999;
display:block;
}
.mmenu-top {
position:absolute;
top: 0;
left: 0;
}
.mmenu-fixed {
position:fixed;
top: 0;
left: 0;
}

/* colors & additional styling */
nav.mmenu {
border-color: #d6d6d6;
box-shadow: -1px 0px 3px 0px rgba(0, 0, 0, .4);
}
nav.mmenu ul li {
border-color:#d6d6d6;
position: relative;
}
nav.mmenu ul li:first-child {
border-color:#d6d6d6;
}
nav.mmenu ul li a {
font-size: 17px;
}
nav.mmenu a.sub-toggle::after {
border-color:#d6d6d6;
}

/* Extra CSS voor PLC direct */
.mmenu-open {
position:absolute;
left:0;
margin-top:10px;
}
nav.mmenu-open {
margin-top:0px;
}
.mmenu-fixed {
position:fixed !important;
margin-top:0px;
}
nav.mmenu,
nav.mmenu ul li,
nav.mmenu ul li:first-child,
nav.mmenu ul li.deeper a:first-child {
border-color:#474747;
box-shadow:none;
}
nav.mmenu li.submenu-open a.sub-toggle {
height:50px;
}
196 changes: 196 additions & 0 deletions helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_menu
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/**
* Helper for mod_menu
*
* @package Joomla.Site
* @subpackage mod_menu
* @since 1.5
*/
class ModResponsiveMenuHelper
{
/**
* Get a list of the menu items.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();

// Get active menu item
$base = self::getBase($params);
$user = JFactory::getUser();
$levels = $user->getAuthorisedViewLevels();
asort($levels);
$key = 'menu_items' . $params . implode(',', $levels) . '.' . $base->id;
$cache = JFactory::getCache('mod_responsivemenu', '');

if (!($items = $cache->get($key)))
{
$path = $base->tree;
$start = (int) $params->get('startLevel');
$end = (int) $params->get('endLevel');
$showAll = $params->get('showAllChildren');
$items = $menu->getItems('menutype', $params->get('menutype'));

$lastitem = 0;

if ($items)
{
foreach ($items as $i => $item)
{
if (($start && $start > $item->level)
|| ($end && $item->level > $end)
|| (!$showAll && $item->level > 1 && !in_array($item->parent_id, $path))
|| ($start > 1 && !in_array($item->tree[$start - 2], $path)))
{
unset($items[$i]);
continue;
}

$item->deeper = false;
$item->shallower = false;
$item->level_diff = 0;

if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = ($item->level > $items[$lastitem]->level);
$items[$lastitem]->shallower = ($item->level < $items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level - $item->level);
}

$item->parent = (boolean) $menu->getItems('parent_id', (int) $item->id, true);

$lastitem = $i;
$item->active = false;
$item->flink = $item->link;

// Reverted back for CMS version 2.5.6
switch ($item->type)
{
case 'separator':
case 'heading':
// No further action needed.
continue;

case 'url':
if ((strpos($item->link, 'index.php?') === 0) && (strpos($item->link, 'Itemid=') === false))
{
// If this is an internal Joomla link, ensure the Itemid is set.
$item->flink = $item->link . '&Itemid=' . $item->id;
}
break;

case 'alias':
$item->flink = 'index.php?Itemid=' . $item->params->get('aliasoptions');
break;

default:
$item->flink = 'index.php?Itemid=' . $item->id;
break;
}

if (strcasecmp(substr($item->flink, 0, 4), 'http') && (strpos($item->flink, 'index.php?') !== false))
{
$item->flink = JRoute::_($item->flink, true, $item->params->get('secure'));
}
else
{
$item->flink = JRoute::_($item->flink);
}

// We prevent the double encoding because for some reason the $item is shared for menu modules and we get double encoding
// when the cause of that is found the argument should be removed
$item->title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false);
$item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''), ENT_COMPAT, 'UTF-8', false);
$item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''), ENT_COMPAT, 'UTF-8', false);
$item->menu_image = $item->params->get('menu_image', '') ?
htmlspecialchars($item->params->get('menu_image', ''), ENT_COMPAT, 'UTF-8', false) : '';
}

if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = (($start?$start:1) > $items[$lastitem]->level);
$items[$lastitem]->shallower = (($start?$start:1) < $items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level - ($start?$start:1));
}
}

$cache->store($items, $key);
}

return $items;
}

/**
* Get base menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getBase(&$params)
{
// Get base menu item from parameters
if ($params->get('base'))
{
$base = JFactory::getApplication()->getMenu()->getItem($params->get('base'));
}
else
{
$base = false;
}

// Use active menu item if no base found
if (!$base)
{
$base = self::getActive($params);
}

return $base;
}

/**
* Get active menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getActive(&$params)
{
$menu = JFactory::getApplication()->getMenu();
$lang = JFactory::getLanguage();

// Look for the home menu
if (JLanguageMultilang::isEnabled())
{
$home = $menu->getDefault($lang->getTag());
}
else
{
$home = $menu->getDefault();
}

return $menu->getActive() ? $menu->getActive() : $home;
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
1 change: 1 addition & 0 deletions js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
Loading

0 comments on commit ef2ea78

Please sign in to comment.