Exemplo n.º 1
0
 public function populate(array $values)
 {
     $diseasesList = $this->_object->_diseasesSrc();
     $oDiseases = new DiseasesDetailsObject();
     $dData = $oDiseases->findData(array($oDiseases->getForeignKey() => $values[$this->_object->getForeignKey()]));
     $fieldSet = $this->getDisplayGroup('diseases');
     $i = 6;
     foreach ($diseasesList as $id => $disease) {
         $tmpForm = new FormDiseasesDetails(array('object' => $oDiseases, 'isXmlHttpRequest' => true));
         if (!empty($values['MR_Diseases']) && in_array($id, $values['MR_Diseases'])) {
             $oDiseases->setFilters(array($oDiseases->getForeignKey() => $values[$this->_object->getForeignKey()], 'DD_DiseaseId' => $id));
             $data = $oDiseases->getAll();
             $data[0]['DD_TypeMedic'] = explode(',', $data[0]['DD_TypeMedic']);
             $tmpForm->populate($data[0]);
         }
         $elems = $tmpForm->getElements();
         $test = new Zend_Form_SubForm();
         $test->setDisableLoadDefaultDecorators(true);
         $test->addElements($elems);
         $test->removeDecorator('DtDdWrapper');
         $test->setLegend('Détails pour ' . $disease);
         $test->setAttrib('class', 'infosFieldsetParent fieldsetDiseaseDetails');
         $test->setOrder($i++);
         $this->addSubForm($test, 'dd_' . $id);
     }
     parent::populate($values);
 }
Exemplo n.º 2
0
 public function save($id, $data, $langId)
 {
     $tmpVal = array();
     if (empty($data['MR_Diseases'])) {
         $data['MR_Diseases'] = 0;
     }
     $tmpVal = explode(',', $data['MR_Diseases']);
     $oDiseaseD = new DiseasesDetailsObject();
     foreach ($data as $field => $dd) {
         if (preg_match('/dd_[0-9]*/', $field)) {
             $diseaseData = array();
             $value = '';
             foreach ($dd as $key => $value) {
                 $dId = explode('_', $field);
                 if (is_array($value)) {
                     $value = implode(',', $value);
                 }
                 $diseaseData[$oDiseaseD->getForeignKey()] = $data['genericId'];
                 $diseaseData['DD_DiseaseId'] = $dId[1];
                 $diseaseData[$key] = $value;
             }
             if (in_array($dId[1], $tmpVal)) {
                 $oDiseaseD->setFilters(array($oDiseaseD->getForeignKey() => $data['genericId'], 'DD_DiseaseId' => $dId[1]));
                 $exist = $oDiseaseD->getAll();
                 if (count($exist) > 0) {
                     $oDiseaseD->save($exist[0][$oDiseaseD->getDataId()], $diseaseData, 1);
                 } else {
                     $oDiseaseD->insert($diseaseData, 1);
                 }
             }
         }
     }
     if (!empty($data['MR_ExpiracyDate'])) {
         $data['MR_ExpiracyDate'] = date('Y-m-d', strtotime($data['MR_ExpiracyDate']));
     }
     if (!empty($data['MR_TravelInduranceExpiracy'])) {
         $data['MR_TravelInduranceExpiracy'] = date('Y-m-d', strtotime($data['MR_TravelInduranceExpiracy']));
     }
     parent::save($id, $data, $langId);
 }
Exemplo n.º 3
0
 public function printRegistrationAction()
 {
     $id = (int) $this->_getParam('id');
     $page = $this->_getParam('page');
     $lang = $this->_getParam('lang');
     if (!$lang) {
         $this->_registry->currentEditLanguage = $this->_defaultEditLanguage;
         $langId = $this->_defaultEditLanguage;
     } else {
         $langId = Cible_FunctionsGeneral::getLanguageID($lang);
         $this->_registry->currentEditLanguage = $langId;
     }
     if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) {
         $firstPData = array();
         $secPData = array();
         $oMember = new MemberProfilesObject();
         $oGeneric = new GenericProfilesObject();
         $oMedic = new MedicalProfilesObject();
         $oDiseasesD = new DiseasesDetailsObject();
         $oParent = new ParentProfilesObject();
         $oAddress = new AddressObject();
         $sections = $oMember->_sectionSrc();
         $memberData = $oMember->populate($id, $langId);
         $data = $oGeneric->populate($memberData['MP_GenericProfileId'], $langId);
         $medicData = $oMedic->populate($memberData['MP_GenericProfileId'], $langId);
         $allergies = $oMedic->_allergySrc();
         $diseases = $oMedic->_diseasesSrc();
         $diseasesDetails = $oDiseasesD->setFilters(array($oDiseasesD->getForeignKey() => $id));
         $diseasesDetails = $oDiseasesD->getAll();
         $memberData = array_merge($memberData, $data, $medicData);
         $this->view->title = 'Membre : ' . $memberData['GP_LastName'] . ' ' . $memberData['GP_FirstName'];
         $resp = $oParent->_listRespSrc();
         $roles = $oParent->_parentsProfileSrc();
         if (!empty($data['MP_FirstParent'])) {
             $firstPData = $oParent->populate($memberData['MP_FirstParent'], $langId);
             if (empty($firstPData)) {
                 $firstPData = $oParent->populate($memberData['MP_GenericProfileId'], $langId);
             }
             $data = $oGeneric->populate($firstPData['PP_GenericProfileId'], $langId);
             $firstPData = array_merge($firstPData, $data);
             $address = $oAddress->populate($firstPData['PP_AddressId'], $langId);
             $firstPData['address'] = $address;
         }
         if (!empty($data['MP_SecondParent'])) {
             $secPData = $oParent->populate($memberData['MP_SecondParent'], $langId);
             $data = $oGeneric->populate($secPData['PP_GenericProfileId'], $langId);
             $secPData = array_merge($secPData, $data);
             $address = $oAddress->populate($secPData['PP_AddressId'], $langId);
             $secPData['address'] = $address;
         }
         $this->view->dataMember = $memberData;
         $this->view->parents = array($firstPData, $secPData);
         $this->view->sections = $sections;
         $this->view->resp = $resp;
         $this->view->roles = $roles;
         $this->view->allergies = $allergies;
         $this->view->diseases = $diseases;
         $this->view->diseasesDetails = $diseasesDetails;
         $this->view->typeMedic = $oDiseasesD->_typeMedicSrc();
     }
 }