Ejemplo n.º 1
0
function generate_table($table)
{
    extract($table);
    if ($project_id == '') {
        $project_id = $project_info['project_id'];
    }
    $R = array('db' => $db, 'project_id' => $project_id, 'subject' => $resource_info['entity'], 'object' => '!=UID');
    $rules = list_shared_rules($R);
    ###Fetch all the objects and all of the verbs to create the header
    if (empty($_SESSION['show_me'])) {
        if (is_array($rules)) {
            $verbs = array_map('grab_verb', $rules);
        }
    } else {
        $verbs = array_map('grab_verb', $_SESSION['show_me']);
    }
    $total_objects = 0;
    if (is_array($verbs)) {
        foreach ($verbs as $i => $value) {
            #Make a new query on rules, this time to find the object that has this specific verb
            if (empty($_SESSION['show_me'])) {
                $objects = array_map('grab_object', $rules, $verbs);
            } else {
                $objects = array_map('grab_object', $_SESSION['show_me'], $verbs);
            }
            $total_objects += count($objects);
        }
    }
    $total_objects += 2;
    $All = array('db' => $db, 'entity' => $resource_info['entity'], 'project_id' => $project_id, 'rules' => $rules, 'verbs' => $verbs, 'objects' => $objects, 'format' => 'html', 'color' => 'on');
    #Create the html part of the table
    #$out = sprintf("%s\n", '<table width=100% border=1 style="border-collapse: collapse;">');
    $out .= sprintf("%s\n", '	<tr><td colspan="' . $total_objects . '">Data of ' . $entity . ' (Project: ' . $project['name'] . ')</td></tr>');
    $out .= sprintf("%s\n", '	<tr><td colspan="' . $total_objects . '">Page ' . $_SESSION['current_page'] . '</td></tr>');
    $out .= create_datamatrix_header($All);
    $out .= render_datamatrix_values($All);
    #$out.= sprintf("%s\n", '</table>');
    return $out;
}
Ejemplo n.º 2
0
function find_object_info($object, $project_id)
{
    $shared_rules = list_shared_rules($project_id, '', $object);
    #echo '<pre>'.$object;print_r($shared_rules);
    #When looking at the shared rules, find which one hve UID as object, those are the ones that are reosurces
    if ($object == $shared_rules[0]['subject']) {
        return $shared_rules[0];
    }
}