Example #1
0
 public function listAction()
 {
     // web page title
     $this->view->title = "Bénévoles";
     if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) {
         $generic = new GenericProfilesObject();
         $generic->setOrderBy('GP_LastName');
         $profile = new VolunteersProfilesObject();
         $oRef = new ReferencesObject();
         $oYears = new YearsParticipateObject();
         //            $select = $oYears->getAll(null, false);
         $select = $profile->getAll(null, false);
         $select->joinLeft($generic->getDataTableName(), $profile->getDataId() . ' = ' . $generic->getDataId(), array('lastName' => 'GP_LastName', 'firstName' => 'GP_FirstName', 'email' => 'GP_Email', 'member_id' => 'GP_MemberID'));
         $select->joinLeft($oYears->getDataTableName(), $oYears->getForeignKey() . ' = ' . $profile->getDataId(), array('YP_Year'));
         $select->joinLeft($oRef->getDataTableName(), $oRef->getDataId() . ' = VP_Job', array('R_TypeRef'));
         $select->joinLeft($oRef->getIndexTableName(), $oRef->getIndexId() . ' = ' . $oRef->getDataId(), array('VP_Job' => 'RI_Value'));
         $tables = array('GenericProfiles' => array('GP_LastName', 'GP_FirstName', 'GP_Email'), 'VolunteersProfile' => array('VP_GenericProfileId', 'VP_Job'), $oRef->getDataTableName() => array('R_TypeRef'), $oRef->getIndexTableName() => array('RI_Value'));
         $field_list = array('firstName' => array('width' => '250px'), 'lastName' => array('width' => '250px'), 'email' => array('width' => '250px'), 'VP_Job' => array('width' => '250px'));
         $filtersList = $profile->_jobsListSrc();
         $filtersList[0] = $this->view->getCibleText('form_select_default_label');
         ksort($filtersList);
         $filterYears = $oYears->getListForFilter();
         sort($filtersList);
         $this->view->params = $this->_getAllParams();
         $pageID = $this->_getParam('pageID');
         $langId = $this->_registry->languageID;
         $options = array('commands' => array($this->view->link($this->view->url(array('module' => 'users', 'controller' => 'index', 'action' => 'general', 'actionKey' => 'add', 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list')), $this->view->getCibleText('button_add_profile'), array('class' => 'action_submit add'))), 'enable-print' => false, 'disable-export-to-excel' => '', 'filters' => array('filter_1' => array('label' => 'Poste', 'default_value' => null, 'associatedTo' => 'VP_Job', 'choices' => $filtersList), 'filter_2' => array('label' => 'Année', 'default_value' => null, 'associatedTo' => 'YP_Year', 'choices' => $filterYears)), 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('menu_submenu_action_edit'), 'url' => $this->view->url(array('module' => 'users', 'action' => 'general', 'actionKey' => 'edit', $this->_ID => "-ID-", 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list')), 'findReplace' => array('search' => '-ID-', 'replace' => 'member_id')), 'delete' => array('label' => $this->view->getCibleText('menu_submenu_action_delete'), 'url' => $this->view->url(array('module' => 'users', 'action' => 'general', 'actionKey' => 'delete', $this->_ID => "-ID-", 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list')), 'findReplace' => array('search' => '-ID-', 'replace' => 'member_id')))));
         $mylist = new Cible_Paginator($select, $tables, $field_list, $options);
         $this->view->assign('mylist', $mylist);
     }
 }
 public function findData($filters = array())
 {
     $addr = array();
     //        $shipAddr = array();
     $oAddress = new AddressObject();
     $langId = Zend_Registry::get('languageID');
     $data = parent::findData($filters);
     if (!empty($data)) {
         $data = $data[0];
         //            $addrId = $data['PP_AddressId'];
         //
         //            if (!empty($addrId))
         //            {
         //                $addr = $oAddress->getAll($langId, true, $addrId);
         //                $addr = $addr[0];
         //                $addr['PP_AddressId'] = $addrId;
         //            }
         //
         //            $data['parentForm'] = $addr;
         //            $data['addressShipping'] = $shipAddr;
         $oYears = new YearsParticipateObject();
         $data['YP_Year'] = $oYears->findData(array($oYears->getForeignKey() => $data[$this->_foreignKey]));
     }
     return $data;
 }
Example #3
0
 public function save($id, $data, $langId)
 {
     $billId = 0;
     $shipId = 0;
     if (isset($data['addressFact'])) {
         $oAdress = new AddressObject();
         $addrBill = $data['addressFact'];
         $addrShip = $data['addressShipping'];
     }
     if (!empty($addrBill)) {
         $billId = $oAdress->save($addrBill['MP_BillingAddrId'], $addrBill, $langId);
         if ($addrShip['duplicate'] == 1) {
             $addrBill['A_Duplicate'] = $billId;
             $shipId = $oAdress->save($addrShip['MP_ShippingAddrId'], $addrBill, $langId);
         } else {
             $addrShip['A_Duplicate'] = 0;
             $shipId = $oAdress->save($addrShip['MP_ShippingAddrId'], $addrShip, $langId);
         }
         $data['MP_BillingAddrId'] = $billId;
         $data['MP_ShippingAddrId'] = $shipId;
     }
     $oYears = new YearsParticipateObject();
     $oYears->manageData($id, $data['MP_YearsParticipate']);
     $data['MP_BirthDate'] = $data['MP_BirthDateDt'];
     $years = $this->calculateAge($data['MP_BirthDate']);
     $data['MP_Age'] = $years;
     $data['MP_PassportExpiracyDate'] = $data['MP_PassportExpiracyDateDt'];
     if ($data['MP_BirthDate'] != $data['MP_PassportBirthDate']) {
         $data['MP_PassportBirthDate'] = $data['MP_BirthDate'];
     }
     parent::save($id, $data, $langId);
 }