Пример #1
0
                $configHandler->insertConfig($config);
            }
        }
        if (isset($_POST['product_property10'])) {
            if (oledrion_utils::getModuleOption('product_property10') != $_POST['product_property10']) {
                $criteria = new CriteriaCompo();
                $criteria->add($moduleIdCriteria);
                $criteria->add(new Criteria('conf_name', 'product_property10'));
                $config = $configHandler->getConfigs($criteria);
                $config = $config[0];
                $configValue = array('conf_modid' => $xoopsModule->getVar('mid'), 'conf_catid' => 0, 'conf_name' => 'product_property10', 'conf_value' => $_POST['product_property10'], 'conf_formtype' => 'hidden', 'conf_valuetype' => 'text');
                $config->setVars($configValue);
                $configHandler->insertConfig($config);
            }
        }
        if (isset($_POST['product_property10_title'])) {
            if (oledrion_utils::getModuleOption('product_property10_title') != $_POST['product_property10_title']) {
                $criteria = new CriteriaCompo();
                $criteria->add($moduleIdCriteria);
                $criteria->add(new Criteria('conf_name', 'product_property10_title'));
                $config = $configHandler->getConfigs($criteria);
                $config = $config[0];
                $configValue = array('conf_modid' => $xoopsModule->getVar('mid'), 'conf_catid' => 0, 'conf_name' => 'product_property10_title', 'conf_value' => $_POST['product_property10_title'], 'conf_formtype' => 'hidden', 'conf_valuetype' => 'text');
                $config->setVars($configValue);
                $configHandler->insertConfig($config);
            }
        }
        oledrion_utils::updateCache();
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=property', 2);
        break;
}
Пример #2
0
    }
}
// Vérification de la validité de la facture (si pas admin)
if (!oledrion_utils::isAdmin()) {
    if ($order->getVar('cmd_state') != OLEDRION_STATE_VALIDATED) {
        // Commande non validée
        oledrion_utils::redirect(_OLEDRION_ERROR12, 'index.php', 6);
    }
}
$caddy = $tmp = $products = $vats = $manufacturers = $tmp2 = $manufacturers = $productsManufacturers = array();
// Récupération des TVA
$vats = $h_oledrion_vat->getAllVats(new oledrion_parameters());
// Récupération des caddy associés
$caddy = $h_oledrion_caddy->getCaddyFromCommand($cmdId);
if (count($caddy) == 0) {
    oledrion_utils::redirect(_OLEDRION_ERROR11, 'index.php', 6);
}
// Récupération de la liste des produits associés
foreach ($caddy as $item) {
    $tmp[] = $item->getVar('caddy_product_id');
}
// Recherche des produits ***********************************************************************************************
$products = $h_oledrion_products->getProductsFromIDs($tmp, true);
// Recherche des fabricants **********************************************************************************************
$tmp2 = $h_oledrion_productsmanu->getFromProductsIds($tmp);
$tmp = array();
foreach ($tmp2 as $item) {
    $tmp[] = $item->getVar('pm_manu_id');
    $productsManufacturers[$item->getVar('pm_product_id')][] = $item;
}
$manufacturers = $h_oledrion_manufacturer->getManufacturersFromIds($tmp);
Пример #3
0
*/
/**
 * oledrion
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author      Hossein Azizabadi (azizabadi@faragostaresh.com)
 * @version     $Id$
 */
require 'header.php';
$xoopsOption['template_main'] = 'oledrion_user.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
// Check is user
$uid = oledrion_utils::getCurrentUserID();
if ($uid == 0) {
    oledrion_utils::redirect(_OLEDRION_ERROR23, XOOPS_URL . '/register.php', 4);
}
// Load header
$handlers = oledrion_handler::getInstance();
// Get list of this user order
$orders = $list = array();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cmd_uid', $uid));
$criteria->setSort('cmd_id');
$criteria->setOrder('DESC');
$orders = $handlers->h_oledrion_commands->getObjects($criteria, false);
if (!empty($orders)) {
    foreach ($orders as $item) {
        $command = $item->toArray();
        /* $caddy = $h_oledrion_caddy->getCaddyFromCommand($command['cmd_id']);
           foreach ($caddy as $item) {
Пример #4
0
        $sform->addElement(new XoopsFormHidden('product_id', $item->getVar('product_id')));
        foreach ($productRelated_d as $value) {
            $sform->addElement(new XoopsFormText($value['title'], $value['id'], 5, 5, $value['percent']), false);
        }
        $button_tray = new XoopsFormElementTray('', '');
        $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
        $button_tray->addElement($submit_btn);
        $sform->addElement($button_tray);
        $sform = oledrion_utils::formMarkRequiredFields($sform);
        $sform->display();
        include_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
        break;
        // **********************************************************************************************
    // **********************************************************************************************
    case 'relatedsave':
        // ******************************************************************************************
        xoops_cp_header();
        $id = isset($_POST['product_id']) ? intval($_POST['product_id']) : 0;
        $item = $h_oledrion_products->get($id);
        if (!is_object($item)) {
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
        }
        foreach ($_POST as $related => $percent) {
            if (is_numeric($related)) {
                $h_oledrion_related->updatePercent($id, $related, $percent);
            }
        }
        $opRedirect = 'products';
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 5);
        break;
}
Пример #5
0
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * oledrion
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
 * @version     $Id: rate-product.php 12290 2014-02-07 11:05:17Z beckmi $
 */
/**
 * Notation d'un produit
 */
require 'header.php';
oledrion_utils::redirect(_OLEDRION_NORATE, 'index.php', 5);
/*
$product_id = 0;
// Les tests **************************************************************************************
// Peut on voter ?
if (oledrion_utils::getModuleOption('rateproducts') == 0 ) {
    oledrion_utils::redirect(_OLEDRION_NORATE, 'index.php', 5);
}
// Recherche du n° du produit
if (isset($_GET['product_id'])) {
    $product_id = intval($_GET['product_id']);
} elseif (isset($_POST['product_id'])) {
    $product_id = intval($_POST['product_id']);
} else {
    oledrion_utils::redirect(_OLEDRION_ERROR1, 'index.php', 5);
}
Пример #6
0
    oledrion_utils::redirect(_OLEDRION_ERROR15, OLEDRION_URL, 5);
}
// On vérifie que la commande associée est payée
$order = null;
$order = $h_oledrion_commands->get($caddy->getVar('caddy_cmd_id'));
if ($order == null) {
    oledrion_utils::redirect(_OLEDRION_ERROR16, OLEDRION_URL, 5);
}
// Tout est bon, on peut envoyer le fichier au navigateur, s'il y a un fichier à télécharger, et s'il existe
$file = '';
$file = $product->getVar('product_download_url');
if (xoops_trim($file) == '') {
    oledrion_utils::redirect(_OLEDRION_ERROR17, OLEDRION_URL, 5);
}
if (!file_exists($file)) {
    oledrion_utils::redirect(_OLEDRION_ERROR18, OLEDRION_URL, 5);
}
// Mise à jour, le fichier n'est plus disponible au téléchargement
$h_oledrion_caddy->markCaddyAsNotDownloadableAnyMore($caddy);
$fileContent = file_get_contents($file);
// Plugins ************************************************
$plugins = oledrion_plugins::getInstance();
$parameters = new oledrion_parameters(array('fileContent' => $fileContent, 'product' => $product, 'order' => $order, 'fullFilename' => $file));
$parameters = $plugins->fireFilter(oledrion_plugins::EVENT_ON_PRODUCT_DOWNLOAD, $parameters);
if (trim($parameters['fileContent']) != '') {
    $fileContent = $parameters['fileContent'];
}
// *********************************************************
// Et affichage du fichier avec le type mime qui va bien
header("Content-Type: " . oledrion_utils::getMimeType($file));
header('Content-disposition: inline; filename="' . basename($file) . '"');
Пример #7
0
            $sform->addElement($editor6, false);
        }
        $editor7 = oledrion_utils::getWysiwygForm(_AM_OLEDRION_CHECKOUT_TEXT2, 'welcome7', $registry->getfile(OLEDRION_TEXTFILE7), 5, 60, 'hometext7_hidden');
        if ($editor7) {
            $sform->addElement($editor7, false);
        }
        $button_tray = new XoopsFormElementTray('', '');
        $submit_btn = new XoopsFormButton('', 'post', _AM_OLEDRION_MODIFY, 'submit');
        $button_tray->addElement($submit_btn);
        $sform->addElement($button_tray);
        $sform = oledrion_utils::formMarkRequiredFields($sform);
        $sform->display();
        break;
        // ****************************************************************************************************************
    // ****************************************************************************************************************
    case 'savetexts':
        // Sauvegarde des textes d'accueil ********************************************************
        // ****************************************************************************************************************
        require_once OLEDRION_PATH . 'class/registryfile.php';
        $registry = new oledrion_registryfile();
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome1']), OLEDRION_TEXTFILE1);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome2']), OLEDRION_TEXTFILE2);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome3']), OLEDRION_TEXTFILE3);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome4']), OLEDRION_TEXTFILE4);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome5']), OLEDRION_TEXTFILE5);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome6']), OLEDRION_TEXTFILE6);
        $registry->savefile($myts->stripSlashesGPC($_POST['welcome7']), OLEDRION_TEXTFILE7);
        oledrion_utils::updateCache();
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=texts', 2);
        break;
}
Пример #8
0
        if (empty($gateway)) {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl . $opRedirect, 5);
        }
        if (!oledrion_gateways::isInstalledGatewayName($gateway)) {
            oledrion_utils::redirect(_AM_OLEDRION_GATEWAYS_ERROR5, $baseurl . $opRedirect, 4);
        }
        if (oledrion_gateways::gatewayClassFileExists($gateway)) {
            if (!oledrion_gateways::loadGatewaysLanguageDefines($gateway)) {
                // Le chargement des traductions a échoué
                oledrion_utils::redirect(_AM_OLEDRION_GATEWAYS_ERROR2, $baseurl . $opRedirect, 4);
            }
            oledrion_gateways::includeGatewayClass($gateway);
            if (oledrion_gateways::gatewayClassExists($gateway)) {
                $gatewayClassName = oledrion_gateways::gatewayClassName($gateway);
                $temporaryGateway = new $gatewayClassName();
                if (!oledrion_gateways::asGoodAncestor($temporaryGateway)) {
                    oledrion_utils::redirect(_AM_OLEDRION_GATEWAYS_ERROR4, $baseurl . $opRedirect, 4);
                }
                if ($temporaryGateway->saveParametersForm($_POST)) {
                    oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . $opRedirect, 2);
                } else {
                    oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . $opRedirect, 4);
                }
            } else {
                oledrion_utils::redirect(_AM_OLEDRION_GATEWAYS_ERROR3, $baseurl . $opRedirect, 4);
            }
        } else {
            oledrion_utils::redirect(_AM_OLEDRION_GATEWAYS_ERROR1, $baseurl . $opRedirect, 4);
        }
        break;
}
Пример #9
0
                     // On va chercher sa valeur par défaut
                     if ($attribute->hasDefaultValue()) {
                         $userAttributes[$attribute->attribute_id] = $attribute->getAttributeDefaultValue();
                     }
                 }
             }
         }
         $h_oledrion_caddy->addProduct($productId, 1, $userAttributes);
         $url = OLEDRION_URL . 'caddy.php';
         if (!OLEDRION_CART_BUG) {
             header("Location: {$url}");
         } else {
             listCart();
         }
     } else {
         oledrion_utils::redirect(_OLEDRION_PROBLEM_QTY, 'index.php', 5);
         // Plus de stock !
     }
     listCart();
     break;
     // ****************************************************************************************************************
 // ****************************************************************************************************************
 case 'empty':
     // Suppression du contenu du caddy
     // ****************************************************************************************************************
     $h_oledrion_caddy->emptyCart();
     listCart();
     break;
     // ****************************************************************************************************************
 // ****************************************************************************************************************
 case 'default':
Пример #10
0
$GLOBALS['current_category'] = -1;
$xoopsOption['template_main'] = 'oledrion_manufacturer.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
// Les tests **************************************************************************************
if (isset($_GET['manu_id'])) {
    $manu_id = intval($_GET['manu_id']);
} else {
    oledrion_utils::redirect(_OLEDRION_ERROR7, 'index.php', 5);
}
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
// Le fabricant existe ?
$manufacturer = null;
$manufacturer = $h_oledrion_manufacturer->get($manu_id);
if (!is_object($manufacturer)) {
    oledrion_utils::redirect(_OLEDRION_ERROR7, 'index.php', 5);
}
$xoopsTpl->assign('mod_pref', $mod_pref);
// Préférences du module
$xoopsTpl->assign('columnsCount', oledrion_utils::getModuleOption('catagory_colums'));
$xoopsTpl->assign('manufacturer', $manufacturer->toArray());
$limit = oledrion_utils::getModuleOption('perpage');
// Lecture des TVA ********************************************************************************
$vatArray = array();
$vatArray = $h_oledrion_vat->getAllVats(new oledrion_parameters());
// Recherche des produits de ce fabricant *********************************************************
// On commence par chercher le nombre total de ses produits
$itemsCount = $h_oledrion_manufacturer->getManufacturerProductsCount($manu_id);
if ($itemsCount > $limit) {
    $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start', 'manu_id=' . $manu_id);
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
Пример #11
0
 $passwordCancel = md5(xoops_makepass());
 $commande = $h_oledrion_commands->create(true);
 $commande->setVars($_POST);
 $commande->setVar('cmd_uid', $uid);
 $commande->setVar('cmd_date', date("Y-m-d"));
 $commande->setVar('cmd_state', OLEDRION_STATE_NOINFORMATION);
 $commande->setVar('cmd_ip', oledrion_utils::IP());
 $commande->setVar('cmd_articles_count', count($cartForTemplate));
 $commande->setVar('cmd_total', oledrion_utils::formatFloatForDB($commandAmountTTC));
 $commande->setVar('cmd_shipping', oledrion_utils::formatFloatForDB($shippingAmount));
 $commande->setVar('cmd_password', $password);
 $commande->setVar('cmd_cancel', $passwordCancel);
 $commande->setVar('cmd_text', implode("\n", $discountsDescription));
 $res = $h_oledrion_commands->insert($commande, true);
 if (!$res) {
     oledrion_utils::redirect(_OLEDRION_ERROR10, OLEDRION_URL, 6);
 }
 // Enregistrement du panier
 $msgCommande = '';
 $handlers = oledrion_handler::getInstance();
 foreach ($cartForTemplate as $line) {
     $panier = $h_oledrion_caddy->create(true);
     $panier->setVar('caddy_product_id', $line['product_id']);
     $panier->setVar('caddy_qte', $line['product_qty']);
     $panier->setVar('caddy_price', oledrion_utils::formatFloatForDB($line['totalPrice']));
     // Attention, prix TTC avec frais de port
     $panier->setVar('caddy_cmd_id', $commande->getVar('cmd_id'));
     $panier->setVar('caddy_shipping', oledrion_utils::formatFloatForDB($line['discountedShipping']));
     $panier->setVar('caddy_pass', md5(xoops_makepass()));
     // Pour le téléchargement
     $msgCommande .= str_pad(wordwrap($line['product_title'], 60), 60, ' ') . ' ' . str_pad($line['product_qty'], 8, ' ', STR_PAD_LEFT) . ' ' . str_pad($line['totalPriceFormated'], 10, ' ', STR_PAD_LEFT) . ' ' . str_pad($line['discountedShipping'], 10, ' ', STR_PAD_LEFT) . "\n";
Пример #12
0
        xoops_cp_header();
        $categories = $h_oledrion_cat->getCategoriesCount();
        if ($categories == 0) {
            $cat_array = array('cat_cid' => 1, 'cat_pid' => 0, 'cat_title' => 'Test category');
            $cat = $h_oledrion_cat->create();
            $cat->setVars($cat_array);
            $res = $h_oledrion_cat->insert($cat);
            $manufacturer_array = array('manu_id' => 1, 'manu_name' => 'Test manufacturer');
            $manufacturer = $h_oledrion_manufacturer->create(true);
            $manufacturer->setVars($manufacturer_array);
            $res = $h_oledrion_manufacturer->insert($manufacturer);
            $product_array = array('product_id' => 1, 'product_cid' => 1, 'product_title' => 'Test product', 'product_vendor_id' => 1, 'product_submitter' => 1, 'product_online' => 1, 'product_submitted' => time(), 'product_price' => '100', 'product_summary' => 'Test test test test test test test test test test test test test test test test test', 'product_vat_id' => 1, 'product_stock' => 100);
            $product = $h_oledrion_products->create(true);
            $product->setVars($product_array);
            $res = $h_oledrion_products->insert($product);
            $productsmanu_array = array('pm_id' => 1, 'pm_id' => 1, 'pm_manu_id' => 1);
            $productsmanu = $h_oledrion_productsmanu->create(true);
            $productsmanu->setVars($productsmanu_array);
            $res = $h_oledrion_products->insert($productsmanu);
            $vat_array = array('vat_id' => 1, 'vat_rate' => '0.00', 'vat_country' => 'us');
            $vat = $h_oledrion_vat->create(true);
            $vat->setVars($vat_array);
            $res = $h_oledrion_vat->insert($vat);
            $vendor_array = array('vendor_id' => 1, 'vendor_name' => 'Test vendor');
            $vendor = $h_oledrion_vendors->create(true);
            $vendor->setVars($vendor_array);
            $res = $h_oledrion_vendors->insert($vendor);
        }
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl, 2);
        break;
}
Пример #13
0
 $removeBr = $removeHtml = false;
 $removeBr = isset($_POST['removebr']) ? intval($_POST['removebr']) : 0;
 $removeHtml = isset($_POST['removehtml']) ? intval($_POST['removehtml']) : 0;
 $header = isset($_POST['header']) ? $_POST['header'] : '';
 $footer = isset($_POST['footer']) ? $_POST['footer'] : '';
 $date1 = strtotime($_POST['date1']);
 $date2 = strtotime($_POST['date2']);
 $cat_id = intval($_POST['cat_cid']);
 $products = $categories = array();
 $products = $h_oledrion_products->getProductsForNewsletter(new oledrion_parameters(array('startingDate' => $date1, 'endingDate' => $date2, 'category' => $cat_id)));
 $newsfile = OLEDRION_NEWSLETTER_PATH;
 $categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'cat_title', 'order' => 'ASC', 'idaskey' => true)));
 $vats = $h_oledrion_vat->getAllVats(new oledrion_parameters());
 $fp = fopen($newsfile, 'w');
 if (!$fp) {
     oledrion_utils::redirect(_AM_OLEDRION_ERROR_7, $baseurl . '?op=newsletter', 5);
 }
 if (xoops_trim($header) != '') {
     fwrite($fp, $header);
 }
 foreach ($products as $item) {
     $content = $newsletterTemplate;
     $tblTmp = $tblTmp2 = array();
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('pm_product_id', $item->getVar('product_id'), '='));
     $tblTmp = $h_oledrion_productsmanu->getObjects($criteria);
     foreach ($tblTmp as $productManufacturer) {
         $tblTmp2[] = $productManufacturer->getVar('pm_manu_id');
     }
     $manufacturers = $h_oledrion_manufacturer->getObjects(new Criteria('manu_id', '(' . implode(',', $tblTmp2) . ')', 'IN'), true);
     $tblTmp = array();
Пример #14
0
        }
        echo '</table></form>';
        if (isset($pagenav) && is_object($pagenav)) {
            echo "<div align='right'>" . $pagenav->renderNav() . '</div>';
        }
        show_footer();
        break;
        // ****************************************************************************************************************
    // ****************************************************************************************************************
    case 'updatequantities':
        // Mise à jour des quantités des produits
        // ****************************************************************************************************************
        $names = array();
        if (isset($_POST['names'])) {
            $names = explode('|', $_POST['names']);
            foreach ($names as $item) {
                $name = 'qty_' . $item;
                if (isset($_POST[$name]) && xoops_trim($_POST[$name]) != '') {
                    $quantity = intval($_POST[$name]);
                    $product_id = intval($item);
                    $product = null;
                    $product = $h_oledrion_products->get($product_id);
                    if (is_object($product)) {
                        $h_oledrion_products->updateAll('product_stock', $quantity, new Criteria('product_id', $product_id, '='), true);
                    }
                }
            }
        }
        oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=lowstock', 2);
        break;
}
Пример #15
0
            echo "<tr>\n";
        }
        echo '</table>';
        if (isset($pagenav) && is_object($pagenav)) {
            echo "<div align='right'>" . $pagenav->renderNav() . "</div>";
        }
        include_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
        break;
        // ****************************************************************************************************************
    // ****************************************************************************************************************
    case 'delete':
        // Suppression d'une liste
        // ****************************************************************************************************************
        xoops_cp_header();
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        if (empty($id)) {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl . '?op=' . $operation, 5);
        }
        $list = null;
        $list = $oledrion_handlers->h_oledrion_lists->get($id);
        if (!is_object($list)) {
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $operation, 5);
        }
        if ($oledrion_handlers->h_oledrion_lists->deleteList($list)) {
            oledrion_utils::updateCache();
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $operation, 2);
        } else {
            oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $operation, 5);
        }
        break;
}
Пример #16
0
        break;
        // ****************************************************************************************************************
    // ****************************************************************************************************************
    case 'export':
        // Export des commandes au format CSV
        // ****************************************************************************************************************
        xoops_cp_header();
        oledrion_adminMenu(6);
        oledrion_utils::htitle(_MI_OLEDRION_ADMENU5, 4);
        $orderType = intval($_POST['cmdtype']);
        $exportFilter = $_POST['exportfilter'];
        $exportFilename = OLEDRION_PATH . 'admin/exports/' . $exportFilter . '.php';
        if (file_exists($exportFilename)) {
            require_once OLEDRION_PATH . 'admin/exports/export.php';
            require_once $exportFilename;
            $className = 'oledrion_' . $exportFilter . '_export';
            if (class_exists($className)) {
                $export = new $className();
                $export->setOrderType($orderType);
                $result = $export->export();
                if ($result === true) {
                    echo "<a href='" . $export->getDownloadUrl() . "'>" . _AM_OLEDRION_EXPORT_READY . '</a>';
                    //echo "<a href='$baseurl?op=orders&action=deleteexport&file=".$export->getDownloadPath()."'>".
                }
            }
        } else {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_11);
        }
        show_footer();
        break;
}
Пример #17
0
    // ****************************************************************************************************************
    case 'delete':
        // Suppression d'un fabricant
        // ****************************************************************************************************************
        xoops_cp_header();
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        if (empty($id)) {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
        }
        $opRedirect = 'manufacturers';
        // On vérifie que ce fabriquant n'est pas relié à des produits
        $cnt = $h_oledrion_manufacturer->getManufacturerProductsCount($id);
        if ($cnt == 0) {
            $item = null;
            $item = $h_oledrion_manufacturer->get($id);
            if (is_object($item)) {
                $res = $h_oledrion_manufacturer->deleteManufacturer($item);
                if ($res) {
                    oledrion_utils::updateCache();
                    oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
                } else {
                    oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
                }
            } else {
                oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
            }
        } else {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_5, $baseurl . '?op=' . $opRedirect, 5);
        }
        break;
}
Пример #18
0
function listForm($op, $product_id = 0)
{
    global $handlers, $baseurl;
    if ($op == 'edit') {
        $title = _OLEDRION_EDIT_LIST;
        $label_submit = _AM_OLEDRION_MODIFY;
        $list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : 0;
        if (empty($list_id)) {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_21, $baseurl, 5);
        }
        $item = null;
        $item = $handlers->h_oledrion_lists->get($list_id);
        if (!is_object($item)) {
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
        }
        // Vérification, est-ce que l'utilisateur courant est bien le propriétaire de cette liste ?
        if (!$handlers->h_oledrion_lists->isThisMyList($list_id)) {
            oledrion_utils::redirect(_OLEDRION_ERROR25, $baseurl, 8);
        }
        $edit = true;
        $label_submit = _AM_OLEDRION_MODIFY;
    } else {
        $title = _OLEDRION_ADD_LIST;
        $label_submit = _AM_OLEDRION_ADD;
        $item = $handlers->h_oledrion_lists->create(true);
        $edit = false;
    }
    $sform = new XoopsThemeForm($title, 'frmList', $baseurl);
    $sform->addElement(new XoopsFormHidden('op', 'save'));
    $sform->addElement(new XoopsFormHidden('list_id', $item->getVar('list_id')));
    $sform->addElement(new XoopsFormText(_AM_OLEDRION_TITLE, 'list_title', 50, 255, $item->getVar('list_title', 'e')), true);
    //$sform->addElement(new XoopsFormText(_OLEDRION_LIST_PASSWORD, 'list_password', 50, 50, $item->getVar('list_password','e')), false);
    $selectTypes = oledrion_lists::getTypesArray();
    $selectType = new XoopsFormSelect(_OLEDRION_LIST_TYPE, 'list_type', $item->getVar('list_type', 'e'));
    $selectType->addOptionArray($selectTypes);
    $sform->addElement($selectType, true);
    $sform->addElement(new XoopsFormTextArea(_OLEDRION_DESCRIPTION, 'list_description', $item->getVar('list_description', 'e'), 7, 60), false);
    $listProducts = array();
    if ($edit) {
        $listProducts = $handlers->h_oledrion_lists->getListProducts($item);
        if (count($listProducts) > 0) {
            $productsTray = new XoopsFormElementTray(_OLEDRION_PROD_IN_THIS_LIST, '<br />');
            $productsTray->addElement(new XoopsFormLabel(_OLEDRION_CHECK_PRODUCTS), false);
            foreach ($listProducts as $product) {
                $caption = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
                $checkbox = new XoopsFormCheckBox($caption, 'productsList[]');
                $checkbox->addOption($product->getVar('product_id'), _DELETE);
                $productsTray->addElement($checkbox);
                unset($caption, $checkbox);
            }
            $sform->addElement($productsTray, false);
        }
    }
    if ($product_id > 0) {
        $product = null;
        $product = $handlers->h_oledrion_products->get($product_id);
        if (is_object($product) && $product->isProductVisible()) {
            $content = "<a target='_blank' href='" . $product->getLink() . "'>" . $product->getVar('product_title') . '</a>';
            $sform->addElement(new XoopsFormLabel(_OLEDRION_PRODUCT_DO_ADD, $content));
            $sform->addElement(new XoopsFormHidden('product_id', $product_id));
        }
    }
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform = oledrion_utils::formMarkRequiredFields($sform);
    return $sform;
}
Пример #19
0
        $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
        if (empty($id)) {
            oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5);
        }
        $opRedirect = 'dashboard';
        $item = $h_oledrion_votedata->get($id);
        if (is_object($item)) {
            $res = $h_oledrion_votedata->delete($item, true);
            if ($res) {
                $product_id = $item->getVar('vote_product_id');
                $product = null;
                $product = $h_oledrion_products->get($product_id);
                if (is_object($product)) {
                    // Update Product's rating
                    $totalVotes = $sumRating = $ret = $finalrating = 0;
                    $ret = $h_oledrion_votedata->getCountRecordSumRating($product->getVar('product_id'), $totalVotes, $sumRating);
                    if ($totalVotes > 0) {
                        $finalrating = $sumRating / $totalVotes;
                        $finalrating = number_format($finalrating, 4);
                    }
                    $h_oledrion_products->updateRating($product_id, $finalrating, $totalVotes);
                }
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2);
            } else {
                oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5);
            }
        } else {
            oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5);
        }
        break;
}
Пример #20
0
        if ($rating < 1 || $rating > 10) {
            exit(_ERRORS);
        }
        $result = $h_oledrion_votedata->createRating($product->getVar('product_id'), $ratinguser, $rating);
        // Calcul du nombre de votes et du total des votes pour mettre à jour les informations du produit
        $totalVotes = 0;
        $sumRating = 0;
        $ret = 0;
        $ret = $h_oledrion_votedata->getCountRecordSumRating($product->getVar('product_id'), $totalVotes, $sumRating);
        $finalrating = $sumRating / $totalVotes;
        $finalrating = number_format($finalrating, 4);
        $h_oledrion_products->updateRating($product_id, $finalrating, $totalVotes);
        $ratemessage = _OLEDRION_VOTEAPPRE . '<br />' . sprintf(_OLEDRION_THANKYOU, $xoopsConfig['sitename']);
        oledrion_utils::redirect($ratemessage, OLEDRION_URL . 'product.php?product_id=' . $product->getVar('product_id'), 2);
    } else {
        oledrion_utils::redirect(_OLEDRION_VOTEONCE, OLEDRION_URL . 'product.php?product_id=' . $product->getVar('product_id'), 5);
    }
} else {
    // Affichage du formulaire
    $GLOBALS['current_category'] = $product->getVar('product_cid');
    $xoopsOption['template_main'] = 'oledrion_rate_product.html';
    require_once XOOPS_ROOT_PATH . '/header.php';
    $xoopsTpl->assign('mod_pref', $mod_pref);
    // Préférences du module
    $xoopsTpl->assign('product', $product->toArray());
    $xoopsTpl->assign('global_advert', oledrion_utils::getModuleOption('advertisement'));
    $breadcrumb = array($product->getLink() => $product->getVar('product_title'), OLEDRION_URL . basename(__FILE__) => _OLEDRION_RATETHISPRODUCT);
    $xoopsTpl->assign('breadcrumb', oledrion_utils::breadcrumb($breadcrumb));
    $title = _OLEDRION_RATETHISPRODUCT . ' : ' . strip_tags($product->getVar('product_title')) . ' - ' . oledrion_utils::getModuleName();
    oledrion_utils::setMetas($title, $title);
    oledrion_utils::setCSS();