Example #1
0
    echo 'fail rubric';
    echo $rjson;
    die;
}
$cjson = stripslashes($_POST['cJSON']);
$cobj = json_decode($cjson);
if ($cobj == null) {
    echo 'fail context';
    echo $cjson;
    die;
}
$cURIs = array();
$newContextsGraph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $config);
foreach ($cobj as $key => $newContextObj) {
    $newContext = new Context($newContextObj);
    $newContext->buildPrivateGraph();
    $newCURI = $newContext->uri;
    $newContextsGraph->mergeResourceGraph($newContext->graph);
    if (in_array($key, $robj->rubricMeta[4]->rContexts)) {
        $cURIs[] = urldecode($newCURI);
    }
}
foreach ($robj->rubricMeta[4]->rContexts as $val) {
    if (substr($val, 0, 3) != 'new') {
        $cURIs[] = urldecode($val);
    }
}
$robj->rubricMeta[4]->rContexts = $cURIs;
//build contexts if needed, and get an array of the context URIs to pass to Rubric
$newRubric = new Rubric($robj, $cURIs);
$newRubric->buildGraph();