isExternal() ? $gadget->getSource() : st_url_for($gadget->getSource()); $query = strpos($source, '?') ? '&' : '?'; $params = array('culture=' . sfContext::getInstance()->getUser()->getCulture()); if (!$gadget->isExternal()) { $params[] = 'gadget_id=' . $gadget->getId(); $params[] = 'dashboard_id=' . $gadget->getDashboardId(); if (sfConfig::get('sf_debug')) { $params[] = 'cache=0'; } } $params[] = 'refreshed_at=' . $gadget->getRefreshedAt(); $min_height = $gadget->getMinHeight() ? $gadget->getMinHeight() . 'px' : 'none'; $max_height = $gadget->getMaxHeight() ? $gadget->getMaxHeight() . 'px' : 'none'; $iframe_id = 'st_dashboard_gadget_' . $gadget->getId(); return ''; } function get_gadget_layout(Dashboard $dashboard) { if ($dashboard->getIsDefault()) { $js = "jQuery('#dashboard > .menu a[href=#default]').hide();"; } else { $js = "jQuery('#dashboard > .menu a[href=#default]').show();"; } return st_get_fast_partial('stDashboard/' . $dashboard->getLayout(), array('dashboard' => $dashboard)) . javascript_tag($js); } function get_gadgets(Dashboard $dashboard, $column) { return st_get_fast_partial('stDashboard/gadgets', array('gadgets' => $dashboard->getGadgetsByColumn($column), 'column' => $column, 'dashboard' => $dashboard)); } function get_gadget_column_id($dashboard, $column) { return 'column-' . ($dashboard instanceof Dashboard ? $dashboard->getId() : $dashboard) . '-' . $column; } function gadget_color_tag($name, DashboardGadget $gadget) { $colors = sfConfig::get('app_dashboard_gadget_colors'); $html = ''; $current = $gadget->getColor(); $id = get_id_from_name($name); foreach ($colors as $color) { $color = '#' . $color; if ($color == $current) { $html .= '
  • '; } else { $html .= '
  • '; } } $js = <<
    ' . javascript_tag($js) . input_hidden_tag($name, $current) . ''; } function gadget_refresh_rates_tag($name, DashboardGadget $gadget) { $options = array(); foreach (sfConfig::get('app_dashboard_gadget_refresh_rates') as $rate => $attr) { $options[$rate] = __($attr['label'], null, 'stBackend'); } return select_tag($name, options_for_select($options, $gadget->getRefreshBy())); } function get_dashboard_layout_tag($name, Dashboard $dashboard) { $layouts = sfConfig::get('app_dashboard_layouts'); $html = ''; $current = $dashboard->getLayout(); $id = get_id_from_name($name); foreach ($layouts as $layout => $params) { if ($layout == $current) { $html .= '
  • '; } else { $html .= '
  • '; } } $js = <<
    ' . javascript_tag($js) . input_hidden_tag($name, $current) . ''; } function backend_language_picker() { if (stSoteshopVersion::getVersion() != stSoteshopVersion::ST_SOTESHOP_VERSION_INTERNATIONAL) { $langs = array( 'pl' => __('Polski'), 'en' => __('Angielski'), ); $culture = sfContext::getInstance()->getUser()->getCulture(); if ($culture == 'pl_PL') { $culture = 'pl'; } if ($culture == 'en_US') { $culture = 'en'; } foreach ($langs as $lang => $label) { $active = $lang == $culture ? ' class="active"' : ''; echo ''; echo ''; echo ''; } } } function get_language_flag_icon($culture, array $options = array()) { if ($culture == 'pl_PL') { $culture = 'pl'; } if ($culture == 'en_US') { $culture = 'en'; } $size = 20; if (isset($options['size'])) { $size = $options['size']; unset($options['size']); } if (!isset($options['style'])) { $options['style'] = ''; } $options['style'] .= '; max-width: ' . $size . 'px; filter: drop-shadow(0px 0px 1px #aaa);'; $options['class'] = 'align-middle'; return image_tag('/images/backend/icons/flags/' . $culture . '.svg', $options); } function gadget_url_for($internal_url, $parameters = array()) { $request = sfContext::getInstance()->getRequest(); $url_params = array( 'gadget_id=' . $request->getParameter('gadget_id'), 'dashboard_id=' . $request->getParameter('dashboard_id'), 'cache=0' ); foreach ($parameters as $name => $value) { $url_params[] = $name . '=' . rawurlencode($value); } return st_url_for($internal_url) . '?' . implode('&', $url_params); } function get_backend_header_text() { $host = sfContext::getInstance()->getRequest()->getHost(); return sprintf('home%s
    Sell Your Products in Poland and Europe
    ', st_url_for('@homepage'), $host); } function get_backend_version_information() { $cache = new stFunctionCache('stBackend'); return $cache->cacheCall('_backend_version_information', array('culture' => sfContext::getInstance()->getUser()->getCulture())); } function _backend_version_information() { $content = array(); if (stLicense::isOpen()) { $content[] = __('Darmowy sklep internetowy SOTESHOP OPEN', null, 'stBackendMain'); } else { $content[] = __('Wersja', null, 'stBackendMain') . ': ' . __('SOTESHOP', null, 'stBackendMain'); } $content[] = stApplication::getSoteshopVersion(); return implode(' ', $content); } function already_called($namespace) { static $called = array(); if (isset($called[$namespace])) { return true; } $called[$namespace] = true; return false; } /** * Tworzy okno modane o podanym id * Ddoatkowe parametry: * content - * remote_url - Adres url zdalnej zawartości jaka ma być wczytana podczas otwierania okna * @param mixed $id Id okna * @param mixed $title Tytuł okna * @param array|null $params Dodatkowe parametry * * @return string */ function modal($id, $title, array $params = null) { $content = isset($params['content']) ? $params['content'] : ''; $remoteUrl = isset($params['remote_url']) ? $params['remote_url'] : ''; $trigger = isset($params['trigger']) ? $params['trigger'] : ''; $width = isset($params['width']) ? $params['width'] : 500; $height = isset($params['height']) ? $params['height'] : 150; $html = <<

    {$title}

    {$content}
    HTML; return $html; } function modal_block_start() { ob_start(); } function modal_block_end($id, $title, array $params = null) { $content = ob_get_clean(); $params['content'] = $content; echo modal($id, $title, $params); } function init_tooltip($selector = ".tooltip", $options = array()) { static $selectors = array(); /** * Duplicate tooltip initialization fix */ if (false !== strpos($selector, '.tooltip,')) { $selector = '.tooltip'; } if (!isset($selectors[$selector])) { $selectors[$selector] = true; } else { return; } $trigger = isset($options['trigger']) ? $options['trigger'] : 'mouseenter focus'; $hideAll = ''; $appendTo = isset($options['append_to']) ? $options['append_to'] : 'document.body'; $interactive = isset($options['interactive']) && false === $options['interactive'] ? 'false' : 'true'; if (isset($options['hideAll']) && $options['hideAll']) { $hideAll = "tippy.hideAll({ duration: 0 })"; } $js = << $appendTo, onShow: function(instance) { $hideAll; $(document).trigger('tooltip-show', instance); return null !== instance.props.content && instance.props.content.length > 0; }, content: function(reference) { if (reference.getAttribute('data-tooltip-source') == 'content') { reference.setAttribute('data-title', reference.innerHTML); reference.removeAttribute('data-tooltip-source'); } else if (reference.getAttribute('title')) { var title = reference.getAttribute('title'); if (title) { reference.setAttribute('data-title', title.replace(/\*([^*]+)\*/g, '$1')); reference.removeAttribute('title'); } } return reference.getAttribute('data-title'); }, }); $(document).data('tippy{$selector}', instance); }); JS; echo javascript_tag($js); } function get_service_information() { $cache = new stFunctionCache('stBackend'); $cache->removeAll(); return $cache->cacheCall('_service_information', array('culture' => sfContext::getInstance()->getUser()->getCulture())); } function _service_information() { $lang = sfContext::getInstance()->getUser()->getCulture(); $licenseBlocked = stLicenseAbuse::isBlocked(); if ($licenseBlocked) { stNotification::getInstance()->addAlert('stUpdate', 'Wystąpił błąd podczas weryfikacji licencji. Proszę o pilny kontakt z SOTE. Sklep może zostać zablokowany.', array( 'i18n_catalogue' => 'stBackend', 'singular' => true, 'action' => 'https://www.sote.pl/page/block', 'icon' => 'refresh' )); return content_tag('span', __('Wystąpił błąd podczas weryfikacji licencji. Proszę o pilny kontakt z SOTE. Sklep może zostać zablokowany.', null, 'stBackend'), array( 'class' => 'color-danger-dark', )); } $license = new stLicense(); $communication = stCommunication::getLicenseInfo(); // Pobierz informacje o licnecji z SOTE $iwt_till = $communication['support']; // Pakiet VIP, dawniej IWT. Data ważności pakietu. Wycofane w 8. $upgrade_exp_date = $communication['guarantee']; // Data dostpu do aktualizacji sklepu $current_date = date("Y-m-d"); // Aktualna data $seven = stCommunication::getIsSeven(); // Czy sklep ma dostępne aktualizacje do wersj 7 $service_has_update = 0; // Czy usługa ma aktualizacje, dotyczy werji bezterminowych switch ($communication['type']) { case "MIESIĄC": // $message_service = __("Abonament miesięczny", null, 'stBackendMain'); $message_url = "#"; break; case "MIESIĄC+HOSTING": // $message_service = __("Abonament miesięczny+hosting", null, 'stBackendMain'); $message_url = "#"; break; case "ROK": // $message_service = __("Abonament roczny", null, 'stBackendMain'); $message_url = "#"; break; case "ROK+HOSTING": // $message_service = __("Abonament roczny+hosting", null, 'stBackendMain'); $message_url = "#"; break; case "BEZTERMINOWO": $service_has_update = 1; // $message_service = __("Licencja bezterminowa", null, 'stBackendMain'); $message_url = get_update_link(); break; case "BEZTERMINOWO+HOSTING": $service_has_update = 1; // $message_service = __("Licencja bezterminowa+hosting", null, 'stBackendMain'); $message_url = get_update_link(); break; default: // $message_service = $communication['type']; break; } if (!$service_has_update) { // komunikaty dla abonamentów $message_expire_name = __("Usługa ważna do", null, 'stBackendMain'); $message_expire_service = __("Twoja usługa wygasła. Dokonaj opłaty na kolejny okres.", null, 'stBackendMain'); $message_payment = null; } else { // komunikaty dla licencji bezterminonwych $message_expire_name = __("Aktualizacje dostępne do", null, 'stBackendMain'); $message_expire_service = __("Dostęp do pomocy i aktualizacji sklepu wygasł.", null, 'stBackendMain'); $message_payment = __("Zamów dostęp do aktualizacji", null, 'stBackendMain'); } $message_expire = __($message_expire_name . ": %date%", array("%date%" => '' . $upgrade_exp_date . ''), 'stBackendMain'); // Sprawdzenie czy usługa wygasła $message_expire_notice = ''; if ($current_date > $upgrade_exp_date) { // usługa wygasła, nie ma dostępu do usługi/akualizacji $message_expire_notice = '
    ' . $message_expire_service; if (!empty($message_payment)) { $message_expire_notice .= ' ' . $message_payment . '
    '; } if (!$service_has_update) { stNotification::getInstance()->addAlert('stUpdate', 'Twoja usługa wygasła. Dokonaj opłaty na kolejny okres.', array( 'i18n_catalogue' => 'stBackendMain', 'singular' => true, 'icon' => 'refresh' )); } else { stNotification::getInstance()->addAlert('stUpdate', 'Dostęp do pomocy i aktualizacji sklepu wygasł. %link%', array( 'i18n_catalogue' => 'stBackendMain', 'i18n_params' => array('%link%' => 'Zamów dostęp do aktualizacji'), 'action' => get_update_link(), 'singular' => true, 'icon' => 'refresh' )); } } else { $message_expire .= '
    ' . __("Serwis i aktualizacje aktywne.", null, 'stBackendMain'); stNotification::getInstance()->markAllAsRead('stUpdate'); } return $message_expire . '
    ' . $message_expire_notice; } /** * Link do aktualziacji z uwzględnieniem wersji jeżykowej * @return string URL */ function get_update_link() { $lang = sfContext::getInstance()->getUser()->getCulture(); if ($lang == 'pl_PL') { $link_update = 'https://www.sote.pl/dostep-do-aktualizacji.html'; } else { $link_update = 'https://www.soteshop.com/access-to-update.html'; } return $link_update; } function get_app_icon($icon_path, $default = true) { $path = $icon_path; if ($path) { $path = _get_app_icon_svg($path); if (null === $path) { $icon_file = basename($icon_path); $sf_web_dir = sfConfig::get('sf_web_dir'); if ($icon_file != "logo_sote_top.png") { if (is_file($sf_web_dir . '/images/backend/main/icons/red_new/' . $icon_file)) { $path = '/images/backend/main/icons/red_new/' . $icon_file; } elseif (is_file($sf_web_dir . '/images/backend/main/icons/red/' . $icon_file)) { $path = '/images/backend/main/icons/red/' . $icon_file; } elseif (is_file('/images/backend/main/icons/' . $icon_file)) { $path = '/images/backend/main/icons/' . $icon_file; } } } } if (null === $path && $default) { $path = _get_app_icon_svg('stDefaultApp.svg'); } return $path; } function _get_app_icon_svg($path) { $info = pathinfo($path); $info['extension'] = 'svg'; $svgFilename = $info['filename'] . '.' . $info['extension']; if (!$info['dirname'] || $info['dirname'] == '.' || 0 === strpos($info['dirname'], '/images/backend/')) { $info['dirname'] = '/images/backend/applications'; } $svgPath = $info['dirname'] . '/' . $svgFilename; if (is_file(sfConfig::get('sf_web_dir') . $svgPath)) { return $svgPath; } $svgPath = '/plugins/' . $info['filename'] . '/images/backend/' . $svgFilename; if (is_file(sfConfig::get('sf_web_dir') . $svgPath)) { return $svgPath; } return null; } function st_backend_get_icon_path($name, $default = true) { $mappings = sfConfig::get('app_icon_mapping'); if (isset($mappings[$name])) { $name = $mappings[$name]; } $filename = $name . '.svg'; if (is_file(sfConfig::get('sf_web_dir') . '/images/backend/icons/svg/' . $filename)) { return '/images/backend/icons/svg/' . $filename . '?v' . stApplication::getApplicationVersion('stBackend'); } $pluginPaths = sfLoader::getPluginModulePaths(); $moduleName = sfContext::getInstance()->getModuleName(); if (isset($pluginPaths[$moduleName])) { list(,,$pluginDir) = explode('/', $pluginPaths[$moduleName]); $iconPluginPath = '/plugins/' . $pluginDir . '/images/backend/icons/' . $filename; if (is_file(sfConfig::get('sf_web_dir') . $iconPluginPath)) { return $iconPluginPath. '?v' . stApplication::getApplicationVersion('stBackend'); } } if ($path = get_app_icon($name, $default)) { return $path; } return false; } function st_backend_is_left_menu_hidden() { $config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance()); return $config->getParameter('left_menu.hidden', MobileDetect::getInstance()->isMobile()); } function st_backend_get_icon($name, array $options = array()) { if (isset($options['size'])) { switch ($options['size']) { case 'medium': $options['size'] = 22; break; } } $icon = st_backend_get_icon_path($name, isset($options['default']) ? $options['default'] : true); if (!$icon) { return null; } $iconClass = $name[0] != '/' ? ' svg-icon-' . $name : ''; $size = isset($options['size']) ? "; width: {$options['size']}px; height: {$options['size']}px" : ''; $customColor = ''; $style = isset($options['style']) ? '; ' . $options['style'] : ''; if (isset($options['color'])) { if ($options['color'][0] == '#') { $customColor = "; background-color: {$options['color']}"; } else { $iconClass .= ' svg-icon-color-' . $options['color']; } } if (isset($options['hidden'])) { $style .= '; display: none'; } if (isset($options['class'])) { $iconClass .= ' ' . $options['class']; } return content_tag('span', '', array( 'class' => 'svg-icon' . $iconClass, 'style' => "-webkit-mask-image: url($icon); mask-image: url($icon) $size $customColor $style", 'title' => isset($options['title']) ? htmlspecialchars($options['title']) : null, )); }