-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from Didldu-Florian/dev
Categories view
- Loading branch information
Showing
14 changed files
with
208 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters