Пример #1
0
				<?php 
    }
    ?>
               
                 <td>&nbsp;</td>
                 <td>
                        <?php 
    //Place the ACO selector here
    $gacl_temp = new gacl_api();
    $list_aco_objects = $gacl_temp->get_objects(NULL, 0, 'ACO');
    foreach ($list_aco_objects as $key => $value) {
        asort($list_aco_objects[$key]);
    }
    echo "<select name='access_control[" . $index . "]'>";
    foreach ($list_aco_objects as $section => $array_acos) {
        $aco_section_data = $gacl_temp->get_section_data($section, 'ACO');
        $aco_section_title = $aco_section_data[3];
        foreach ($array_acos as $aco) {
            $aco_id = $gacl_temp->get_object_id($section, $aco, 'ACO');
            $aco_data = $gacl_temp->get_object_data($aco_id, 'ACO');
            $aco_title = $aco_data[0][3];
            $select = '';
            if ($rule->access_control() == $section . ":" . $aco) {
                $select = 'selected';
            }
            echo "<option value='" . attr($section) . ":" . attr($aco) . "' " . $select . ">" . xlt($aco_section_title) . ": " . xlt($aco_title) . "</option>";
        }
    }
    echo "</select>";
    ?>
                 </td> 
Пример #2
0
function aco_listings_xml($group, $return_value, $err)
{
    global $phpgacl_location;
    include_once "{$phpgacl_location}/gacl_api.class.php";
    $gacl = new gacl_api();
    //collect and sort all aco objects
    $list_aco_objects = $gacl->get_objects(NULL, 0, 'ACO');
    foreach ($list_aco_objects as $key => $value) {
        asort($list_aco_objects[$key]);
    }
    //collect aco objects within the specified acl(already sorted)
    $acl_id = $gacl->search_acl(FALSE, FALSE, FALSE, FALSE, $group, FALSE, FALSE, FALSE, $return_value);
    $acl = $gacl->get_acl($acl_id[0]);
    $active_aco_objects = $acl["aco"];
    $message = "<?xml version=\"1.0\"?>\n" . "<response>\n" . "\t<inactive>\n";
    foreach ($list_aco_objects as $key => $value) {
        $counter = 0;
        foreach ($list_aco_objects[$key] as $value2) {
            if (!array_key_exists($key, $active_aco_objects) || !in_array($value2, $active_aco_objects[$key])) {
                if ($counter == 0) {
                    $counter = $counter + 1;
                    $aco_section_data = $gacl->get_section_data($key, 'ACO');
                    $aco_section_title = $aco_section_data[3];
                    // Modified 6-2009 by BM - Translate gacl aco section name
                    $message .= "\t\t<section>\n" . "\t\t\t<name>" . xl($aco_section_title) . "</name>\n";
                }
                $aco_id = $gacl->get_object_id($key, $value2, 'ACO');
                $aco_data = $gacl->get_object_data($aco_id, 'ACO');
                $aco_title = $aco_data[0][3];
                $message .= "\t\t\t<aco>\n";
                // Modified 6-2009 by BM - Translate gacl aco name
                $message .= "\t\t\t\t<title>" . xl($aco_title) . "</title>\n";
                $message .= "\t\t\t\t<id>" . $aco_id . "</id>\n";
                $message .= "\t\t\t</aco>\n";
            }
        }
        if ($counter != 0) {
            $message .= "\t\t</section>\n";
        }
    }
    $message .= "\t</inactive>\n" . "\t<active>\n";
    foreach ($active_aco_objects as $key => $value) {
        $aco_section_data = $gacl->get_section_data($key, 'ACO');
        $aco_section_title = $aco_section_data[3];
        // Modified 6-2009 by BM - Translate gacl aco section name
        $message .= "\t\t<section>\n" . "\t\t\t<name>" . xl($aco_section_title) . "</name>\n";
        foreach ($active_aco_objects[$key] as $value2) {
            $aco_id = $gacl->get_object_id($key, $value2, 'ACO');
            $aco_data = $gacl->get_object_data($aco_id, 'ACO');
            $aco_title = $aco_data[0][3];
            $message .= "\t\t\t<aco>\n";
            // Modified 6-2009 by BM - Translate gacl aco name
            $message .= "\t\t\t\t<title>" . xl($aco_title) . "</title>\n";
            $message .= "\t\t\t\t<id>" . $aco_id . "</id>\n";
            $message .= "\t\t\t</aco>\n";
        }
        $message .= "\t\t</section>\n";
    }
    $message .= "\t</active>\n";
    if (isset($err)) {
        foreach ($err as $value) {
            $message .= "\t<error>" . $value . "</error>\n";
        }
    }
    $message .= "</response>\n";
    return $message;
}