Esempio n. 1
0
 /**
  * get biobank infos and convert into an LDIF format
  * @return string
  */
 private function getBiobanksLDIF()
 {
     $result = "\ndn: c=fr,ou=biobanks,dc=directory,dc=bbmri-eric,dc=eu\nobjectClass: country\nobjectClass: top\nc: fr\n\n";
     //FIXME Mandatory empty line here ( TODO use ldif exporter to check syntax)
     $biobanks = Biobank::model()->findAll();
     foreach ($biobanks as $biobank) {
         $attributes = array();
         $attributes['biobankCountry'] = "FR";
         $attributes['biobankID'] = "bbmri-eric:ID:FR_" . $biobank->identifier;
         $attributes['biobankName'] = $biobank->name;
         $attributes['biobankJuridicalPerson'] = $biobank->name;
         //TODO flase in cappital
         $attributes['biobankMaterialStoredDNA'] = "FALSE";
         $attributes['biobankMaterialStoredRNA'] = "FALSE";
         // $attributes['biobankMaterialStoredcDNAmRNA'] = "FALSE";
         // $attributes['biobankMaterialStoredmicroRNA'] = "FALSE";
         //   $attributes['biobankMaterialStoredWholeBlood'] = "FALSE";
         //  $attributes['biobankMaterialStoredPBC'] = "FALSE";
         $attributes['biobankMaterialStoredBlood'] = "FALSE";
         $attributes['biobankMaterialStoredPlasma'] = "FALSE";
         $attributes['biobankMaterialStoredSerum'] = "FALSE";
         //            $attributes['biobankMaterialStoredTissueCryo'] = "FALSE";
         $attributes['biobankMaterialStoredTissueFrozen'] = "FALSE";
         //            $attributes['biobankMaterialStoredTissueParaffin'] = "FALSE";
         $attributes['biobankMaterialStoredTissueFFPE'] = "FALSE";
         //            $attributes['biobankMaterialStoredCellLines'] = "FALSE";
         $attributes['biobankMaterialStoredImmortalizedCellLines'] = "FALSE";
         $attributes['biobankMaterialStoredUrine'] = "FALSE";
         $attributes['biobankMaterialStoredSaliva'] = "FALSE";
         $attributes['biobankMaterialStoredFaeces'] = "FALSE";
         //            $attributes['biobankMaterialStoredPathogen'] = "FALSE";
         $attributes['biobankMaterialStoredIsolatedPathogen'] = "FALSE";
         $attributes['biobankMaterialStoredOther'] = "FALSE";
         //TODO each biobank need to sign a chart between bbmri and the biobank (TODO to discuss)
         $attributes['biobankPartnerCharterSigned'] = "FALSE";
         //nmber of samples 10^n n=number
         $attributes['biobankSize'] = "1";
         $attributes['objectClass'] = "biobankClinical";
         //TODO implementer la valeur de ce champ Si biobankClinical Diagnosis obligatoire
         $attributes['diagnosisAvailable'] = "urn:miriam:icd:D*";
         $contact = $biobank->getContact();
         $attributes['biobankContactCountry'] = "FR";
         //TODO get pays avec FR pas integer $contact->pays;
         //TODO info de contact obligatoire lever un warning si pas affectée pour l export
         if ($contact != null) {
             $attributes['biobankContactFirstName'] = $contact->first_name;
             $attributes['biobankContactLastName'] = $contact->last_name;
             $attributes['biobankContactPhone'] = CommonTools::getIntPhone($contact->phone);
             $attributes['biobankContactAddress'] = $contact->adresse;
             $attributes['biobankContactZIP'] = $contact->code_postal;
             $attributes['biobankContactCity'] = $contact->ville;
             //TODO contact email need to be filled
             if (isset($contact->email)) {
                 $attributes['biobankContactEmail'] = $contact->email;
             } else {
                 $attributes['biobankContactEmail'] = $contact->email;
             }
         } else {
             $attributes['biobankContactEmail'] = "N/A";
             Yii::log("contact must be filled for export LDIF. Biobank without contact:" . $biobank->name, CLogger::LEVEL_WARNING, "application");
         }
         $this->checkAttributesComplianceWithBBMRI($attributes);
         $result .= "dn: biobankID=" . trim($attributes['biobankID']) . ",c=fr,ou=biobanks,dc=directory,dc=bbmri-eric,dc=eu\n";
         //TODO recuperer le diagnistique agréger
         foreach ($attributes as $key => $value) {
             if (isset($value)) {
                 //$result.=$key . ":: " . base64_encode(trim($value)) . "\n";
                 $result .= $key . ":: " . trim($value) . "\n";
             }
         }
         //FIXME mandatory empty line
         $result .= "objectClass: biobank\n\n";
     }
     return $result;
 }