Ejemplo n.º 1
0
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $countries = new Opus_Model_Field('Countries');
     $dateGranted = new Opus_Model_Field('DateGranted');
     $dateGranted->setValueModelClass('Opus_Date');
     $number = new Opus_Model_Field('Number');
     $number->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $yearApplied = new Opus_Model_Field('YearApplied');
     $yearApplied->setValidator(new Opus_Validate_Year());
     $application = new Opus_Model_Field('Application');
     $this->addField($countries)->addField($dateGranted)->addField($number)->addField($yearApplied)->addField($application);
 }
Ejemplo n.º 2
0
 /**
  * Initialize model with the following fields:
  * - AcademicTitle
  * - Email
  * - FirstName
  * - LastName
  *
  * @return void
  */
 protected function _init()
 {
     $title = new Opus_Model_Field('AcademicTitle');
     $first_name = new Opus_Model_Field('FirstName');
     $last_name = new Opus_Model_Field('LastName');
     $last_name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $date_of_birth = new Opus_Model_Field('DateOfBirth');
     $date_of_birth->setValueModelClass('Opus_Date');
     $place_of_birth = new Opus_Model_Field('PlaceOfBirth');
     $email = new Opus_Model_Field('Email');
     $email->setValidator(new Zend_Validate_EmailAddress());
     $identifier_orcid = new Opus_Model_Field('IdentifierOrcid');
     $identifier_gnd = new Opus_Model_Field('IdentifierGnd');
     $identifier_misc = new Opus_Model_Field('IdentifierMisc');
     $this->addField($title)->addField($first_name)->addField($last_name)->addField($date_of_birth)->addField($place_of_birth)->addField($identifier_orcid)->addField($identifier_gnd)->addField($identifier_misc)->addField($email);
 }
Ejemplo n.º 3
0
 /**
  * Add an field to the model. If a field with the same name has already been added,
  * it will be replaced by the given field.
  *
  * @param Opus_Model_Field $field Field instance that gets appended to the models field collection.
  * @return Opus_Model_Abstract Provide fluent interface.
  */
 public function addField(Opus_Model_Field $field)
 {
     $fieldname = $field->getName();
     if (isset($fieldname, $this->_externalFields[$fieldname])) {
         $options = $this->_externalFields[$fieldname];
         // set ValueModelClass if a through option is given
         if (isset($options['model'])) {
             $field->setValueModelClass($options['model']);
         }
         // set LinkModelClass if a through option is given
         if (isset($options['through'])) {
             $field->setLinkModelClass($options['through']);
         }
         // set SortOrderField, if a "sort_field" option is given.
         if (isset($options['sort_field'])) {
             $field->setSortFieldName($options['sort_field']);
         }
     }
     return parent::addField($field);
 }
Ejemplo n.º 4
0
 /**
  * Initialize model with the following fields:
  * - PathName
  * - Label
  * - FileType
  * - MimeType
  * - Language
  *
  * @return void
  */
 protected function _init()
 {
     $filepathname = new Opus_Model_Field('PathName');
     $filepathname->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $filelabel = new Opus_Model_Field('Label');
     $filecomment = new Opus_Model_Field('Comment');
     $mimetype = new Opus_Model_Field('MimeType');
     $filelanguage = new Opus_Model_Field('Language');
     if (Zend_Registry::isRegistered('Available_Languages') === true) {
         $filelanguage->setDefault(Zend_Registry::get('Available_Languages'));
     }
     $filelanguage->setSelection(true);
     $tempfile = new Opus_Model_Field('TempFile');
     $server_date_submitted = new Opus_Model_Field('ServerDateSubmitted');
     $server_date_submitted->setValueModelClass('Opus_Date');
     $sortOrder = new Opus_Model_Field('SortOrder');
     $filesize = new Opus_Model_Field('FileSize');
     $filesize->setMandatory(true);
     $visible_in_frontdoor = new Opus_Model_Field('VisibleInFrontdoor');
     $visible_in_oai = new Opus_Model_Field('VisibleInOai');
     $hashvalue = new Opus_Model_Field('HashValue');
     $hashvalue->setMandatory(true)->setMultiplicity('*');
     $this->addField($filepathname)->addField($filelabel)->addField($filecomment)->addField($mimetype)->addField($filelanguage)->addField($tempfile)->addField($filesize)->addField($visible_in_frontdoor)->addField($visible_in_oai)->addField($hashvalue)->addField($server_date_submitted)->addField($sortOrder);
 }