示例#1
0
 public function initMenu()
 {
     $mainCap = $this->getMainCap();
     $mainSlug = dispatcherGmp::applyFilters('adminMenuMainSlug', $this->_mainSlug);
     $mainMenuPageOptions = array('page_title' => GMP_WP_PLUGIN_NAME, 'menu_title' => GMP_WP_PLUGIN_NAME, 'capability' => $mainCap, 'menu_slug' => $mainSlug, 'function' => array(frameGmp::_()->getModule('options'), 'getAdminPage'));
     $mainMenuPageOptions = dispatcherGmp::applyFilters('adminMenuMainOption', $mainMenuPageOptions);
     add_menu_page($mainMenuPageOptions['page_title'], $mainMenuPageOptions['menu_title'], $mainMenuPageOptions['capability'], $mainMenuPageOptions['menu_slug'], $mainMenuPageOptions['function'], 'dashicons-admin-site');
     //remove duplicated WP menu item
     //add_submenu_page($mainMenuPageOptions['menu_slug'], '', '', $mainMenuPageOptions['capability'], $mainMenuPageOptions['menu_slug'], $mainMenuPageOptions['function']);
     $tabs = frameGmp::_()->getModule('options')->getTabs();
     $subMenus = array();
     foreach ($tabs as $tKey => $tab) {
         if ($tKey == 'main_page') {
             continue;
         }
         // Top level menu item - is main page, avoid place it 2 times
         if (isset($tab['hidden']) && $tab['hidden'] || isset($tab['hidden_for_main']) && $tab['hidden_for_main'] || isset($tab['is_main']) && $tab['is_main']) {
             continue;
         }
         $subMenus[] = array('title' => $tab['label'], 'capability' => $mainCap, 'menu_slug' => 'admin.php?page=' . $mainSlug . '&tab=' . $tKey, 'function' => '');
     }
     $subMenus = dispatcherGmp::applyFilters('adminMenuOptions', $subMenus);
     foreach ($subMenus as $opt) {
         add_submenu_page($mainSlug, $opt['title'], $opt['title'], $opt['capability'], $opt['menu_slug'], $opt['function']);
     }
 }
示例#2
0
文件: mod.php 项目: Roman921/Step-21
 public function init()
 {
     if (frameGmp::isAdminPlugPage()) {
         $this->_styles = array('styleGmp' => array('path' => GMP_CSS_PATH . 'style.css'), 'adminStylesGmp' => array('path' => GMP_CSS_PATH . 'adminStyles.css'), 'farbtastic' => array(), 'wp-jquery-ui-dialog' => array(), 'jquery-dialog' => array('path' => GMP_CSS_PATH . 'jquery-dialog.css'));
     }
     $defaultPlugTheme = frameGmp::_()->getModule('options')->get('default_theme');
     $ajaxurl = admin_url('admin-ajax.php');
     if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) {
         $ajaxurl = uriGmp::makeHttps($ajaxurl);
     }
     $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'cssPath' => GMP_CSS_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps());
     if (frameGmp::isAdminPlugPage()) {
         frameGmp::_()->addScript('commonGmp', GMP_JS_PATH . 'common.js');
         frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js');
         $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
         frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
         frameGmp::_()->addScript('datatable', GMP_JS_PATH . 'jquery.dataTables.min.js');
         frameGmp::_()->addScript('farbtastic', get_bloginfo('wpurl') . '/wp-admin/js/farbtastic.js', array('jquery'));
         frameGmp::_()->addScript('jquery-ui-tabs', '', array('jquery'), false, true);
         frameGmp::_()->addScript('jquery-ui-autocomplete', '', array('jquery'), false, true);
         frameGmp::_()->getModule('marker')->connectAssets();
         frameGmp::_()->addScript('jquery-ui-dialog', '', array('jquery'));
         frameGmp::_()->addScript('adminOptionsGmp', GMP_JS_PATH . 'admin.options.js');
     }
     if (is_admin()) {
         frameGmp::_()->addScript('ajaxupload', GMP_JS_PATH . 'ajaxupload.js');
         frameGmp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
         add_action('wp_enqueue_scripts', array($this, 'addThickbox'));
         $jsData['allCheckRegPlugs'] = modInstallerGmp::getCheckRegPlugs();
     } else {
     }
     foreach ($this->_styles as $s => $sInfo) {
         if (isset($sInfo['for'])) {
             if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) {
                 continue;
             }
         }
         $canBeSubstituted = true;
         if (isset($sInfo['substituteFor'])) {
             switch ($sInfo['substituteFor']) {
                 case 'frontend':
                     $canBeSubstituted = !is_admin();
                     break;
                 case 'admin':
                     $canBeSubstituted = is_admin();
                     break;
             }
         }
         if ($canBeSubstituted && file_exists(GMP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
             frameGmp::_()->addStyle($s, GMP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
         } elseif ($canBeSubstituted && file_exists(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . $s . '.css')) {
             frameGmp::_()->addStyle($s, utilsGmp::getCurrentWPThemePath() . '/toe/' . $s . '.css');
         } elseif (!empty($sInfo['path'])) {
             frameGmp::_()->addStyle($s, $sInfo['path']);
         } else {
             frameGmp::_()->addStyle($s);
         }
     }
     parent::init();
 }
示例#3
0
 public function initMenu()
 {
     $mainSlug = dispatcherGmp::applyFilters('adminMenuMainSlug', $this->_mainSlug);
     $this->_options = dispatcherGmp::applyFilters('adminMenuOptions', $this->_options);
     add_menu_page(langGmp::_('Ready! Google Maps'), langGmp::_('Ready! Google Maps'), 10, $this->_mainSlug, array(frameGmp::_()->getModule('options')->getView(), 'getAdminPage'), 'dashicons-admin-site');
     foreach ($this->_options as $opt) {
         add_submenu_page($mainSlug, langGmp::_($opt['title']), langGmp::_($opt['title']), $opt['capability'], $opt['menu_slug'], $opt['function']);
     }
 }
示例#4
0
 public function getPluginSettingsTab()
 {
     $saveStatistic = $this->getModel('options')->getStatisticStatus();
     $indoWindowSize = utilsGmp::unserialize($this->getModel('options')->get('infowindow_size'));
     $this->assign('saveStatistic', $saveStatistic);
     $this->assign('indoWindowSize', $indoWindowSize);
     $this->assign('additionalGlobalSettings', dispatcherGmp::applyFilters('additionalGlobalSettings', array()));
     return parent::getContent('settingsTab');
 }
示例#5
0
 public function getStylizationsList()
 {
     if (empty($this->_stylizations)) {
         $this->_stylizations = dispatcherGmp::applyFilters('stylizationsList', require_once $this->getModDir() . 'stylezations.php');
         foreach ($this->_stylizations as $k => $v) {
             $this->_stylizations[$k] = utilsGmp::jsonDecode($this->_stylizations[$k]);
         }
     }
     return $this->_stylizations;
 }
示例#6
0
 public function getComingSoonPageHtml()
 {
     $this->_beforeShow();
     $this->assign('msgTitle', frameGmp::_()->getModule('options')->get('msg_title'));
     $this->assign('msgTitleColor', frameGmp::_()->getModule('options')->get('msg_title_color'));
     $this->assign('msgTitleFont', frameGmp::_()->getModule('options')->get('msg_title_font'));
     $msgTitleStyle = array();
     if (!empty($this->msgTitleColor)) {
         $msgTitleStyle['color'] = $this->msgTitleColor;
     }
     if (!empty($this->msgTitleFont)) {
         $msgTitleStyle['font-family'] = $this->msgTitleFont;
         $this->_styles[] = 'http://fonts.googleapis.com/css?family=' . $this->msgTitleFont . '&subset=latin,cyrillic-ext';
     }
     $this->assign('msgTitleStyle', utilsGmp::arrToCss($msgTitleStyle));
     $this->assign('msgText', frameGmp::_()->getModule('options')->get('msg_text'));
     $this->assign('msgTextColor', frameGmp::_()->getModule('options')->get('msg_text_color'));
     $this->assign('msgTextFont', frameGmp::_()->getModule('options')->get('msg_text_font'));
     $msgTextStyle = array();
     if (!empty($this->msgTextColor)) {
         $msgTextStyle['color'] = $this->msgTextColor;
     }
     if (!empty($this->msgTextFont)) {
         $msgTextStyle['font-family'] = $this->msgTextFont;
         if ($this->msgTitleFont != $this->msgTextFont) {
             $this->_styles[] = 'http://fonts.googleapis.com/css?family=' . $this->msgTextFont . '&subset=latin,cyrillic-ext';
         }
     }
     $this->assign('msgTextStyle', utilsGmp::arrToCss($msgTextStyle));
     if ($this->_useSubscribeForm && frameGmp::_()->getModule('options')->get('sub_enable')) {
         $this->_scripts[] = frameGmp::_()->getModule('subscribe')->getModPath() . 'js/frontend.subscribe.js';
         $this->assign('subscribeForm', frameGmp::_()->getModule('subscribe')->getController()->getView()->getUserForm());
     }
     $this->assign('countDownTimerHtml', dispatcherGmp::applyFilters('countDownTimerHtml', ''));
     $this->assign('progressBarHtml', dispatcherGmp::applyFilters('progressBarHtml', ''));
     $this->assign('contactFormHtml', dispatcherGmp::applyFilters('contactFormHtml', ''));
     $this->assign('googleMapsHtml', dispatcherGmp::applyFilters('googleMapsHtml', ''));
     if ($this->_useSocIcons) {
         $this->assign('socIcons', frameGmp::_()->getModule('social_icons')->getController()->getView()->getFrontendContent());
     }
     if (file_exists($this->getModule()->getModDir() . 'css/style.css')) {
         $this->_styles[] = $this->getModule()->getModPath() . 'css/style.css';
     }
     $this->assign('logoPath', $this->getModule()->getLogoImgPath());
     $this->assign('bgCssAttrs', dispatcherGmp::applyFilters('tplBgCssAttrs', $this->getModule()->getBgCssAttrs()));
     $this->assign('styles', dispatcherGmp::applyFilters('tplStyles', $this->_styles));
     $this->assign('scripts', dispatcherGmp::applyFilters('tplScripts', $this->_scripts));
     $this->assign('initJsVars', dispatcherGmp::applyFilters('tplInitJsVars', $this->initJsVars()));
     $this->assign('messages', frameGmp::_()->getRes()->getMessages());
     $this->assign('errors', frameGmp::_()->getRes()->getErrors());
     return parent::getContent($this->getCode() . 'GMPHtml');
 }
示例#7
0
 public function loadCoreJs()
 {
     static $loaded = false;
     if (!$loaded) {
         frameGmp::_()->addScript('jquery');
         frameGmp::_()->addScript('commonGmp', GMP_JS_PATH . 'common.js', array('jquery'));
         frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js', array('jquery'));
         $ajaxurl = admin_url('admin-ajax.php');
         if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) {
             $ajaxurl = uriGmp::makeHttps($ajaxurl);
         }
         $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'cssPath' => GMP_CSS_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'GMP_CODE' => GMP_CODE, 'isAdmin' => is_admin());
         if (is_admin()) {
             $jsData['isPro'] = frameGmp::_()->getModule('supsystic_promo')->isPro();
         }
         $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
         frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
         $loaded = true;
     }
 }
示例#8
0
文件: gmap.php 项目: Roman921/Step-21
 public function getParamsList()
 {
     $mapOptKeys = dispatcherGmp::applyFilters('mapParamsKeys', array('enable_zoom', 'enable_mouse_zoom', 'zoom', 'type', 'language', 'map_display_mode', 'map_center', 'infowindow_height', 'infowindow_width', 'width_units'));
     return $mapOptKeys;
 }
示例#9
0
文件: gmap.php 项目: Roman921/Step-21
 public function drawMap($params)
 {
     $ajaxurl = admin_url('admin-ajax.php');
     if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) {
         $ajaxurl = uriGmp::makeHttps($ajaxurl);
     }
     $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps());
     frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js');
     $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
     frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
     frameGmp::_()->addScript('jquery', '', array('jquery'));
     $mapObj = frameGmp::_()->getModule('gmap')->getModel()->getMapById($params['id']);
     if (isset($params['map_center']) && is_string($params['map_center'])) {
         if (strpos($params['map_center'], ';')) {
             $centerXY = array_map('trim', explode(';', $params['map_center']));
             $params['map_center'] = array('coord_x' => $centerXY[0], 'coord_y' => $centerXY[1]);
         } elseif (is_numeric($params['map_center'])) {
             // Map center - is coords of one of it's marker
             $params['map_center'] = (int) trim($params['map_center']);
             $found = false;
             if (!empty($mapObj['markers'])) {
                 foreach ($mapObj['markers'] as $marker) {
                     if ($marker['id'] == $params['map_center']) {
                         $params['map_center'] = array('coord_x' => $marker['coord_x'], 'coord_y' => $marker['coord_y']);
                         $found = true;
                         break;
                     }
                 }
             }
             // If no marker with such ID were found - just unset it to prevent map broke
             if (!$found) {
                 unset($params['map_center']);
             }
         } else {
             // If it is set, but not valid - just unset it to not break user map
             unset($params['map_center']);
         }
     }
     $shortCodeHtmlParams = array('width', 'height', 'align');
     $paramsCanNotBeEmpty = array('width', 'height');
     foreach ($shortCodeHtmlParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['html_options'][$code] = $params[$code];
         }
     }
     $shortCodeMapParams = $this->getModel()->getParamsList();
     //array('map_display_mode', 'language', 'type', 'zoom', 'enable_zoom', 'enable_mouse_zoom');
     foreach ($shortCodeMapParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['params'][$code] = $params[$code];
         }
     }
     if (isset($params['display_as_img']) && $params['display_as_img']) {
         $mapObj['params']['map_display_mode'] = 'popup';
     }
     if ($mapObj['params']['map_display_mode'] == 'popup') {
         frameGmp::_()->addScript('bpopup', GMP_JS_PATH . '/bpopup.js');
     }
     frameGmp::_()->addScript('google_maps_api_' . $mapObj['params']['language'], $this->getApiUrl() . $mapObj['params']['language']);
     frameGmp::_()->addScript('map.options', $this->getModule()->getModPath() . 'js/map.options.js', array('jquery'));
     frameGmp::_()->addStyle('map_params', $this->getModule()->getModPath() . 'css/map.css');
     frameGmp::_()->getModule('marker')->connectAssets();
     if (empty($mapObj['params']['map_display_mode'])) {
         $mapObj['params']['map_display_mode'] = 'map';
     }
     // This is for posibility to show multy maps with same ID on one page
     $mapObj['original_id'] = $mapObj['id'];
     if (isset($this->_idToRandId[$mapObj['original_id']])) {
         $mapObj['id'] = $this->_idToRandId[$mapObj['original_id']];
     } else {
         $this->_idToRandId[$mapObj['original_id']] = $mapObj['id'] = mt_rand(1, 99999) . $mapObj['id'];
     }
     $indoWindowSize = utilsGmp::unserialize(frameGmp::_()->getModule('options')->getModel('options')->get('infowindow_size'));
     $this->assign('indoWindowSize', $indoWindowSize);
     $this->assign('currentMap', $mapObj);
     $markersDisplayType = '';
     if (isset($params['display_type'])) {
         $markersDisplayType = $params['display_type'];
     } else {
         if (isset($params['markers_list_type'])) {
             $markersDisplayType = $params['markers_list_type'];
         } else {
             if (isset($mapObj['params']['markers_list_type']) && !empty($mapObj['params']['markers_list_type'])) {
                 $markersDisplayType = $mapObj['params']['markers_list_type'];
             }
         }
     }
     $mapObj['params']['markers_list_type'] = $markersDisplayType;
     $this->addMapData($mapObj);
     $this->assign('markersDisplayType', $markersDisplayType);
     // This will require only in PRO, but we will make it here - to avoid code doubling
     $this->assign('mapCategories', frameGmp::_()->getModule('marker_groups')->getModel()->getListForMarkers(isset($mapObj['markers']) ? $mapObj['markers'] : false));
     return parent::getContent('mapPreview');
 }
示例#10
0
 public function getParamsList()
 {
     $mapOptKeys = dispatcherGmp::applyFilters('mapParamsKeys', array('enable_zoom', 'enable_mouse_zoom', 'zoom', 'type', 'language', 'map_display_mode', 'map_center', 'width_units', 'infowindow_on_mouseover', 'type_control', 'zoom_control', 'street_view_control', 'pan_control', 'overview_control', 'draggable', 'dbl_click_zoom', 'mouse_wheel_zoom', 'map_type', 'map_stylization', 'marker_clasterer', 'marker_title_color', 'marker_infownd_width', 'marker_infownd_width_units', 'marker_infownd_height', 'marker_infownd_height_units', 'marker_clasterer_icon', 'marker_clasterer_icon_width', 'marker_clasterer_icon_height', 'marker_infownd_bg_color', 'zoom_min', 'zoom_max', 'markers_list_type', 'markers_list_color'));
     return $mapOptKeys;
 }
示例#11
0
 public function getAll()
 {
     if (empty($this->_options)) {
         $this->_options = dispatcherGmp::applyFilters('optionsDefine', array('general' => array('label' => __('General', GMP_LANG_CODE), 'opts' => array('send_stats' => array('label' => __('Send usage statistics', GMP_LANG_CODE), 'desc' => __('Send information about what plugin options you prefer to use, this will help us make our solution better for You.', GMP_LANG_CODE), 'def' => '0', 'html' => 'checkboxHiddenVal'), 'add_love_link' => array('label' => __('Enable promo link', GMP_LANG_CODE), 'desc' => __('We are trying to make our plugin better for you, and you can help us with this. Just check this option - and small promotion link will be added in the bottom of your Google Maps. This is easy for you - but very helpful for us!', GMP_LANG_CODE), 'def' => '0', 'html' => 'checkboxHiddenVal')))));
         foreach ($this->_options as $catKey => $cData) {
             foreach ($cData['opts'] as $optKey => $opt) {
                 $this->_optionsToCategoires[$optKey] = $catKey;
             }
         }
         $this->getModel()->fillInValues($this->_options);
     }
     return $this->_options;
 }
示例#12
0
 public function drawMap($params)
 {
     $mapObj = frameGmp::_()->getModule('gmap')->getModel()->getMapById($params['id']);
     if (empty($mapObj)) {
         return;
     }
     if (isset($params['map_center']) && is_string($params['map_center'])) {
         if (strpos($params['map_center'], ';')) {
             $centerXY = array_map('trim', explode(';', $params['map_center']));
             $params['map_center'] = array('coord_x' => $centerXY[0], 'coord_y' => $centerXY[1]);
         } elseif (is_numeric($params['map_center'])) {
             // Map center - is coords of one of it's marker
             $params['map_center'] = (int) trim($params['map_center']);
             $found = false;
             if (!empty($mapObj['markers'])) {
                 foreach ($mapObj['markers'] as $marker) {
                     if ($marker['id'] == $params['map_center']) {
                         $params['map_center'] = array('coord_x' => $marker['coord_x'], 'coord_y' => $marker['coord_y']);
                         $found = true;
                         break;
                     }
                 }
             }
             // If no marker with such ID were found - just unset it to prevent map broke
             if (!$found) {
                 unset($params['map_center']);
             }
         } else {
             // If it is set, but not valid - just unset it to not break user map
             unset($params['map_center']);
         }
     }
     $shortCodeHtmlParams = array('width', 'height', 'align');
     $paramsCanNotBeEmpty = array('width', 'height');
     foreach ($shortCodeHtmlParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['html_options'][$code] = $params[$code];
         }
     }
     $shortCodeMapParams = $this->getModel()->getParamsList();
     foreach ($shortCodeMapParams as $code) {
         if (isset($params[$code])) {
             if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) {
                 continue;
             }
             $mapObj['params'][$code] = $params[$code];
         }
     }
     if (isset($params['display_as_img']) && $params['display_as_img']) {
         $mapObj['params']['map_display_mode'] = 'popup';
         $mapObj['params']['img_width'] = isset($params['img_width']) ? $params['img_width'] : 175;
         $mapObj['params']['img_height'] = isset($params['img_height']) ? $params['img_height'] : 175;
     }
     if (isset($params['display_as_img']) && $params['display_as_img']) {
         $mapObj['params']['map_display_mode'] = 'popup';
     }
     if ($mapObj['params']['map_display_mode'] == 'popup') {
         frameGmp::_()->addScript('bpopup', GMP_JS_PATH . '/bpopup.js');
     }
     if (empty($mapObj['params']['map_display_mode'])) {
         $mapObj['params']['map_display_mode'] = 'map';
     }
     $indoWindowSize = frameGmp::_()->getModule('options')->getModel('options')->get('infowindow_size');
     $this->assign('indoWindowSize', $indoWindowSize);
     $markersDisplayType = '';
     if (isset($params['markers_list_type'])) {
         $markersDisplayType = $params['markers_list_type'];
     } else {
         if (isset($mapObj['params']['markers_list_type']) && !empty($mapObj['params']['markers_list_type'])) {
             $markersDisplayType = $mapObj['params']['markers_list_type'];
         }
     }
     $mapObj['params']['markers_list_type'] = $markersDisplayType;
     $mapObj = dispatcherGmp::applyFilters('mapDataRender', $mapObj);
     $this->addMapData(dispatcherGmp::applyFilters('mapDataToJs', $mapObj));
     $this->assign('markersDisplayType', $markersDisplayType);
     $this->connectMapsAssets($mapObj['params']);
     frameGmp::_()->addScript('frontend.gmap', $this->getModule()->getModPath() . 'js/frontend.gmap.js', array('jquery'), false, true);
     $this->assign('currentMap', $mapObj);
     return parent::getInlineContent('gmapDrawMap');
 }
示例#13
0
 /**
  * Common method for list table data
  */
 public function getListForTbl()
 {
     $res = new responseGmp();
     $res->ignoreShellData();
     $model = $this->getModel();
     $page = (int) reqGmp::getVar('page');
     $rowsLimit = (int) reqGmp::getVar('rows');
     $orderBy = reqGmp::getVar('sidx');
     $sortOrder = reqGmp::getVar('sord');
     // Our custom search
     $search = reqGmp::getVar('search');
     if ($search && !empty($search) && is_array($search)) {
         foreach ($search as $k => $v) {
             $v = trim($v);
             if (empty($v)) {
                 continue;
             }
             if ($k == 'text_like') {
                 $v = $this->_prepareTextLikeSearch($v);
                 if (!empty($v)) {
                     $model->addWhere(array('additionalCondition' => $v));
                 }
             } else {
                 $model->addWhere(array($k => $v));
             }
         }
     }
     // jqGrid search
     $isSearch = reqGmp::getVar('_search');
     if ($isSearch) {
         $searchField = trim(reqGmp::getVar('searchField'));
         $searchString = trim(reqGmp::getVar('searchString'));
         if (!empty($searchField) && !empty($searchString)) {
             // For some cases - we will need to modify search keys and/or values before put it to the model
             $model->addWhere(array($this->_prepareSearchField($searchField) => $this->_prepareSearchString($searchString)));
         }
     }
     $model = $this->_prepareModelBeforeListSelect($model);
     // Get total pages count for current request
     $totalCount = $model->getCount(array('clear' => array('selectFields')));
     $totalPages = 0;
     if ($totalCount > 0) {
         $totalPages = ceil($totalCount / $rowsLimit);
     }
     if ($page > $totalPages) {
         $page = $totalPages;
     }
     // Calc limits - to get data only for current set
     $limitStart = $rowsLimit * $page - $rowsLimit;
     // do not put $limit*($page - 1)
     if ($limitStart < 0) {
         $limitStart = 0;
     }
     $data = $model->setLimit($limitStart . ', ' . $rowsLimit)->setOrderBy($this->_prepareSortOrder($orderBy))->setSortOrder($sortOrder)->getFromTbl();
     $data = $this->_prepareListForTbl($data);
     $res->addData('page', $page);
     $res->addData('total', $totalPages);
     $res->addData('rows', $data);
     $res->addData('records', $model->getLastGetCount());
     $res = dispatcherGmp::applyFilters($this->getCode() . '_getListForTblResults', $res);
     $res->ajaxExec();
 }