Browse Source

Added additional functionality to CollectionPolicy::getNextPid

pull/63/head
Alan Stanley 13 years ago
parent
commit
33bc8c922e
  1. 5
      CollectionPolicy.inc

5
CollectionPolicy.inc

@ -360,13 +360,14 @@ class CollectionPolicy extends XMLDatastream {
* @param string $dsid * @param string $dsid
* @return string $nextPid * @return string $nextPid
*/ */
public function getNextPid($dsid) { public function getNextPid($dsid, $content_model = null) {
$ret = FALSE; $ret = FALSE;
if (self::valid_dsid($dsid) && $this->validate()) { if (self::valid_dsid($dsid) && $this->validate()) {
$content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model'); $content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model');
$namespace = FALSE; $namespace = FALSE;
for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) { for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) {
if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid)) { if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid) && (strtolower($content_models->item($i)->getAttribute('pid') == $content_model) || $content_model == null)) {
$namespace = $content_models->item($i)->getAttribute('namespace'); $namespace = $content_models->item($i)->getAttribute('namespace');
} }
} }

Loading…
Cancel
Save