Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 /**
  * @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>';
 }
Ejemplo n.º 3
0
 /**
  * @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();
 }
Ejemplo n.º 4
0
 /**
  * @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;
 }
Ejemplo n.º 5
0
 /**
  * @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;
 }
Ejemplo n.º 6
0
 /**
  * @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);
 }
Ejemplo n.º 7
0
 /**
  * @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;
 }
Ejemplo n.º 8
0
 /**
  * @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>';
 }
Ejemplo n.º 9
0
 /**
  * @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;
 }
Ejemplo n.º 10
0
 /**
  * @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;
 }
Ejemplo n.º 11
0
/**
 * Smarty form error function.
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @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);
}
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 /**
  * @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;
 }
 /**
  * @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;
     }
     $customHeadData = implode('', $this->customHeadInfo);
     $assignArray = array('title' => $this->getTitle(), 'headData' => $headData . $headJsInclude . $customHeadData, 'language' => $this->language, 'direction' => $this->direction, 'pageBody' => $this->prependCode . $masterPageOutput . $this->appendCode . $jsData . OW_Document::APPEND_PLACEHOLDER, 'bodyClass' => !empty($this->bodyClass) ? ' ' . $this->bodyClass : '');
     $renderer = OW_ViewRenderer::getInstance();
     $renderer->clearAssignedVars();
     $renderer->assignVars($assignArray);
     return $renderer->renderTemplate($this->getTemplate());
 }
Ejemplo n.º 15
0
 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);
 }
Ejemplo n.º 16
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('googlelocation')->getStaticJsUrl() . 'location.js', "text/javascript", GOOGLELOCATION_BOL_LocationService::JQUERY_LOAD_PRIORITY + 1);
     $name = json_encode($this->getName());
     $id = json_encode($this->getId());
     $lat = !empty($this->value['latitude']) ? (double) $this->value['latitude'] : 0;
     $lon = !empty($this->value['longitude']) ? (double) $this->value['longitude'] : 0;
     $northEastLat = !empty($this->value['northEastLat']) ? (double) $this->value['northEastLat'] : 0;
     $northEastLng = !empty($this->value['northEastLng']) ? (double) $this->value['northEastLng'] : 0;
     $southWestLat = !empty($this->value['southWestLat']) ? (double) $this->value['southWestLat'] : 0;
     $southWestLng = !empty($this->value['southWestLng']) ? (double) $this->value['southWestLng'] : 0;
     $params = array('lat' => $lat, 'lng' => $lon, 'northEastLat' => $northEastLat, 'northEastLng' => $northEastLng, 'southWestLat' => $southWestLat, 'southWestLng' => $southWestLng, 'region' => $this->region, 'countryRestriction' => GOOGLELOCATION_BOL_LocationService::getInstance()->getCountryRestriction(), 'customMarkerIcon' => GOOGLELOCATION_BOL_LocationService::getInstance()->getDefaultMarkerIcon());
     OW::getDocument()->addOnloadScript(' $( document ).ready( function(){ window.googlemap_location = new OW_GoogleMapLocation( ' . json_encode($this->getName()) . ', ' . json_encode($this->getId()) . ', ' . json_encode($this->getName() . '_map') . ' );
                                          window.googlemap_location.initialize(' . json_encode($params) . '); }); ');
     $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['northEastLat']) ? $this->escapeValue($this->value['northEastLat']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[northEastLng]', 'value' => !empty($this->value['northEastLng']) ? $this->escapeValue($this->value['northEastLng']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[southWestLat]', 'value' => !empty($this->value['southWestLat']) ? $this->escapeValue($this->value['southWestLat']) : '');
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = array('type' => 'hidden', 'name' => $this->getName() . '[southWestLng]', 'value' => !empty($this->value['southWestLng']) ? $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' => 'hidden', 'name' => $this->getName() . '[remove]', 'value' => !empty($this->value['remove']) ? $this->escapeValue($this->value['remove']) : false);
     $html .= UTIL_HtmlTag::generateTag('input', $attribute);
     $attribute = $this->attributes;
     unset($attribute['name']);
     $attribute['value'] = !empty($this->value['address']) ? $this->value['address'] : '';
     $attribute['class'] .= ' ow_left ow_googlelocation_location_input';
     if (empty($attribute['value']) && $this->hasInvitation) {
         $attribute['value'] = $this->invitation;
         $attribute['class'] .= ' invitation';
     }
     $html .= '<div class="googlelocation_form_element_div clearfix">' . 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;
 }
Ejemplo n.º 17
0
 private function renderItem($index, $proto = false)
 {
     $value = $this->getValue();
     $inputAttrs = array('type' => 'text', 'maxlength' => 150, 'name' => $this->getName() . '[]', 'class' => 'mt-item-input', 'value' => empty($value[$index]) ? '' : $value[$index]);
     $contAttrs = array('class' => 'mt-item ow_smallmargin');
     if ($proto) {
         $inputAttrs['value'] = '';
         $contAttrs['style'] = 'display: none;';
     }
     if ($this->getHasInvitation() && empty($inputAttrs['value'])) {
         $inputAttrs['value'] = $this->invitation;
         $inputAttrs['class'] .= ' invitation';
     }
     $input = UTIL_HtmlTag::generateTag('input', $inputAttrs);
     return UTIL_HtmlTag::generateTag('div', $contAttrs, true, $input);
 }
Ejemplo n.º 18
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     if ($this->disabled) {
         $attributes = $this->attributes;
         unset($attributes['name']);
         $message = OW::getLanguage()->text('admin', 'possible_values_disable_message');
         $event = new OW_Event('admin.get.possible_values_disable_message', array('name' => $this->getName(), 'id' => $this->getId()), $message);
         OW::getEventManager()->trigger($event);
         $message = $event->getData();
         return UTIL_HtmlTag::generateTag('div', $attributes, true, $message);
     }
     parent::renderInput($params);
     $template = '
                     <div class="clearfix question_value_block" style="cursor:move;">
                             <span class="tag">
                                 <input type="hidden" value="{$value}">
                                 <span class="label" style="max-width:250px;overflow:hidden;">{$label}</span>
                                 <a title=' . json_encode(OW::getLanguage()->text('admin', 'remove_value')) . ' class="remove" href="javascript://"></a>
                             </span>
                     </div>';
     $template = UTIL_String::replaceVars($template, array('label' => '', 'value' => 0));
     $addButtonName = $this->getName() . '_add_button';
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "questions.js");
     $json = json_encode(array('tagFieldId' => $this->tag->getId(), 'dataFieldId' => $this->getId(), 'value' => $this->value, 'order' => array_keys($this->value), 'template' => $template));
     OW::getDocument()->addOnloadScript("\n            if ( !window.addQuestionValues )\n            {\n                window.addQuestionValues = {};\n            }\n\n            window.addQuestionValues[" . json_encode($this->getId()) . "] = new questionValuesField(" . $json . "); ");
     OW::getLanguage()->addKeyForJs('admin', 'questions_edit_delete_value_confirm_message');
     $inputValues = array();
     foreach ($this->value as $key => $val) {
         $inputValues[] = array($key => $val);
     }
     $html = '<div class="values_list">
             </div>
             <input type="hidden" id=' . json_encode($this->getId()) . ' name=' . json_encode($this->getName()) . ' value=' . json_encode($inputValues) . ' />
             <input type="hidden" id=' . json_encode($this->getId() . "_deleted_values") . ' name=' . json_encode($this->getName() . "_deleted_values") . ' value="" />
             <div style="padding-left: 4px;" class="ow_smallmargin">' . OW::getLanguage()->text('admin', 'add_question_value_description') . '</div>
             <div class="clearfix">
                 <div class="ow_left" style="width: 260px;">' . $this->tag->renderInput() . '</div>
                 <div class="ow_right">
                     <span class="ow_button">
                         <span class="ow_ic_add">
                             <input type="button" value=' . json_encode(OW::getLanguage()->text('admin', 'add_button')) . ' class="ow_ic_add" name="' . $addButtonName . '">
                         </span>
                     </span>
                 </div>
             </div>';
     return $html;
 }
Ejemplo n.º 19
0
 /**
  * @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());
     }
     //        echo "<pre>";
     //        print_r($_SERVER);
     //        die;
     //home page changes Mehul
     $this->getMasterPage()->assign('userfiles_url', OW_URL_USERFILES);
     $this->getMasterPage()->assign('theme_css_url', OW_URL_STATIC . "themes/morning/");
     $this->getMasterPage()->assign('site_url', OW_URL_HOME);
     $is_login_id = $_SESSION['userId'];
     //echo $is_login_id; die;
     $this->getMasterPage()->assign('is_login_id', $is_login_id);
     $page_url = $_SERVER['REQUEST_URI'];
     $split = explode("/", $page_url);
     $page_name = $split[count($split) - 1];
     $this->getMasterPage()->assign('page_name', $page_name);
     //echo $page_name; die;
     if (!empty($is_login_id)) {
         $page_url = $_SERVER['REQUEST_URI'];
         $substr = substr(strstr($page_url, "/"), 1);
         $is_page = substr(strstr($substr, "/"), 1);
         $uname = BOL_UserService::getInstance()->findUserById($is_login_id);
         $user_name = $uname->username;
         $this->getMasterPage()->assign('uname', $user_name);
         $is_status = BOL_UserService::getInstance()->isApproved($is_login_id);
         if ($is_status == 1) {
             $profile_status = 'Active';
         } else {
             $profile_status = 'Suspended';
         }
         $this->getMasterPage()->assign('profile_status', $profile_status);
         //            $userRoles = BOL_AuthorizationService::getInstance()->findUserRoleList($is_login_id);
         //            $membership = OW::getLanguage()->text('base', 'authorization_role_' . $userRoles[0]->getName());
         //            $this->getMasterPage()->assign('membership', $membership);
     }
     //home page over
     if (!empty($is_login_id)) {
         if ($is_page == 'my-profile' || $is_page == 'profile/edit' || $is_page == '') {
             $this->getMasterPage()->assign('heading', $user_name);
         } else {
             $this->getMasterPage()->assign('heading', $this->getHeading());
         }
     }
     $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;
     }
     $customHeadData = implode('', $this->customHeadInfo);
     $assignArray = array('title' => $this->getTitle(), 'headData' => $headData . $headJsInclude . $customHeadData, 'language' => $this->language, 'direction' => $this->direction, 'pageBody' => $this->prependCode . $masterPageOutput . $this->appendCode . $jsData . OW_Document::APPEND_PLACEHOLDER, 'bodyClass' => !empty($this->bodyClass) ? ' ' . $this->bodyClass : '');
     $renderer = OW_ViewRenderer::getInstance();
     $renderer->clearAssignedVars();
     $renderer->assignVars($assignArray);
     return $renderer->renderTemplate($this->getTemplate());
 }
Ejemplo n.º 20
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $fileElementId = $this->getId() . '_file';
     $entityId = $this->getValue();
     if (empty($entityId)) {
         $entityId = uniqid('upload');
     }
     $iframeUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Mailbox', 'fileUpload', array('entityId' => $entityId, 'formElementId' => $fileElementId));
     $attachFileHtml = '<div id="file_attachment" class="ow_mailbox_attachment">
                            <span class="ow_mailbox_attachment_icon ow_ic_attach ">&nbsp;</span>
                            <a class="file" href="javascript://"></a> (<span class="filesize"></span>)
                            <a rel="40" class="ow_delete_attachment ow_lbutton ow_hidden" href="javascript://" style="display: none;">' . OW::getLanguage()->text('mailbox', 'attache_file_delete_button') . '</a>
                        </div>';
     $fileList = array();
     if (!empty($entityId)) {
         $fileService = MAILBOX_BOL_FileUploadService::getInstance();
         $uploadFileDtoList = $fileService->findUploadFileList($entityId);
         foreach ($uploadFileDtoList as $uploadFileDto) {
             $file = array();
             $file['hash'] = $uploadFileDto->hash;
             $file['filesize'] = round($uploadFileDto->fileSize / 1024, 2) . 'Kb';
             $file['filename'] = $uploadFileDto->fileName;
             $file['fileUrl'] = $fileService->getUploadFileUrl($uploadFileDto->hash, UTIL_File::getExtension($uploadFileDto->fileName));
             $fileList[] = $file;
         }
     }
     $params = array('elementId' => $fileElementId, 'ajaxResponderUrl' => OW::getRouter()->urlFor("MAILBOX_CTRL_Mailbox", "responder"), 'fileResponderUrl' => $iframeUrl, 'attachFileHtml' => $attachFileHtml, 'fileList' => $fileList);
     $script = "  window.fileUpload_" . $this->getId() . " = new fileUpload(" . json_encode($params) . ");\n                        window.fileUpload_" . $this->getId() . ".init();";
     OW::getDocument()->addOnloadScript($script);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("mailbox")->getStaticJsUrl() . 'ajax_file_upload.js');
     $hiddenAttr = array('id' => $this->getId(), 'type' => 'hidden', 'name' => $this->getName(), 'value' => $entityId);
     $fileAttr = $this->attributes;
     unset($fileAttr['name']);
     $fileAttr['id'] = $fileElementId;
     return UTIL_HtmlTag::generateTag('input', $hiddenAttr) . '<span class="' . $fileElementId . '_class">' . UTIL_HtmlTag::generateTag('input', $fileAttr) . '</span>
             <div id="' . $fileElementId . '_list" class="ow_small ow_smallmargin">
                 <div class="ow_attachments_label mailbox_attachments_label ow_hidden">' . OW::getLanguage()->text('mailbox', 'attachments') . ' :</div>
             </div>';
 }
Ejemplo n.º 21
0
    public function __construct(array $params)
    {
        parent::__construct();
        $this->scope = $params['scope'];
        $value = isset($params['token']) ? trim(htmlspecialchars($params['token'])) : null;
        $userValue = isset($params['userToken']) ? trim(htmlspecialchars($params['userToken'])) : null;
        $invitation = $this->getInvitationLabel();
        $inputParams = array('type' => 'text', 'class' => !mb_strlen($value) ? 'invitation' : '', 'value' => mb_strlen($value) ? $value : $invitation, 'id' => UTIL_HtmlTag::generateAutoId('input'));
        $this->assign('input', UTIL_HtmlTag::generateTag('input', $inputParams));
        $userInputParams = array('type' => 'text', 'value' => $userValue, 'id' => $inputParams['id'] . '_user');
        $this->assign('userInput', UTIL_HtmlTag::generateTag('input', $userInputParams));
        $this->addComponent('filterContext', $this->getFilterContextAction());
        $this->assign('themeUrl', OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl());
        $this->assign('userToken', $userValue);
        switch ($this->scope) {
            case 'topic':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_topic', array('topicId' => $params['topicId'])));
                break;
            case 'group':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_group', array('groupId' => $params['groupId'])));
                break;
            case 'section':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_section', array('sectionId' => $params['sectionId'])));
                break;
            default:
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search'));
                break;
        }
        $userInvitation = OW::getLanguage()->text('forum', 'enter_username');
        $script = 'var invitation = ' . json_encode($invitation) . ';
        var input = ' . json_encode($inputParams['id']) . ';
        var userInvitation = ' . json_encode($userInvitation) . ';
        var userInput = ' . json_encode($userInputParams['id']) . ';

        $("#" + userInput).focus(function() {
            if ( $(this).val() == userInvitation ) {
                $(this).removeClass("invitation").val("");
            }
        });
        $("#" + userInput).blur(function() {
            if ( $(this).val() == "" ) {
                $(this).addClass("invitation").val(userInvitation);
            }
        });
        ';
        if (!mb_strlen($value)) {
            $script .= '$("#" + input).focus(function() {
                if ( $(this).val() == invitation ) {
                    $(this).removeClass("invitation").val("");
                }
            });
            $("#" + input).blur(function() {
                if ( $(this).val() == "" ) {
                    $(this).addClass("invitation").val(invitation);
                }
            });
            ';
        }
        $script .= 'var $form = $("form#forum_search");
        $(".ow_miniic_delete", $form).click(function() {
            $(".forum_search_tag_input", $form).css({visibility : "hidden", height: "0px", padding: "0px"});
            $(".add_filter", $form).show();
            $("#forum_search_cont").removeClass("forum_search_inputs");
            $("#" + userInput).val("").removeClass("invitation");
        });

        $("#btn-filter-by-user").click(function() {
            $(".forum_search_tag_input", $form).css({visibility : "visible", height: "auto", padding: "4px"});
            $("#" + userInput).val(userInvitation).addClass("invitation");
            $(".add_filter", $form).hide();
            $("#forum_search_cont").addClass("forum_search_inputs");
        });

        $("#' . $inputParams['id'] . ', #' . $userInputParams['id'] . '").keydown(function(e){
            if (e.keyCode == 13) {
                $(this).parents("form").submit();
                return false;
            }
        });
            
        $form.submit(function() {
            var value = $("#" + input).val();
            var userValue = $("#" + userInput).val();

            if ( value == invitation && !userValue.length || userValue == userInvitation && !value.length ) {
                return false;
            }

            if ( value == invitation ) {
                value = ""; $("#" + input).val(value);
            }

            if ( userValue == userInvitation ) {
                userValue = ""; $("#" + userInput).val(userValue);
            }

            var search = encodeURIComponent(value);
            userSearch = encodeURIComponent(userValue);
            document.location.href = ' . $location . ' + "?"
                + (search.length ? "&q=" + search : "")
                + (userSearch.length ? "&u=" + userSearch : "");

            return false;
        });
        ';
        OW::getDocument()->addOnloadScript($script);
    }
Ejemplo n.º 22
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     for ($hour = 0; $hour <= 23; $hour++) {
         $valuesArray[$hour . ':0'] = array('label' => $this->getTimeString($hour, '00'), 'hour' => $hour, 'minute' => 0);
         $valuesArray[$hour . ':30'] = array('label' => $this->getTimeString($hour, '30'), 'hour' => $hour, 'minute' => 30);
     }
     $optionsString = UTIL_HtmlTag::generateTag('option', array('value' => ""), true, OW::getLanguage()->text('event', 'time_field_invitation_label'));
     $allDayAttrs = array('value' => "all_day");
     if ($this->allDay) {
         $allDayAttrs['selected'] = 'selected';
     }
     $optionsString = UTIL_HtmlTag::generateTag('option', $allDayAttrs, true, OW::getLanguage()->text('event', 'all_day'));
     foreach ($valuesArray as $value => $labelArr) {
         $attrs = array('value' => $value);
         if (!empty($this->value) && $this->value['hour'] === $labelArr['hour'] && $this->value['minute'] === $labelArr['minute']) {
             $attrs['selected'] = 'selected';
         }
         $optionsString .= UTIL_HtmlTag::generateTag('option', $attrs, true, $labelArr['label']);
     }
     return UTIL_HtmlTag::generateTag('select', $this->attributes, true, $optionsString);
 }
Ejemplo n.º 23
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.tagsinput.js');
     $this->addAttribute('value', $this->value ? implode(',', $this->value) : '');
     $markup = UTIL_HtmlTag::generateTag('input', $this->attributes);
     return $markup;
 }
Ejemplo n.º 24
0
 /**
  * Returns rendered HTML code of form object.
  *
  * @param string $formContent
  * @param string $decorator
  * @return string
  */
 public function render($formContent, array $params = array())
 {
     $formElementJS = '';
     /* @var $element FormElement */
     foreach ($this->elements as $element) {
         $formElementJS .= $element->getElementJs() . PHP_EOL;
         $formElementJS .= "form.addElement(formElement);" . PHP_EOL;
     }
     $formInitParams = array('id' => $this->getId(), 'name' => $this->getName(), 'reset' => $this->getAjaxResetOnSuccess(), 'ajax' => $this->isAjax(), 'ajaxDataType' => $this->getAjaxDataType(), 'validateErrorMessage' => $this->emptyElementsErrorMessage);
     $jsString = " var form = new OwForm(" . json_encode($formInitParams) . ");window.owForms[form.name] = form;\n\t\t\t" . PHP_EOL . $formElementJS . "\n\n\t\t\tif ( form.form ) \n\t\t\t{\n    \t\t\t\$(form.form).bind( 'submit', {form:form},\n    \t\t\t\t\tfunction(e){\n    \t\t\t\t\t\treturn e.data.form.submitForm();\n    \t\t\t\t\t}\n    \t\t\t);\n                        }\n                        \n                        OW.trigger('base.onFormReady.' + form.name, [], form);\n                        OW.trigger('base.onFormReady', [form]);\n\t\t";
     foreach ($this->bindedFunctions as $bindType => $binds) {
         if (empty($binds)) {
             continue;
         }
         foreach ($binds as $function) {
             $jsString .= "form.bind('" . trim($bindType) . "', " . $function . ");";
         }
     }
     OW::getDocument()->addOnloadScript($jsString, 10);
     $hiddenFieldString = '';
     /* @var $value OW_FormElement */
     foreach ($this->elements as $value) {
         if ($value instanceof HiddenField) {
             $hiddenFieldString .= $value->renderInput() . PHP_EOL;
         }
     }
     return UTIL_HtmlTag::generateTag('form', array_merge($this->attributes, $params), true, PHP_EOL . $hiddenFieldString . $formContent . PHP_EOL);
 }