public function addCampaign()
 {
     $campaign = new Campaigns();
     $campaign->setCampaignName($this->form_values['campaign_name']);
     $campaign->setDateFrom(App_Tools_Time::now());
     $campaign->setDateTo(App_Tools_Time::now());
     $campaign->setCatchUpDays($this->form_values['catch_up_days']);
     $campaign_type_id = $this->_em->find('CampaignTypes', $this->form_values['campaign_type_id']);
     $campaign->setCampaignType($campaign_type_id);
     $campaign->setIsClosed('0');
     $created_by = $this->_em->find('Users', $this->_user_id);
     $campaign->setCreatedBy($created_by);
     $campaign->setCreatedDate(App_Tools_Time::now());
     $campaign->setModifiedBy($created_by);
     $campaign->setModifiedDate(App_Tools_Time::now());
     $this->_em->persist($campaign);
     $this->_em->flush();
     $last_id = $campaign->getPkId();
     $campaign_id = $this->_em->find('Campaigns', $last_id);
     foreach ($this->form_values['item_id'] as $item_id) {
         $campaign_ips = new CampaignItemPackSizes();
         $campaign_ips->setCampaign($campaign_id);
         $item_id_ips = $this->_em->find('ItemPackSizes', $item_id);
         $campaign_ips->setItemPackSize($item_id_ips);
         $campaign_ips->setCreatedBy($created_by);
         $campaign_ips->setCreatedDate(App_Tools_Time::now());
         $campaign_ips->setModifiedBy($created_by);
         $campaign_ips->setModifiedDate(App_Tools_Time::now());
         $this->_em->persist($campaign_ips);
     }
     $this->_em->flush();
     //$district_ids = explode(',', $this->form_values['district_ids']);
     //App_Controller_Functions::pr($this->form_values['districts']);
     $created_by = $this->_em->find('Users', $this->_user_id);
     foreach ($this->form_values['districts'] as $district_id) {
         $campaign_d = new CampaignDistricts();
         $campaign_d->setCampaign($campaign_id);
         $district_location_id = $this->_em->find('Locations', $district_id);
         $campaign_d->setDistrict($district_location_id);
         $campaign_d->setCreatedBy($created_by);
         $campaign_d->setCreatedDate(App_Tools_Time::now());
         $campaign_d->setModifiedBy($created_by);
         $campaign_d->setModifiedDate(App_Tools_Time::now());
         $this->_em->persist($campaign_d);
     }
     $this->_em->flush();
     return $last_id;
 }
 public function setDateFrom($dateFrom)
 {
     $this->__load();
     return parent::setDateFrom($dateFrom);
 }