+ файл

This commit is contained in:
root 2016-11-29 00:38:45 +05:00
parent b179aba448
commit 5889bc57c5
624 changed files with 1655 additions and 0 deletions

419
gmap/class.gmap.php Normal file
View File

@ -0,0 +1,419 @@
<?php
/**
* Класс работы с картами
*
* @package AVE.cms
* @subpackage module_gmap
* @filesource
*/
class Gmap
{
/**
* ФУНКЦИИ ПУБЛИЧНОЙ ЧАСТИ
*/
/**
* Вывод карты
*
* @param int $gmap_id - идентификатор карты
*/
function gmapShow($tpl_dir, $gmap_id)
{
global $AVE_DB, $AVE_Template;
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap
WHERE id = '" . $gmap_id . "'
");
$row_gs = $sql->FetchAssocArray();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_markers
WHERE gmap_id = '" . $gmap_id . "'
");
$markers = array();
while ($row = $sql->FetchAssocArray())
{
array_push($markers, $row);
}
$AVE_Template->assign('gmap', $row_gs);
$AVE_Template->assign('markers', json_encode($markers));
$AVE_Template->display($tpl_dir . 'map.tpl');
}
/**
* ФУНКЦИИ АДМИНИСТРАТИВНОЙ ЧАСТИ
*/
/**
* Просмотр маркеров карты и добавление новых в админке
*
* @param string $tpl_dir - путь к папке с шаблонами модуля
* @param int $gmap_id - идентификатор карты
*/
function gmapMarkersShow($tpl_dir, $gmap_id)
{
global $AVE_DB, $AVE_Template;
$pin_dir = BASE_DIR.'/modules/gmap/images';
$pin_base_dir = ABS_PATH.'modules/gmap/images';
$pins = array();
if ($handle = opendir($pin_dir . '/')) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..')
{
$image_title = substr($file, 0, -4);
$upload_file_ext = strtolower(substr($file, -4));
$upload_filename = prepare_fname($image_title) . $upload_file_ext;
if (!empty($upload_filename) && $upload_file_ext == '.png')
{
$pins[] = array('name' => $image_title, 'path' => $pin_base_dir . '/' . $upload_filename);
}
}
}
closedir($handle);
}
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap
WHERE id = '" . $gmap_id . "'
");
$row_gs = $sql->FetchAssocArray();
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_markers
WHERE gmap_id = '" . $gmap_id . "'
");
$load_markers = array();
while ($row = $sql->FetchAssocArray())
{
array_push($load_markers, $row);
}
$limit = 5;
$start = get_current_page() * $limit - $limit;
$sql = $AVE_DB->Query("
SELECT SQL_CALC_FOUND_ROWS *
FROM " . PREFIX . "_module_gmap_markers
WHERE gmap_id = '" . $gmap_id . "'
ORDER BY id ASC
LIMIT " . $start . "," . $limit . "
");
$sql_num = $AVE_DB->Query("SELECT FOUND_ROWS()");
$num = $sql_num->GetCell();
$markers = array();
while ($row = $sql->FetchAssocArray())
{
array_push($markers, $row);
}
if ($num > $limit)
{
$page_nav = ' <a class="pnav" href="index.php?do=modules&action=modedit&mod=gmap&moduleaction=show&id=' . $gmap_id . '&page={s}&amp;cp=' . SESSION . '">{t}</a> ';
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
}
else
{
$page_nav = '';
}
$AVE_Template->assign('page_nav', $page_nav);
$AVE_Template->assign('gmap', $row_gs);
$AVE_Template->assign('gmap_id', $row_gs['id']);
$AVE_Template->assign('gmap_title', $row_gs['gmap_title']);
$AVE_Template->assign('markers', $markers);
$AVE_Template->assign('load_markers', json_encode($load_markers));
$AVE_Template->assign('pins', $pins);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gmap_markers.tpl'));
}
/**
* Вывод списка карт
*
* @param string $tpl_dir - путь к папке с шаблонами модуля
*/
function gmapListShow($tpl_dir)
{
global $AVE_DB, $AVE_Template;
$gmaps = array();
$limit = 20;
$start = get_current_page() * $limit - $limit;
$sql = $AVE_DB->Query("
SELECT SQL_CALC_FOUND_ROWS
g.*,
COUNT(m.id) AS marker_count
FROM
" . PREFIX . "_module_gmap AS g
LEFT JOIN
" . PREFIX . "_module_gmap_markers AS m
ON m.gmap_id = g.id
GROUP BY g.id
ORDER BY g.id ASC
LIMIT " . $start . "," . $limit . "
");
$sql_num = $AVE_DB->Query("SELECT FOUND_ROWS()");
$num = $sql_num->GetCell();
while($row = $sql->FetchAssocArray())
{
array_push($gmaps, $row);
}
if ($num > $limit)
{
$page_nav = "<li><a href=\"index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&page={s}&amp;cp=" . SESSION . "\">{t}</a></li>";
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
}
else
{
$page_nav = '';
}
$AVE_Template->assign('page_nav', $page_nav);
if (!empty($_REQUEST['alert']))
{
$AVE_Template->assign('alert', htmlspecialchars(stripslashes($_REQUEST['alert'])));
}
$AVE_Template->assign('gmaps', $gmaps);
$AVE_Template->assign('formaction', 'index.php?do=modules&action=modedit&mod=gmap&moduleaction=new&sub=save&amp;cp=' . SESSION);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gmap_list.tpl'));
}
/**
* Сохранение маркеров
*
* @param int $gmap_id - идентификатор карты
*/
function gmapMarkersAdd($gmap_id){
if (isset($_POST['marker']))
{
global $AVE_DB;
$markerData = $_POST['marker'];
$sql = "
INSERT
INTO " . PREFIX . "_module_gmap_markers
SET
id = '',
gmap_id = '".(int)$gmap_id."',
latitude = '" . $markerData['latitude'] . "',
longitude = '" . $markerData['longitude'] . "',
title = '" . $markerData['title'] . "',
image = '" . $markerData['image']. "'
";
$AVE_DB->Query($sql);
$markerData['id'] = $AVE_DB->InsertId();
echo json_encode($markerData);
exit;
}
}
/**
* Сохранение редактирования описания маркера
*
* @param int $id - идентификатор маркера
*/
function gmapMarkerSave($id){
if (isset($_POST['marker_title']))
{
global $AVE_DB;
$markerData = $_POST['marker_title'];
$sql = "UPDATE " . PREFIX . "_module_gmap_markers
SET
title = '" . $markerData . "' WHERE id = '" . (int)$id. "'
";
$AVE_DB->Query($sql);
}
exit;
}
/**
* Удаление маркера
*
* @param int $id - идентификатор маркера
*/
function gmapMarkersDel($id){
global $AVE_DB;
$sql = "DELETE FROM " . PREFIX . "_module_gmap_markers WHERE id = '" . (int)$id. "'";
$AVE_DB->Query($sql);
exit;
}
/**
* Получение описания маркера
*
* @param int $id - идентификатор маркера
*/
function gmapMarkersGet($id){
global $AVE_DB;
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap_markers
WHERE id = '" . $id . "'
");
$row_gs = $sql->FetchRow();
echo $row_gs->title;
exit;
}
/**
* Создание карты
*
*/
function gmapNew()
{
if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save')
{
global $AVE_DB;
$cont = true;
$alert = '';
if (empty($_POST['gmap_title']))
{
$alert = '&alert=empty_gmap_title';
$cont = false;
}
if ($cont)
{
$AVE_DB->Query("
INSERT
INTO " . PREFIX . "_module_gmap
SET
id = '',
gmap_title = '" . $_POST['gmap_title'] . "',
gmap_height = '" . $_POST['gmap_height'] . "',
gmap_width = '" . $_POST['gmap_width'] . "',
longitude = '" . $_POST['longitude'] . "',
latitude = '" . $_POST['latitude'] . "',
gmap_zoom = '" . (int)$_POST['gmap_zoom'] . "'
");
}
header('Location:index.php?do=modules&action=modedit&mod=gmap&moduleaction=1'. $alert);
exit;
}
}
/**
* Редактирование карты
*
* @param string $tpl_dir - путь к папке с шаблонами модуля
* @param int $gmap_id - идентификатор карты
*/
function gmapEdit($tpl_dir, $gmap_id)
{
global $AVE_DB, $AVE_Template;
if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save')
{
$AVE_DB->Query("
UPDATE " . PREFIX . "_module_gmap
SET
gmap_title = '" . $_POST['gmap_title'] . "',
gmap_height = '" . $_POST['gmap_height'] . "',
gmap_width = '" . $_POST['gmap_width'] . "',
longitude = '" . $_POST['longitude'] . "',
latitude = '" . $_POST['latitude'] . "',
gmap_zoom = '" . (int)$_POST['gmap_zoom'] . "'
WHERE
id = '" . (int)$gmap_id . "'
");
header('Location:index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&amp;cp=' . SESSION);
exit;
}
$sql = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_gmap
WHERE id = '" . (int)$gmap_id . "'
");
$row = $sql->FetchAssocArray();
$AVE_Template->assign('gmap', $row);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gmap_edit.tpl'));
}
/**
* Удаление карты
*
* @param int $gmap_id - идентификатор карты
*/
function gmapDelete($gmap_id)
{
global $AVE_DB;
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_gmap WHERE id = '" . $gmap_id . "'");
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_gmap_markers WHERE gmap_id = '" . $gmap_id . "'");
header('Location:index.php?do=modules&action=modedit&mod=gmap&moduleaction=1&amp;cp=' . SESSION);
exit;
}
}
?>

BIN
gmap/images/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/101.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/102.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/103.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/104.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/105.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/106.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/107.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/108.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/109.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
gmap/images/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/110.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/111.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/112.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/113.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/114.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/115.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/116.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/117.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/118.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/119.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/121.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/122.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/123.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/124.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/125.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/126.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/127.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
gmap/images/129.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
gmap/images/131.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/132.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/133.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/134.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/135.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/136.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/137.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/138.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/139.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/142.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/143.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/145.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/146.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/147.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/148.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/149.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/151.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/152.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/153.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/154.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/155.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/156.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/157.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/158.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/159.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/160.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/161.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/162.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/163.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/164.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/165.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/166.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/167.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
gmap/images/168.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/169.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/170.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/171.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/172.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/173.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/174.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/175.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/176.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/177.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
gmap/images/178.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/179.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/180.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/181.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/182.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/183.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gmap/images/184.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
gmap/images/185.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/186.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/187.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
gmap/images/188.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
gmap/images/189.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Some files were not shown because too many files have changed in this diff Show More