public function dispatchLoopShutdown() { // // Force output to be sent - we need the client to have the page before // we start flushing progress bar updates // $app = AppController::getInstance(); $req = $app->getRequest(); $resp = $app->getResponse(); $resp->sendResponse(); $resp->clearContent(); // // Do batch processing // if ($req->isLoggedIn()) { set_time_limit(3600 * 24); // if it takes more than 24 hours we're in trouble if (isset($this->opa_options['isBatchDelete']) && $this->opa_options['isBatchDelete']) { $va_errors = BatchProcessor::deleteBatchForSet($this->request, $this->ot_set, $this->ot_subject, array_merge($this->opa_options, array('progressCallback' => 'caIncrementBatchEditorProgress', 'reportCallback' => 'caCreateBatchEditorResultsReport'))); } elseif (isset($this->opa_options['isBatchTypeChange']) && $this->opa_options['isBatchTypeChange']) { $va_errors = BatchProcessor::changeTypeBatchForSet($this->request, $this->opa_options['type_id'], $this->ot_set, $this->ot_subject, array_merge($this->opa_options, array('progressCallback' => 'caIncrementBatchEditorProgress', 'reportCallback' => 'caCreateBatchEditorResultsReport'))); } else { $va_errors = BatchProcessor::saveBatchEditorFormForSet($this->request, $this->ot_set, $this->ot_subject, array_merge($this->opa_options, array('progressCallback' => 'caIncrementBatchEditorProgress', 'reportCallback' => 'caCreateBatchEditorResultsReport'))); } } }
public function process($pa_parameters) { $o_response = new ResponseHTTP(); $o_request = new RequestHTTP($o_response, array('simulateWith' => $x = array('POST' => $pa_parameters['values'], 'SCRIPT_NAME' => join('/', array(__CA_URL_ROOT__, 'index.php')), 'REQUEST_METHOD' => 'POST', 'REQUEST_URI' => join('/', array(__CA_URL_ROOT__, 'index.php', 'batch', 'Editor', 'Save', $pa_parameters['screen'], 'set_id', $pa_parameters['set_id'])), 'PATH_INFO' => '/' . join('/', array('batch', 'Editor', 'Save', $pa_parameters['screen'], 'set_id', $pa_parameters['set_id'])), 'REMOTE_ADDR' => $pa_parameters['ip_address'], 'HTTP_USER_AGENT' => 'batchEditor', 'user_id' => $pa_parameters['user_id']))); $o_app = AppController::getInstance($o_request, $o_response); $t_set = new ca_sets($pa_parameters['set_id']); $o_dm = Datamodel::load(); $t_subject = $o_dm->getInstanceByTableNum($t_set->get('table_num')); $va_report = BatchProcessor::saveBatchEditorFormForSet($o_request, $t_set, $t_subject, array('sendMail' => (bool) $pa_parameters['sendMail'], 'sendSMS' => (bool) $pa_parameters['sendSMS'])); return $va_report; }