~slub.team/goobi-presentation/old-bzr-trunk

« back to all changes in this revision

Viewing changes to dlf/hooks/class.tx_dlf_hacks.php

  • Committer: Sebastian Meyer
  • Date: 2012-08-17 07:02:36 UTC
  • mfrom: (82.1.54 Goobi.Presentation 1.1)
  • Revision ID: sebastian.meyer@slub-dresden.de-20120817070236-d6gh9s8l47q9k5j8
Merge changes from Goobi.Presentation CE 1.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
                        $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
57
57
 
58
 
                        if (($_divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]'))) {
59
 
 
60
 
                                $_smLinks = $xml->xpath('//mets:structLink/mets:smLink');
61
 
 
62
 
                                if ($_smLinks) {
63
 
 
64
 
                                        foreach ($_smLinks as $_smLink) {
65
 
 
66
 
                                                $_links[(string) $_smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $_smLink->attributes('http://www.w3.org/1999/xlink')->to;
 
58
                        if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]'))) {
 
59
 
 
60
                                $smLinks = $xml->xpath('//mets:structLink/mets:smLink');
 
61
 
 
62
                                if ($smLinks) {
 
63
 
 
64
                                        foreach ($smLinks as $smLink) {
 
65
 
 
66
                                                $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
67
67
 
68
68
                                        }
69
69
 
70
 
                                        foreach ($_divs as $_div) {
71
 
 
72
 
                                                if (!empty($_links[(string) $_div['ID']])) {
73
 
 
74
 
                                                        $_id = (string) $_div['DMDID'];
 
70
                                        foreach ($divs as $div) {
 
71
 
 
72
                                                if (!empty($links[(string) $div['ID']])) {
 
73
 
 
74
                                                        $id = (string) $div['DMDID'];
75
75
 
76
76
                                                        break;
77
77
 
81
81
 
82
82
                                }
83
83
 
84
 
                                if (empty($_id)) {
 
84
                                if (empty($id)) {
85
85
 
86
 
                                        $_id = (string) $_divs[0]['DMDID'];
 
86
                                        $id = (string) $divs[0]['DMDID'];
87
87
 
88
88
                                }
89
89
 
90
 
                                $_recordId = $xml->xpath('//mets:dmdSec[@ID="'.$_id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
91
 
 
92
 
                                if (!empty($_recordId[0])) {
93
 
 
94
 
                                        return (string) $_recordId[0];
 
90
                                $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
 
91
 
 
92
                                if (!empty($recordIds[0])) {
 
93
 
 
94
                                        return (string) $recordIds[0];
95
95
 
96
96
                                }
97
97