verifyPackage( 'pigeonholes' ); $gBitSystem->verifyPermission( 'p_pigeonholes_view' ); include_once( PIGEONHOLES_PKG_INCLUDE_PATH.'lookup_pigeonholes_inc.php' ); /* If we came in via structure_id redirect to content_id */ if (isset($_REQUEST['structure_id'])) { header("Location:".$gContent->getDisplayUrl()); } $gBitSmarty->assign( 'memberFeedback', $memberFeedback = [] ); // set up structure related stuff global $gStructure; if( !BitBase::verifyId( $gContent->mInfo['root_structure_id'] ) ) { header( "Location:".PIGEONHOLES_PKG_URL."list.php" ); } $gStructure = new LibertyStructure( $gContent->mInfo['root_structure_id'] ); $gStructure->load(); // expunge request if( !empty( $_REQUEST['action'] ) ) { if( $_REQUEST['action'] == 'dismember' && !empty( $_REQUEST['content_id'] ) && !empty( $_REQUEST['parent_id'] ) && $gContent->verifyUpdatePermission() ) { if( $gContent->expungePigeonholeMember( [ 'parent_id' => $_REQUEST['content_id'], 'member_id' => $_REQUEST['parent_id'] ] ) ) { $feedback['success'] = KernelTools::tra( 'The item was successfully removed' ); } else { $feedback['error'] = KernelTools::tra( 'The item could not be removed' ); } } } // confirm that structure is valid if( empty( $gStructure ) || !$gStructure->isValid() ) { $gBitSystem->fatalError( KernelTools::tra( 'Invalid structure' )); } $gBitSmarty->assign( 'gStructure', $gStructure ); $gBitSmarty->assign( 'structureInfo', $gStructure->mInfo ); $gBitSmarty->assign( 'subtree', $gStructure->getSubTree( $gStructure->mStructureId ) ); if( $gContent->checkPathPermissions( $gContent->getField( 'path' ) ) ) { $listHash = [ 'root_structure_id' => $gContent->mInfo['root_structure_id'], 'structure_id' => $gContent->mInfo['structure_id'], 'parse_data' => true, 'max_records' => -1, 'load_extras' => true, 'members_max_records' => -1, ]; $pigeonList = $gContent->getList( $listHash ); $gBitSmarty->assign( 'pigeonList', $pigeonList ); } else { $memberFeedback['warning'] = KernelTools::tra( "You do not have the required permissions to view the content of this category" ); } $gContent->addHit(); // Display the template $gBitSystem->display( 'bitpackage:pigeonholes/view_structure.tpl', KernelTools::tra( 'View Pigeonhole' ) , [ 'display_mode' => 'display' ]); ?>