コード例 #1
0
ファイル: DocumenttypeParser.php プロジェクト: alexukua/opus4
 /**
  * Allocates member variables of currentElement with found attributes in XML Documenttype for element "field".
  * Parses for top elements "field" and their atrributes.
  * 
  * @param DomElement $field
  * @param Publish_Model_FormElement $currentElement
  * 
  * @return false: field has no attributes
  */
 private function _parseAttributes(DomElement $field, $currentElement)
 {
     if ($field->hasAttributes()) {
         $elementName = $field->getAttribute('name');
         $required = $field->getAttribute('required');
         $formElement = $field->getAttribute('formelement');
         $datatype = $field->getAttribute('datatype');
         $multiplicity = $field->getAttribute('multiplicity');
         if ($datatype === 'Enrichment') {
             if ($this->isValidEnrichmentKey($elementName)) {
                 $elementName = 'Enrichment' . $elementName;
             }
         }
         if ($datatype == 'Collection' || $datatype == 'CollectionLeaf') {
             $collectionRole = $field->getAttribute('root');
             $currentElement->setCollectionRole($collectionRole);
             $currentElement->setCurrentCollectionId();
         }
         $this->zendConformElementName($elementName);
         $currentElement->setElementName($elementName);
         if ($required === 'yes') {
             $currentElement->setRequired(true);
         } else {
             $currentElement->setRequired(false);
         }
         $currentElement->setFormElement($formElement);
         $currentElement->setDatatype($datatype);
         $currentElement->setMultiplicity($multiplicity);
     } else {
         return false;
     }
 }