/** * export pdf avec mpdf et liste d'index : Technique HTML to PDF */ public function actionExportPdf() { $criteria = new EMongoCriteria(); $criteria->sort('name', EMongoCriteria::SORT_ASC); $models = Biobank::model()->findAll($criteria); BiobanksPDFExporter::exporter($models); }
public function run() { $users = User::model()->findAll(); foreach ($users as $user) { $criteria = new EMongoCriteria(); $criteria->id = $user->biobank_id; $biobank = Biobank::model()->find($criteria); if ($user->biobank_id === "") { $user->unsetAttributes(array('biobank_id')); $user->biobank_id = null; $user->update(); } if (!isset($user->biobank_id)) { $user->biobank_id = null; $user->update(); } else { if (is_a($user->biobank_id, 'MongoId')) { $user->biobank_id = (string) $user->biobank_id; $user->update(); } else { $biobank = Biobank::model()->findByAttributes(array('id' => $user->biobank_id)); if ($biobank != null) { $user->biobank_id = (string) $biobank->_id; $user->update(); } } } } }
public function run($args) { include_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'CommonTools.php'; $biobankList = Biobank::model()->findAll(); foreach ($biobankList as $biobank) { if (isset($biobank->ville)) { $biobank->address->city = $biobank->ville; unset($biobank->ville); } if (isset($biobank->adresse)) { $biobank->address->street = $biobank->adresse; $biobank->address->zip = str_ireplace(' ', '', extract_zipcode($biobank->address->street)); $biobank->address->street = str_ireplace($biobank->address->zip, '', $biobank->address->street); $biobank->address->street = str_ireplace($biobank->address->city, '', $biobank->address->street); unset($biobank->adresse); } if (isset($biobank->region)) { $biobank->address->initSoftAttribute('region'); $biobank->address->region = $biobank->region; unset($biobank->region); } $biobank->address->country = 'fr'; $biobank->save(false); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Biobank the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Biobank::model()->findByPk(new MongoID($id)); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getBiobankName() { $biobank = Biobank::model()->findByAttributes(array('id' => $this->biobank_id)); if ($biobank != null) { return $biobank->identifier; } else { return null; } }
public function run($args) { include_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'StatTools.php'; $biobanks = Biobank::model()->findAll(array('select' => array('id'))); foreach ($biobanks as $biobank) { $result = StatTools::saveBiobankStats($biobank->id); $message = $result === true ? "Statistiques de la biobanque n°{$biobank->id} bien calculées" : "Une erreur est apparue lors de la sauvegarde des statistiques de la biobanque n°{$biobank->id} : {$result}"; echo $message . "\n"; } StatTools::saveAverageRate(); echo "Statistiques globales enregistrées. \n"; }
/** * retourne la reparttion des echantillons par ville * Fournit un tableau aossicatif de nom entier * * @return array[array(string,int)] */ public static function getRepartitionSamplesByTown() { $result = array(); $biobanks = Biobank::model()->findAll(); foreach ($biobanks as $biobank) { $criteria = new EMongoCriteria(); $criteria->biobank_id = (string) $biobank->_id; $compte = Sample::model()->count($criteria); if ($compte != 0) { $result[] = array($biobank->address->city, $compte); } } return $result; }
public function run($args) { include_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'CommonMailer.php'; $biobanks = Biobank::model()->findAll(); foreach ($biobanks as $biobank) { $lastImportDate = FileImported::model()->getDateLastImportByBiobank($biobank->id); $today = date('Y-m-d H:i:s'); $diffSec = strtotime($today) - strtotime($lastImportDate); $diffJours = round($diffSec / 60 / 60 / 24, 0); if ($diffJours >= 30 && ($diffJours - 30) % 5 == 0) { CommonMailer::sendMailRelanceExport($biobank->getContact(), $lastImportDate, $diffJours); } } echo "Check des imports effectués et relances envoyées\n"; }
public function run() { echo 'Massive Run for samples'; $biobanks = Biobank::model()->findAll(); foreach ($biobanks as $biobank) { $modifier = new EMongoModifier(); $modifier->addModifier('biobank_id', 'set', (string) $biobank->_id); $criteria = new EMongoCriteria(); $criteria->biobank_id = $biobank->id; $status = Sample::model()->updateAll($modifier, $criteria); $criteriaAfter = new EMongoCriteria(); $criteriaAfter->biobank_id = (string) $biobank->_id; $count = Sample::model()->count($criteriaAfter); echo "Done for biobank {$biobank->_id} - {$biobank->name} : {$count}\n"; } }
public function run($args) { //uppar case for each last name of contact $criteria = new EMongoCriteria(); $criteria->sort('last_name', EMongoCriteria::SORT_ASC); $contacts = Contact::model()->findAll($criteria); foreach ($contacts as $model) { //last name to upper case automatically /prevent pb to sort and display // echo $model->_id."\n"; $model->last_name = mb_strtoupper($model->last_name, "UTF-8"); //convertie first name en lower case et mettant les caracteres en utf-8 ( cas possible de bug sur chaines mixtes) $model->first_name = mb_strtolower($model->first_name, "UTF-8"); //phone without withespace, point a 0> +33 $model->phone = mb_ereg_replace('/\\s+/', '', $model->phone); $model->phone = mb_ereg_replace('/\\./', '', $model->phone); //replace first zero and add +33 $model->phone = mb_ereg_replace('/^0/', '+33', $model->phone); //pays = FR $model->pays = "FR"; $model->inactive = 0; //catch exception on update if problem ( utf8 encoding for example?) try { $model->update(); } catch (Exception $e) { echo 'Exception reçue pour le model: ' . $model->_id . " " . $model->last_name . " " . $model->first_name, $e->getMessage(), "\n"; //detection de le ncodage si pb d estring echo "first name encoding :" . mb_detect_encoding($model->first_name) . "\n"; } } //update relation biobank->contact_id if old id contact, si ancien attribut id utilisé alors on mets le nouvel attribut _id $criteriaB = new EMongoCriteria(); $criteriaB->sort('name', EMongoCriteria::SORT_ASC); $biobanks = Biobank::model()->findAll($criteriaB); foreach ($biobanks as $biobank) { $contact = Contact::model()->findByAttributes(array('id' => $biobank->contact_id)); if ($contact != null) { // echo "current value from migration:" . $contact->last_name . " " . $contact->first_name."\n"; $biobank->contact_id = $contact->_id; $biobank->update(); } } }
<?php /* @var $this SearchBiobankController */ /* @var $data Biobank */ ?> <div class='view'> <?php foreach (Biobank::Model()->attributeExportedLabels() as $attribute => $value) { if (isset($data->{$attribute})) { ?> <b><?php echo CHtml::encode($data->getAttributeLabel($attribute)); ?> :</b> <?php switch ($attribute) { case 'contact_id': echo $data->contact_id != null && !empty($data->contact_id) ? CHtml::encode($data->getShortContact()) . '<br>' . CHtml::encode($data->getEmailContact()) . '<br>' . CHtml::encode($data->getPhoneContact()) : ""; break; case 'address': echo nl2br($data->getAddress()); break; case 'website': echo CHtml::link($data->website, 'http://' . $data->website, array('target' => 'blank')); break; default: echo CHtml::encode($data->{$attribute}); break; } ?> <br />
<div class="wide form"> <?php $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <table> <tr> <td> <?php echo $form->label($model, 'biobank_id'); ?> <?php $biobank = new Biobank(); echo $form->dropDownList($model, 'biobank_id', $biobank->getArrayBiobank($biobank_id)); ?> </td> <td> <?php echo $form->label($model, 'field_age_min'); ?> <?php echo $form->textField($model, 'field_age_min', array('size' => 10, 'maxlength' => 3)); ?> </td> <td> <?php echo $form->label($model, 'storage_conditions'); echo $form->dropDownList($model, 'storage_conditions', $model->getArrayStorage(), array('prompt' => '----')); ?> </td>
<?php /** * Création des listes d'attributs à affciher dans les différentes parties * La liste $attributes_oblig représente la liste des attributs obligatoire, et doit être présente. * Elle ne doit pas être ajoutée à la liste d'onglets * * La liste $attributes_other regroupe tous les attributs non présents dans les autres listes. Elle doit être ajoutée en dernière à la liste d'onglets */ $attributes_oblig = array('identifier', 'name', 'collection_name', 'collection_id', 'biobank_class', 'diagnosis_available', array('attributeName' => 'contact_id', 'value' => Contact::model()->getArrayContacts()), 'address'); $attributes_facult = array('website', 'folder_reception', 'folder_done', 'date_entry', 'passphrase', 'longitude', 'latitude'); $listOnglets['facultatif'] = $attributes_facult; $attributes_qualite = array('cert_ISO9001', 'cert_NFS96900', 'cert_autres', 'observations'); $listOnglets['qualite'] = $attributes_qualite; $attributes_info = array(array('attributeName' => 'gest_software', 'value' => CommonTools::getSoftwareList()), 'other_software', array('attributeName' => 'connector_installed', 'value' => array('Oui' => 'Oui', 'Non' => 'Non')), 'connector_version'); $listOnglets['info'] = $attributes_info; $attributes_sampling = array(array('attributeName' => 'sampling_practice', 'value' => Biobank::model()->getArraySamplingPractice()), 'sampling_disease_group', 'sampling_disease_group_code', 'nbs_dna_samples_affected', 'nbs_dna_samples_relatives', 'nbs_cdna_samples_affected', 'nbs_cdna_samples_relatives', 'nbs_wholeblood_samples_affected', 'nbs_wholeblood_samples_relatives', 'nbs_bloodcellisolates_samples_affected', 'nbs_bloodcellisolates_samples_relatives', 'nbs_serum_samples_affected', 'nbs_serum_samples_relatives', 'nbs_plasma_samples_affected', 'nbs_plasma_samples_relatives', 'nbs_fluids_samples_affected', 'nbs_fluids_samples_relatives', 'nbs_tissuescryopreserved_samples_affected', 'nbs_tissuescryopreserved_samples_relatives', 'nbs_tissuesparaffinembedded_samples_affected', 'nbs_tissuesparaffinembedded_samples_relatives', 'nbs_celllines_samples_affected', 'nbs_celllines_samples_relatives', 'nbs_other_samples_affected', 'nbs_other_samples_relatives', 'nbs_other_specification'); $listOnglets['sampling'] = $attributes_sampling; //make array of attributes stored but not defined in the common model $attributes_other = array(); $definedAttributes = array_merge($attributes_oblig, $attributes_facult, $attributes_qualite, $attributes_info, $attributes_sampling, array('_id', 'contact_id', 'gest_software', 'connector_installed', 'vitrine', 'sampling_practice')); $att = $model->getAttributes(); foreach ($att as $attributeName => $attributeValue) { if (!in_array($attributeName, $definedAttributes)) { $attributes_other[] = $attributeName; } } $listOnglets['other'] = $attributes_other; ?> <div class="form"> <?php
<?php $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route))); ?> <table> <tr> <td> <?php echo $form->label($model, 'biobank_id'); ?> <?php if ($this->layout == '//layouts/vitrine_layout') { $biobank = $_SESSION['vitrine']['biobank']; echo $form->dropDownList($model, 'biobank_id', array($biobank->id => $biobank->identifier)); } else { $biobank = new Biobank(); echo $form->dropDownList($model, 'biobank_id', $biobank->getArrayBiobanks(), array('prompt' => '----', 'style' => 'width:145px')); } ?> </td> <td> <?php echo $form->label($model, 'field_age_min'); ?> <?php echo $form->textField($model, 'field_age_min', array('size' => 10, 'maxlength' => 3)); ?> </td> <td> <?php echo $form->label($model, 'storage_conditions');
/** * get biobank name of this contact * usefull in view contacts for site * @return type */ public function getBiobankName() { $result = 'Not defined'; if ($this->biobank_id != null && isset($this->biobank_id)) { $biobank = Biobank::model()->findByPK(new MongoID($this->biobank_id)); if (isset($biobank)) { $result = $biobank->name; } } return $result; }
/** * display catalog of biobanks with contacts and agregated infos */ public function actionCatalog() { $model = new Biobank('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Biobank'])) { $model->attributes = $_GET['Biobank']; } //make the search //render the biobanks $this->render('catalog', array('model' => $model)); }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'biobank_manUploaded-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'text/html', 'accept-charset' => "UTF-8"))); ?> <?php echo $form->errorSummary($biobankIdentifier); ?> <div class="row" > <?php $criteria = new EMongoCriteria(); $criteria->sort('identifier', EMongoCriteria::SORT_ASC); echo $form->DropDownList($biobankIdentifier, 'identifier', CHtml::listData(Biobank::model()->findAll($criteria), 'identifier', 'identifierAndName'), array('empty' => 'select brif code')); ?> <?php echo $form->error($biobankIdentifier, 'identifier'); ?> </div> <?php $this->endWidget(); ?> </div> <!-- form -->
/** * retourne le modele de la biobanque fournit par l id mongo * null sinon */ public function getBiobank($mongoId) { if ($mongoId != null) { return Biobank::model()->findByPk(new MongoId($mongoId)); } else { return null; } }
<h1><?php echo Yii::t('common', 'sample') . ' #' . $model->biobank_id . '_' . $model->id_sample; ?> </h1> <div style="float:left;"> <h3 >Caracteristics</h3> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id_depositor', 'id_sample', 'consent_ethical', 'gender', 'age', 'collect_date', array('name' => 'storage_conditions', 'value' => $model->getLiteralStorageCondition()), 'consent', 'supply', 'max_delay_delivery', 'detail_treatment', 'disease_outcome', 'authentication_method', 'patient_birth_date', 'tumor_diagnosis'))); ?> </div> <div style="float:left;padding-left:10px;"> <div> <h3 style="margin-bottom:-5px;" >Notes</h3> <?php $notesDataProvider = new CArrayDataProvider($model->notes, array('keyField' => 'key')); $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $notesDataProvider, 'template' => '{items}{pager}', 'columns' => array(array('header' => 'Key', 'value' => '$data->key'), array('header' => 'Value', 'value' => '$data->value')))); ?> </div> <div> <h3 >Biobank informations</h3> <?php $data = Biobank::model()->findByPk(new MongoId($model->biobank_id)); $this->widget('zii.widgets.CDetailView', array('data' => $data, 'attributes' => array(array('name' => 'biobank', 'value' => $data->identifier), array('name' => 'contact', 'value' => $data->getShortContact()), array('name' => 'email', 'value' => $data->getEmailContact()), array('name' => 'phone', 'value' => $data->getPhoneContact())))); ?> </div> </div> <div style="clear:both;"></div>
/** * export xls des biobanques */ public function actionExportXls() { $model = new Biobank('search'); $model->unsetAttributes(); if (isset($_GET['Biobank'])) { $model->attributes = $_GET['Biobank']; } if (isset($_SESSION['criteria']) && $_SESSION['criteria'] != null && $_SESSION['criteria'] instanceof EMongoCriteria) { $criteria = $_SESSION['criteria']; } else { $criteria = new EMongoCriteria(); } $biobanks = Biobank::model()->findAll($criteria); $data = array(1 => array_keys(Biobank::model()->attributeExportedLabels())); setlocale(LC_ALL, 'fr_FR.UTF-8'); foreach ($biobanks as $biobank) { $line = array(); foreach (array_keys($biobank->attributeExportedLabels()) as $attribute) { if (isset($biobank->{$attribute}) && $biobank->{$attribute} != null && !empty($biobank->{$attribute})) { $line[] = iconv("UTF-8", "ASCII//TRANSLIT", $biobank->{$attribute}); //solution la moins pire qui ne fait pas bugge les accents mais les convertit en caractere generique } else { $line[] = "-"; } } $line[] = iconv("UTF-8", "ASCII//TRANSLIT", $biobank->getShortContact()); $line[] = iconv("UTF-8", "ASCII//TRANSLIT", $biobank->getEmailContact()); $contact = $biobank->getContact(); if ($contact != null) { $line[] = iconv("UTF-8", "ASCII//TRANSLIT", $contact->getFullAddress()); } else { $line[] = "No address"; } $data[] = $line; } Yii::import('application.extensions.phpexcel.JPhpExcel'); $xls = new JPhpExcel('UTF-8', true, 'Biobank list'); $xls->addArray($data); $xls->generateXML('Biobank list'); }
/** * 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; }
?> </div> <div class="row"> <?php echo $form->labelEx($model, 'inactif'); echo $form->dropDownList($model, 'inactif', User::model()->getArrayInactif(), array('prompt' => '----')); ?> <?php echo $form->error($model, 'inactif'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'biobank_id'); echo $form->dropDownList($model, 'biobank_id', Biobank::model()->getArrayBiobanks(), array('prompt' => '----')); echo $form->error($model, 'biobank_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
$countDisplayedColumns = 0; foreach ($prefs as $property => $propertyValue) { if ($property != 'id_user' && $property != '_id') { if ($propertyValue) { $visibility = "table_cell"; $countDisplayedColumns++; } else { $visibility = 'display:none'; } if ($property == 'notes') { $columns[] = addColumn($property, $model->getAttributeLabel($property), '$data->getShortNotes()', $visibility); } elseif ($property == 'biobank_id') { $columns[] = addColumn('biobank_id', $model->getAttributeLabel('biobank_id'), '$data->getBiobankName()', $visibility); } elseif ($property == 'collection_name') { $columns[] = addColumn('collection_name', Biobank::model()->getAttributeLabel('collection_name'), '$data->biobank->collection_name', $visibility); } elseif ($property == 'collection_id') { $columns[] = addColumn('collection_id', Biobank::model()->getAttributeLabel('collection_id'), '$data->biobank->collection_id', $visibility); } elseif ($property == 'collect_date') { $columns[] = addColumn('collect_date', $model->getAttributeLabel('collect_date'), '$data->collect_date', $visibility); //TODO normaliser les dates de collecte avant d activer cette feature // $columns [] = getArrayColumn('collect_date', $model->getAttributeLabel('collect_date'), 'CommonTools::toShortDateFR($data->collect_date)', $visibility); } elseif ($property == 'storage_conditions') { $columns[] = addColumn('storage_conditions', $model->getAttributeLabel('storage_conditions'), '$data->getLiteralStorageCondition()', $visibility); } else { $columns[] = addColumn($property, $model->getAttributeLabel($property), '$data->' . $property, $visibility); } } } //popup de choix des colonnes à afficher $columns[] = array('class' => 'CButtonColumn', 'header' => CHtml::link($imageSelect, '#', array('onclick' => '$("#selectPopup").dialog("open");return false;')), 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("site/view",array("id"=>"$data->_id", "asDialog"=>1))', 'click' => 'function(){window.open(this.href,"_blank","left=100,top=100,width=760,height=650,toolbar=0,resizable=1, location=no");return false;}'))); $this->widget('zii.widgets.grid.CGridView', array('id' => 'sample-grid', 'dataProvider' => $model->searchWithNotes(), 'columns' => $columns));
/** * Envoie une demande aux contacts des biobanques concernées par une demande */ public function actionEnvoyer() { if (isset($_GET['demande_id'])) { $demande = $this->loadModel($_GET['demande_id']); if (!empty($demande->titre) && !empty($demande->detail) && !empty($demande->sampleList)) { $samples = $demande->getArraySamples(); $biobankIdList = $demande->getBiobanksFromSamples($samples); $demandeSent = false; foreach ($biobankIdList as $biobankId) { $biobank = Biobank::model()->findByPk(new MongoId($biobankId)); if ($biobank->contact_id != null) { $contact = Contact::model()->findByPk(new MongoId($biobank->contact_id)); if ($contact != null) { $concernSamplesList = array(); foreach ($samples as $sample) { if ($sample->biobank_id == $biobankId) { $concernSamplesList[] = $sample; } } // PB si pas envoyer a une biuobank alors pas sauvegarder if (CommonMailer::sendDemande($contact, $demande->titre . ' : ' . $biobank->identifier, $demande->detail, $concernSamplesList) == 1) { $demandeSent = true; } } else { } } } if ($demandeSent) { $demande->envoi = 1; $demande->save(); $this->actionCreateNewDemand(); Yii::app()->user->setFlash('success', 'Votre demande a bien été envoyée aux différents sites'); $this->render('view', array_merge(array('model' => $this->loadModel($demande->_id), isset($_GET['layout']) || isset($layout) && $layout != null ? array('layout' => $_GET['layout']) : array()))); } else { Yii::app()->user->setFlash('error', 'Un problème est apparu, les demandes n\'ont pas été transmises'); $this->redirect(array_merge(array('updateAndSend', 'id' => Yii::app()->session['activeDemand'][0]->_id), isset($_GET['layout']) ? array('layout' => $_GET['layout']) : array())); // } } else { Yii::app()->user->setFlash('notice', 'Merci de completer votre demande avant de l\'envoyer'); $this->redirect(array_merge(array('updateAndSend', 'id' => $demande->_id), isset($_GET['layout']) ? array('layout' => $_GET['layout']) : array())); // } } }
$this->widget('application.widgets.charting.CBarsChartWidget', array('id' => 'columnchart-count-files-month', 'theme' => 'Distinctive', 'title' => '', 'data' => StatTools::getCountFilesReceptionByMonth(), 'width' => 380, 'heigth' => 250, 'xAxisRotation' => 0)); $this->endWidget(); ?> </div> <div style="float:left;width:430px;padding-left:10px;"> <?php $this->beginWidget('zii.widgets.CPortlet', array('title' => "<i class='icon-adjust'></i>" . Yii::t('common', 'LoSaCh'))); //affichage du graphe de repartition par ville des echantillons $this->widget('application.widgets.charting.CPieChartWidget', array('id' => 'piechart-collab', 'theme' => 'WatersEdge', 'width' => 380, 'height' => 250, 'data' => StatTools::getRepartitionSamplesByTown(), 'title' => 'Location by biobank')); $this->endWidget(); ?> </div> </div> <div style="clear:both;"> <div style="float:left;width:430px;"> <?php $this->beginWidget('zii.widgets.CPortlet', array('title' => "<i class='icon-adjust'></i>" . Yii::t('common', 'BioBkReg'))); $this->widget('zii.widgets.grid.CGridView', array('id' => 'echantillon-grid', 'dataProvider' => Biobank::model()->search(), 'columns' => array('identifier', 'name', array('header' => 'collection name', 'value' => 'CommonTools::getShortValue($data->collection_name)'), array('header' => 'Main contact', 'value' => '$data->getShortContact()')))); $this->endWidget(); ?> </div> <div style="float:left;width:430px;padding-left:10px;"> <?php $this->beginWidget('zii.widgets.CPortlet', array('title' => "<i class='icon-share'></i>" . Yii::t('common', 'SaReAct'))); $this->widget('application.widgets.charting.CBarsChartWidget', array('id' => 'columnchart-count-month', 'theme' => 'Distinctive', 'title' => '', 'data' => StatTools::getCountReceptionByMonth(), 'width' => 380, 'heigth' => 250, 'xAxisRotation' => 0)); $this->endWidget(); ?> </div> </div> <div style="clear:both;"/>
public function getBiobankName() { $result = null; if (isset($this->biobank_id) && $this->biobank_id != null && $this->biobank_id != '') { $biobank = Biobank::model()->findByPk(new MongoId($this->biobank_id)); if ($biobank != null) { $result = $biobank->name; } } return $result; }
/** * * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array('id_user' => Yii::t('common', 'idUser'), 'id' => Yii::t('sample', 'id'), 'biobank_id' => Yii::t('sample', 'biobank_id'), 'consent_ethical' => Yii::t('sample', 'consent_ethical'), 'id_depositor' => Yii::t('sample', 'id_depositor'), 'id_sample' => Yii::t('sample', 'id_sample'), 'gender' => Yii::t('sample', 'gender'), 'age' => Yii::t('sample', 'age'), 'collect_date' => Yii::t('sample', 'collect_date'), 'storage_conditions' => Yii::t('sample', 'storage_conditions'), 'consent' => Yii::t('sample', 'consent'), 'supply' => Yii::t('sample', 'supply'), 'max_delay_delivery' => Yii::t('sample', 'max_delay_delivery'), 'detail_treatment' => Yii::t('sample', 'detail_treatment'), 'disease_outcome' => Yii::t('sample', 'disease_outcome'), 'authentication_method' => Yii::t('sample', 'authentication_method'), 'patient_birth_date' => Yii::t('sample', 'patient_birth_date'), 'tumor_diagnosis' => Yii::t('sample', 'tumor_diagnosis'), 'file_imported_id' => Yii::t('sample', 'file_imported_id'), 'notes' => Yii::t('sample', 'notes'), 'collection_name' => Biobank::model()->getAttributeLabel('collection_name'), 'collection_id' => Biobank::model()->getAttributeLabel('collection_id')); }
public function actionUploadAll() { $model = new Biobank(); $listFile = array(); // $fichier = null; $biobankIdentifier = new BiobankIdentifierForm(); if (!isset($model->presentation)) { $model->initSoftAttribute('presentation'); } if (!isset($model->thematiques)) { $model->initSoftAttribute('thematiques'); } if (!isset($model->publications)) { $model->initSoftAttribute('publications'); } if (!isset($model->reseaux)) { $model->initSoftAttribute('reseaux'); } if (!isset($model->qualite)) { $model->initSoftAttribute('qualite'); } if (!isset($model->projetRecherche)) { $model->initSoftAttribute('projetRecherche'); } if (!isset($model->activeLogo)) { $model->initSoftAttribute('activeLogo'); } if (is_dir(Yii::app()->basePath . '/../images/extractedLogos/')) { $listFile = scandir(Yii::app()->basePath . '/../images/extractedLogos/'); } // if (isset($listFile[2]) && !is_dir($listFile[2])) // $fichier = $listFile[2]; // if (isset($_POST['Biobank'])) { // $model->attributes = $_POST['Biobank']; // if (isset($_POST['importLogo']) && $_POST['importLogo'] == 1) { // $file = $folder . $fichier; // $model->initSoftAttribute('activeLogo'); // // $model->activeLogo = (string) $this->logoUpload($file, $model); // if (rename($file, $folder . 'done/' . $fichier)) { // $listFile = scandir(Yii::app()->basePath . '/../images/extractedLogos/'); // $fichier = $listFile[2]; // Yii::app()->user->setFlash('success', 'renamed'); // } else { // Yii::app()->user->setFlash('error', 'error on rename'); // } // Yii::app()->user->setFlash('success', 'imported'); // } else { // Yii::app()->user->setFlash('success', 'logo not imported'); // } // // if (isset($_FILES['Logo'])) { // // // $model->activeLogo = (string) $this->storeLogo($_FILES['Logo'], $model); // } // if ($model->save()) { // // Yii::app()->user->setFlash('success', Yii::app()->user->getFlash('success') . 'Biobank infos saved'); // } // if (isset($_FILES['Logo'])) { // // $model->initSoftAttribute('activeLogo'); // $model->activeLogo = (string) $this->storeLogo($_FILES['Logo'], $model); // } /* if ($model->update()) { Yii::app()->user->setFlash('success', Yii::app()->user->getFlash('success') . 'Biobank infos saved'); unset($_POST['Biobank']); } else { // $list = ''; // foreach ($model->errors as $errorName => $errorName) // $list .= "<li>$errorName</li>"; // Yii::app()->user->setFlash('error', 'error on save : <ul>' . $list . '</ul>'); } */ // }*/ // } else { // Yii::app()->user->setFlash('error', 'biobank not found'); // } if (isset($_POST['BiobankIdentifierForm']) && isset($_POST['BiobankIdentifierForm']['identifier']) && $_POST['BiobankIdentifierForm']['identifier'] != "") { $model = Biobank::model()->findByAttributes(array('identifier' => $_POST['BiobankIdentifierForm']['identifier'])); } if (isset($_POST['Biobank'])) { $model = Biobank::model()->findByAttributes(array('identifier' => $_POST['Biobank']['identifier'])); if (!isset($model->presentation)) { $model->initSoftAttribute('presentation'); } $model->presentation = $_POST['Biobank']['presentation']; // print_r($model->getErrors()); if (!isset($model->thematiques)) { $model->initSoftAttribute('thematiques'); } $model->thematiques = $_POST['Biobank']['thematiques']; if (!isset($model->publications)) { $model->initSoftAttribute('publications'); } $model->publications = $_POST['Biobank']['publications']; if (!isset($model->reseaux)) { $model->initSoftAttribute('reseaux'); } $model->reseaux = $_POST['Biobank']['reseaux']; if (!isset($model->qualite)) { $model->initSoftAttribute('qualite'); } $model->qualite = $_POST['Biobank']['qualite']; if (!isset($model->projetRecherche)) { $model->initSoftAttribute('projetRecherche'); } $model->projetRecherche = $_POST['Biobank']['projetRecherche']; if ($model->save(false)) { Yii::app()->user->setFlash('success', 'La biobanque a bien été mise à jour.'); } else { Yii::app()->user->setFlash('error', 'La biobanque n\'a pas pu être mise à jour'); } } // if ($fichier != '.' && $fichier != '..') { $this->render('upload', array('model' => $model, 'listLogos' => $listFile, 'biobankIdentifier' => $biobankIdentifier)); // } }
/** * FIXME fonction etrange retour bizarre, action de controller melangée * @return type */ public static function getBiobankInfo() { $id = $_SESSION['biobank_id']; $biobank = Biobank::getBiobank($id); if ($biobank != null) { if (isset($biobank->logo) && $biobank->logo != null) { $logo = $biobank->logo; $_SESSION['vitrine'] = array('biobank' => $biobank, 'biobankLogo' => $logo); } return $id; } else { Yii::app()->user->setFlash('error', yii::t('common', 'noBiobankFound')); //Yii::app()->controller->redirect(Yii::app()->createUrl('site/biobanks')); } }
public function getBiobank() { $biobank = Biobank::model()->findByPk(new MongoId($this->biobank_id)); if ($biobank != null) { return $biobank; } else { return null; } }