Ejemplo n.º 1
0
 * @param $scrollZoom {0; 1} - Allow zoom while scrolling. Default: 0.
 * @param $mapCenterOffset {comma separated string} - Center offset of the map with respect to the center of the map container in pixels. Default: '0,0'.
 * @param $lang {'ru_RU'; 'en_US'; 'ru_UA'; 'uk_UA'; 'tr_TR'} - Map language — locale ID. See http://api.yandex.com/maps/doc/jsapi/2.x/dg/concepts/load.xml for more information. Default: 'ru_RU'.
 * 
 * @link http://code.divandesign.biz/modx/ddymap/1.5
 * 
 * @copyright 2015, DivanDesign
 * http://www.DivanDesign.biz
 */
//Подключаем modx.ddTools
require_once $modx->getConfig('base_path') . 'assets/snippets/ddTools/modx.ddtools.class.php';
//Для обратной совместимости
extract(ddTools::verifyRenamedParams($params, array('docField' => 'getField', 'docId' => 'getId')));
//Если задано имя поля, которое необходимо получить
if (isset($docField)) {
    $geoPos = ddTools::getTemplateVarOutput(array($docField), $docId);
    $geoPos = $geoPos[$docField];
}
//Если координаты заданы и не пустые
if (!empty($geoPos)) {
    if (empty($lang)) {
        $lang = 'ru_RU';
    }
    if (empty($mapElement)) {
        $mapElement = '#map';
    }
    //Подключаем библиотеку карт
    $modx->regClientStartupScript('http://api-maps.yandex.ru/2.1/?lang=' . $lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1'));
    //Подключаем $.ddYMap
    $modx->regClientStartupScript($modx->getConfig('site_url') . 'assets/js/jquery.ddYMap-1.3.1.min.js', array('name' => '$.ddYMap', 'version' => '1.3.1'));
    //Инлайн-скрипт инициализации
Ejemplo n.º 2
0
 * @param $outerTpl {string: chunkName} - Wrapper template (“outputFormat” has to be != 'array'). Available placeholders: [+result+], [+total+] (total number of rows), [+resultTotal+] (total number of returned rows), [+rowY.colX+] (“Y” — row number, “X” — column number). Default: ''.
 * @param $placeholders {separated string} - Additional data has to be passed into “outerTpl”. Syntax: string separated with '::' between key and value and '||' between key-value pairs. Default: ''.
 * @param $urlencode {0; 1} - Is it required to URL encode the result? “outputFormat” has to be != 'array'. URL encoding is used according to RFC 3986. Default: 0.
 * @param $totalRowsToPlaceholder {string} - The name of the global MODX placeholder that holds the total number of rows. The placeholder won't be set if “totalRowsToPlaceholder” is empty. Default: ''.
 * @param $resultToPlaceholder {string} - The name of the global MODX placeholder that holds the snippet result. The result will be returned in a regular manner if the parameter is empty. Default: ''.
 * 
 * @link http://code.divandesign.biz/modx/ddgetmultiplefield/3.2
 * 
 * @copyright 2015, DivanDesign
 * http://www.DivanDesign.biz
 */
//Подключаем modx.ddTools
require_once $modx->config['base_path'] . 'assets/snippets/ddTools/modx.ddtools.class.php';
//Если задано имя поля, которое необходимо получить
if (isset($docField)) {
    $string = ddTools::getTemplateVarOutput(array($docField), $docId);
    $string = $string[$docField];
}
//Если задано значение поля
if (isset($string) && strlen($string) > 0) {
    if (!isset($rowDelimiter)) {
        $rowDelimiter = '||';
    }
    if (!isset($colDelimiter)) {
        $colDelimiter = '::';
    }
    //Являются ли разделители регулярками
    $rowDelimiterIsRegexp = filter_var($rowDelimiter, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^\\/.*\\/[a-z]*$/'))) !== false ? true : false;
    $colDelimiterIsRegexp = filter_var($colDelimiter, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^\\/.*\\/[a-z]*$/'))) !== false ? true : false;
    //Если заданы условия фильтрации
    if (isset($filter)) {