|
|
|
@ -124,8 +124,7 @@ function islandora_describe_repository($url = NULL) {
|
|
|
|
|
try { |
|
|
|
|
$info = $connection->api->a->describeRepository(); |
|
|
|
|
return $info; |
|
|
|
|
} |
|
|
|
|
catch (RepositoryException $e) { |
|
|
|
|
} catch (RepositoryException $e) { |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -283,8 +282,7 @@ function islandora_get_parents_from_rels_ext(FedoraObject $object) {
|
|
|
|
|
$collections = array_merge( |
|
|
|
|
$object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOfCollection'), |
|
|
|
|
$object->relationships->get(FEDORA_RELS_EXT_URI, 'isMemberOf')); |
|
|
|
|
} |
|
|
|
|
catch (RepositoryException $e) { |
|
|
|
|
} catch (RepositoryException $e) { |
|
|
|
|
// @todo some logging would be nice, not sure what this throws. |
|
|
|
|
return array(); |
|
|
|
|
} |
|
|
|
@ -718,14 +716,17 @@ function islandora_get_allowed_namespaces() {
|
|
|
|
|
function islandora_get_content_models($ignore_system_namespace = TRUE) { |
|
|
|
|
module_load_include('inc', 'islandora', 'includes/utilities'); |
|
|
|
|
$tuque = islandora_get_tuque_connection(); |
|
|
|
|
$query = 'select $object $label from <#ri> |
|
|
|
|
where ($object <fedora-model:label> $label |
|
|
|
|
and ($object <fedora-model:hasModel> <info:fedora/fedora-system:ContentModel-3.0> |
|
|
|
|
or $object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:ContentModelsCollection>) |
|
|
|
|
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) |
|
|
|
|
order by $label'; |
|
|
|
|
$query = 'PREFIX fm: <info:fedora/fedora-system:def/model#> |
|
|
|
|
SELECT ?object ?label |
|
|
|
|
FROM <#ri> |
|
|
|
|
WHERE { |
|
|
|
|
?object fm:hasModel <info:fedora/fedora-system:ContentModel-3.0>; |
|
|
|
|
OPTIONAL{ |
|
|
|
|
?object fm:label ?label |
|
|
|
|
} |
|
|
|
|
}'; |
|
|
|
|
$content_models = array(); |
|
|
|
|
$results = $tuque->repository->ri->itqlQuery($query, 'unlimited'); |
|
|
|
|
$results = $tuque->repository->ri->sparqlQuery($query, 'unlimited'); |
|
|
|
|
foreach ($results as $result) { |
|
|
|
|
$content_model = $result['object']['value']; |
|
|
|
|
$label = $result['label']['value']; |
|
|
|
@ -760,17 +761,25 @@ function islandora_content_model_select_table_form_element($drupal_variable) {
|
|
|
|
|
$allowed[] = trim($namespace); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$options = islandora_get_content_models(TRUE); |
|
|
|
|
$selected = variable_get($drupal_variable, array('')); |
|
|
|
|
foreach ($selected as $cmodel) { |
|
|
|
|
$options = array($cmodel => $options[$cmodel]) + $options; |
|
|
|
|
$defaults = array(); |
|
|
|
|
$options = array(); |
|
|
|
|
$options = $options + islandora_get_content_models(TRUE); |
|
|
|
|
|
|
|
|
|
foreach($options as $option){ |
|
|
|
|
$content_models[$option['pid']] = $option['label']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$selected = array_values(variable_get($drupal_variable, array(''))); |
|
|
|
|
foreach($selected as $selection){ |
|
|
|
|
$content_models = array($selection => $content_models[$selection]) + $content_models; |
|
|
|
|
} |
|
|
|
|
foreach ($options as $key => $value) { |
|
|
|
|
$rows[$key] = array( |
|
|
|
|
'pid' => $key, |
|
|
|
|
'title' => $value, |
|
|
|
|
|
|
|
|
|
foreach ($content_models as $pid => $label) { |
|
|
|
|
$rows[$pid] = array( |
|
|
|
|
'pid' => $pid, |
|
|
|
|
'title' => $label, |
|
|
|
|
); |
|
|
|
|
in_array($key, $selected) ? $defaults[$key] = TRUE : $defaults[$key] = FALSE; |
|
|
|
|
in_array($pid, $selected) ? $defaults[$pid] = TRUE : $defaults[$pid] = FALSE; |
|
|
|
|
} |
|
|
|
|
$header = array( |
|
|
|
|
'pid' => array('data' => t('PID')), |
|
|
|
|