/**
  * The function converts a user group name into a user group ID or creates a new user group if a user group specified in the import file does not exist
  *
  * @param string $usergroup Usergroup name presented in the file
  * @param string $lang_code 2-letter language code
  * @return int usergroup id
  */
 function fn_exim_put_usergroup($usergroup, $lang_code)
 {
     $default_usergroups = fn_get_default_usergroups($lang_code);
     foreach ($default_usergroups as $usergroup_id => $ug) {
         if ($ug['usergroup'] == $usergroup) {
             return $usergroup_id;
         }
     }
     $usergroup_id = fn_get_usergroup_id($usergroup, $lang_code);
     // Create new usergroup
     if (empty($usergroup_id)) {
         $_data = array('type' => 'C', 'status' => 'A');
         $usergroup_id = db_query("INSERT INTO ?:usergroups ?e", $_data);
         $_data = array('usergroup_id' => $usergroup_id, 'usergroup' => $usergroup);
         foreach (fn_get_translation_languages() as $_data['lang_code'] => $v) {
             db_query("INSERT INTO ?:usergroup_descriptions ?e", $_data);
         }
     }
     return $usergroup_id;
 }
Exemplo n.º 2
0
function fn_se_get_products_data($product_ids, $company_id = 0, $lang_code = NULL, $fl_echo = true)
{
    $xml = '';
    $products = array();
    if (!empty($product_ids)) {
        list($products) = fn_get_products(array('disable_searchanise' => true, 'area' => 'A', 'sort_by' => 'null', 'pid' => $product_ids, 'extend' => array('description', 'search_words', 'popularity', 'sales')), 0, $lang_code);
    }
    if ($fl_echo) {
        fn_echo('.');
    }
    if (!empty($products)) {
        foreach ($products as &$_product) {
            $_product['exclude_from_calculate'] = true;
            //pass additional params to fn_gather_additional_products_data for some speed up
        }
        fn_gather_additional_products_data($products, array('get_features' => false, 'get_icon' => true, 'get_detailed' => true, 'get_options' => false, 'get_discounts' => false, 'get_taxed_prices' => false));
        if ($fl_echo) {
            fn_echo('.');
        }
        if (!fn_allowed_for('ULTIMATE:FREE')) {
            $usergroups = empty($usergroups) ? array_merge(fn_get_default_usergroups(), db_get_hash_array("SELECT a.usergroup_id, a.status, a.type FROM ?:usergroups as a WHERE a.type = 'C' ORDER BY a.usergroup_id", 'usergroup_id')) : $usergroups;
        } else {
            $usergroups = array();
        }
        fn_se_get_products_additionals($products, $company_id, $lang_code);
        fn_se_get_products_features($products, $company_id, $lang_code);
        $schema = $items = array();
        foreach ($products as $product) {
            $item = array();
            $data = fn_se_prepare_product_data($product, $usergroups, $company_id, $lang_code);
            foreach ($data as $name => $d) {
                $name = isset($d['name']) ? $d['name'] : $name;
                $item[$name] = $d['value'];
                unset($d['value']);
                if (!empty($d)) {
                    $schema[$name] = $d;
                }
            }
            $items[] = $item;
        }
    }
    return array('schema' => $schema, 'items' => $items);
}
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    return;
}
if ($mode == 'update') {
    // Add new tab to page sections
    // [Page sections]
    // Add new tab to page sections
    Registry::set('navigation.tabs.reward_points', array('title' => __('reward_points'), 'js' => true));
    // [/Page sections]
    Registry::get('view')->assign('reward_points', fn_get_reward_points($_REQUEST['category_id'], CATEGORY_REWARD_POINTS));
    Registry::get('view')->assign('object_type', CATEGORY_REWARD_POINTS);
} elseif ($mode == 'add') {
    // Add new tab to page sections
    // [Page sections]
    Registry::set('navigation.tabs.reward_points', array('title' => __('reward_points'), 'js' => true));
    // [/Page sections]
    Registry::get('view')->assign('object_type', CATEGORY_REWARD_POINTS);
}
Registry::get('view')->assign('reward_usergroups', fn_array_merge(fn_get_default_usergroups(), fn_get_usergroups('C')));
/** /Body **/
Exemplo n.º 4
0
/**
 * Get simple list of usergroups
 *
 * @param string $type Type of usergroups (C - customers, A - administrators)
 * @param bool $get_default If set, default usergroups will be returned too (all, guest, registred)
 * @param strging $lang_code 2-letters language code
 * @return array like usergroup_id => usergroup_name
 */
function fn_get_simple_usergroups($type, $get_default = false, $lang_code = CART_LANGUAGE)
{
    $usergroups = array();
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        if ($get_default) {
            $default_usergroups = fn_get_default_usergroups($lang_code);
            foreach ($default_usergroups as $usergroup) {
                if ($usergroup['usergroup_id'] == USERGROUP_ALL) {
                    continue;
                }
                $usergroups[$usergroup['usergroup_id']] = $usergroup['usergroup'];
            }
        }
        $where = AREA == 'C' ? " a.status = 'A'" : " a.status IN ('A', 'H')";
        if ($type == 'C' || AREA == 'C') {
            $where .= " AND a.type = 'C'";
        } elseif ($type == 'A') {
            $where .= " AND a.type = 'A'";
        }
        $_usergroups = db_get_hash_single_array('SELECT a.usergroup_id, b.usergroup' . ' FROM ?:usergroups as a' . ' LEFT JOIN ?:usergroup_descriptions as b' . ' ON b.usergroup_id = a.usergroup_id AND b.lang_code = ?s' . ' WHERE ?p ORDER BY usergroup', array('usergroup_id', 'usergroup'), $lang_code, $where);
        $usergroups = $usergroups + $_usergroups;
    }
    return $usergroups;
}
    function content_55ccecdc0884e3_29924886($_smarty_tpl)
    {
        if (!is_callable('smarty_function_math')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.math.php';
        }
        if (!is_callable('smarty_function_cycle')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/function.cycle.php';
        }
        fn_preload_lang_vars(array('quantity', 'value', 'type', 'qty_discount_type_tooltip', 'usergroup', 'absolute', 'percent', 'absolute', 'percent', 'all', 'absolute', 'percent'));
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            ?>
    <?php 
            $_smarty_tpl->tpl_vars["usergroups"] = new Smarty_variable(fn_get_usergroups("C"), null, 0);
        }
        ?>

<div id="content_qty_discounts" class="hidden">
    <table class="table table-middle" width="100%">
    <thead class="cm-first-sibling">
    <tr>
        <th width="5%"><?php 
        echo $_smarty_tpl->__("quantity");
        ?>
</th>
        <th width="20%"><?php 
        echo $_smarty_tpl->__("value");
        ?>
</th>
        <th width="25%"><?php 
        echo $_smarty_tpl->__("type");
        echo $_smarty_tpl->getSubTemplate("common/tooltip.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('tooltip' => __("qty_discount_type_tooltip")), 0);
        ?>
</th>
        <?php 
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            ?>
            <th width="25%"><?php 
            echo $_smarty_tpl->__("usergroup");
            ?>
</th>
        <?php 
        }
        ?>
        <th width="15%">&nbsp;</th>
    </tr>
    </thead>
    <tbody>
    <?php 
        $_smarty_tpl->tpl_vars["price"] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars["price"]->_loop = false;
        $_smarty_tpl->tpl_vars["_key"] = new Smarty_Variable();
        $_from = $_smarty_tpl->tpl_vars['product_data']->value['prices'];
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars["price"]->key => $_smarty_tpl->tpl_vars["price"]->value) {
            $_smarty_tpl->tpl_vars["price"]->_loop = true;
            $_smarty_tpl->tpl_vars["_key"]->value = $_smarty_tpl->tpl_vars["price"]->key;
            ?>
    <tr class="cm-row-item">
        <td width="5%" class="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
            <?php 
            if ($_smarty_tpl->tpl_vars['price']->value['lower_limit'] == "1" && $_smarty_tpl->tpl_vars['price']->value['usergroup_id'] == "0") {
                ?>
                &nbsp;<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['price']->value['lower_limit'], ENT_QUOTES, 'UTF-8');
                ?>

            <?php 
            } else {
                ?>
            <input type="text" name="product_data[prices][<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['_key']->value, ENT_QUOTES, 'UTF-8');
                ?>
][lower_limit]" value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['price']->value['lower_limit'], ENT_QUOTES, 'UTF-8');
                ?>
" class="input-micro" />
            <?php 
            }
            ?>
</td>
        <td width="20%" class="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
            <?php 
            if ($_smarty_tpl->tpl_vars['price']->value['lower_limit'] == "1" && $_smarty_tpl->tpl_vars['price']->value['usergroup_id'] == "0") {
                ?>
                &nbsp;<?php 
                if ($_smarty_tpl->tpl_vars['price']->value['percentage_discount'] == 0) {
                    echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['price']->value['price']) === null || $tmp === '' ? "0.00" : $tmp, ENT_QUOTES, 'UTF-8');
                } else {
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['price']->value['percentage_discount'], ENT_QUOTES, 'UTF-8');
                }
                ?>
            <?php 
            } else {
                ?>
            <input type="text" name="product_data[prices][<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['_key']->value, ENT_QUOTES, 'UTF-8');
                ?>
][price]" value="<?php 
                if ($_smarty_tpl->tpl_vars['price']->value['percentage_discount'] == 0) {
                    echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['price']->value['price']) === null || $tmp === '' ? "0.00" : $tmp, ENT_QUOTES, 'UTF-8');
                } else {
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['price']->value['percentage_discount'], ENT_QUOTES, 'UTF-8');
                }
                ?>
" size="10" class="input-medium" />
            <?php 
            }
            ?>
</td>
        <td width="25%" class="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
">
            <?php 
            if ($_smarty_tpl->tpl_vars['price']->value['lower_limit'] == "1" && $_smarty_tpl->tpl_vars['price']->value['usergroup_id'] == "0") {
                ?>
                &nbsp;<?php 
                if ($_smarty_tpl->tpl_vars['price']->value['percentage_discount'] == 0) {
                    echo $_smarty_tpl->__("absolute");
                } else {
                    echo $_smarty_tpl->__("percent");
                }
                ?>
            <?php 
            } else {
                ?>
            <select class="span3" name="product_data[prices][<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['_key']->value, ENT_QUOTES, 'UTF-8');
                ?>
][type]">
                <option value="A" <?php 
                if ($_smarty_tpl->tpl_vars['price']->value['percentage_discount'] == 0) {
                    ?>
selected="selected"<?php 
                }
                ?>
><?php 
                echo $_smarty_tpl->__("absolute");
                ?>
 (<?php 
                echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
                ?>
)</option>
                <option value="P" <?php 
                if ($_smarty_tpl->tpl_vars['price']->value['percentage_discount'] != 0) {
                    ?>
selected="selected"<?php 
                }
                ?>
><?php 
                echo $_smarty_tpl->__("percent");
                ?>
 (%)</option>
            </select>
            <?php 
            }
            ?>
</td>
        <?php 
            if (!fn_allowed_for("ULTIMATE:FREE")) {
                ?>
        <td width="25%" class="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
                ?>
">
            <?php 
                if ($_smarty_tpl->tpl_vars['price']->value['lower_limit'] == "1" && $_smarty_tpl->tpl_vars['price']->value['usergroup_id'] == "0") {
                    ?>
                &nbsp;<?php 
                    echo $_smarty_tpl->__("all");
                    ?>

            <?php 
                } else {
                    ?>
            <select id="usergroup_id" name="product_data[prices][<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['_key']->value, ENT_QUOTES, 'UTF-8');
                    ?>
][usergroup_id]" class="span3">
                <?php 
                    $_smarty_tpl->tpl_vars["usergroup"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["usergroup"]->_loop = false;
                    $_from = fn_get_default_usergroups();
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["usergroup"]->key => $_smarty_tpl->tpl_vars["usergroup"]->value) {
                        $_smarty_tpl->tpl_vars["usergroup"]->_loop = true;
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['price']->value['usergroup_id'] != $_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id']) {
                            ?>
                        <option value="<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                            ?>
</option>
                    <?php 
                        } else {
                            ?>
                        
                        <?php 
                            $_smarty_tpl->tpl_vars["default_usergroup_name"] = new Smarty_variable($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], null, 0);
                            ?>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
                <?php 
                    $_smarty_tpl->tpl_vars["usergroup"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["usergroup"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['usergroups']->value;
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["usergroup"]->key => $_smarty_tpl->tpl_vars["usergroup"]->value) {
                        $_smarty_tpl->tpl_vars["usergroup"]->_loop = true;
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['price']->value['usergroup_id'] != $_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id']) {
                            ?>
                        <option value="<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                            ?>
</option>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
                    <option value="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['price']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                    ?>
" selected="selected"><?php 
                    if ($_smarty_tpl->tpl_vars['default_usergroup_name']->value) {
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['default_usergroup_name']->value, ENT_QUOTES, 'UTF-8');
                    } else {
                        echo htmlspecialchars(fn_get_usergroup_name($_smarty_tpl->tpl_vars['price']->value['usergroup_id']), ENT_QUOTES, 'UTF-8');
                    }
                    ?>
</option>
            </select>
            <?php 
                    echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "price_" . (string) $_smarty_tpl->tpl_vars['_key']->value, 'name' => "update_all_vendors[prices][" . (string) $_smarty_tpl->tpl_vars['_key']->value . "]"), 0);
                    ?>

            <?php 
                    $_smarty_tpl->tpl_vars["default_usergroup_name"] = new Smarty_variable('', null, 0);
                    ?>
            <?php 
                }
                ?>
</td>
        <?php 
            }
            ?>
        <td width="15%" class="nowrap <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
            ?>
 right">
            <?php 
            if ($_smarty_tpl->tpl_vars['price']->value['lower_limit'] == "1" && $_smarty_tpl->tpl_vars['price']->value['usergroup_id'] == "0") {
                ?>
            &nbsp;<?php 
            } else {
                ?>
            <?php 
                echo $_smarty_tpl->getSubTemplate("buttons/clone_delete.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('microformats' => "cm-delete-row", 'no_confirm' => true), 0);
                ?>

            <?php 
            }
            ?>
        </td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        echo smarty_function_math(array('equation' => "x+1", 'x' => ($tmp = @$_smarty_tpl->tpl_vars['_key']->value) === null || $tmp === '' ? 0 : $tmp, 'assign' => "new_key"), $_smarty_tpl);
        ?>

    <tr class="<?php 
        echo smarty_function_cycle(array('values' => "table-row , ", 'reset' => 1), $_smarty_tpl);
        echo htmlspecialchars($_smarty_tpl->tpl_vars['no_hide_input_if_shared_product']->value, ENT_QUOTES, 'UTF-8');
        ?>
" id="box_add_qty_discount">
        <td width="5%">
            <input type="text" name="product_data[prices][<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['new_key']->value, ENT_QUOTES, 'UTF-8');
        ?>
][lower_limit]" value="" class="input-micro" /></td>
        <td width="20%">
            <input type="text" name="product_data[prices][<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['new_key']->value, ENT_QUOTES, 'UTF-8');
        ?>
][price]" value="0.00" size="10" class="input-medium" /></td>
        <td width="25%">
        <select class="span3" name="product_data[prices][<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['new_key']->value, ENT_QUOTES, 'UTF-8');
        ?>
][type]">
            <option value="A" selected="selected"><?php 
        echo $_smarty_tpl->__("absolute");
        ?>
 (<?php 
        echo $_smarty_tpl->tpl_vars['currencies']->value[$_smarty_tpl->tpl_vars['primary_currency']->value]['symbol'];
        ?>
)</option>
            <option value="P"><?php 
        echo $_smarty_tpl->__("percent");
        ?>
 (%)</option>
        </select></td>
        <?php 
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            ?>
        <td width="25%">
            <select id="usergroup_id" name="product_data[prices][<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['new_key']->value, ENT_QUOTES, 'UTF-8');
            ?>
][usergroup_id]" class="span3">
                <?php 
            $_smarty_tpl->tpl_vars["usergroup"] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars["usergroup"]->_loop = false;
            $_from = fn_get_default_usergroups();
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars["usergroup"]->key => $_smarty_tpl->tpl_vars["usergroup"]->value) {
                $_smarty_tpl->tpl_vars["usergroup"]->_loop = true;
                ?>
                    <option value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                ?>
</option>
                <?php 
            }
            ?>
                <?php 
            $_smarty_tpl->tpl_vars["usergroup"] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars["usergroup"]->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['usergroups']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars["usergroup"]->key => $_smarty_tpl->tpl_vars["usergroup"]->value) {
                $_smarty_tpl->tpl_vars["usergroup"]->_loop = true;
                ?>
                    <option value="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                ?>
</option>
                <?php 
            }
            ?>
            </select>
            <?php 
            echo $_smarty_tpl->getSubTemplate("buttons/update_for_all.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('display' => $_smarty_tpl->tpl_vars['show_update_for_all']->value, 'object_id' => "price_" . (string) $_smarty_tpl->tpl_vars['new_key']->value, 'name' => "update_all_vendors[prices][" . (string) $_smarty_tpl->tpl_vars['new_key']->value . "]"), 0);
            ?>

        </td>
        <?php 
        }
        ?>
        <td width="15%" class="right">
            <?php 
        echo $_smarty_tpl->getSubTemplate("buttons/multiple_buttons.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('item_id' => "add_qty_discount"), 0);
        ?>

        </td>
    </tr>
    </tbody>
    </table>

</div><?php 
    }
    function content_55ccecdbdaa829_22080058($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_modifier_in_array')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/modifier.in_array.php';
        }
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            if ($_smarty_tpl->tpl_vars['usergroup_ids']->value !== '') {
                $_smarty_tpl->tpl_vars["ug_ids"] = new Smarty_variable(explode(",", $_smarty_tpl->tpl_vars['usergroup_ids']->value), null, 0);
            }
            ?>

<?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "usergroups:select_usergroups"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "usergroups:select_usergroups"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

<input type="hidden" name="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8');
                ?>
" value="0" <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['input_extra']->value, ENT_QUOTES, 'UTF-8');
                ?>
/>
<?php 
                $_smarty_tpl->_capture_stack[0][] = array("usergroups_list", null, null);
                ob_start();
                $_smarty_tpl->tpl_vars['usergroups_default'] = new Smarty_variable(fn_get_default_usergroups(), null, 0);
                $_smarty_tpl->tpl_vars['usergroup'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['usergroup']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['usergroups_default']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['usergroup']->key => $_smarty_tpl->tpl_vars['usergroup']->value) {
                    $_smarty_tpl->tpl_vars['usergroup']->_loop = true;
                    ?>
    <?php 
                    if ($_smarty_tpl->tpl_vars['select_mode']->value) {
                        ?>
<li><a>
    <?php 
                    } else {
                        ?>
<label class="checkbox <?php 
                        if (!$_smarty_tpl->tpl_vars['list_mode']->value) {
                            ?>
inline<?php 
                        }
                        ?>
" for="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                        ?>
">
    <?php 
                    }
                    ?>
    <input type="checkbox" name="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8');
                    ?>
[]" id="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                    ?>
"<?php 
                    if ($_smarty_tpl->tpl_vars['ug_ids']->value && smarty_modifier_in_array($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], $_smarty_tpl->tpl_vars['ug_ids']->value) || !$_smarty_tpl->tpl_vars['ug_ids']->value && $_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'] == @constant('USERGROUP_ALL')) {
                        ?>
 checked="checked"<?php 
                    }
                    ?>
 <?php 
                    if ((!$_smarty_tpl->tpl_vars['ug_ids']->value || $_smarty_tpl->tpl_vars['ug_ids']->value && count($_smarty_tpl->tpl_vars['ug_ids']->value) == 1 && smarty_modifier_in_array($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], $_smarty_tpl->tpl_vars['ug_ids']->value)) && $_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'] == @constant('USERGROUP_ALL')) {
                        ?>
 disabled="disabled"<?php 
                    }
                    ?>
 value="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['input_extra']->value, ENT_QUOTES, 'UTF-8');
                    ?>
 onclick="fn_switch_default_box(this, '<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
', <?php 
                    echo htmlspecialchars(@constant('USERGROUP_ALL'), ENT_QUOTES, 'UTF-8');
                    ?>
);" />
    <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                    ?>


    <?php 
                    if ($_smarty_tpl->tpl_vars['select_mode']->value) {
                        ?>
</a></li>
    <?php 
                    } else {
                        ?>
</label>
    <?php 
                    }
                }
                ?>

<?php 
                $_smarty_tpl->tpl_vars['usergroup'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['usergroup']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['usergroups']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['usergroup']->key => $_smarty_tpl->tpl_vars['usergroup']->value) {
                    $_smarty_tpl->tpl_vars['usergroup']->_loop = true;
                    ?>
    <?php 
                    if ($_smarty_tpl->tpl_vars['select_mode']->value) {
                        ?>
<li><a>
    <?php 
                    } else {
                        ?>
<label class="checkbox <?php 
                        if (!$_smarty_tpl->tpl_vars['list_mode']->value) {
                            ?>
inline<?php 
                        }
                        ?>
" for="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                        ?>
_<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                        ?>
">
    <?php 
                    }
                    ?>
        
        <input type="checkbox" name="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8');
                    ?>
[]" id="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
_<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                    ?>
"<?php 
                    if ($_smarty_tpl->tpl_vars['ug_ids']->value && smarty_modifier_in_array($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], $_smarty_tpl->tpl_vars['ug_ids']->value)) {
                        ?>
 checked="checked"<?php 
                    }
                    ?>
 value="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup_id'], ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['input_extra']->value, ENT_QUOTES, 'UTF-8');
                    ?>
 onclick="fn_switch_default_box(this, '<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8');
                    ?>
', <?php 
                    echo htmlspecialchars(@constant('USERGROUP_ALL'), ENT_QUOTES, 'UTF-8');
                    ?>
);" />
        <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                    ?>


    <?php 
                    if ($_smarty_tpl->tpl_vars['select_mode']->value) {
                        ?>
</a></li>
    <?php 
                    } else {
                        ?>
</label>
    <?php 
                    }
                    ?>

<?php 
                }
                list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
                if (!empty($_capture_buffer)) {
                    if (isset($_capture_assign)) {
                        $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                    }
                    if (isset($_capture_append)) {
                        $_smarty_tpl->append($_capture_append, ob_get_contents());
                    }
                    Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
                } else {
                    $_smarty_tpl->capture_error();
                }
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "usergroups:select_usergroups"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>


<?php 
            if ($_smarty_tpl->tpl_vars['select_mode']->value) {
                ?>
    <div class="btn-group">
    <a class="btn-text dropdown-toggle" data-toggle="dropdown">
    <?php 
                if ($_smarty_tpl->tpl_vars['ug_ids']->value) {
                    ?>
        <?php 
                    $_smarty_tpl->tpl_vars["ug_count"] = new Smarty_variable(count($_smarty_tpl->tpl_vars['ug_ids']->value), null, 0);
                    ?>
    <?php 
                } else {
                    ?>
        <?php 
                    $_smarty_tpl->tpl_vars["ug_count"] = new Smarty_variable(count($_smarty_tpl->tpl_vars['ug_ids']->value), null, 0);
                    ?>
    <?php 
                }
                ?>
        <i class="exicon-usergroup"></i>
            <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8');
                ?>
 <span class="cm-ug-amount">(<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['ug_count']->value, ENT_QUOTES, 'UTF-8');
                ?>
)</span>
        <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
        <?php 
                echo Smarty::$_smarty_vars['capture']['usergroups_list'];
                ?>

    </ul>
    </div>
<?php 
            } else {
                ?>
    <?php 
                echo Smarty::$_smarty_vars['capture']['usergroups_list'];
                ?>

<?php 
            }
            ?>

<?php 
            if (!defined("SMARTY_USERGROUPS_LOADED")) {
                ?>
    <?php 
                $_smarty_tpl->tpl_vars["tmp"] = new Smarty_variable(define("SMARTY_USERGROUPS_LOADED", true), null, 0);
                ?>
    <script type="text/javascript">
        
        function fn_switch_default_box(holder, prefix, default_id)
        {
            var $ = Tygh.$;
            var p = $(holder).parents(':not(li,a,label,ul):first');

            var default_box = $('input[id^=' + prefix + '_' + default_id + ']', p);
            var checked_groups = $('input[id^=' + prefix + '_][type=checkbox]:checked', p).not(default_box).not(holder).length + (holder.checked ? 1 : 0);

            default_box.prop('disabled', (checked_groups == 0));
            if (checked_groups == 0) {
                default_box.prop('checked', true);
            }

            fn_calculate_usergroups(p);
            return true;
        }

        function fn_calculate_usergroups(holder)
        {
            var $ = Tygh.$;
            if ($(holder).length) {
                var note = $('.cm-ug-amount', $(holder));
            } else {
                var note = $('.cm-ug-amount');
            }

            note.each(function(){
                var p = $(this).parents(':not(li,a,label,ul):first');
                var total_checked = $('input[type=checkbox]:checked', p).length;
                $(this).html('(' + total_checked + ')');
            });

        }
        
    </script>
<?php 
            }
            ?>

<?php 
        }
    }
Exemplo n.º 7
0
    }
    if ($mode == 'do_cleanup_logs') {
        db_query("DELETE FROM ?:reward_point_changes WHERE user_id = ?i", $_REQUEST['user_id']);
    }
    // Add/Update wholesale prices info
    if ($mode == 'add' || $mode == 'update') {
        if (isset($_REQUEST['reward_points'])) {
            foreach ($_REQUEST['reward_points'] as $k => $v) {
                fn_add_reward_points($v, 0, GLOBAL_REWARD_POINTS);
            }
        }
    }
    return array(CONTROLLER_STATUS_OK, "reward_points.manage");
}
if ($mode == 'manage') {
    // Add new tab to page sections
    Registry::set('navigation.tabs.reward_points', array('title' => fn_get_lang_var('reward_points'), 'js' => true));
    $view->assign('reward_points', fn_get_reward_points(0, GLOBAL_REWARD_POINTS));
    $view->assign('object_type', GLOBAL_REWARD_POINTS);
} elseif ($mode == 'add') {
    // Add new tab to page sections
    Registry::set('navigation.tabs.reward_points', array('title' => fn_get_lang_var('reward_points'), 'js' => true));
    $view->assign('object_type', GLOBAL_REWARD_POINTS);
} elseif ($mode == 'do_userlog_delete') {
    if (!empty($_REQUEST['change_id'])) {
        db_query("DELETE FROM ?:reward_point_changes WHERE change_id = ?i", $_REQUEST['change_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "reward_points.userlog?user_id={$_REQUEST['user_id']}");
}
$view->assign('reward_usergroups', fn_array_merge(fn_get_default_usergroups(), fn_get_usergroups('C')));
/** /Body **/