|
|
|
@ -28,15 +28,15 @@
|
|
|
|
|
*/ |
|
|
|
|
function islandora_basic_collection_menu() { |
|
|
|
|
$items = array(); |
|
|
|
|
$items['islandora/object/%/edit/collection'] = array( |
|
|
|
|
'title' => 'Manage Collection', |
|
|
|
|
'page callback' => 'islandora_basic_collection_edit_object', |
|
|
|
|
$items['islandora/object/%/manage/collection'] = array( |
|
|
|
|
'title' => 'Collection Related', |
|
|
|
|
'page callback' => 'islandora_basic_collection_manage_object', |
|
|
|
|
'page arguments' => array(2), |
|
|
|
|
'type' => MENU_LOCAL_TASK, |
|
|
|
|
'access callback' => 'islandora_basic_collection_access', |
|
|
|
|
'access arguments' => array(2), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
/* an example of adding a tab for view |
|
|
|
|
$items['islandora/object/%/view/collection'] = array( |
|
|
|
|
'title' => 'Collection View', |
|
|
|
|
'page callback' => 'islandora_basic_collection_view1', |
|
|
|
@ -44,18 +44,20 @@ function islandora_basic_collection_menu() {
|
|
|
|
|
'type' => MENU_LOCAL_TASK, |
|
|
|
|
'access callback' => 'islandora_basic_collection_access', |
|
|
|
|
'access arguments' => array(2), |
|
|
|
|
); |
|
|
|
|
); */ |
|
|
|
|
|
|
|
|
|
return $items; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function islandora_basic_collection_edit_object($object_id){ |
|
|
|
|
return 'Collection CModel edit function '.$object_id; |
|
|
|
|
/** |
|
|
|
|
* This function is where we create the view for the related menu item |
|
|
|
|
* @param type $object_id |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function islandora_basic_collection_manage_object($object_id) { |
|
|
|
|
return 'Collection CModel edit function ' . $object_id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function islandora_basic_collection_view1($object_id){ |
|
|
|
|
return 'A view returned by the Collection cmodel '.$object_id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -64,7 +66,7 @@ function islandora_basic_collection_view1($object_id){
|
|
|
|
|
* @param string $object_id |
|
|
|
|
* @return boolean |
|
|
|
|
*/ |
|
|
|
|
function islandora_basic_collection_access($object_id){ |
|
|
|
|
function islandora_basic_collection_access($object_id) { |
|
|
|
|
module_load_include('inc', 'islandora', 'RestConnection'); |
|
|
|
|
global $user; |
|
|
|
|
try { |
|
|
|
@ -80,15 +82,13 @@ function islandora_basic_collection_access($object_id){
|
|
|
|
|
$models = $fedora_object->models; |
|
|
|
|
$cmodel_list = islandora_basic_collection_islandora_get_types(); |
|
|
|
|
foreach ($fedora_object->models as $model) { |
|
|
|
|
if (isset($cmodel_list[$model])){ |
|
|
|
|
if (isset($cmodel_list[$model])) { |
|
|
|
|
return user_access(FEDORA_MODIFY_STATE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Theme registry function |
|
|
|
|
* We supply a pattern so we can overide templates at the theme level if needed. |
|
|
|
@ -117,7 +117,7 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
|
|
|
|
|
function islandora_basic_collection_islandora_get_types() { |
|
|
|
|
$types = array(); |
|
|
|
|
$types['islandora:collectionCModel'][ISLANDORA_VIEW_HOOK] = TRUE; |
|
|
|
|
$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE; |
|
|
|
|
//$types['islandora:collectionCModel'][ISLANDORA_EDIT_HOOK] = FALSE; |
|
|
|
|
return $types; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|