示例#1
0
        //						{echo "Rule ".$rule_info['subject']."|".$rule_info['verb']."|".$rule_info['object']." already exists in this project";}break;
        //					case 6:
        //						{echo "Subject of this rule does not exist in this project, a resource must be created/shared before a rule can be added to it";}break;
        //					case 7:
        //						{echo "Permission on rule ".$rule_info['subject']."|".$rule_info['verb']."|".$rule_info['object']." was already requested. The rule administrator must first give you permission on it.";}break;
        //
        //					}
        echo "</font></tr></td>";
    }
}
#project rules
$project_rules = array();
$s3ql = compact('user_id', 'db');
$s3ql['from'] = 'rules';
$s3ql['where']['project_id'] = $_REQUEST['project_id'];
$rules = s3list($s3ql);
if (is_array($rules)) {
    $project_rules = array_map('grab_rule_id', $rules);
}
#Get all the requests
$s3ql = compact('user_id', 'db');
$s3ql['select'] = '*';
$s3ql['from'] = 'requests';
#echo '<pre>';print_r($s3ql);
$allRequests = S3QLaction($s3ql);
#echo $allRequests;
$MyPending = $allRequests;
if (is_array($MyPending)) {
    foreach ($MyPending as $key => $user_request) {
        #those requests taht have nothing to do with this project can go
        if ($user_request['project_id'] != $_REQUEST['project_id']) {
示例#2
0
function delete_project($P)
{
    extract($P);
    if ($db == '') {
        $db = $_SESSION['db'];
    }
    if ($newowner == '') {
        #delete all the classes. These should fall into a cascade of deleting all the instances, which will delete all the statements
        if (!is_array($classes)) {
            $s3ql = compact('user_id', 'db');
            $s3ql['select'] = '*';
            $s3ql['from'] = 'classes';
            $s3ql['where']['project_id'] = $project_id;
            $classes = s3list($s3ql);
        }
        if (!is_array($rules)) {
            $s3ql = compact('user_id', 'db');
            $s3ql['select'] = '*';
            $s3ql['from'] = 'rules';
            $s3ql['where']['project_id'] = $project_id;
            $rules = s3list($s3ql);
        }
        if (is_array($classes)) {
            foreach ($classes as $key => $class_info) {
                if ($class_info['project_id'] == $project_id) {
                    $s3ql = compact('user_id', 'db');
                    $s3ql['delete'] = 'class';
                    $s3ql['where']['class_id'] = $class_info['class_id'];
                    $s3ql['where']['confirm'] = 'yes';
                    $done = S3QLaction($s3ql);
                } else {
                    $s3ql = compact('user_id', 'db');
                    $s3ql['delete'] = 'rule';
                    $s3ql['where']['rule_id'] = $class_info['rule_id'];
                    $s3ql['where']['project_id'] = $project_id;
                }
            }
        }
        $sql = "update s3db_project set project_status = 'I', status = 'I', modified_on = now() where project_id='" . $project_id . "'";
        $db->query($sql, __LINE__, __FILE__);
        $dbdata = get_object_vars($db);
        if ($dbdata['Errno'] == '0') {
            return True;
        }
    } else {
        $sql = "update s3db_project set project_owner='" . $newowner . "' where project_id='" . $project_id . "'";
        $db->query($sql, __LINE__, __FILE__);
        return True;
    }
    return False;
}
示例#3
0
function include_statements1($S)
{
    extract($S);
    if (is_array($instances)) {
        foreach ($instances as $instance_info) {
            $s3ql = compact('db', 'user_id');
            $s3ql['select'] = '*';
            $s3ql['from'] = 'statements';
            $s3ql['where']['instance_id'] = $instance_info['resource_id'];
            #$s3ql['where']['project_id'] = $project_id;
            #$done = S3QLaction($s3ql);
            $done = s3list($s3ql);
            if (is_array($done)) {
                $statements = $done;
                #figure out the classes of the subject and object of the rule_id
                #$statements = include_rule_info($statements, $project_id, $db);
                #$statements = include_button_notes($statements, $project_id, $db);
                $instance_info['stats'] = $done;
            }
            $data[] = $instance_info;
        }
    }
    #echo '<pre>';print_r($data);
    return $data;
}