コード例 #1
0
 /**
  * Should be transfered in Docman_Metadata
  * @param DOMDocument $doc
  * @return DOMNode
  */
 public function getMetadataDef(DOMDocument $doc)
 {
     $propdefs = $doc->createElement('propdefs');
     $mdFactory = new Docman_MetadataFactory($this->groupId);
     foreach ($mdFactory->getRealMetadataList() as $metadata) {
         $propdef = $doc->createElement('propdef');
         $propdef->setAttribute('name', $metadata->getName());
         switch ($metadata->getType()) {
             case PLUGIN_DOCMAN_METADATA_TYPE_TEXT:
                 $type = 'text';
                 break;
             case PLUGIN_DOCMAN_METADATA_TYPE_STRING:
                 $type = 'string';
                 break;
             case PLUGIN_DOCMAN_METADATA_TYPE_DATE:
                 $type = 'date';
                 break;
             case PLUGIN_DOCMAN_METADATA_TYPE_LIST:
                 $type = 'list';
                 break;
         }
         $propdef->setAttribute('type', $type);
         $propdef->setAttribute('multivalue', $metadata->getIsMultipleValuesAllowed() ? 'true' : 'false');
         $propdef->setAttribute('empty', $metadata->getIsEmptyAllowed() ? 'true' : 'false');
         if ($metadata->getType() == PLUGIN_DOCMAN_METADATA_TYPE_LIST) {
             $loveFactory = new Docman_MetadataListOfValuesElementFactory($metadata->getId());
             foreach ($loveFactory->getListByFieldId($metadata->getId(), $metadata->getLabel(), true) as $love) {
                 if ($love->getId() != 100) {
                     $value = $doc->createElement('value');
                     $value->appendChild($doc->createTextNode($love->getName()));
                     $propdef->appendChild($value);
                 }
             }
         }
         $propdefs->appendChild($propdef);
     }
     return $propdefs;
 }
コード例 #2
0
 private function getCustomDateMetadata(Docman_Item $item)
 {
     $this->metadata_factory->setRealGroupId($item->getGroupId());
     return $this->metadata_factory->getRealMetadataList(false, array(PLUGIN_DOCMAN_METADATA_TYPE_DATE));
 }
コード例 #3
0
 /**
  * Returns the (used) metadata of the given project 
  */
 function getProjectMetadata()
 {
     $request =& $this->_controler->request;
     $groupId = $request->get('group_id');
     $metadataFactory = new Docman_MetadataFactory($groupId);
     $metadataList = array_merge($metadataFactory->getRealMetadataList(true), $metadataFactory->getHardCodedMetadataList(true));
     $this->_controler->_viewParams['action_result'] = $metadataList;
 }