本文整理汇总了PHP中Shop::getCompleteListOfShopsID方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getCompleteListOfShopsID方法的具体用法?PHP Shop::getCompleteListOfShopsID怎么用?PHP Shop::getCompleteListOfShopsID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getCompleteListOfShopsID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_module_1_3_2_2
function upgrade_module_1_3_2_2($object)
{
if (!Shop::isFeatureActive()) {
$categories = SimpleBlogCategory::getCategories(Context::getContext()->language->id, false);
foreach ($categories as $id_category => $category) {
$instance = new SimpleBlogCategory($id_category, Context::getContext()->language->id);
$instance->associateTo(Shop::getCompleteListOfShopsID());
unset($instance);
}
}
return true;
}
示例2: launchExport
/**
* Launch the export process
*/
public function launchExport()
{
// Addition of a secured token
if (!Tools::getValue('token') || Tools::getValue('token') != Tools::getAdminToken('DataExtractorController')) {
return;
}
@ini_set('max_execution_time', '3000');
@ini_set('max_input_time', '3000');
@ini_set('memory_limit', '384M');
$oDataExtractor = false;
$aPrediggoConfigs = array();
$oContext = Context::getContext();
foreach (Shop::getCompleteListOfShopsID() as $iIDShop) {
$oContext->shop = new Shop((int) $iIDShop);
$aPrediggoConfigs[(int) $iIDShop] = new PrediggoConfig($oContext);
}
// Launch Customers export process
$params = array('aPrediggoConfigs' => array());
foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
if ($oPrediggoConfig->customers_file_generation) {
$params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
}
}
if (count($params['aPrediggoConfigs'])) {
$oDataExtractor = new CustomerExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
$this->lauchFileExport($oDataExtractor);
}
// Launch Orders export process
$params = array('aPrediggoConfigs' => array());
foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
if ($oPrediggoConfig->orders_file_generation) {
$params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
}
}
if (count($params['aPrediggoConfigs'])) {
$oDataExtractor = new OrderExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
$this->lauchFileExport($oDataExtractor);
}
// Launch Products export process
$params = array('aPrediggoConfigs' => array());
foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
if ($oPrediggoConfig->products_file_generation) {
$params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
}
}
if (count($params['aPrediggoConfigs'])) {
$oDataExtractor = new ProductExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
$this->lauchFileExport($oDataExtractor);
}
}
示例3: initContent
/**
* Get view
*
* @return string
*/
public function initContent()
{
if (Context::getContext()->employee->id_profile == Configuration::get('APH_PROFILE_SITE_OWNER')) {
$shops = array();
//$_shops = Shop::getShops(true, null, true);
$_shops = Shop::getCompleteListOfShopsID();
foreach ($_shops as $id_shop) {
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT')) {
continue;
}
$shop = new Shop($id_shop);
$shops[$id_shop] = $shop->name;
}
asort($shops);
$this->context->smarty->assign('shops', $shops);
}
if ($this->display == 'edit') {
$obj = $this->loadObject(true);
$this->context->smarty->assign(array('obj' => $obj));
// Selected products
$selected_products = array();
$products = AphTool::getProducts($obj->id);
if (!empty($products)) {
foreach ($products as $product) {
$selected_products[] = $product['id_product'];
}
}
}
if ($this->display == 'add' || $this->display == 'edit') {
// Generate category selection tree
$tree = new HelperTreeProducts('products-tree', $this->l('Seleziona servizio'));
$tree->setInputName('checkBoxProductAsso_tool');
if (!empty($selected_products)) {
$tree->setAttribute('selected_products', $selected_products);
$tree->setSelectedProducts($selected_products);
}
$tree->setUseShopRestriction(true);
$this->context->smarty->assign('product_tree', $tree->render());
$languages = Language::getLanguages(true);
$this->context->smarty->assign(array("id_lang_default" => Configuration::get('PS_LANG_DEFAULT'), 'tpl_dir' => $this->tpl_dir, "languages" => $languages));
$this->content .= $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . "/views/templates/admin/controllers/tools/form.tpl");
}
parent::initContent();
}
示例4: duplicateMultistoreTab
private function duplicateMultistoreTab($id_tab)
{
$tab = new IqitMenuTab($id_tab);
$shops = Shop::getCompleteListOfShopsID();
foreach ($shops as $shop_id) {
if ($this->context->shop->id == $shop_id) {
continue;
}
$newobject = $tab->duplicateObject();
$newobject->associateToShop($shop_id);
}
}
示例5: productImport
public function productImport($offset = false, $limit = false, &$crossStepsVariables = false, $validateOnly = false, $moreStep = 0)
{
if ($moreStep == 1) {
return $this->productImportAccessories($offset, $limit, $crossStepsVariables);
}
$this->receiveTab();
$handle = $this->openCsvFile($offset);
if (!$handle) {
return false;
}
$default_language_id = (int) Configuration::get('PS_LANG_DEFAULT');
$id_lang = Language::getIdByIso(Tools::getValue('iso_lang'));
if (!Validate::isUnsignedId($id_lang)) {
$id_lang = $default_language_id;
}
AdminImportController::setLocale();
$shop_ids = Shop::getCompleteListOfShopsID();
$force_ids = Tools::getValue('forceIDs');
$match_ref = Tools::getValue('match_ref');
$regenerate = Tools::getValue('regenerate');
$shop_is_feature_active = Shop::isFeatureActive();
if (!$validateOnly) {
Module::setBatchMode(true);
}
$accessories = array();
if ($crossStepsVariables !== false && array_key_exists('accessories', $crossStepsVariables)) {
$accessories = $crossStepsVariables['accessories'];
}
$line_count = 0;
for ($current_line = 0; ($line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator)) && (!$limit || $current_line < $limit); $current_line++) {
$line_count++;
if ($this->convert) {
$line = $this->utf8EncodeArray($line);
}
if (count($line) == 1 && $line[0] == null) {
$this->warnings[] = $this->l('There is an empty row in the file that won\'t be imported.');
continue;
}
$info = AdminImportController::getMaskedRow($line);
$this->productImportOne($info, $default_language_id, $id_lang, $force_ids, $regenerate, $shop_is_feature_active, $shop_ids, $match_ref, $accessories, $validateOnly);
}
$this->closeCsvFile($handle);
if (!$validateOnly) {
Module::processDeferedFuncCall();
Module::processDeferedClearCache();
Tag::updateTagCount();
}
if ($crossStepsVariables !== false) {
$crossStepsVariables['accessories'] = $accessories;
}
return $line_count;
}
示例6: addSqlAssociation
public static function addSqlAssociation($table, $alias, $identifier, $inner_join = true, $on = null, $shops = false)
{
if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && Shop::isFeatureActive()) {
if ($shops == 'all') {
$ids_shop = array_values(Shop::getCompleteListOfShopsID());
} else {
if (is_array($shops) && sizeof($shops)) {
$ids_shop = array_values($shops);
} else {
if (is_numeric($shops)) {
$ids_shop = array($shops);
} else {
$ids_shop = array_values(Shop::getContextListShopID());
}
}
}
$table_alias = $alias . '_shop';
if (strpos($table, '.') !== false) {
list($table_alias, $table) = explode('.', $table);
}
$sql = ($inner_join ? ' INNER' : ' LEFT') . ' JOIN `' . _DB_PREFIX_ . $table . '_shop` ' . $table_alias . '
ON ' . $table_alias . '.' . $identifier . ' = ' . $alias . '.' . $identifier . '
AND ' . $table_alias . '.id_shop IN (' . implode(', ', $ids_shop) . ') ' . ($on ? ' AND ' . $on : '');
return $sql;
}
return;
}
示例7: add
/**
* Adds current object to the database
*
* @param bool $auto_date
* @param bool $null_values
*
* @return bool Insertion result
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function add($auto_date = true, $null_values = false)
{
if (isset($this->id) && !$this->force_id) {
unset($this->id);
}
// @hook actionObject*AddBefore
Hook::exec('actionObjectAddBefore', array('object' => $this));
Hook::exec('actionObject' . get_class($this) . 'AddBefore', array('object' => $this));
// Automatically fill dates
if ($auto_date && property_exists($this, 'date_add')) {
$this->date_add = date('Y-m-d H:i:s');
}
if ($auto_date && property_exists($this, 'date_upd')) {
$this->date_upd = date('Y-m-d H:i:s');
}
if (Shop::isTableAssociated($this->def['table'])) {
$id_shop_list = Shop::getContextListShopID();
if (count($this->id_shop_list) > 0) {
$id_shop_list = $this->id_shop_list;
}
}
// Database insertion
if (Shop::checkIdShopDefault($this->def['table'])) {
$this->id_shop_default = in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
}
if (!($result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values))) {
return false;
}
// Get object id in database
$this->id = Db::getInstance()->Insert_ID();
// Database insertion for multishop fields related to the object
if (Shop::isTableAssociated($this->def['table'])) {
$fields = $this->getFieldsShop();
$fields[$this->def['primary']] = (int) $this->id;
foreach ($id_shop_list as $id_shop) {
$fields['id_shop'] = (int) $id_shop;
$result &= Db::getInstance()->insert($this->def['table'] . '_shop', $fields, $null_values);
}
}
if (!$result) {
return false;
}
// Database insertion for multilingual fields related to the object
if (!empty($this->def['multilang'])) {
$fields = $this->getFieldsLang();
if ($fields && is_array($fields)) {
$shops = Shop::getCompleteListOfShopsID();
$asso = Shop::getAssoTable($this->def['table'] . '_lang');
foreach ($fields as $field) {
foreach (array_keys($field) as $key) {
if (!Validate::isTableOrIdentifier($key)) {
throw new PrestaShopException('key ' . $key . ' is not table or identifier');
}
}
$field[$this->def['primary']] = (int) $this->id;
if ($asso !== false && $asso['type'] == 'fk_shop') {
foreach ($shops as $id_shop) {
$field['id_shop'] = (int) $id_shop;
$result &= Db::getInstance()->insert($this->def['table'] . '_lang', $field);
}
} else {
$result &= Db::getInstance()->insert($this->def['table'] . '_lang', $field);
}
}
}
}
// @hook actionObject*AddAfter
Hook::exec('actionObjectAddAfter', array('object' => $this));
Hook::exec('actionObject' . get_class($this) . 'AddAfter', array('object' => $this));
return $result;
}
示例8: define
<?php
/*
* 2015-2016 DOGS
* @author J.Podracky, L.Fisher
* @copyright 2015-2016 F2FCREATIVE
*/
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include _PS_ADMIN_DIR_ . '/../config/config.inc.php';
if (isset($_GET['secure_key'])) {
$secureKey = md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
if (!empty($secureKey) && $secureKey === $_GET['secure_key']) {
$shop_ids = Shop::getCompleteListOfShopsID();
foreach ($shop_ids as $shop_id) {
Shop::setContext(Shop::CONTEXT_SHOP, (int) $shop_id);
Currency::refreshCurrencies();
}
}
}
示例9: registerHook
/**
* Connect module to a hook
*
* @param string $hook_name Hook name
* @param array $shop_list List of shop linked to the hook (if null, link hook to all shops)
* @return bool result
*/
public function registerHook($hook_name, $shop_list = null)
{
$return = true;
if (is_array($hook_name)) {
$hook_names = $hook_name;
} else {
$hook_names = array($hook_name);
}
foreach ($hook_names as $hook_name) {
// Check hook name validation and if module is installed
if (!Validate::isHookName($hook_name)) {
throw new PrestaShopException('Invalid hook name');
}
if (!isset($this->id) || !is_numeric($this->id)) {
return false;
}
// Retrocompatibility
$hook_name_bak = $hook_name;
if ($alias = Hook::getRetroHookName($hook_name)) {
$hook_name = $alias;
}
Hook::exec('actionModuleRegisterHookBefore', array('object' => $this, 'hook_name' => $hook_name));
// Get hook id
$id_hook = Hook::getIdByName($hook_name);
$live_edit = Hook::getLiveEditById((int) Hook::getIdByName($hook_name_bak));
// If hook does not exist, we create it
if (!$id_hook) {
$new_hook = new Hook();
$new_hook->name = pSQL($hook_name);
$new_hook->title = pSQL($hook_name);
$new_hook->live_edit = (bool) preg_match('/^display/i', $new_hook->name);
$new_hook->position = (bool) $new_hook->live_edit;
$new_hook->add();
$id_hook = $new_hook->id;
if (!$id_hook) {
return false;
}
}
// If shop lists is null, we fill it with all shops
if (is_null($shop_list)) {
$shop_list = Shop::getCompleteListOfShopsID();
}
$shop_list_employee = Shop::getShops(true, null, true);
foreach ($shop_list as $shop_id) {
// Check if already register
$sql = 'SELECT hm.`id_module`
FROM `' . _DB_PREFIX_ . 'hook_module` hm, `' . _DB_PREFIX_ . 'hook` h
WHERE hm.`id_module` = ' . (int) $this->id . ' AND h.`id_hook` = ' . $id_hook . '
AND h.`id_hook` = hm.`id_hook` AND `id_shop` = ' . (int) $shop_id;
if (Db::getInstance()->getRow($sql)) {
continue;
}
// Get module position in hook
$sql = 'SELECT MAX(`position`) AS position
FROM `' . _DB_PREFIX_ . 'hook_module`
WHERE `id_hook` = ' . (int) $id_hook . ' AND `id_shop` = ' . (int) $shop_id;
if (!($position = Db::getInstance()->getValue($sql))) {
$position = 0;
}
// Register module in hook
$return &= Db::getInstance()->insert('hook_module', array('id_module' => (int) $this->id, 'id_hook' => (int) $id_hook, 'id_shop' => (int) $shop_id, 'position' => (int) ($position + 1)));
if (!in_array($shop_id, $shop_list_employee)) {
$where = '`id_module` = ' . (int) $this->id . ' AND `id_shop` = ' . (int) $shop_id;
$return &= Db::getInstance()->delete('module_shop', $where);
}
}
Hook::exec('actionModuleRegisterHookAfter', array('object' => $this, 'hook_name' => $hook_name));
}
return $return;
}
示例10: productImport
public function productImport()
{
$this->receiveTab();
$handle = $this->openCsvFile();
$default_language_id = (int) Configuration::get('PS_LANG_DEFAULT');
$id_lang = Language::getIdByIso(Tools::getValue('iso_lang'));
if (!Validate::isUnsignedId($id_lang)) {
$id_lang = $default_language_id;
}
AdminImportController::setLocale();
$shop_ids = Shop::getCompleteListOfShopsID();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) {
if (Tools::getValue('convert')) {
$line = $this->utf8EncodeArray($line);
}
$info = AdminImportController::getMaskedRow($line);
if (Tools::getValue('forceIDs') && isset($info['id']) && (int) $info['id']) {
$product = new Product((int) $info['id']);
} elseif (Tools::getValue('match_ref') && array_key_exists('reference', $info)) {
$datas = Db::getInstance()->getRow('
SELECT p.`id_product`
FROM `' . _DB_PREFIX_ . 'product` p
' . Shop::addSqlAssociation('product', 'p') . '
WHERE p.`reference` = "' . pSQL($info['reference']) . '"
');
if (isset($datas['id_product']) && $datas['id_product']) {
$product = new Product((int) $datas['id_product']);
} else {
$product = new Product();
}
} elseif (array_key_exists('id', $info) && (int) $info['id'] && Product::existsInDatabase((int) $info['id'], 'product')) {
$product = new Product((int) $info['id']);
} else {
$product = new Product();
}
if (isset($product->id) && $product->id && Product::existsInDatabase((int) $product->id, 'product')) {
$product->loadStockData();
$category_data = Product::getProductCategories((int) $product->id);
if (is_array($product->category)) {
foreach ($category_data as $tmp) {
$product->category[] = $tmp;
}
}
}
AdminImportController::setEntityDefaultValues($product);
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $product);
if (!Shop::isFeatureActive()) {
$product->shop = 1;
} elseif (!isset($product->shop) || empty($product->shop)) {
$product->shop = implode($this->multiple_value_separator, Shop::getContextListShopID());
}
if (!Shop::isFeatureActive()) {
$product->id_shop_default = 1;
} else {
$product->id_shop_default = (int) Context::getContext()->shop->id;
}
// link product to shops
$product->id_shop_list = array();
foreach (explode($this->multiple_value_separator, $product->shop) as $shop) {
if (!empty($shop) && !is_numeric($shop)) {
$product->id_shop_list[] = Shop::getIdByName($shop);
} elseif (!empty($shop)) {
$product->id_shop_list[] = $shop;
}
}
if ((int) $product->id_tax_rules_group != 0) {
if (Validate::isLoadedObject(new TaxRulesGroup($product->id_tax_rules_group))) {
$address = $this->context->shop->getAddress();
$tax_manager = TaxManagerFactory::getManager($address, $product->id_tax_rules_group);
$product_tax_calculator = $tax_manager->getTaxCalculator();
$product->tax_rate = $product_tax_calculator->getTotalRate();
} else {
$this->addProductWarning('id_tax_rules_group', $product->id_tax_rules_group, Tools::displayError('Invalid tax rule group ID. You first need to create a group with this ID.'));
}
}
if (isset($product->manufacturer) && is_numeric($product->manufacturer) && Manufacturer::manufacturerExists((int) $product->manufacturer)) {
$product->id_manufacturer = (int) $product->manufacturer;
} elseif (isset($product->manufacturer) && is_string($product->manufacturer) && !empty($product->manufacturer)) {
if ($manufacturer = Manufacturer::getIdByName($product->manufacturer)) {
$product->id_manufacturer = (int) $manufacturer;
} else {
$manufacturer = new Manufacturer();
$manufacturer->name = $product->manufacturer;
if (($field_error = $manufacturer->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $manufacturer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && $manufacturer->add()) {
$product->id_manufacturer = (int) $manufacturer->id;
} else {
$this->errors[] = sprintf(Tools::displayError('%1$s (ID: %2$s) cannot be saved'), $manufacturer->name, isset($manufacturer->id) && !empty($manufacturer->id) ? $manufacturer->id : 'null');
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '') . Db::getInstance()->getMsgError();
}
}
}
if (isset($product->supplier) && is_numeric($product->supplier) && Supplier::supplierExists((int) $product->supplier)) {
$product->id_supplier = (int) $product->supplier;
} elseif (isset($product->supplier) && is_string($product->supplier) && !empty($product->supplier)) {
if ($supplier = Supplier::getIdByName($product->supplier)) {
$product->id_supplier = (int) $supplier;
} else {
$supplier = new Supplier();
$supplier->name = $product->supplier;
$supplier->active = true;
//.........这里部分代码省略.........
示例11: prepareModuleSettings
//.........这里部分代码省略.........
$tab->id_parent = $parent_tab->id;
$tab->module = $this->name;
$tab->add();
// Tags
$tab = new Tab();
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = $this->l('Tags');
}
$tab->class_name = 'AdminSimpleBlogTags';
$tab->id_parent = $parent_tab->id;
$tab->module = $this->name;
$tab->add();
// Settings
$tab = new Tab();
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = $this->l('Settings');
}
$tab->class_name = 'AdminSimpleBlogSettings';
$tab->id_parent = $parent_tab->id;
$tab->module = $this->name;
$tab->add();
$id_lang = $this->context->language->id;
// Default category
$simple_blog_category = new SimpleBlogCategory();
foreach (Language::getLanguages(true) as $lang) {
$simple_blog_category->name[$lang['id_lang']] = 'News';
}
foreach (Language::getLanguages(true) as $lang) {
$simple_blog_category->link_rewrite[$lang['id_lang']] = 'news';
}
$simple_blog_category->add();
$simple_blog_category->associateTo(Shop::getCompleteListOfShopsID());
// Post Types
$default_post_type = new SimpleBlogPostType();
$default_post_type->name = 'Post';
$default_post_type->slug = 'post';
$default_post_type->description = 'Default type of post';
$default_post_type->add();
$gallery_post_type = new SimpleBlogPostType();
$gallery_post_type->name = 'Gallery';
$gallery_post_type->slug = 'gallery';
$gallery_post_type->add();
$external_url_post_type = new SimpleBlogPostType();
$external_url_post_type->name = 'External URL';
$external_url_post_type->slug = 'url';
$external_url_post_type->add();
$video_post_type = new SimpleBlogPostType();
$video_post_type->name = 'Video';
$video_post_type->slug = 'video';
$video_post_type->add();
// Settings
Configuration::updateValue('PH_BLOG_POSTS_PER_PAGE', '10');
Configuration::updateValue('PH_BLOG_FB_COMMENTS', '1');
Configuration::updateValue('PH_BLOG_SLUG', 'blog');
Configuration::updateValue('PH_BLOG_COLUMNS', 'prestashop');
Configuration::updateValue('PH_BLOG_LAYOUT', 'default');
Configuration::updateValue('PH_BLOG_LIST_LAYOUT', 'grid');
Configuration::updateValue('PH_BLOG_GRID_COLUMNS', '2');
Configuration::updateValue('PH_BLOG_MAIN_TITLE', array($this->context->language->id => 'Blog - whats new?'));
Configuration::updateValue('PH_BLOG_LOAD_FA', '0');
Configuration::updateValue('PH_BLOG_DISPLAY_AUTHOR', '1');
Configuration::updateValue('PH_BLOG_DISPLAY_DATE', '1');
Configuration::updateValue('PH_BLOG_DISPLAY_THUMBNAIL', '1');
Configuration::updateValue('PH_BLOG_DISPLAY_CATEGORY', '1');
示例12: generateCss
//.........这里部分代码省略.........
} elseif ($menu['minheight_submenu'] === '0') {
$css[] = '.advtm_menu_' . $menu['id_menu'] . ' .adtm_sub {height:auto!important;min-height:0!important;}';
$css[] = '#adtm_menu .advtm_menu_' . $menu['id_menu'] . ' div.adtm_column_wrap {height:auto!important;min-height:0!important;}';
}
if ($menu['position_submenu']) {
if (intval($menu['position_submenu']) == 1 || intval($menu['position_submenu']) == 3) {
$css[] = '#adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ':hover, #adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ' a.a-niveau1:hover {position:relative!important;}';
} elseif (intval($menu['position_submenu']) == 2) {
$css[] = '#adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ':hover, #adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ' a.a-niveau1:hover {position:static!important;}';
}
if (intval($menu['position_submenu']) == 3) {
$css[] = '#adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ':hover div.adtm_sub {left:auto!important;right:0!important;}';
$css[] = '#adtm_menu ul#menu li.advtm_menu_' . $menu['id_menu'] . ' a:hover div.adtm_sub {left:auto!important;right:1px!important;}';
}
}
if ($menu['fnd_color_submenu']) {
$menu['fnd_color_submenu'] = explode($this->gradient_separator, $menu['fnd_color_submenu']);
if (isset($menu['fnd_color_submenu'][1])) {
$color1 = htmlentities($menu['fnd_color_submenu'][0], ENT_COMPAT, 'UTF-8');
$color2 = htmlentities($menu['fnd_color_submenu'][1], ENT_COMPAT, 'UTF-8');
$css[] = '.advtm_menu_' . $menu['id_menu'] . ' .adtm_sub {background-color: ' . $color1 . ';filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'' . $color1 . '\', endColorstr=\'' . $color2 . '\')!important; background: -webkit-gradient(linear, left top, left bottom, from(' . $color1 . '), to(' . $color2 . '))!important;background: -moz-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: -ms-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: -o-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important;}';
} else {
$css[] = '.advtm_menu_' . $menu['id_menu'] . ' .adtm_sub {background-color:' . htmlentities($menu['fnd_color_submenu'][0], ENT_COMPAT, 'UTF-8') . '!important;filter: none!important; background: ' . htmlentities($menu['fnd_color_submenu'][0], ENT_COMPAT, 'UTF-8') . '!important;background: ' . htmlentities($menu['fnd_color_submenu'][0], ENT_COMPAT, 'UTF-8') . '!important;}';
}
}
if ($menu['border_color_submenu']) {
$css[] = '.advtm_menu_' . $menu['id_menu'] . ' div.adtm_sub {border-color:' . htmlentities($menu['border_color_submenu'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
if ($menu['border_size_submenu']) {
$css[] = '.advtm_menu_' . $menu['id_menu'] . ' div.adtm_sub {border-width:' . htmlentities($menu['border_size_submenu'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
}
foreach ($columnsWrap as $columnWrap) {
if ($columnWrap['bg_color']) {
$columnWrap['bg_color'] = explode($this->gradient_separator, $columnWrap['bg_color']);
if (isset($columnWrap['bg_color'][1])) {
$color1 = htmlentities($columnWrap['bg_color'][0], ENT_COMPAT, 'UTF-8');
$color2 = htmlentities($columnWrap['bg_color'][1], ENT_COMPAT, 'UTF-8');
$css[] = '.advtm_column_wrap_td_' . $columnWrap['id_wrap'] . ' {background-color: ' . $color1 . ';filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'' . $color1 . '\', endColorstr=\'' . $color2 . '\')!important; background: -webkit-gradient(linear, left top, left bottom, from(' . $color1 . '), to(' . $color2 . '))!important;background: -moz-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: -ms-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: -o-linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important; background: linear-gradient(top, ' . $color1 . ', ' . $color2 . ')!important;}';
} else {
$css[] = '.advtm_column_wrap_td_' . $columnWrap['id_wrap'] . ' {background-color:' . htmlentities($columnWrap['bg_color'][0], ENT_COMPAT, 'UTF-8') . '!important;filter: none!important; background: ' . htmlentities($columnWrap['bg_color'][0], ENT_COMPAT, 'UTF-8') . '!important;background: ' . htmlentities($columnWrap['bg_color'][0], ENT_COMPAT, 'UTF-8') . '!important;}';
}
}
if ($columnWrap['txt_color_column']) {
$css[] = '.advtm_column_wrap_' . $columnWrap['id_wrap'] . ' span.column_wrap_title, .advtm_column_wrap_' . $columnWrap['id_wrap'] . ' span.column_wrap_title a {color:' . htmlentities($columnWrap['txt_color_column'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
if ($columnWrap['txt_color_column_over']) {
$css[] = '.advtm_column_wrap_' . $columnWrap['id_wrap'] . ' span.column_wrap_title a:hover {color:' . htmlentities($columnWrap['txt_color_column_over'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
if ($columnWrap['txt_color_element']) {
$css[] = '.advtm_column_wrap_' . $columnWrap['id_wrap'] . ', .advtm_column_wrap_' . $columnWrap['id_wrap'] . ' a {color:' . htmlentities($columnWrap['txt_color_element'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
if ($columnWrap['txt_color_element_over']) {
$css[] = '.advtm_column_wrap_' . $columnWrap['id_wrap'] . ' a:hover {color:' . htmlentities($columnWrap['txt_color_element_over'], ENT_COMPAT, 'UTF-8') . '!important;}';
}
if ($columnWrap['width']) {
$css[] = '.advtm_column_wrap_' . $columnWrap['id_wrap'] . ' {width:' . htmlentities($columnWrap['width'], ENT_COMPAT, 'UTF-8') . 'px!important;}';
}
}
$advanced_css_file = dirname(__FILE__) . '/' . self::ADVANCED_CSS_FILE;
$old_advanced_css_file_exists = file_exists($advanced_css_file);
$ids_shop = array(1);
if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
$ids_shop = array_values(Shop::getCompleteListOfShopsID());
}
foreach ($ids_shop as $id_shop) {
$advanced_css_file_shop = str_replace('.css', '-' . $id_shop . '.css', $advanced_css_file);
if (!$old_advanced_css_file_exists && !file_exists($advanced_css_file_shop)) {
file_put_contents($advanced_css_file_shop, file_get_contents(dirname(__FILE__) . '/' . self::ADVANCED_CSS_FILE_RESTORE));
} else {
if ($old_advanced_css_file_exists && sizeof($ids_shop) == 1 && !file_exists($advanced_css_file_shop)) {
file_put_contents($advanced_css_file_shop, file_get_contents(dirname(__FILE__) . '/' . self::ADVANCED_CSS_FILE));
@unlink(dirname(__FILE__) . '/' . self::ADVANCED_CSS_FILE);
} else {
if (!file_exists($advanced_css_file_shop)) {
file_put_contents($advanced_css_file_shop, file_get_contents(dirname(__FILE__) . '/' . self::ADVANCED_CSS_FILE_RESTORE));
}
}
}
}
$ids_shop = array(1);
if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
$ids_shop = array_values(Shop::getCompleteListOfShopsID());
}
$specific_css_file = array();
foreach ($ids_shop as $id_shop) {
$specific_css_file[] = str_replace('.css', '-' . $id_shop . '.css', dirname(__FILE__) . '/' . self::DYN_CSS_FILE);
}
if (sizeof($css) && sizeof($specific_css_file)) {
foreach ($specific_css_file as $value) {
file_put_contents($value, implode("\n", $css));
}
} else {
if (!sizeof($css) && sizeof($specific_css_file)) {
foreach ($specific_css_file as $value) {
file_put_contents($value, '');
}
}
}
}
示例13: postProcess
public function postProcess()
{
$this->_setFields();
// set default configuration to default channel & dafault configuration for backup and upgrade
// (can be modified in expert mode)
$config = $this->getConfig('channel');
if ($config === false) {
$config = array();
$config['channel'] = Upgrader::DEFAULT_CHANNEL;
$this->writeConfig($config);
if (class_exists('Configuration', false)) {
Configuration::updateValue('PS_UPGRADE_CHANNEL', $config['channel']);
}
$this->writeConfig(array('PS_AUTOUP_PERFORMANCE' => '1', 'PS_AUTOUP_CUSTOM_MOD_DESACT' => '1', 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => '1', 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => '0', 'PS_AUTOUP_KEEP_MAILS' => '0', 'PS_AUTOUP_BACKUP' => '1', 'PS_AUTOUP_KEEP_IMAGES' => '0'));
}
if (Tools14::isSubmit('putUnderMaintenance')) {
foreach (Shop::getCompleteListOfShopsID() as $id_shop) {
Configuration::updateValue('PS_SHOP_ENABLE', 0, false, null, (int) $id_shop);
}
Configuration::updateGlobalValue('PS_SHOP_ENABLE', 0);
}
if (Tools14::isSubmit('customSubmitAutoUpgrade')) {
$config_keys = array_keys(array_merge($this->_fieldsUpgradeOptions, $this->_fieldsBackupOptions));
$config = array();
foreach ($config_keys as $key) {
if (isset($_POST[$key])) {
$config[$key] = $_POST[$key];
}
}
$res = $this->writeConfig($config);
if ($res) {
Tools14::redirectAdmin($this->currentIndex . '&conf=6&token=' . Tools14::getValue('token'));
}
}
if (Tools14::isSubmit('deletebackup')) {
$res = false;
$name = Tools14::getValue('name');
$filelist = scandir($this->backupPath);
foreach ($filelist as $filename) {
// the following will match file or dir related to the selected backup
if (!empty($filename) && $filename[0] != '.' && $filename != 'index.php' && $filename != '.htaccess' && preg_match('#^(auto-backupfiles_|)' . preg_quote($name) . '(\\.zip|)$#', $filename, $matches)) {
if (is_file($this->backupPath . DIRECTORY_SEPARATOR . $filename)) {
$res &= unlink($this->backupPath . DIRECTORY_SEPARATOR . $filename);
} elseif (!empty($name) && is_dir($this->backupPath . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR)) {
$res = self::deleteDirectory($this->backupPath . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR);
}
}
}
if ($res) {
Tools14::redirectAdmin($this->currentIndex . '&conf=1&token=' . Tools14::getValue('token'));
} else {
$this->_errors[] = sprintf($this->l('Error when trying to delete backups %s'), $name);
}
}
parent::postProcess();
}
示例14: initContent
/**
* Get view
*
* @return string
*/
public function initContent()
{
$features = array();
//$_features = FeatureValue::getFeatureValuesWithLang( (int)Context::getContext()->language->id, Configuration::get('APH_FEATURE_DURATION') );
$services_duration = json_decode(Configuration::get('APH_SERVICES_DURATION'), true);
foreach ($services_duration as $id_feature_value => $duration) {
if ($duration >= 120) {
$features[$id_feature_value] = $duration / 60 . ' ore';
} else {
$features[$id_feature_value] = $duration . ' minuti';
}
}
$this->context->smarty->assign('features', $features);
$currency = $this->context->currency;
$this->context->smarty->assign('currency', $currency);
if (Context::getContext()->employee->id_profile == Configuration::get('APH_PROFILE_SITE_OWNER')) {
$shops = array();
//$_shops = Shop::getShops(true, null, true);
$_shops = Shop::getCompleteListOfShopsID();
foreach ($_shops as $id_shop) {
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT')) {
continue;
}
$shop = new Shop($id_shop);
$shops[$id_shop] = $shop->name;
}
asort($shops);
$this->context->smarty->assign('shops', $shops);
}
if ($this->display == 'edit') {
list($this->id_product, $this->id_shop) = explode('-', Tools::getValue('id_ps'));
$obj = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT a.*,pl.name,j.id_feature_value FROM `' . _DB_PREFIX_ . 'product_shop` a' . ' JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON pl.`id_product` = a.`id_product` AND pl.`id_shop`=' . $this->id_shop . ' AND pl.`id_lang`= ' . (int) Context::getContext()->language->id . ' JOIN `' . _DB_PREFIX_ . 'feature_product` j ON j.`id_product` = a.`id_product`' . ' AND j.`id_feature`=' . Configuration::get('APH_FEATURE_DURATION') . ' AND a.`id_shop`=' . $this->id_shop . ' AND a.`id_product`=' . $this->id_product);
if ($obj['id_service_duration'] <= 0) {
$obj['id_service_duration'] = $obj['id_feature_value'];
}
$this->context->smarty->assign(array('obj' => $obj));
$this->content .= $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . "/views/templates/admin/controllers/long_prices/form.tpl");
} elseif ($this->display == 'add') {
$languages = Language::getLanguages(true);
$this->context->smarty->assign(array("id_lang_default" => Configuration::get('PS_LANG_DEFAULT'), 'tpl_dir' => $this->tpl_dir, "languages" => $languages));
$this->content .= $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . "/views/templates/admin/controllers/long_prices/form.tpl");
}
parent::initContent();
}
示例15: dirname
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @author Benichou <benichou.software@gmail.com>
* @copyright 2015 Benichou
* @license http://opensource.org/licenses/MIT The MIT License (MIT)
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
if (!Module::isInstalled('blocknetreviews')) {
die('Module not installed');
}
$blocknetreviews = Module::getInstanceByName('blocknetreviews');
/* Check if the module is enabled */
if ($blocknetreviews->active) {
/* Check if the requested shop exists */
$list_id_shop = Shop::getCompleteListOfShopsID();
$id_shop = isset($_GET['id_shop']) && in_array($_GET['id_shop'], $list_id_shop) ? (int) $_GET['id_shop'] : (int) Configuration::get('PS_SHOP_DEFAULT');
die($blocknetreviews->upateShopRating((int) $id_shop));
}