Skip to content

Commit

Permalink
Merge pull request #86 from Didldu-Florian/dev
Browse files Browse the repository at this point in the history
Categories view
  • Loading branch information
HRIT-Florian authored Feb 6, 2018
2 parents 70b8423 + a548961 commit 3145a87
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 6 deletions.
1 change: 1 addition & 0 deletions admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
label="COM_DD_GMAPS_LOCATIONS_COMPONENT_MARK_AS_NEW_SELECTION_LABEL"
description="COM_DD_GMAPS_LOCATIONS_COMPONENT_MARK_AS_NEW_SELECTION_DESC"
>
<option value="0">JNO</option>
<option value="30">COM_DD_GMAPS_LOCATIONS_COMPONENT_MARK_AS_NEW_DEFAULT_THIRTYDAYS</option>
</field>

Expand Down
2 changes: 2 additions & 0 deletions admin/language/de-DE/de-DE.com_dd_gmaps_locations.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ COM_DD_GMAPS_LOCATIONS_HEADING_LOCATION="Adressee"
COM_DD_GMAPS_LOCATIONS_HEADING_ZIP="PLZ"
COM_DD_GMAPS_LOCATIONS_HEADING_COUNTRY="Land"

COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_OPTIONS="Kategorien"
COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_DESC="Zeige Kategorien"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_TITLE="Zeigt Standorte an"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_DESC="Zeigt Standorte an"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_OPTION="Default"
Expand Down
2 changes: 2 additions & 0 deletions admin/language/en-GB/en-GB.com_dd_gmaps_locations.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ COM_DD_GMAPS_LOCATIONS_HEADING_LOCATION="Addresse"
COM_DD_GMAPS_LOCATIONS_HEADING_ZIP="ZIP"
COM_DD_GMAPS_LOCATIONS_HEADING_COUNTRY="Country"

COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_OPTIONS="Categories"
COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_DESC="Shows Categories"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_TITLE="Shows Locations"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_DESC="Shows Locations"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_OPTION="Default"
Expand Down
3 changes: 3 additions & 0 deletions admin/language/ru-RU/ru-RU.com_dd_gmaps_locations.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ COM_DD_GMAPS_LOCATIONS_HEADING_LOCATION="Адрес"
COM_DD_GMAPS_LOCATIONS_HEADING_ZIP="Почтовый индекс"
COM_DD_GMAPS_LOCATIONS_HEADING_COUNTRY="Страна"

; todo: translate
COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_OPTIONS="Categories"
COM_DD_GMAPS_LOCATIONS_CATEGORIES_VIEW_DEFAULT_DESC="Shows Categories"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_TITLE="Показывает географические положения"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_DESC="Показывает географические положения"
COM_DD_GMAPS_LOCATIONS_LOCATIONS_VIEW_DEFAULT_OPTION="По умолчанию"
Expand Down
2 changes: 1 addition & 1 deletion admin/views/location/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class="btn btn-small btn-danger"
<?php echo JText::_('COM_DD_GMAPS_LOCATIONS_FIELD_EXT_C_ID_NOTE'); ?>
</div>

<p><a href="javascript:void(0)"
<p><a href="javascript:void(0)" rel="nofollow"
class="btn btn-small btn-danger"
id="extcclear"><?php echo JText::_('COM_DD_GMAPS_LOCATIONS_FIELD_EXT_C_ID_UNSET')?>
</a>
Expand Down
2 changes: 1 addition & 1 deletion admin/views/locations/tmpl/modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
. ' data-title="' . $this->escape(addslashes($item->title)) . '"'
. ' data-uri="' . $this->escape('index.php?option=com_dd_gmaps_locations&view=profile&id=' . (int) $item->id) . '"'
?>
<a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>>
<a class="select-link" href="javascript:void(0)" rel="nofollow" <?php echo $attribs; ?>>
<?php echo $this->escape($item->title); ?>
</a>
</td>
Expand Down
66 changes: 66 additions & 0 deletions site/models/categories.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* @package DD_GMaps_Locations
*
* @author HR IT-Solutions Florian Häusler <[email protected]>
* @copyright Copyright (C) 2011 - 2018 Didldu e.K. | HR IT-Solutions
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
**/

defined('_JEXEC') or die;

class DD_GMaps_LocationsModelCategories extends JModelList
{

/**
* populateState
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since Version 1.1.1.8
*/
protected function populateState($ordering = null, $direction = null, $listlimit = true)
{
parent::populateState($ordering, $direction);

$catid = (int) JFactory::getApplication()->input->get('catid');

// Category
if ($catid)
{
$this->setState('dd_filter.catid', $catid);
}
}

/**
* getListQuery
*
* @since Version 1.1.1.8
*
* @return JDatabaseQuery
*/
public function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);

$catid = (int) $this->getState('dd_filter.catid');

$select = $db->qn(array('c.id', 'c.title', 'c.description', 'c.params'));

$query->select($select);

$query->from($db->qn('#__categories', 'c'))
->join('INNER', $db->qn('#__categories', 'cc') . ' ON ' . $db->qn('c.parent_id') . ' = ' . $db->qn('cc.id'))
->where($db->qn('c.parent_id') . ' != 1')
->where($db->qn('cc.id') . ' = ' . $db->q($catid))
->where($db->qn('c.published') . '= 1 OR' . ($db->qn('c.id') . ' = ' . $db->q($catid)));

$db->setQuery($query);

return $query;
}
}
1 change: 1 addition & 0 deletions site/models/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function getItem($id = null)
array(
'a.id',
'a.title',
'a.alias',
'a.catid',
'a.state',
'a.profileimage',
Expand Down
3 changes: 2 additions & 1 deletion site/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public function preprocess($query)

$allowed_views = array(
'locations',
'profile'
'profile',
'categories'
);

if (!isset($query['view']) || !in_array($query['view'], $allowed_views))
Expand Down
30 changes: 30 additions & 0 deletions site/views/categories/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* @package DD_GMaps_Locations
*
* @author HR IT-Solutions Florian Häusler <[email protected]>
* @copyright Copyright (C) 2011 - 2018 Didldu e.K. | HR IT-Solutions
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
**/

defined('_JEXEC') or die;
?>
<div class="dd_gmaps_locations categories well">
<div class="row-fluid">
<?php foreach ($this->items as $i => $item): ?>
<?php if ($i % 3 == 0){ echo '</div><div class="row-fluid">'; } ?>
<div class="span4 category well">
<h5><?php echo $this->escape($item->title); ?></h5>
<img src="<?php echo json_decode($item->params)->image; ?>" alt="<?php echo json_decode($item->params)->image_alt; ?>">
<hr>
<div class="category-desc">
<?php echo $item->description; ?>
</div>
<form name="categories_<?php echo $item->id; ?>" action="<?php echo JRoute::_('index.php?option=com_dd_gmaps_locations&view=locations'); ?>" method="post" role="search">
<input type="hidden" name="category_filter" value="<?php echo $item->id; ?>">
<button class="btn" type="submit"><?php echo $this->escape($item->title); ?></button>
</form>
</div>
<?php endforeach;?>
</div>
</div>
23 changes: 23 additions & 0 deletions site/views/categories/tmpl/default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Categories" option="com_dd_gmaps_locations_categories_view_default_options">
<message>
<![CDATA[com_dd_gmaps_locations_categories_view_default_desc]]>
</message>
</layout>

<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">

<field name="catid" type="category"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_dd_gmaps_locations"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
>
<option value="">JOPTION_SELECT_CATEGORY</option>
</field>

</fieldset>
</fields>
</metadata>
73 changes: 73 additions & 0 deletions site/views/categories/view.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* @package DD_GMaps_Locations
*
* @author HR IT-Solutions Florian Häusler <[email protected]>
* @copyright Copyright (C) 2011 - 2018 Didldu e.K. | HR IT-Solutions
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
**/

defined('_JEXEC') or die;

class DD_GMaps_LocationsViewCategories extends JViewLegacy
{
protected $app;

protected $items;

protected $params;

/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse
*
* @return boolean | mixed
*
* @since Version 1.1.0.0
* @throws Exception
*/
public function display($tpl = null)
{
$this->app = JFactory::getApplication();

$this->items = $this->get('Items');

$this->params = $this->app->getParams();

// Active menu
$activeMenu = $this->app->getMenu()->getItem($this->app->getMenu()->getActive()->id);

if (method_exists($activeMenu, 'getParams')) // Joomla 3.7.xx
{
// Active menu params
$activeMenuParams = $activeMenu->getParams();

// Get meta data from menu
$metadesc = $activeMenuParams->get('menu-meta_description');
$metakey = $activeMenuParams->get('menu-meta_keywords');
$robots = $activeMenuParams->get('robots');
}
else // Joomla 3.5.xx
{
// Get meta data from menu
$metadesc = $activeMenu->{'menu-meta_description'};
$metakey = $activeMenu->{'menu-meta_keywords'};
$robots = $activeMenu->robots;
}

// Set meta data haeder from menu : default from item
$doc = JFactory::getDocument();
$doc->setMetaData('description', $metadesc);
$doc->setMetaData('keywords', $metakey);
$doc->setMetaData('robots', $robots);

// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}

return parent::display($tpl);
}
}
4 changes: 2 additions & 2 deletions site/views/locations/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<?php endif; ?>
<?php // Mark as new
$mark_as_new = (int) $params->get('mark_as_new', 0);
if( strtotime("-$mark_as_new days") < strtotime($item->created)):?>
if($mark_as_new AND strtotime("-$mark_as_new days") < strtotime($item->created)):?>
<span class="label new"><?php echo JText::_('COM_DD_GMAPS_LOCATIONS_NEW'); ?></span>
<?php endif; ?>
<?php // Featured
Expand Down Expand Up @@ -105,7 +105,7 @@
<div class="page-header map_bar">
<?php // Show on map button
if($params->get('show_on_map')):?>
<a class="showOnMap" data-showonmap_action="<?php echo $params->get('show_on_map_action') ?>" id="showID<?php echo $i; ?>" href="javascript:void(0)">
<a class="showOnMap" data-showonmap_action="<?php echo $params->get('show_on_map_action') ?>" id="showID<?php echo $i; ?>" href="javascript:void(0)" rel="nofollow" >
<?php echo JText::_('COM_DD_GMAPS_LOCATIONS_SHOW_ON_MAP'); ?>
</a>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion site/views/profile/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<?php endif; ?>
<?php // Mark as new
$mark_as_new = (int) $this->params->get('mark_as_new', 0);
if( strtotime("-$mark_as_new days") < strtotime($this->item->created)):?>
if($mark_as_new AND strtotime("-$mark_as_new days") < strtotime($this->item->created)):?>
<span class="label new"><?php echo JText::_('COM_DD_GMAPS_LOCATIONS_NEW'); ?></span>
<?php endif; ?>
<?php // Featured
Expand Down

0 comments on commit 3145a87

Please sign in to comment.