public function execute($request)
 {
     parent::execute($request);
     $this->dc = new sfDcPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-identifier">', '%2%' => '</a>'))));
         $values['identifier'] = $this->resource->identifier;
         $validatorSchema->title = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Title%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-title">', '%2%' => '</a>'))));
         $values['title'] = $this->resource->getTitle(array('cultureFallback' => true));
         $validatorSchema->repository = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Relation%2% (%3%isLocatedAt%4%) - This is a mandatory element for this resource or one its higher descriptive levels (if part of a collection hierarchy).', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-relation">', '%2%' => '</a>', '%3%' => '<a href="http://dublincore.org/groups/collections/collection-application-profile/#colcldisLocatedAt">', '%4%' => '</a>'))));
         foreach ($this->resource->ancestors->andSelf() as $item) {
             $values['repository'] = $item->repository;
             if (isset($values['repository'])) {
                 break;
             }
         }
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->mods = new sfModsPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
 }
 public function execute($request)
 {
     // run the core informationObject show action commands
     parent::execute($request);
     $this->ead = new sfEadPlugin($this->resource);
     // Create formated publication date
     // todo: use 'published at' date, see issue#902
     $date = strtotime($this->resource->getCreatedAt());
     $this->publicationDate = date('Y', $date) . '-' . date('m', $date) . '-' . date('d', $date);
     // Determine language(s) used in the export
     $this->exportLanguage = sfContext::getInstance()->user->getCulture();
     $this->sourceLanguage = $this->resource->getSourceCulture();
     // Instantiate Object to use in Converting ISO 639-1 language codes to 639-2
     $this->iso639convertor = new fbISO639_Map();
     // Set array with valid EAD level values (see ead.dtd line 2220)
     $this->eadLevels = array('class', 'collection', 'file', 'fonds', 'item', 'otherlevel', 'recordgrp', 'series', 'subfonds', 'subgrp', 'subseries');
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->isad = new sfIsadPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     // Function relations
     $criteria = new Criteria();
     $criteria->add(QubitRelation::OBJECT_ID, $this->resource->id);
     $criteria->addJoin(QubitRelation::SUBJECT_ID, QubitFunction::ID);
     $this->functionRelations = QubitRelation::get($criteria);
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->creators = new QubitValidatorCountable(array('required' => true), array('required' => $this->context->i18n->__('This archival description, or one of its higher levels, %1%requires%2% at least one %3%creator%4%.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#3.2.1">', '%4%' => '</a>'))));
         foreach ($this->resource->ancestors->andSelf()->orderBy('rgt') as $item) {
             $values['creators'] = $item->getCreators();
             if (0 < count($values['creators'])) {
                 break;
             }
         }
         $validatorSchema->dateRange = new QubitValidatorIsadDates(array(), array('invalid' => $this->context->i18n->__('%1%Date(s)%2% - are not consistent with %3%higher levels%2%.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.3">', '%2%' => '</a>', '%3%' => '<a href="%ancestor%">'))));
         $values['dateRange'] = $this->resource;
         $validatorSchema->dates = new QubitValidatorCountable(array('required' => true), array('required' => $this->context->i18n->__('%1%Date(s)%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.3">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%4%' => '</a>'))));
         $values['dates'] = $this->resource->getDates();
         $validatorSchema->extentAndMedium = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Extent and medium%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.5">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%4%' => '</a>'))));
         $values['extentAndMedium'] = $this->resource->getExtentAndMedium(array('cultureFallback' => true));
         $validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%4%' => '</a>'))));
         $values['identifier'] = $this->resource->identifier;
         $this->addField($validatorSchema, 'levelOfDescription');
         $validatorSchema->levelOfDescription->setMessage('forbidden', $this->context->i18n->__('%1%Level of description%2% - Value "%value%" is not consistent with higher levels.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.4">', '%2%' => '</a>')));
         $validatorSchema->levelOfDescription->setMessage('required', $this->context->i18n->__('%1%Level of description%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.4">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%4%' => '</a>')));
         if (isset($this->resource->levelOfDescription)) {
             $values['levelOfDescription'] = $this->resource->levelOfDescription->getName(array('sourceCulture' => true));
         }
         $validatorSchema->title = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Title%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-1#3.1.2">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-1#I.12">', '%4%' => '</a>'))));
         $values['title'] = $this->resource->getTitle(array('cultureFallback' => true));
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->rad = new sfRadPlugin($this->resource);
     if (1 > strlen($title = $this->resource->__toString())) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->dates = new QubitValidatorCountable(array('required' => true), array('required' => $this->context->i18n->__('This archival description requires at least one date.')));
         $values['dates'] = $this->resource->getDates();
         // Dates consistency
         $validatorSchema->dateRange = new QubitValidatorIsadDates(array(), array('invalid' => $this->context->i18n->__('Date(s) - are not consistent with %1%higher levels%2%.', array('%1%' => '<a href="%ancestor%">', '%2%' => '</a>'))));
         $values['dateRange'] = $this->resource;
         $validatorSchema->extentAndMedium = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Physical description - This is a mandatory element.')));
         $values['extentAndMedium'] = $this->resource->getExtentAndMedium(array('cultureFallback' => true));
         $validatorSchema->scopeAndContent = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Scope and content - This is a mandatory element.')));
         $values['scopeAndContent'] = $this->resource->getScopeAndContent(array('cultureFallback' => true));
         $validatorSchema->title = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Title - This is a mandatory element.')));
         $values['title'] = $this->resource->getTitle(array('cultureFallback' => true));
         $this->addField($validatorSchema, 'levelOfDescription');
         $validatorSchema->levelOfDescription->setMessage('forbidden', $this->context->i18n->__('Level of description - Value "%value%" is not consistent with higher levels.'));
         $validatorSchema->levelOfDescription->setMessage('required', $this->context->i18n->__('Level of description - This is a mandatory element.'));
         if (isset($this->resource->levelOfDescription)) {
             $values['levelOfDescription'] = $this->resource->levelOfDescription->getName(array('sourceCulture' => true));
         }
         // Class of materials specific details
         foreach ($this->resource->getMaterialTypes() as $materialType) {
             switch ($materialType->term->getName(array('sourceCulture' => true))) {
                 case 'Architectural drawing':
                     $validatorSchema->statementOfScaleArchitectural = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Statement of scale (architectural) - This is a mandatory element for architectural drawing.')));
                     $values['statementOfScaleArchitectural'] = $this->resource->getPropertyByName('statementOfScaleArchitectural', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     break;
                 case 'Cartographic material':
                     $validatorSchema->statementOfCoordinates = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Statement of coordinates (cartographic) - This is a mandatory element for cartographic material.')));
                     $values['statementOfCoordinates'] = $this->resource->getPropertyByName('statementOfCoordinates', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     $validatorSchema->statementOfProjection = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Statement of projection (cartographic) - This is a mandatory element for cartographic material.')));
                     $values['statementOfProjection'] = $this->resource->getPropertyByName('statementOfProjection', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     $validatorSchema->statementOfScaleCartographic = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Statement of scale (cartographic) - This is a mandatory element for cartographic material.')));
                     $values['statementOfScaleCartographic'] = $this->resource->getPropertyByName('statementOfScaleCartographic', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     break;
                 case 'Philatelic record':
                     $validatorSchema->issuingJurisdictionAndDenomination = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Issuing jurisdiction and denomination (philatelic) - This is a mandatory element for philatelic record.')));
                     $values['issuingJurisdictionAndDenomination'] = $this->resource->getPropertyByName('issuingJurisdictionAndDenomination', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     break;
             }
         }
         if (isset($this->resource->levelOfDescription)) {
             switch ($this->resource->levelOfDescription->getName(array('sourceCulture' => true))) {
                 // Only if top level of description
                 /* Disable custodial history validation temporary (see issue 1984)
                           case 'Series':
                           case 'Fonds':
                           case 'Collection':
                 
                             if (!isset($this->resource->parent->parent))
                             {
                               $validatorSchema->custodialHistory = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Custodial history - This is a mandatory element for top level of description.')));
                               $values['custodialHistory'] = $this->resource->getArchivalHistory(array('cultureFallback' => true));
                             }
                 
                             break;
                           */
                 case 'Item':
                     // No publication events?
                     $isPublication = false;
                     foreach ($this->resource->events as $item) {
                         if (QubitTerm::PUBLICATION_ID == $item->typeId) {
                             $isPublication = true;
                             break;
                         }
                     }
                     if ($isPublication) {
                         $validatorSchema->edition = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Edition statement - This is a mandatory element for published items.')));
                         $values['edition'] = $this->resource->getEdition(array('cultureFallback' => true));
                         $validatorSchema->standardNumber = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Standard number - This is a mandatory element for published items.')));
                         $values['standardNumber'] = $this->resource->getPropertyByName('standardNumber', array('scope' => 'rad'))->getValue(array('cultureFallback' => true));
                     }
             }
         }
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }