public static function getMarkers($params, $renderer) { $app = App::getInstance('zoo'); //чтоб работал выбор категории в модуле $category_id = $params->get('category'); //чтоб отображало текущую категорию // $category_id = $app->jbrequest->getSystem('category'); //var_dump($category_id); $conditions = " a.state = 1 " . ($params->get('application') ? " AND a.application_id = " . $params->get('application') : '') . ($category_id ? " AND cc.category_id " . (is_array($category_id) ? ' IN (' . implode(',', $category_id) . ')' : ' = ' . $category_id) : '') . " GROUP BY a.id"; $options = array('select' => "a.*", 'from' => "#__zoo_item AS a" . ($category_id ? " LEFT JOIN #__zoo_category_item as cc on a.id=cc.item_id" : ""), 'conditions' => $conditions); $items = $app->table->item->all($options); foreach ($items as $item) { $elements = $item->getElements(); foreach ($elements as $element) { if ($element->getElementType() == 'yamap' && $element->hasValue()) { foreach ($element->data() as $value) { $coordinatesArr = explode(',', $value["coordinates"]); $lng = trim($coordinatesArr[1]); $lat = trim($coordinatesArr[0]); $name = htmlspecialchars($item->name, ENT_QUOTES); $text = modZoomapHelper::relToAbs($renderer->render('item.' . str_replace('_:', '', $params->get('layout', 'default')), compact('item', 'params'))); $markers[] = array(array($lat, $lng), $name, $item->id, JFactory::getApplication()->getMenu()->getActive()->id); } } } } return $markers; }
defined('_JEXEC') or die('(@)|(@)'); // load config require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // get app $zoo = App::getInstance('zoo'); // init vars $path = dirname(__FILE__); //register base path $zoo->path->register($path, 'mod_zoomap'); require_once dirname(__FILE__) . '/helper.php'; if ($application = $zoo->table->application->get($params->get('application'))) { $renderer = $zoo->renderer->create('item')->addPath(array($zoo->path->path('component.site:'), dirname(__FILE__))); if ($params->get('filter', 1)) { require_once JPATH_BASE . '/media/zoo/applications/jbuniversal/framework/jbzoo.php'; JBZoo::init(); $task = $zoo->jbrequest->get('task'); $option = $zoo->jbrequest->get('option'); if ($task == 'filter' && $option == 'com_zoo') { $markers = modZoomapHelper::getFilterMarkers($params, $renderer); } else { $markers = modZoomapHelper::getMarkers($params, $renderer); } } else { $markers = modZoomapHelper::getMarkers($params, $renderer); } $center = trim($params->get('center', '')); $zoom = trim($params->get('zoom', '')); $width = trim($params->get('width', '500px')); $height = trim($params->get('height', '400px')); require JModuleHelper::getLayoutPath('mod_zoomap', $params->get('layout', 'default')); }