Пример #1
0
 public function endPostProcess()
 {
     // make submit buttons keep the current working tab opened.
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $className = CRM_Utils_String::getClassName($this->_name);
         // hack for special cases.
         switch ($className) {
             case 'Event':
                 $attributes = $this->getVar('_attributes');
                 $subPage = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
                 break;
             case 'EventInfo':
                 $subPage = 'settings';
                 break;
             case 'ScheduleReminders':
                 $subPage = 'reminder';
                 break;
             default:
                 $subPage = strtolower($className);
                 break;
         }
         CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className))), ts('Saved'), 'success');
         $config = CRM_Core_Config::singleton();
         if (in_array('CiviCampaign', $config->enableComponents)) {
             $values = $this->controller->exportValues($this->_name);
             $newCampaignID = CRM_Utils_Array::value('campaign_id', $values);
             $eventID = CRM_Utils_Array::value('id', $values);
             if ($eventID && $this->_campaignID != $newCampaignID) {
                 CRM_Event_BAO_Event::updateParticipantCampaignID($eventID, $newCampaignID);
             }
         }
         $this->postProcessHook();
         if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
             if ($this->_isTemplate) {
                 CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
             } else {
                 CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/event/manage', 'reset=1'));
             }
         } else {
             CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url("civicrm/event/manage/{$subPage}", "action=update&reset=1&id={$this->_id}"));
         }
     }
 }