public function addAction()
 {
     if ($this->_request->isPost()) {
         if ($this->_request->getPost()) {
             $form_values = $this->_request->getPost();
             $locations = new Locations();
             if ($form_values['location_level_add'] == 3) {
                 $parentId = $form_values['combo1_add'];
             }
             if ($form_values['location_level_add'] == 4) {
                 $parentId = $form_values['combo1_add'];
             }
             if ($form_values['location_level_add'] == 5) {
                 $parentId = $form_values['combo2_add'];
             }
             if ($form_values['location_level_add'] == 6) {
                 $parentId = $form_values['combo3_add'];
             }
             $province_id = $this->_em->find('Locations', $form_values['combo1_add']);
             $locations->setProvince($province_id);
             $locations->setLocationName($form_values['location_name_add']);
             $geo_level_id = $this->_em->find('GeoLevels', $form_values['location_level_add']);
             $locations->setGeoLevel($geo_level_id);
             $location_types = $this->_em->find('LocationTypes', $form_values['location_type_id']);
             $locations->setLocationType($location_types);
             $parent_id = $this->_em->find('Locations', $parentId);
             $locations->setParent($parent_id);
             if ($form_values['location_level_add'] == 5 || $form_values['location_level_add'] == 6) {
                 $district_id = $this->_em->find('Locations', $form_values['combo2_add']);
                 $locations->setDistrict($district_id);
             }
             $locations->setCcmLocationId($form_values['ccm_location_id']);
             $created_by = $this->_em->find('Users', $this->_user_id);
             $locations->setCreatedBy($created_by);
             $locations->setCreatedDate(App_Tools_Time::now());
             $locations->setModifiedBy($created_by);
             $locations->setModifiedDate(App_Tools_Time::now());
             $this->_em->persist($locations);
             $this->_em->flush();
         }
     }
     $this->_redirect("/iadmin/manage-locations");
 }
Exemplo n.º 2
0
 public function setModifiedBy(\Users $modifiedBy)
 {
     $this->__load();
     return parent::setModifiedBy($modifiedBy);
 }