Beispiel #1
0
function remove_cart()
{
    $prod = $_COOKIE['products'];
    $prod = stripslashes($prod);
    $prod = json_decode($prod, true);
    $key = findKey($prod, 'id', $_POST['item_code']);
    unset($prod[$key]);
    $prod = json_encode($prod);
    setcookie('products', $prod, time() + 2678400, COOKIEPATH, COOKIE_DOMAIN, false);
    header('Content-Type: application/json');
    echo $prod;
    exit;
}
?>
</textarea>
                                </div>
                               
                            </div>
                            <div class="tab-pane" id="tab2">

                                <p>Asigne los permisos al modulo o modulos que le quiera dar acceso a este rol.</p>

                                <!-- BEGIN ACORDEON -->
                                <div id="accordion" class="panel-group">
                                    <?php 
if (!empty($modules)) {
    foreach ($modules as $controller_name => $module) {
        $module_id = !empty($module['module_id']) ? $module['module_id'] : "";
        $selectedModuleKey = findKey($controller_name, !empty($rol_info['modulos']) ? $rol_info['modulos'] : array());
        $selectedModule = !empty($rol_info['modulos']) && !empty($rol_info['modulos'][$selectedModuleKey]) && !empty($rol_info['modulos'][$selectedModuleKey][$controller_name]) ? $rol_info['modulos'][$selectedModuleKey][$controller_name] : array();
        ?>
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <h5 class="panel-title">
                                                <a href="#collapse-<?php 
        echo $controller_name;
        ?>
" data-parent="#accordion" data-toggle="collapse" class="collapsed"><i class="fa fa-minus-circle"></i> Modulo: <?php 
        echo ucwords($module['module_name']);
        ?>
</a>
                                            </h5>
                                        </div>
                                        <div class="panel-collapse collapse" id="collapse-<?php 
Beispiel #3
0
function findKey($array, $keySearch)
{
    foreach ($array as $item) {
        if (isset($item[$keySearch]) && false === findKey($item[$keySearch], $item)) {
            echo 'yes, it exists';
        }
    }
}
Beispiel #4
0
function findKey($array, $suggested_key)
{
    if (isset($array[$suggested_key])) {
        return findKey($array, $suggested_key + 1);
    }
    return $suggested_key;
}