public function process() { $this->informationObject = new QubitInformationObject(); $this->informationObject->parentId = $this->resource->id; $publicationStatus = sfConfig::get('app_defaultPubStatus', QubitTerm::PUBLICATION_STATUS_DRAFT_ID); $this->informationObject->setPublicationStatus($publicationStatus); // Main object if (null != ($dmdSec = $this->getMainDmdSec())) { $this->informationObject = $this->processDmdSec($dmdSec, $this->informationObject); } foreach ($this->getFilesFromDirectory() as $item) { $parts = pathinfo($item); $filename = $parts['basename']; $uuid = $this->getUUID($filename); $child = new QubitInformationObject(); $child->setPublicationStatus($publicationStatus); if (null !== ($dmdSec = $this->searchFileDmdSec($uuid))) { $child = $this->processDmdSec($dmdSec, $child); } $digitalObject = new QubitDigitalObject(); $digitalObject->assets[] = new QubitAsset($filename, file_get_contents($item)); $digitalObject->usageId = QubitTerm::MASTER_ID; $child->digitalObjects[] = $digitalObject; $this->informationObject->informationObjectsRelatedByparentId[] = $child; } $this->informationObject->save(); }
protected function updateChildLevels() { if (is_array($updateChildLevels = $this->request->updateChildLevels) && count($updateChildLevels)) { foreach ($updateChildLevels as $item) { $childLevel = new QubitInformationObject(); $childLevel->identifier = $item['identifier']; $childLevel->title = $item['title']; if (null != ($pubStatus = $this->resource->getPublicationStatus())) { $childLevel->setPublicationStatus($pubStatus->statusId); } if (0 < strlen($item['levelOfDescription']) && null !== QubitTerm::getById($item['levelOfDescription'])) { $childLevel->levelOfDescriptionId = $item['levelOfDescription']; } if (0 < strlen($item['levelOfDescription']) || 0 < strlen($item['identifier']) || 0 < strlen($item['title'])) { $this->resource->informationObjectsRelatedByparentId[] = $childLevel; } } } }
public function execute($request) { $this->form = new sfForm(); $this->resource = $this->getRoute()->resource; if (!QubitAcl::check(QubitInformationObject::getRoot(), 'update')) { QubitAcl::forwardUnauthorized(); } // Create new information object $informationObject = new QubitInformationObject(); $informationObject->setRoot(); // Populate fields $informationObject->title = $this->resource->title; $informationObject->physicalCharacteristics = $this->resource->physicalCharacteristics; $informationObject->scopeAndContent = $this->resource->scopeAndContent; $informationObject->archivalHistory = $this->resource->archivalHistory; // Copy (not link) rights foreach (QubitRelation::getRelationsBySubjectId($this->resource->id, array('typeId' => QubitTerm::RIGHT_ID)) as $item) { $sourceRight = $item->object; $right = new QubitRights(); $right->act = $sourceRight->act; $right->startDate = $sourceRight->startDate; $right->endDate = $sourceRight->endDate; $right->basis = $sourceRight->basis; $right->restriction = $sourceRight->restriction; $right->copyrightStatus = $sourceRight->copyrightStatus; $right->copyrightStatusDate = $sourceRight->copyrightStatusDate; $right->copyrightJurisdiction = $sourceRight->copyrightJurisdiction; $right->statuteNote = $sourceRight->statuteNote; // Right holder if (isset($sourceRight->rightsHolder)) { $right->rightsHolder = $sourceRight->rightsHolder; } // I18n $right->rightsNote = $sourceRight->rightsNote; $right->copyrightNote = $sourceRight->copyrightNote; $right->licenseIdentifier = $sourceRight->licenseIdentifier; $right->licenseTerms = $sourceRight->licenseTerms; $right->licenseNote = $sourceRight->licenseNote; $right->statuteJurisdiction = $sourceRight->statuteJurisdiction; $right->statuteCitation = $sourceRight->statuteCitation; $right->statuteDeterminationDate = $sourceRight->statuteDeterminationDate; foreach ($sourceRight->rightsI18ns as $sourceRightI18n) { if ($this->context->user->getCulture() == $sourceRightI18n->culture) { continue; } $rightI18n = new QubitRightsI18n(); $rightI18n->rightNote = $sourceRightI18n->rightNote; $rightI18n->copyrightNote = $sourceRightI18n->copyrightNote; $rightI18n->licenseIdentifier = $sourceRightI18n->licenseIdentifier; $rightI18n->licenseTerms = $sourceRightI18n->licenseTerms; $rightI18n->licenseNote = $sourceRightI18n->licenseNote; $rightI18n->statuteJurisdiction = $sourceRightI18n->statuteJurisdiction; $rightI18n->statuteCitation = $sourceRightI18n->statuteCitation; $rightI18n->statuteNote = $sourceRightI18n->statuteNote; $rightI18n->culture = $sourceRightI18n->culture; $right->rightsI18ns[] = $rightI18n; } $right->save(); $relation = new QubitRelation(); $relation->object = $right; $relation->typeId = QubitTerm::RIGHT_ID; $informationObject->relationsRelatedBysubjectId[] = $relation; } // Populate creators (from QubitRelation to QubitEvent) foreach (QubitRelation::getRelationsByObjectId($this->resource->id, array('typeId' => QubitTerm::CREATION_ID)) as $item) { $event = new QubitEvent(); $event->actor = $item->subject; $event->typeId = QubitTerm::CREATION_ID; $informationObject->events[] = $event; } // Relationship between the information object and accession record $relation = new QubitRelation(); $relation->object = $this->resource; $relation->typeId = QubitTerm::ACCESSION_ID; $informationObject->relationsRelatedBysubjectId[] = $relation; // Set publication status $informationObject->setPublicationStatus(sfConfig::get('app_defaultPubStatus', QubitTerm::PUBLICATION_STATUS_DRAFT_ID)); $informationObject->save(); $this->redirect(array($informationObject, 'module' => 'informationobject')); }