85 lines
2.1 KiB
PHP
85 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* View file for responding to Ajax request for performing Search Here on the map
|
|
*
|
|
*/
|
|
|
|
// No direct access to this file
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
class leafletViewleaflet extends JViewLegacy
|
|
{
|
|
/**
|
|
* This display function returns in json format the Helloworld greetings
|
|
* found within the latitude and longitude boundaries of the map.
|
|
* These bounds are provided in the parameters
|
|
* minlat, minlng, maxlat, maxlng
|
|
*/
|
|
|
|
function display($tpl = null)
|
|
{
|
|
$input = JFactory::getApplication()->input;
|
|
$type = $input->get('type', null, 'string');
|
|
$catId = $input->get('catId', null, 'string');
|
|
|
|
$model = $this->getModel();
|
|
if ($type == "categories")
|
|
{
|
|
$records = $model->getCategory();
|
|
if ($records)
|
|
{
|
|
echo new JResponseJson($records);
|
|
}
|
|
else
|
|
{
|
|
echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_RECORDS'), true);
|
|
}
|
|
} else if ($type == "departement") {
|
|
$records = $model->getTerritoires();
|
|
if ($records)
|
|
{
|
|
echo new JResponseJson($records);
|
|
}
|
|
else
|
|
{
|
|
echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_RECORDS'), true);
|
|
}
|
|
} else if ($type == "categorie") {
|
|
$records = $model->getCategoriesExperience();
|
|
if ($records)
|
|
{
|
|
echo new JResponseJson($records);
|
|
}
|
|
else
|
|
{
|
|
echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_RECORDS'), true);
|
|
}
|
|
} else if ($type == "activite") {
|
|
$records = $model->getActivite();
|
|
if ($records)
|
|
{
|
|
echo new JResponseJson($records);
|
|
}
|
|
else
|
|
{
|
|
echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_RECORDS'), true);
|
|
}
|
|
} else if ($type == "markers" && isset($catId)) {
|
|
$records = $model->getMarkers($catId);
|
|
if ($records)
|
|
{
|
|
echo new JResponseJson($records);
|
|
}
|
|
else
|
|
{
|
|
echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_RECORDS_1'), true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$records = array();
|
|
//echo new JResponseJson(null, JText::_('COM_HELLOWORLD_ERROR_NO_MAP_BOUNDS'), true);
|
|
echo new JResponseJson($type);
|
|
}
|
|
}
|
|
} |