コード例 #1
0
ファイル: Licence.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Active
  * - CommentInternal
  * - DescMarkup
  * - DescText
  * - Language
  * - LinkLicence
  * - LinkLogo
  * - LinkSign
  * - MimeType
  * - NameLong
  * - PodAllowed
  * - SortOrder
  *
  * @return void
  */
 protected function _init()
 {
     $active = new Opus_Model_Field('Active');
     $active->setCheckbox(true);
     $comment_internal = new Opus_Model_Field('CommentInternal');
     $comment_internal->setTextarea(true);
     $desc_markup = new Opus_Model_Field('DescMarkup');
     $desc_markup->setTextarea(true);
     $desc_text = new Opus_Model_Field('DescText');
     $desc_text->setTextarea(true);
     $licence_language = new Opus_Model_Field('Language');
     if (Zend_Registry::isRegistered('Available_Languages') === true) {
         $licence_language->setDefault(Zend_Registry::get('Available_Languages'));
     }
     $licence_language->setSelection(true);
     $licence_language->setMandatory(true);
     $link_licence = new Opus_Model_Field('LinkLicence');
     $link_licence->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $link_logo = new Opus_Model_Field('LinkLogo');
     $link_sign = new Opus_Model_Field('LinkSign');
     $mime_type = new Opus_Model_Field('MimeType');
     $name_long = new Opus_Model_Field('NameLong');
     $name_long->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $sort_order = new Opus_Model_Field('SortOrder');
     $pod_allowed = new Opus_Model_Field('PodAllowed');
     $pod_allowed->setCheckbox(true);
     $this->addField($active)->addField($comment_internal)->addField($desc_markup)->addField($desc_text)->addField($licence_language)->addField($link_licence)->addField($link_logo)->addField($link_sign)->addField($mime_type)->addField($name_long)->addField($sort_order)->addField($pod_allowed);
 }
コード例 #2
0
ファイル: HashValues.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - HashType
  * - HashValue
  *
  * @return void
  */
 protected function _init()
 {
     $hashtype = new Opus_Model_Field('Type');
     $hashtype->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $hashvalue = new Opus_Model_Field('Value');
     $hashvalue->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($hashtype)->addField($hashvalue);
 }
コード例 #3
0
ファイル: Note.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $message = new Opus_Model_Field('Message');
     $message->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setTextarea(true);
     $visibility = new Opus_Model_Field('Visibility');
     $visibility->setValidator(new Opus_Validate_NoteVisibility())->setDefault(array('private' => 'private', 'public' => 'public'))->setSelection(true);
     $this->addField($visibility)->addField($message);
 }
コード例 #4
0
ファイル: Identifier.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Value
  * - Label
  *
  * @return void
  */
 protected function _init()
 {
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($value);
     $type = new Opus_Model_Field('Type');
     $type->setMandatory(true)->setSelection(true)->setValidator(new Zend_Validate_NotEmpty())->setDefault(array('old' => 'old', 'serial' => 'serial', 'uuid' => 'uuid', 'isbn' => 'isbn', 'urn' => 'urn', 'doi' => 'doi', 'handle' => 'handle', 'url' => 'url', 'issn' => 'issn', 'std-doi' => 'std-doi', 'cris-link' => 'cris-link', 'splash-url' => 'splash-url', 'opus3-id' => 'opus3-id', 'opac-id' => 'opac-id', 'pmid' => 'pmid', 'arxiv' => 'arxiv'));
     $this->addField($type);
 }
コード例 #5
0
ファイル: Enrichment.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - KeyName
  * - Value
  *
  * @return void
  */
 protected function _init()
 {
     $key = new Opus_Model_Field('KeyName');
     $key->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setSelection(true)->setDefault(Opus_EnrichmentKey::getAll());
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($key);
     $this->addField($value);
 }
コード例 #6
0
ファイル: Job.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $label = new Opus_Model_Field('Label');
     $label->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $state = new Opus_Model_Field('State');
     $data = new Opus_Model_Field('Data');
     $errors = new Opus_Model_Field('Errors');
     $this->addField($label)->addField($state)->addField($data)->addField($errors);
 }
コード例 #7
0
ファイル: Iprange.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - staringip
  * - endingip
  * - Name
  *
  * @return void
  */
 protected function _init()
 {
     $startingip = new Opus_Model_Field('Startingip');
     $endingip = new Opus_Model_Field('Endingip');
     $name = new Opus_Model_Field('Name');
     $role = new Opus_Model_Field('Role');
     $startingip->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_IP));
     $endingip->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_IP));
     $role->setMultiplicity('*')->setDefault(Opus_UserRole::getAll())->setSelection(true);
     $this->addField($startingip)->addField($endingip)->addField($name)->addField($role);
 }
コード例 #8
0
ファイル: SubjectSwd.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Language
  * - Type
  * - Value
  * - External key
  *
  * @return void
  */
 protected function _init()
 {
     $language = new Opus_Model_Field('Language');
     $type = new Opus_Model_Field('Type');
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $externalKey = new Opus_Model_Field('ExternalKey');
     $this->addField($language)->addField($type)->addField($value)->addField($externalKey);
     $this->_primaryTableRow->language = 'deu';
     $this->_primaryTableRow->type = 'swd';
 }
コード例 #9
0
ファイル: Patent.php プロジェクト: alexukua/opus4
 /**
  * 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);
 }
コード例 #10
0
ファイル: Series.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with fields.
  *
  * @return void
  */
 protected function _init()
 {
     $title = new Opus_Model_Field('Title');
     $title->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $infobox = new Opus_Model_Field('Infobox');
     $infobox->setTextarea(true);
     $visible = new Opus_Model_Field('Visible');
     $visible->setCheckbox(true);
     $sortOrder = new Opus_Model_Field('SortOrder');
     $sortOrder->setValidator(new Zend_Validate_Int());
     $this->addField($title)->addField($infobox)->addField($visible)->addField($sortOrder);
 }
コード例 #11
0
ファイル: DocumentSeries.php プロジェクト: alexukua/opus4
 /**
  * Initialize model
  *
  * @return void
  */
 protected function _init()
 {
     $modelClass = $this->_modelClass;
     if (is_null($this->getId()) === false) {
         $this->setModel(new $modelClass($this->_primaryTableRow->{$this->_modelKey}));
     }
     $number = new Opus_Model_Field('Number');
     $number->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($number);
     $docSortOrder = new Opus_Model_Field('DocSortOrder');
     $this->addField($docSortOrder);
 }
コード例 #12
0
ファイル: DateTimestamp.php プロジェクト: alexukua/opus4
 /**
  * Initialize model by adding the corresponding fields
  * Year, Month, Day, Hour, Minute, Second, Timezone, and UnixTimestamp.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array('Year', 'Month', 'Day', 'Hour', 'Minute', 'Second');
     foreach ($fields as $fieldName) {
         $field = new Opus_Model_Field($fieldName);
         $field->setValidator(new Zend_Validate_Int());
         $this->addField($field);
     }
     $field = new Opus_Model_Field('Timezone');
     $this->addField($field);
     $field = new Opus_Model_Field('UnixTimestamp');
     $this->addField($field);
 }
コード例 #13
0
ファイル: Language.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with fields.
  *
  * @return void
  */
 protected function _init()
 {
     $part2B = new Opus_Model_Field('Part2B');
     $part2T = new Opus_Model_Field('Part2T');
     $part2T->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $part1 = new Opus_Model_Field('Part1');
     $scope = new Opus_Model_Field('Scope');
     $type = new Opus_Model_Field('Type');
     $ref_name = new Opus_Model_Field('RefName');
     $ref_name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $comment = new Opus_Model_Field('Comment');
     $active = new Opus_Model_Field('Active');
     $active->setCheckbox(true);
     $this->addField($part2B)->addField($part2T)->addField($part1)->addField($scope)->addField($type)->addField($ref_name)->addField($comment)->addField($active);
 }
コード例 #14
0
ファイル: Title.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $language = new Opus_Model_Field('Language');
     if (Zend_Registry::isRegistered('Available_Languages') === true) {
         $language->setDefault(Zend_Registry::get('Available_Languages'));
     }
     $language->setSelection(true);
     $language->setMandatory(true);
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setTextarea(true);
     $type = new Opus_Model_Field('Type');
     $type->setMandatory(false);
     $type->setSelection(true);
     $type->setDefault(array('main' => 'main', 'parent' => 'parent', 'sub' => 'sub', 'additional' => 'additional'));
     $this->addField($language)->addField($value)->addField($type);
 }
コード例 #15
0
ファイル: Person.php プロジェクト: alexukua/opus4
 /**
  * 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);
 }
コード例 #16
0
ファイル: Subject.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Language
  * - Type
  * - Value
  * - External key
  *
  * @return void
  */
 protected function _init()
 {
     $language = new Opus_Model_Field('Language');
     if (Zend_Registry::isRegistered('Available_Languages') === true) {
         $language->setDefault(Zend_Registry::get('Available_Languages'));
     }
     $language->setSelection(true);
     $language->setMandatory(true);
     $type = new Opus_Model_Field('Type');
     $type->setMandatory(true);
     $type->setSelection(true);
     $type->setDefault(array('swd' => 'swd', 'psyndex' => 'psyndex', 'uncontrolled' => 'uncontrolled'));
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $externalKey = new Opus_Model_Field('ExternalKey');
     $this->addField($language)->addField($type)->addField($value)->addField($externalKey);
 }
コード例 #17
0
ファイル: Reference.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Value
  * - Label
  *
  * @return void
  */
 protected function _init()
 {
     $value = new Opus_Model_Field('Value');
     $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $label = new Opus_Model_Field('Label');
     $label->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $relation = new Opus_Model_Field('Relation');
     $relation->setMandatory(false);
     $relation->setSelection(true);
     $relation->setDefault(array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other'));
     $type = new Opus_Model_Field('Type');
     $type->setMandatory(false);
     // TODO change later
     $type->setSelection(true);
     $type->setDefault(array('isbn' => 'isbn', 'urn' => 'urn', 'doi' => 'doi', 'handle' => 'handle', 'url' => 'url', 'issn' => 'issn', 'std-doi' => 'std-doi', 'cris-link' => 'cris-link', 'splash-url' => 'splash-url', 'opus4-id' => 'opus4-id'));
     $this->addField($value);
     $this->addField($label);
     $this->addField($relation);
     $this->addField($type);
 }
コード例 #18
0
ファイル: UserRole.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Name
  *
  * @return void
  */
 protected function _init()
 {
     $name = new Opus_Model_Field('Name');
     $name->setMandatory(true);
     $this->addField($name);
 }
コード例 #19
0
ファイル: Account.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Username
  * - Password
  *
  * @return void
  */
 protected function _init()
 {
     $login = new Opus_Model_Field('Login');
     $loginValidator = new Zend_Validate();
     $loginValidator->addValidator(new Zend_Validate_Regex('/^[A-Za-z0-9@._-]+$/'));
     $login->setValidator($loginValidator)->setMandatory(true);
     $password = new Opus_Model_Field('Password');
     $password->setMandatory(true);
     $email = new Opus_Model_Field('Email');
     $emailValidator = new Zend_Validate();
     $emailValidator->addValidator(new Zend_Validate_EmailAddress());
     $email->setMandatory(true);
     $first_name = new Opus_Model_Field('FirstName');
     $last_name = new Opus_Model_Field('LastName');
     $role = new Opus_Model_Field('Role');
     $role->setMultiplicity('*');
     $role->setSelection(true);
     $this->addField($login)->addField($password)->addField($email)->addField($first_name)->addField($last_name)->addField($role);
 }
コード例 #20
0
ファイル: CollectionRole.php プロジェクト: alexukua/opus4
 /**
  * Initialize model.
  * 
  * @return void
  */
 protected function _init()
 {
     // Attributes, which are defined by the database schema.
     $name = new Opus_Model_Field('Name');
     $name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($name);
     $oaiName = new Opus_Model_Field('OaiName');
     $oaiName->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($oaiName);
     $position = new Opus_Model_Field('Position');
     $this->addField($position);
     // Attributes for defining visibility.
     $visible = new Opus_Model_Field('Visible');
     $visible->setCheckbox(true);
     $this->addField($visible);
     $visibleBrowsingStart = new Opus_Model_Field('VisibleBrowsingStart');
     $visibleBrowsingStart->setCheckbox(true);
     $this->addField($visibleBrowsingStart);
     $visibleFrontdoor = new Opus_Model_Field('VisibleFrontdoor');
     $visibleFrontdoor->setCheckbox(true);
     $this->addField($visibleFrontdoor);
     $visibleOai = new Opus_Model_Field('VisibleOai');
     $visibleOai->setCheckbox(true);
     $this->addField($visibleOai);
     // Attributes for defining output formats.
     $displayBrowsing = new Opus_Model_Field('DisplayBrowsing');
     $this->addField($displayBrowsing);
     $displayFrontdoor = new Opus_Model_Field('DisplayFrontdoor');
     $this->addField($displayFrontdoor);
     // Field to be removed.  See ticket OPUSVIER-2155.
     $displayOai = new Opus_Model_Field('DisplayOai');
     $this->addField($displayOai);
     // Virtual attributes, which depend on other tables.
     $rootCollection = new Opus_Model_Field('RootCollection');
     $this->addField($rootCollection);
 }
コード例 #21
0
ファイル: Version2.php プロジェクト: alexukua/opus4
 /**
  * Map field information to a DOMDocument.
  *
  * @param Opus_Model_Field $field    Contains informations about mapping field.
  * @param DOMDocument      $dom      General DOM document.
  * @param DOMNode          $rootNode Node where to add created structure.
  * @return void
  *
  * FIXME: remove code duplication (duplicates Opus_Model_Xml_Version*)
  */
 protected function _mapField(Opus_Model_Field $field, DOMDocument $dom, DOMNode $rootNode)
 {
     $fieldName = $field->getName();
     $modelClass = $field->getValueModelClass();
     $fieldValues = $field->getValue();
     if (true === $this->_config->_excludeEmpty) {
         if (true === is_null($fieldValues) or is_string($fieldValues) && trim($fieldValues) == '' or is_array($fieldValues) && empty($fieldValues)) {
             return;
         }
     }
     if (null === $modelClass) {
         // create a new element
         $element = $dom->createElement($fieldName);
         // workaround for simple fields with multiple values
         if (true === $field->hasMultipleValues()) {
             $fieldValues = implode(',', $fieldValues);
         }
         if ($fieldValues instanceof DateTimeZone) {
             $fieldValues = $fieldValues->getName();
         }
         // set value
         //if (empty($fieldValues) === false)
         $element->nodeValue = htmlspecialchars($fieldValues);
         $rootNode->appendChild($element);
     } else {
         if (!is_array($fieldValues)) {
             $fieldValues = array($fieldValues);
         }
         foreach ($fieldValues as $value) {
             $childNode = $dom->createElement($fieldName);
             $rootNode->appendChild($childNode);
             // if a field has no value then is nothing more to do
             // TODO maybe must be there an other solution
             // FIXME remove code duplication (duplicates Opus_Model_Xml_Version*)
             if (is_null($value)) {
                 continue;
             }
             // delivers a URI if a mapping for the given model exists
             $uri = $this->_createXlinkRef($value);
             if (null !== $uri) {
                 $childNode->setAttribute('xlink:type', 'simple');
                 $childNode->setAttribute('xlink:href', $uri);
                 $this->_mapAttributes($value, $dom, $childNode, true);
             } else {
                 $this->_mapAttributes($value, $dom, $childNode);
             }
         }
     }
 }
コード例 #22
0
ファイル: AbstractDb.php プロジェクト: alexukua/opus4
 /**
  * Implements adder mechanism.
  *
  * @see Opus_Model_Abstract::_addFieldValue()
  */
 protected function _addFieldValue(Opus_Model_Field $field, $value)
 {
     // get Modelclass if model is linked
     $linkmodelclass = $field->getLinkModelClass();
     if (!is_null($linkmodelclass)) {
         // Check if $linkmodelclass is a known class name
         if (class_exists($linkmodelclass) === false) {
             throw new Opus_Model_Exception("Link model class '{$linkmodelclass}' does not exist.");
         }
         if (is_null($value)) {
             throw new InvalidArgumentException('Argument required when adding to a link field.');
         }
         if (!$value instanceof Opus_Model_Dependent_Link_Abstract) {
             $linkmodel = new $linkmodelclass();
             $linkmodel->setModel($value);
             $value = $linkmodel;
         }
     }
     $value = parent::_addFieldValue($field, $value);
     if ($value instanceof Opus_Model_Dependent_Abstract) {
         $value->setParentId($this->getId());
     }
     return $value;
 }
コード例 #23
0
ファイル: Version1.php プロジェクト: alexukua/opus4
 /**
  * Map field information to a DOMDocument.
  *
  * @param Opus_Model_Field $field    Contains informations about mapping field.
  * @param DOMDocument      $dom      General DOM document.
  * @param DOMNode          $rootNode Node where to add created structure.
  * @return void
  *
  * FIXME: remove code duplication (duplicates Opus_Model_Xml_Version*)
  */
 protected function _mapField(Opus_Model_Field $field, DOMDocument $dom, DOMNode $rootNode)
 {
     $fieldName = $field->getName();
     $modelClass = $field->getValueModelClass();
     $fieldValues = $field->getValue();
     if (true === $this->_config->_excludeEmpty) {
         if (true === is_null($fieldValues) or is_string($fieldValues) && trim($fieldValues) == '' or is_array($fieldValues) && empty($fieldValues)) {
             return;
         }
     }
     if (null === $modelClass) {
         // workaround for simple fields with multiple values
         if (true === $field->hasMultipleValues()) {
             $fieldValues = implode(',', $fieldValues);
         }
         if ($fieldValues instanceof DateTimeZone) {
             $fieldValues = $fieldValues->getName();
         }
         // Replace invalid XML-1.0-Characters by UTF-8 replacement character.
         $fieldValues = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]/', "� ", $fieldValues);
         $rootNode->setAttribute($fieldName, $fieldValues);
     } else {
         if (!is_array($fieldValues)) {
             $fieldValues = array($fieldValues);
         }
         foreach ($fieldValues as $value) {
             $childNode = $dom->createElement($fieldName);
             if ($value instanceof Opus_Model_AbstractDb) {
                 if ($value instanceof Opus_Model_Dependent_Link_Abstract) {
                     $modelId = $value->getLinkedModelId();
                 } else {
                     $modelId = $value->getId();
                 }
                 // Ignore compound keys.
                 if (false === is_array($modelId)) {
                     $childNode->setAttribute('Id', $modelId);
                 }
             }
             $rootNode->appendChild($childNode);
             // if a field has no value then is nothing more to do
             // TODO maybe must be there an other solution
             // FIXME remove code duplication (duplicates Opus_Model_Xml_Version*)
             if (is_null($value)) {
                 continue;
             }
             // delivers a URI if a mapping for the given model exists
             $uri = $this->_createXlinkRef($value);
             if (null !== $uri) {
                 $childNode->setAttribute('xlink:type', 'simple');
                 $childNode->setAttribute('xlink:href', $uri);
                 $this->_mapAttributes($value, $dom, $childNode, true);
             } else {
                 $this->_mapAttributes($value, $dom, $childNode);
             }
         }
     }
 }
コード例 #24
0
ファイル: DocumentPerson.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following values:
  * - Institute
  * - Role
  * - SortOrder
  *
  * @return void
  */
 protected function _init()
 {
     $modelClass = $this->_modelClass;
     if (is_null($this->getId()) === false) {
         $this->setModel(new $modelClass($this->_primaryTableRow->{$this->_modelKey}));
     }
     $role = new Opus_Model_Field('Role');
     $role->setSelection(true);
     $role->setMandatory(false);
     // TODO change later maybe
     $role->setDefault(array('advisor' => 'advisor', 'author' => 'author', 'contributor' => 'contributor', 'editor' => 'editor', 'referee' => 'referee', 'other' => 'other', 'translator' => 'translator', 'submitter' => 'submitter'));
     $sortOrder = new Opus_Model_Field('SortOrder');
     $allowEmailContact = new Opus_Model_Field('AllowEmailContact');
     $allowEmailContact->setCheckbox(true);
     $this->addField($role)->addField($sortOrder)->addField($allowEmailContact);
 }
コード例 #25
0
ファイル: Collection.php プロジェクト: alexukua/opus4
 /**
  * Sets up field by analyzing collection content table metadata.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array('Number', 'Name', 'OaiSubset', 'RoleId', 'Role', 'RoleName', 'RoleDisplayFrontdoor', 'RoleVisibleFrontdoor', 'DisplayFrontdoor', 'VisiblePublish');
     foreach ($fields as $field) {
         $field = new Opus_Model_Field($field);
         $this->addField($field);
     }
     $visible = new Opus_Model_Field('Visible');
     $visible->setCheckbox(true);
     $this->addField($visible);
     // Add a field to hold collection specific theme.
     $theme = new Opus_Model_Field('Theme');
     $theme->setSelection(true);
     $this->addField($theme);
     /**
      * External fields.
      */
     $children = new Opus_Model_Field('Children');
     $children->setMultiplicity('*');
     $this->addField($children);
     // Contains the path back to the root node.
     $parents = new Opus_Model_Field('Parents');
     $parents->setMultiplicity('*');
     $this->addField($parents);
     /*
      * Fields used to define the position of new nodes.
      */
     $positionKeys = array('Root', 'FirstChild', 'LastChild', 'NextSibling', 'PrevSibling');
     $positionKey = new Opus_Model_Field('PositionKey');
     $positionKey->setDefault($positionKeys);
     $this->addField($positionKey);
     $positionId = new Opus_Model_Field('PositionId');
     $this->addField($positionId);
     $pending_nodes = new Opus_Model_Field('PendingNodes');
     $pending_nodes->setMultiplicity('*');
     $this->addField($pending_nodes);
 }
コード例 #26
0
ファイル: Document.php プロジェクト: alexukua/opus4
 /**
  * Initialize the document's fields.  The language field needs special
  * treatment to initialize the default values.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array("CompletedDate", "CompletedYear", "ContributingCorporation", "CreatingCorporation", "ThesisDateAccepted", "ThesisYearAccepted", "Edition", "Issue", "Language", "PageFirst", "PageLast", "PageNumber", "PublishedDate", "PublishedYear", "PublisherName", "PublisherPlace", "PublicationState", "ServerDateCreated", "ServerDateModified", "ServerDatePublished", "ServerDateDeleted", "ServerState", "Type", "Volume", "BelongsToBibliography", "EmbargoDate");
     foreach ($fields as $fieldname) {
         if (isset($this->_externalFields[$fieldname])) {
             throw new Exception("Field {$fieldname} exists in _externalFields");
         }
         $field = new Opus_Model_Field($fieldname);
         $this->addField($field);
     }
     foreach (array_keys($this->_externalFields) as $fieldname) {
         $field = new Opus_Model_Field($fieldname);
         $field->setMultiplicity('*');
         $this->addField($field);
     }
     // Initialize available date fields and set up date validator
     // if the particular field is present
     $dateFields = array('ThesisDateAccepted', 'CompletedDate', 'PublishedDate', 'ServerDateCreated', 'ServerDateModified', 'ServerDatePublished', 'ServerDateDeleted', 'EmbargoDate');
     foreach ($dateFields as $fieldName) {
         $this->getField($fieldName)->setValueModelClass('Opus_Date');
     }
     $this->initFieldOptionsForDisplayAndValidation();
 }
コード例 #27
0
ファイル: DnbInstitute.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - name
  * - address
  * - city
  * - phone
  * - dnbContactId
  * - is_grantor
  *
  * @return void
  */
 protected function _init()
 {
     $name = new Opus_Model_Field('Name');
     $name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $department = new Opus_Model_Field('Department');
     $address = new Opus_Model_Field('Address');
     $city = new Opus_Model_Field('City');
     $city->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $phone = new Opus_Model_Field('Phone');
     $dnb_contact_id = new Opus_Model_Field('DnbContactId');
     $is_grantor = new Opus_Model_Field('IsGrantor');
     $is_grantor->setCheckbox(true);
     $is_publisher = new Opus_Model_Field('IsPublisher');
     $is_publisher->setCheckbox(true);
     $this->addField($name)->addField($department)->addField($address)->addField($city)->addField($phone)->addField($dnb_contact_id)->addField($is_grantor)->addField($is_publisher);
 }
コード例 #28
0
ファイル: Abstract.php プロジェクト: alexukua/opus4
 /**
  * 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)
 {
     $this->_fields[$field->getName()] = $field;
     $field->setOwningModelClass(get_class($this));
     return $this;
 }
コード例 #29
0
ファイル: EnrichmentKey.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - Name
  *
  * @return void
  */
 protected function _init()
 {
     $name = new Opus_Model_Field('Name');
     $name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $this->addField($name);
 }
コード例 #30
0
ファイル: File.php プロジェクト: alexukua/opus4
 /**
  * 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);
 }