Browse Source

added constants, redefined menu path

pull/386/head
Alan Stanley 12 years ago
parent
commit
1228a6da6b
  1. 27
      includes/manage_deleted_objects.inc
  2. 3
      islandora.module

27
includes/manage_deleted_objects.inc

@ -214,23 +214,22 @@ function islandora_delete_form_contentmodels(array $form, array &$form_state) {
* array of pids
*/
function islandora_get_deleted_objects($content_models) {
$tuque = islandora_get_tuque_connection();
$repository = $tuque->repository;
$qualifier = '';
$last_content_model = key(array_slice($content_models, -1, 1, TRUE));
foreach ($content_models as $content_model) {
$qualifier .= "\$subject<info:fedora/fedora-system:def/model#hasModel> <info:fedora/$content_model>";
$qualifier .= "\$subject <" . FEDORA_MODEL_URI . "hasModel> <info:fedora/$content_model>";
if ($content_model != $last_content_model) {
$qualifier .= ' or ';
}
}
$tuque = new IslandoraTuque();
$repository = $tuque->repository;
$query = <<<STRING
select \$subject \$title \$object from <#ri>
where ($qualifier)
and \$subject <info:fedora/fedora-system:def/model#state> <info:fedora/fedora-system:def/model#Deleted>
and \$subject<info:fedora/fedora-system:def/model#hasModel> \$object
and \$subject <dc:title> \$title
STRING;
$query = "select \$subject \$title \$object from <#ri>";
$query .= "where ($qualifier)";
$query .= "and \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>";
$query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object ";
$query .= "and \$subject <dc:title> \$title";
$objects = $repository->ri->itqlQuery($query, 'unlimited');
$deleted_objects = array();
foreach ($objects as $object) {
@ -257,12 +256,10 @@ function islandora_get_contentmodels_with_deleted_members() {
$tuque = new IslandoraTuque();
$repository = $tuque->repository;
$query = <<<STRING
select \$object from <#ri>
where \$subject <info:fedora/fedora-system:def/model#state> <info:fedora/fedora-system:def/model#Deleted>
and \$subject<info:fedora/fedora-system:def/model#hasModel> \$object
$query = "select \$object from <#ri>";
$query .= "where \$subject <" . FEDORA_MODEL_URI . "state> <" . FEDORA_MODEL_URI . "Deleted>";
$query .= "and \$subject<" . FEDORA_MODEL_URI . "hasModel> \$object";
STRING;
$objects = $repository->ri->itqlQuery($query, 'unlimited');
$content_models = array();
foreach ($objects as $object) {

3
islandora.module

@ -305,7 +305,8 @@ function islandora_menu() {
'access arguments' => array('administer site configuration'),
'type' => MENU_CALLBACK,
);
$items['restore/islandora'] = array(
$items['admin/islandora/restore'] = array(
'description' => 'Restore or permanantly remove objects with Deleted status',
'title' => 'Manage Deleted Objects',
'file' => 'includes/manage_deleted_objects.inc',
'page callback' => 'drupal_get_form',

Loading…
Cancel
Save