当前位置: 首页>>代码示例>>PHP>>正文


PHP UTIL_HtmlTag::generateTag方法代码示例

本文整理汇总了PHP中UTIL_HtmlTag::generateTag方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_HtmlTag::generateTag方法的具体用法?PHP UTIL_HtmlTag::generateTag怎么用?PHP UTIL_HtmlTag::generateTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UTIL_HtmlTag的用法示例。


在下文中一共展示了UTIL_HtmlTag::generateTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderInput

 public function renderInput($params = null)
 {
     $defaultAgeFrom = isset($this->value['from']) ? (int) $this->value['from'] : $this->minAge;
     $defaultAgeTo = isset($this->value['to']) ? (int) $this->value['to'] : $this->maxAge;
     $fromAgeAttrs = $this->attributes;
     $fromAgeAttrs['name'] = $this->getAttribute('name') . '[from]';
     $fromAgeAttrs['type'] = 'text';
     $fromAgeAttrs['maxlength'] = 3;
     $fromAgeAttrs['style'] = 'width: 40px;';
     $fromAgeAttrs['value'] = $defaultAgeFrom;
     if (isset($fromAgeAttrs['id'])) {
         unset($fromAgeAttrs['id']);
     }
     $toAgeAttrs = $this->attributes;
     $toAgeAttrs['name'] = $this->getAttribute('name') . '[to]';
     $toAgeAttrs['type'] = 'text';
     $toAgeAttrs['maxlength'] = 3;
     $toAgeAttrs['style'] = 'width: 40px;';
     $toAgeAttrs['value'] = $defaultAgeTo;
     if (isset($toAgeAttrs['id'])) {
         unset($toAgeAttrs['id']);
     }
     $language = OW::getLanguage();
     $result = '<span id="' . $this->getAttribute('id') . '"class="' . $this->getAttribute('name') . '">
         ' . UTIL_HtmlTag::generateTag('input', $fromAgeAttrs) . '
         ' . $language->text('base', 'form_element_to') . '
         ' . UTIL_HtmlTag::generateTag('input', $toAgeAttrs) . '</span>';
     return $result;
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:29,代码来源:age_range_field.php

示例2: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if ($this->options === null || empty($this->options)) {
         return '';
     }
     $columnWidth = floor(100 / $this->columnsCount);
     $renderedString = '<ul class="ow_checkbox_group clearfix">';
     $noValue = true;
     foreach ($this->options as $key => $value) {
         if ($this->value !== null && is_array($this->value) && in_array($key, $this->value)) {
             $this->addAttribute(FormElement::ATTR_CHECKED, 'checked');
             $noValue = false;
         }
         $this->setId(UTIL_HtmlTag::generateAutoId('input'));
         $this->addAttribute('value', $key);
         $renderedString .= '<li style="width:' . $columnWidth . '%">' . UTIL_HtmlTag::generateTag('input', $this->attributes) . '&nbsp;<label for="' . $this->getId() . '">' . $value . '</label></li>';
         $this->removeAttribute(FormElement::ATTR_CHECKED);
     }
     $language = OW::getLanguage();
     $attributes = $this->attributes;
     $attributes['id'] = $this->getName() . '_unimportant';
     $attributes['name'] = $this->getName() . '_unimportant';
     if ($noValue) {
         $attributes[FormElement::ATTR_CHECKED] = 'checked';
     }
     $renderedString .= '<li class="matchmaking_unimportant_checkbox" style="display:block;border-top: 1px solid #bbb; margin-top: 12px;padding-top:6px; width:100%">' . UTIL_HtmlTag::generateTag('input', $attributes) . '&nbsp;<label for="' . $this->getId() . '">' . $language->text('matchmaking', 'this_is_unimportant') . '</label></li>';
     return $renderedString . '</ul>';
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:35,代码来源:checkbox_group.php

示例3: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $this->addAttribute('type', 'hidden');
     $this->addAttribute('class', 'userFieldHidden');
     $this->addAttribute('placeholder', OW::getLanguage()->text('mailbox', 'to'));
     $input = new UserFieldRenderable();
     $input->assign('input', UTIL_HtmlTag::generateTag('input', $this->attributes));
     return $input->render();
 }
开发者ID:tammyrocks,项目名称:mailbox,代码行数:16,代码来源:user_field.php

示例4: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $deleteLabel = OW::getLanguage()->text('base', 'delete');
     $markup = '<div class="ow_avatar_field">';
     $markup .= UTIL_HtmlTag::generateTag('input', $this->attributes);
     $markup .= '<div class="ow_avatar_field_preview" style="display: none;"><img src="" alt="" /><span title="' . $deleteLabel . '"></span></div>';
     $markup .= '<input type="hidden" name="" value="" class="ow_avatar_field_value" />';
     $markup .= '</div>';
     return $markup;
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:17,代码来源:avatar_field.php

示例5: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if (isset($params['checked'])) {
         $this->addAttribute(FormElement::ATTR_CHECKED, 'checked');
     }
     $label = isset($params['label']) ? $params['label'] : '';
     $this->addAttribute('value', $params['value']);
     $this->setId(UTIL_HtmlTag::generateAutoId('input'));
     $renderedString = '<label>' . UTIL_HtmlTag::generateTag('input', $this->attributes) . $label . '</label>';
     $this->removeAttribute(FormElement::ATTR_CHECKED);
     return $renderedString;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:19,代码来源:radio_group_item_field.php

示例6: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     $optionsString = '';
     foreach ($this->getOptions() as $option) {
         $attrs = !is_null($this->value) && $option['value'] == $this->value ? array('selected' => 'selected') : array();
         $attrs['value'] = $option['value'];
         if ($option['disabled']) {
             $attrs['disabled'] = $option['disabled'];
             $attrs['class'] = 'disabled_option';
         }
         $optionsString .= UTIL_HtmlTag::generateTag('option', $attrs, true, trim($option['label']));
     }
     return UTIL_HtmlTag::generateTag('select', $this->attributes, true, $optionsString);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:20,代码来源:forum_select_box.php

示例7: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     $this->addAttribute('type', 'hidden');
     $jsParamsArray = array('cmpId' => $this->getName(), 'itemsCount' => MATCHMAKING_BOL_Service::MAX_COEFFICIENT, 'id' => $this->getId(), 'checkedCoefficient' => $this->getValue());
     OW::getDocument()->addOnloadScript("var " . $this->getName() . " = new MatchmakingCoefficient(" . json_encode($jsParamsArray) . "); " . $this->getName() . ".init();");
     $renderedString = UTIL_HtmlTag::generateTag('input', $this->attributes);
     $renderedString .= '<div id="' . $this->getName() . '">';
     $renderedString .= '<div class="coefficients_cont clearfix">';
     for ($i = 1; $i <= $this->count; $i++) {
         $renderedString .= '<a href="javascript://" class="coefficient_item" id="' . $this->getName() . '_item_' . $i . '">&nbsp;</a>';
     }
     $renderedString .= '</div></div>';
     return $renderedString;
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:20,代码来源:coefficient.php

示例8: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $staticUrl = OW::getPluginManager()->getPlugin('mcompose')->getStaticUrl();
     OW::getDocument()->addStyleSheet($staticUrl . 'select2.css');
     OW::getDocument()->addScript($staticUrl . 'select2.js');
     OW::getDocument()->addStyleSheet($staticUrl . 'style.css');
     OW::getDocument()->addScript($staticUrl . 'script.js');
     $this->addAttribute('type', 'hidden');
     $this->addAttribute('style', 'width: 100%');
     $imagesUrl = OW::getPluginManager()->getPlugin('base')->getStaticCssUrl();
     $css = array('.mc-tag-bg { background-image: url(' . $imagesUrl . 'images/tag_bg.png); };');
     OW::getDocument()->addStyleDeclaration(implode("\n", $css));
     return UTIL_HtmlTag::generateTag('input', $this->attributes) . '<div class="us-field-fake"><input type="text" class="ow_text invitation" value="' . $this->invitation . '" /></div>';
 }
开发者ID:vazahat,项目名称:dudex,代码行数:21,代码来源:user_select_field.php

示例9: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $elementId = 'file_' . $this->uniqName;
     $router = OW::getRouter();
     $respUrl = $this->slideId ? $router->urlForRoute('slideshow.update-file', array('slideId' => $this->slideId)) : $router->urlForRoute('slideshow.upload-file', array('uniqName' => $this->uniqName));
     $params = array('elementId' => $elementId, 'fileResponderUrl' => $respUrl);
     $script = "window.uploadSlideFields = {};\n        \twindow.uploadSlideFields['" . $this->uniqName . "'] = new uploadSlideField(" . json_encode($params) . ");\n\t\t\twindow.uploadSlideFields['" . $this->uniqName . "'].init();";
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("slideshow")->getStaticJsUrl() . 'upload_slide_field.js');
     OW::getDocument()->addOnloadScript($script);
     $fileAttr = array('type' => 'file', 'id' => $elementId);
     $fileField = UTIL_HtmlTag::generateTag('input', $fileAttr);
     $hiddenAttr = array('type' => 'hidden', 'name' => $this->getName(), 'id' => 'hidden_' . $this->uniqName);
     $hiddenField = UTIL_HtmlTag::generateTag('input', $hiddenAttr);
     return '<span class="' . $elementId . '_cont">' . $fileField . '</span>' . $hiddenField;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:22,代码来源:upload_slide_field.php

示例10: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if ($this->getValue() !== null) {
         $this->addAttribute('value', $this->value);
     } else {
         if ($this->getHasInvitation()) {
             $this->addAttribute('value', $this->invitation);
             $this->addAttribute('class', 'invitation');
         }
     }
     $tag = UTIL_HtmlTag::generateTag('input', $this->attributes);
     if ($this->showCloseButton) {
         $tag .= '<a href="javascript://" class="ow_btn_close_search" id="' . $this->attributes['name'] . '_close_btn_search"></a>';
     }
     return $tag;
 }
开发者ID:tammyrocks,项目名称:mailbox,代码行数:23,代码来源:search_field.php

示例11: smarty_function_error

/**
 * Smarty form error function.
 *
 * @author Sardar Madumarov <madumarov@gmail.com>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_function_error($params)
{
    if (!isset($params['name'])) {
        throw new InvalidArgumentException('Empty input name!');
    }
    $vr = OW_ViewRenderer::getInstance();
    /* @var $form Form */
    $form = $vr->getAssignedVar('_owActiveForm_');
    if (!$form) {
        throw new InvalidArgumentException('There is no form for input `' . $params['name'] . '` !');
    }
    $input = $form->getElement(trim($params['name']));
    if ($input === null) {
        throw new WarningException('No input named `' . $params['name'] . '` in form !');
    }
    $errors = $input->renderErrors();
    return UTIL_HtmlTag::generateTag('span', array('id' => $input->getId() . '_error', 'style' => $errors ? 'display:block;' : 'display:none;', 'class' => 'error'), true, $errors);
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:25,代码来源:function.error.php

示例12: renderInput

 public function renderInput($params = null)
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('googlelocation')->getStaticJsUrl() . 'location_search.js', "text/javascript", GOOGLELOCATION_BOL_LocationService::JQUERY_LOAD_PRIORITY + 1);
     OW::getDocument()->addOnloadScript(' $( document ).ready( function(){ window.googlemap_location_search = new OW_GoogleMapLocationSearch( ' . json_encode($this->getName()) . ',' . ' ' . json_encode($this->getId()) . ', ' . json_encode(GOOGLELOCATION_BOL_LocationService::getInstance()->getCountryRestriction()) . ' );
                                          window.googlemap_location_search.initialize(); }); ');
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[address]', 'value' => !empty($this->value['address']) ? $this->escapeValue($this->value['address']) : '');
     $html = UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[latitude]', 'value' => !empty($this->value['latitude']) ? $this->escapeValue($this->value['latitude']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[longitude]', 'value' => !empty($this->value['longitude']) ? $this->escapeValue($this->value['longitude']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[northEastLat]', 'value' => !empty($this->value['latitude']) ? $this->escapeValue($this->value['northEastLat']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[northEastLng]', 'value' => !empty($this->value['longitude']) ? $this->escapeValue($this->value['northEastLng']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[southWestLat]', 'value' => !empty($this->value['latitude']) ? $this->escapeValue($this->value['southWestLat']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[southWestLng]', 'value' => !empty($this->value['longitude']) ? $this->escapeValue($this->value['southWestLng']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[json]', 'value' => !empty($this->value['json']) ? $this->escapeValue($this->value['json']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'text', 'name' => $this->getName() . '[distance]', 'class' => 'ow_googlelocation_search_distance', 'value' => !empty($this->value['distance']) ? $this->escapeValue($this->value['distance']) : '');
     $html .= '<span>' . UTIL_HtmlTag::generateTag('input', $attribute) . '</span>';
     if (OW::getConfig()->getValue('googlelocation', 'distance_units') == GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES) {
         $html .= '<span class="ow_googlelocation_search_miles_from" >' . OW::getLanguage()->text('googlelocation', 'miles_from') . '</span>';
     } else {
         $html .= '<span class="ow_googlelocation_search_miles_from" >' . OW::getLanguage()->text('googlelocation', 'kms_from') . '</span>';
     }
     $attribute = $this->attributes;
     unset($attribute['name']);
     $attribute['value'] = !empty($this->value['address']) ? $this->value['address'] : '';
     $attribute['class'] .= ' ow_left ow_googlelocation_location_search_input';
     if (empty($attribute['value']) && $this->hasInvitation) {
         $attribute['value'] = $this->invitation;
         $attribute['class'] .= ' invitation';
     }
     $html .= '<div class="googlelocation_address_div">' . UTIL_HtmlTag::generateTag('input', $attribute) . '<div class="googlelocation_address_icon_div">
                     <span id=' . json_encode($this->getId() . '_icon') . ' style="' . (!empty($this->value['json']) ? 'display:none' : 'display:inline') . '" class="ic_googlemap_pin googlelocation_address_icon"></span>
                     <div id=' . json_encode($this->getId() . '_delete_icon') . '  style="' . (empty($this->value['json']) ? 'display:none' : 'display:inline') . '" class="ow_miniic_delete googlelocation_delete_icon"></div>
                 </div>
              </div>';
     //$html .= '<div id="' . $this->getName() . '_map" style="margin-top:10px;width:90%;height:200px;display:none;"></div>';
     return $html;
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:44,代码来源:location_search.php

示例13: renderInput

 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $deleteLabel = OW::getLanguage()->text('base', 'delete');
     if ($this->value) {
         // hide the input
         $this->attributes = array_merge($this->attributes, array('style' => 'display:none'));
     }
     $markup = '<div class="ow_avatar_field">';
     $markup .= UTIL_HtmlTag::generateTag('input', $this->attributes);
     if (!$this->value) {
         $markup .= '<div class="ow_avatar_field_preview" style="display: none;"><img src="" alt="" /><span title="' . $deleteLabel . '"></span></div>';
     } else {
         $markup .= '<div class="ow_avatar_field_preview" style="display: block;"><img src="' . $this->value . '" alt="" /><span title="' . $deleteLabel . '"></span></div>';
         $markup .= '<input type="hidden" id="' . $this->getId() . '_preload_avatar" name="avatarPreloaded" value="1" />';
     }
     $markup .= '<input type="hidden" name="' . $this->attributes['name'] . '" value="' . $this->value . '" class="ow_avatar_field_value" />';
     $markup .= '</div>';
     return $markup;
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:26,代码来源:avatar_field.php

示例14: render

 /**
  * @return string
  */
 public function render()
 {
     if ($this->getTemplate() === null) {
         $this->setTemplate(OW::getThemeManager()->getMasterPageTemplate('html_document'));
     }
     $this->addMetaInfo(self::META_CONTENT_TYPE, $this->getMime() . '; charset=' . $this->getCharset(), 'http-equiv');
     $this->addMetaInfo(self::META_CONTENT_LANGUAGE, $this->getLanguage(), 'http-equiv');
     if ($this->getKeywords()) {
         $this->addMetaInfo('keywords', $this->getKeywords());
     }
     if ($this->getDescription()) {
         $this->addMetaInfo('description', $this->getDescription());
     }
     $this->getMasterPage()->assign('content', $this->body);
     $this->getMasterPage()->assign('heading', $this->getHeading());
     $this->getMasterPage()->assign('heading_icon_class', $this->getHeadingIconClass());
     $this->throwEvent("core.before_master_page_render");
     $masterPageOutput = $this->getMasterPage()->render();
     $this->throwEvent("core.after_master_page_render");
     $headData = '';
     $jsData = '';
     // META INFO
     foreach ($this->meta as $key => $value) {
         if (in_array($key, $this->availableMetaAttrs) && !empty($value)) {
             foreach ($value as $name => $content) {
                 $attrs = array($key => $name, 'content' => $content);
                 $headData .= UTIL_HtmlTag::generateTag('meta', $attrs) . PHP_EOL;
             }
         }
     }
     // CSS FILE INCLUDES
     ksort($this->styleSheets['items']);
     foreach ($this->styleSheets['items'] as $priority => $scipts) {
         foreach ($scipts as $media => $urls) {
             foreach ($urls as $url) {
                 $attrs = array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $url, 'media' => $media);
                 $headData .= UTIL_HtmlTag::generateTag('link', $attrs) . PHP_EOL;
             }
         }
     }
     // JS PRE INCLUDES HEAD DECLARATIONS
     ksort($this->preIncludeJavaScriptDeclarations);
     foreach ($this->preIncludeJavaScriptDeclarations as $priority => $types) {
         foreach ($types as $type => $declarations) {
             foreach ($declarations as $declaration) {
                 $attrs = array('type' => $type);
                 $jsData .= UTIL_HtmlTag::generateTag('script', $attrs, true, PHP_EOL . $declaration . PHP_EOL) . PHP_EOL;
             }
         }
     }
     // JS FILE INCLUDES
     ksort($this->javaScripts['items']);
     $headJsInclude = '';
     foreach ($this->javaScripts['items'] as $priority => $types) {
         foreach ($types as $type => $urls) {
             foreach ($urls as $url) {
                 $attrs = array('type' => $type, 'src' => $url);
                 //TODO remake temp fix - get JQUERY lib to the head area
                 if ($priority == -100) {
                     $headJsInclude .= UTIL_HtmlTag::generateTag('script', $attrs, true) . PHP_EOL;
                 } else {
                     $jsData .= UTIL_HtmlTag::generateTag('script', $attrs, true) . PHP_EOL;
                 }
             }
         }
     }
     // CSS HEAD DECLARATIONS
     ksort($this->styleDeclarations['items']);
     foreach ($this->styleDeclarations['items'] as $priority => $mediaTypes) {
         foreach ($mediaTypes as $media => $declarations) {
             $attrs = array('media' => $media);
             $headData .= UTIL_HtmlTag::generateTag('style', $attrs, true, implode(' ', $declarations));
         }
     }
     // JS HEAD DECLARATIONS
     ksort($this->javaScriptDeclarations['items']);
     foreach ($this->javaScriptDeclarations['items'] as $priority => $types) {
         foreach ($types as $type => $declarations) {
             foreach ($declarations as $declaration) {
                 $attrs = array('type' => $type);
                 $jsData .= UTIL_HtmlTag::generateTag('script', $attrs, true, PHP_EOL . '(function() {' . $declaration . '})();' . PHP_EOL) . PHP_EOL;
             }
         }
     }
     // ONLOAD JS
     $jsData .= '<script type="text/javascript">' . PHP_EOL . '$(function () {' . PHP_EOL;
     ksort($this->onloadJavaScript['items']);
     foreach ($this->onloadJavaScript['items'] as $priority => $scripts) {
         foreach ($scripts as $script) {
             $jsData .= '(function(_scope) {' . $script . '})(window);' . PHP_EOL;
         }
     }
     $jsData .= PHP_EOL . '});' . PHP_EOL . '</script>';
     // LINKS
     foreach ($this->links as $linkInfo) {
         $headData .= UTIL_HtmlTag::generateTag('link', $linkInfo) . PHP_EOL;
     }
//.........这里部分代码省略.........
开发者ID:hardikamutech,项目名称:hammu,代码行数:101,代码来源:html_document_20_04_live.php

示例15: initialize

 public function initialize()
 {
     $points = "";
     $bounds = " var bounds; ";
     $count = 0;
     foreach ($this->points as $point) {
         $points .= " window.map[" . json_encode($this->name) . "].addPoint(" . (double) $point['location']['lat'] . ", " . (double) $point['location']['lng'] . ", " . json_encode($point['title']) . ", " . json_encode($point['content']) . ", " . json_encode($point['isOpen']) . ", " . json_encode($point['icon']) . " ); \n";
         if ($this->setAutoBounds || !$this->isSetBounds) {
             $sw = " new google.maps.LatLng(" . (double) $point['location']['southWestLat'] . "," . (double) $point['location']['southWestLng'] . ") ";
             $ne = " new google.maps.LatLng(" . (double) $point['location']['northEastLat'] . "," . (double) $point['location']['northEastLng'] . ") ";
             $bound = " new google.maps.LatLngBounds( {$sw} , {$ne} ) ";
             if ($count == 0) {
                 $bounds .= "\n                        bounds = new google.maps.LatLngBounds( {$sw} , {$ne} );\n                     ";
             } else {
                 $bounds .= "\n                        bounds.union( new google.maps.LatLngBounds( {$sw} , {$ne} ) );\n                     ";
             }
             $count++;
         }
     }
     if ($count > 0) {
         $bounds .= "\n                        window.map[" . json_encode($this->name) . "].fitBounds(bounds);\n                     ";
     }
     if ($this->isSetBounds) {
         $bounds = "\n                var sw = new google.maps.LatLng(" . (double) $this->southWestLat . "," . (double) $this->southWestLng . ");\n                var ne = new google.maps.LatLng(" . (double) $this->northEastLat . "," . (double) $this->northEastLng . ");\n\n                var bounds = new google.maps.LatLngBounds(sw, ne);\n                window.map[" . json_encode($this->name) . "].fitBounds(bounds); ";
     }
     $mapOptions = $this->options;
     if (empty($mapOptions['minZoom'])) {
         $mapOptions['minZoom'] = 2;
     }
     $mapOptionsString = " {\n                zoom: " . (int) $mapOptions['zoom'] . ",\n                minZoom:" . (int) $mapOptions['minZoom'] . ",\n                center: latlng,\n                mapTypeId: google.maps.MapTypeId.ROADMAP, ";
     unset($mapOptions['zoom']);
     if (isset($mapOptions['center'])) {
         unset($mapOptions['center']);
     }
     if (isset($mapOptions['mapTypeId'])) {
         unset($mapOptions['mapTypeId']);
     }
     foreach ($this->options as $key => $value) {
         if (isset($value)) {
             $mapOptionsString .= " {$key}: {$value}, \n";
         }
     }
     $mapOptionsString .= "}";
     $displaySearchInput = "";
     if ($this->displaySearchInput) {
         $displaySearchInput = " window.map[" . json_encode($this->name) . "].displaySearchInput(); ";
     }
     $script = "\$( document ).ready(function(){\n            var latlng = new google.maps.LatLng(" . (double) $this->centerLatitude . ", " . (double) $this->centerLonditude . ");\n\n            var options = {$mapOptionsString};\n\n            window.map[" . json_encode($this->name) . "] = new OW_GoogleMap(" . json_encode($this->attributes['id']) . ");\n            window.map[" . json_encode($this->name) . "].initialize(options);\n            \n            {$displaySearchInput}\n\n            {$bounds}\n            \n            {$points} \n                \n            window.map[" . json_encode($this->name) . "].createMarkerCluster();\n                \n           }); ";
     OW::getDocument()->addOnloadScript($script);
     $this->attributes['style'] = (!empty($this->attributes['style']) ? $this->attributes['style'] : "") . "width:" . $this->width . ";height:" . $this->height . ";";
     $tag = UTIL_HtmlTag::generateTag('div', $this->attributes, true);
     $this->assign('map', $tag);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:53,代码来源:map.php


注:本文中的UTIL_HtmlTag::generateTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。