add_register("onto_class",true);
if (($gestion_acces_active == 1) && (($gestion_acces_empr_contribution_area == 1) || ($gestion_acces_empr_contribution_scenario == 1))) {
$ac = new acces();
if ($gestion_acces_empr_contribution_area == 1) {
$dom_4 = $ac->setDomain(4);
}
if ($gestion_acces_empr_contribution_scenario == 1) {
$dom_5 = $ac->setDomain(5);
}
}
if ($sub == 'area') {
if (isset($dom_4) && !$dom_4->getRights($_SESSION['id_empr_session'],$id, 4)) {
print $msg['empr_contribution_area_unauthorized'];
return false;
}
$contribution = new contribution_area($id);
$start_scenarios = $contribution->get_start_scenarios();
if (count($start_scenarios) == 1) {
// S'il n'y a qu'un seul scénario dans l'espace, on l'affiche directement
$sub = 'scenario';
$scenario = $start_scenarios[0]['id'];
$contribution_url = "./index.php?lvl=contribution_area&sub=".$sub."&id=".$id."&scenario=".$scenario;
print '';
}
}
if ($sub == 'scenario') {
if (isset($dom_4) && !$dom_4->getRights($_SESSION['id_empr_session'], $id, 4)) {
print $msg['empr_contribution_area_unauthorized'];
return false;
}
if (isset($dom_5) && !$dom_5->getRights($_SESSION['id_empr_session'], onto_common_uri::get_id('http://www.pmbservices.fr/ca/Scenario#'.$scenario), 4)) {
print $msg['empr_contribution_area_unauthorized'];
return false;
}
$contribution_area_scenario = new contribution_area_scenario($scenario,$id);
$scenario_forms = $contribution_area_scenario->get_forms();
if (count($scenario_forms) == 1) {
// S'il n'y a qu'un seul formulaire dans le scénario, on l'affiche directement
$sub = $scenario_forms[0]['entityType'];
$area_id = $id;
$form_id = $scenario_forms[0]['formId'];
$form_uri = $scenario_forms[0]['id'];
$id = 0;
$contribution_url = "./index.php?lvl=contribution_area&sub=".$sub."&area_id=".$area_id."&scenario=".$scenario."&form_id=".$form_id."&form_uri=".$form_uri."&id=".$id;
print '';
}
}
if ($id_empr) {
switch ($sub) {
case 'area' :
print $contribution->render();
break;
case 'scenario' :
print $contribution_area_scenario->render();
break;
case 'attachment' :
global $attachment, $area_id;
$contribution_area_attachment = new contribution_area_attachment($attachment,$area_id);
print $contribution_area_attachment->render();
break;
case 'convert' :
print contribution_area_form::get_form_entity_convert();
break;
case 'edit_contribution' :
case 'scenario_child' :
global $sub_form, $entity_type, $entity;
$edit_entity = false;
if (!empty($entity) && $entity) {
// on modifie une entité du fonds
$edit_entity = true;
}
$contribution_area_scenario = new contribution_area_scenario($scenario,$area_id);
$scenario_forms = $contribution_area_scenario->get_forms($edit_entity);
if (count($scenario_forms) > 1 && 'scenario_child' == $sub) {
print $contribution_area_scenario->sub_render();
break;
}
// On a qu'un seul formulaire on passe dans le default.
$area_id = $scenario_forms[0]['area_id'];
$form_id = $scenario_forms[0]['formId'];
$form_uri = $scenario_forms[0]['id'];
if ($edit_entity) {
$sub = $entity_type;
} else {
$sub = $scenario_forms[0]['entityType'];
}
$sub_form = 1;
default :
global $lvl_redirect, $action, $unauthorized_ids;
$contribution_area_store = new contribution_area_store();
// Si on a aucun id on fait la redirection
if (empty($id) && in_array($action, array('push', 'delete'))) {
echo $msg['empr_contribution_area_unauthorized'];
echo '';
break;
}
$ids = explode(',', $id);
$count_ids = count($ids);
foreach ($ids as $key => $id) {
$id = intval($id);
// Si on a un identifiant pmb on interdit la modification de l'entitée
if ($contribution_area_store->get_pmb_identifier_from_uri_id($id) != 0) {
$id = 0;
}
$uri = onto_common_uri::get_uri($id);
if ($action == "delete" && empty($uri) && $id != 0) {
if ($count_ids > 1) {
continue;
}else{
print "";
}
}
$infos = $contribution_area_store->get_properties_from_uri($uri);
$params = new onto_param(array(
'base_resource' => 'index.php',
'lvl' => 'contribution_area',
'sub' => '',
'action' => 'edit',
'page' => '1',
'nb_per_page' => (isset($nb_per_page) ? $nb_per_page : 20),
'id' => $id,
'area_id' => (!empty($infos['area']) ? $infos['area'] : ""),
'parent_id' => '',
'form_id' => '',
'form_uri' => '',
'item_uri' => '',
));
if (isset($dom_4) && !$dom_4->getRights($_SESSION['id_empr_session'], $params->area_id, 4)) {
print $msg['empr_contribution_area_unauthorized'];
return false;
}
$form = contribution_area_form::get_contribution_area_form($params->sub,$params->form_id,$params->area_id,$params->form_uri);
$onto_store_config = array(
/* db */
'db_name' => DATA_BASE,
'db_user' => USER_NAME,
'db_pwd' => USER_PASS,
'db_host' => SQL_SERVER,
/* store */
'store_name' => 'onto_contribution_form_' . $form_id,
/* stop after 100 errors */
'max_errors' => 100,
'store_strip_mb_comp_str' => 0,
'params' => $form->get_active_properties()
);
$onto_store = new onto_store_arc2_extended($onto_store_config);
$onto_store->set_namespaces(contribution_area_store::CONTRIBUTION_NAMESPACE);
//chargement de l'ontologie dans son store
$reset = $onto_store->load($class_path."/rdf/ontologies_pmb_entities.rdf", onto_parametres_perso::is_modified());
onto_parametres_perso::load_in_store($onto_store, $reset);
$onto_ui = new onto_ui("", $onto_store, array(), "arc2", contribution_area_store::DATASTORE_CONFIG, contribution_area_store::CONTRIBUTION_NAMESPACE,'http://www.w3.org/2000/01/rdf-schema#label',$params);
$last_item = false;
if ($key == $count_ids-1) {
$last_item = true;
}
$onto_ui->proceed($last_item);
}
break;
}
} else {
if ($iframe) {
print '{ "session_expired" : "'.sprintf($msg['session_expired'], round($opac_duration_session_auth / 60)).'"}';
} else {
print sprintf($msg['session_expired'], round($opac_duration_session_auth / 60));
}
}