Set what to do when the form is 'finished'.

@return \Gems\Tracker\Snippets\ExportTrackSnippetAbstract
195995
protected function setAfterSaveRoute()
    {
        $filename = $this->getExportBatch(false)->getSessionVariable('filename');
        if ($filename) {
            // Now is a good moment to remove the temporary file
            @unlink($filename);
        }

       // Default is just go to the index
        if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
            $this->afterSaveRouteUrl = array(
                $this->request->getControllerKey() => $this->request->getControllerName(),
                $this->request->getActionKey()     => $this->routeAction,
                \MUtil_Model::REQUEST_ID           => $this->request->getParam(\MUtil_Model::REQUEST_ID),
                );
        }

        return $this;
    }
118710
public function end()
    {
        if (null !== $this->currentGroup) {
            $this->currentGroup = null;
        } elseif (null !== $this->currentTab) {
            $this->currentTab = null;
        } else {
            throw new \RuntimeException('No open tabs or groups, you cannot use end()');
        }

        return $this;
    }
818710
public function done()
	{
		// Compute the totall length of the output
		$length = $this->contentLength + $this->initMessageLength;

		// Back up all the way
		$this->backspace($length, true);

		// In case this gets used again...
		$this->contentLength     = 0;
		$this->initMessageLength = 0;
	}
1091810
private function done(){
		$rtn = $this->form_endpoint->render(
			'form_edit_done.html',
			array(
				'href_backto'=>$this->options['href_backto'],
			)
		);

		$rtn = $this->form_endpoint->wrap_theme($rtn);
		return $rtn;
	}
399279
public function definition() {
        $mform = $this->_form;

        $mform->addElement('header', 'database', get_string('dbexport', 'tool_dbtransfer'));
        $mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
        $mform->setType('description', PARAM_TEXT);

        $this->add_action_buttons(false, get_string('exportdata', 'tool_dbtransfer'));
    }
365869
public function exportTrackAction()
    {
        if ($this->exportTrackSnippets) {
            $params = $this->_processParameters($this->exportTrackParameters);

            $this->addSnippets($this->exportTrackSnippets, $params);
        }
    }
773942
public function exportAction()
    {
        $step = $this->request->getParam('step');
        $post = $this->request->getPost();
        
        $this->autofilterParameters = $this->autofilterParameters + $this->_autofilterExtraParameters;

        $model = $this->getExportModel();

        if (isset($this->autofilterParameters['sortParamAsc'])) {
            $model->setSortParamAsc($this->autofilterParameters['sortParamAsc']);
        }
        if (isset($this->autofilterParameters['sortParamDesc'])) {
            $model->setSortParamDesc($this->autofilterParameters['sortParamDesc']);
        }

        $model->applyParameters($this->getSearchFilter(false), true);
        
        if (!empty($post)) {
            $this->accesslog->logChange($this->request, null, $post + $model->getFilter());
        }

        // Add any defaults.
        if (isset($this->autofilterParameters['extraFilter'])) {
            $model->addFilter($this->autofilterParameters['extraFilter']);
        }
        if (isset($this->autofilterParameters['extraSort'])) {
            $model->addSort($this->autofilterParameters['extraSort']);
        }

        if ((!$step) || ($post && $step == 'form')) {
            $this->addSnippet($this->exportFormSnippets);
            $batch = $this->loader->getTaskRunnerBatch('export_data');
            $batch->reset();
        } elseif ($step == 'batch') {
            $batch = $this->loader->getTaskRunnerBatch('export_data');


            $batch->setVariable('model', $model);
            if (!$batch->count()) {
                $batch->minimalStepDurationMs = 2000;
                $batch->finishUrl = $this->view->url(array('step' => 'download'));

                $batch->setSessionVariable('files', array());

                if (! isset($post['type'])) {
                    // Export type is needed, use most basic type
                    $post['type'] = 'CsvExport';
                }
                $batch->addTask('Export_ExportCommand', $post['type'], 'addExport', $post);
                $batch->addTask('addTask', 'Export_ExportCommand', $post['type'], 'finalizeFiles');
                
                $export = $this->loader->getExport()->getExport($post['type']);
                if ($snippet = $export->getHelpSnippet()) {
                    $this->addSnippet($snippet);
                }

                $batch->autoStart = true;
            }

            if (MUtil_Console::isConsole()) {
                // This is for unit tests, if we want to be able to really export from
                // cli we need to place the exported file somewhere.
                // This is out of scope for now.
                $batch->runContinuous();
            } elseif ($batch->run($this->request)) {
                exit;
            } else {
                $controller = $this;

                if ($batch->isFinished()) {
                    /*\MUtil_Echo::track('finished');
                    $file = $batch->getSessionVariable('file');
                    if ((!empty($file)) && isset($file['file']) && file_exists($file['file'])) {
                        // Forward to download action
                        $this->_session->exportFile = $file;
                    }*/
                } else {
                    if ($batch->count()) {
                        $controller->html->append($batch->getPanel($controller->view, $batch->getProgressPercentage() . '%'));
                    } else {
                        $controller->html->pInfo($controller->_('Nothing to do.'));
                    }
                    $controller->html->pInfo()->a(
                            \MUtil_Html_UrlArrayAttribute::rerouteUrl($this->getRequest(), array('action'=>'index', 'step' => false)),
                            array('class'=>'actionlink'),
                            $this->_('Back')
                            );
                }
            }
        } elseif ($step == 'download') {
            $this->view->layout()->disableLayout();
            $this->_helper->viewRenderer->setNoRender(true);
            $batch = $this->loader->getTaskRunnerBatch('export_data');
            $file = $batch->getSessionVariable('file');
            foreach($file['headers'] as $header) {
                header($header);
            }
            while (ob_get_level()) {
                ob_end_clean();
            }
            readfile($file['file']);
            // Now clean up the file
            unlink($file['file']);

            exit;
        }
    }
1307766
protected function finishLastPoint()
    {
        // Measurements are more accurate
        $stopTime = microtime(true);

        if($this->currentPoint)
        {
            // Get point
            $point = $this->currentPoint;

            if($point->isActive())
            {
                // Set query log items
                $this->setQueryLogItemsToPoint($point);

                // Check if message in label text
                $this->checkAndSetMessageInToLabel($point);

                // Finish point
                $point->setStopTime($stopTime);
                $point->finish();

                $this->pointStack[] = $point;

                // Trigger presenter listener
                $this->presenter->finishPointTrigger($point);
            }
        }
    }
81449
public function completed()
    {
        $resource = $this->getActionExecution();
        if ($resource === null) {
            $requiredActionClass = new \core_kernel_classes_Class(self::CLASS_URI);
            $resource = $requiredActionClass->createInstanceWithProperties(array(
                self::PROPERTY_SUBJECT => $this->getUser()->getIdentifier(),
                self::PROPERTY_NAME => $this->requiredAction->getName(),
                self::PROPERTY_EXECUTION_TIME => time(),
            ));
        }
        $timeProperty = (new \core_kernel_classes_Property(self::PROPERTY_EXECUTION_TIME));
        $resource->editPropertyValues($timeProperty, time());
        return $resource;
    }
813023
protected function setJobExport()
    {
        $submitted = $this->getSubmitted();
        $settings = $this->module->getSettings('export');

        $settings['columns'] = $submitted['columns'];
        $settings['options'] = $submitted['options'];

        $this->module->setSettings('export', $settings);

        $data = array_merge($settings, $submitted);

        $data['header'] = array_intersect_key($data['header'], array_flip($data['columns']));
        gplcart_file_csv($data['file'], $data['header'], $data['delimiter']);

        $hash = gplcart_string_encode($data['file']);
        $total = $this->getTotalProductExport($data['options']);

        $vars = array('@url' => $this->url('', array('download' => $hash)), '@num' => $total);
        $finish = $this->text('Exported @num items. <a href="@url">Download</a>', $vars);

        $job = array(
            'data' => $data,
            'total' => $total,
            'id' => 'export_product',
            'redirect_message' => array('finish' => $finish)
        );

        $this->job->submit($job);
    }
840558
public function exportAction()
	{
		$cntl = $this->createAdmin();

		if( ( $html = $cntl->export() ) == '' ) {
			return $this->setPsrResponse( $cntl->getView()->response() );
		}

		$this->view->assign( 'content', $html );
	}
363665
public function _endif()
    {
        if (!$this->conditionalProxy) {
            throw new LogicException(__METHOD__ .' must be called after _if()');
        }

        $this->conditionalProxy = $this->conditionalProxy->getParentProxy();

        if ($this->conditionalProxy) {
            return $this->conditionalProxy->getCriteriaOrProxy();
        }

        // reached last level
        return $this;
    }
235919
public function RenderEnd () {
		$this->PreDispatch();
		$this->SetFormTagRenderingStatus(FALSE);
		$result = '</form>'
			. $this->RenderSupportingJs()
			. $this->RenderSupportingCss();
		$this->cleanSessionErrorsAfterRender();
		return $result;
	}
868165
protected function _finish()
		{

			// Check layout path
			$layoutPath = !is_null($this->request->route->module) ? $this->request->route->module->path . '/Layouts' : LAYOUT_PATH;

			// Layout set?
			if (!isset($this->_layout)) {

				// Layout in controller?
				if (!is_null(static::$layout)) {

					// Use that.
					$this->_layout = $layoutPath . '/' . static::$layout;

				} elseif (!is_null($this->request->route->module) && !is_null($this->request->route->module->defaultLayout)) {

					// Use that with module info
					$this->_layout = $layoutPath . '/' . $this->request->route->module->defaultLayout;
					

				} else {

					// Use app's default.
					$this->_layout = LAYOUT_PATH . '/' . Application::getConfiguration()->defaultLayout;

				}

			}

			// No layout?
			if ($this->_layout === false) {

				// Just output the content then.
				if (array_key_exists('main', $this->_renderedContent)) {
					echo $this->_renderedContent['main'];
				}

			} else {

				// Guess the extension
				$layoutFile = $this->_guessExtension($this->_layout);
				
				// Not found?
				if ($layoutFile === false) {
					throw new \Exception("Couldn't find layout for " . $this->_layout, 1);					
				}
				$this->_layout = $layoutFile;

				// Create and render the layout
				$layout = new Layout($this->_layout, $this, $this->_renderedContent);

			}


		}
991113
public function getExport()
    {
        $form = FormBuilder::create($this->export_form, [
            'model' => $this->model
        ]);

        $form_content = view('expendable::admin.form.components.formgenerator.export', [
            'form' => $form
        ]);
        $content      = view('expendable::admin.form.state.form', [

        ]);

        $this->layoutManager->add([
            'form'=>$form_content,
            'content'=>$content,
        ]);

        return $this->layoutManager->render();
    }
650576
public function last()
    {
        $this->executeBeforeCallback();

        return count($this->items) > 0 ? end($this->items) : null;
    }
525908
public function mark_complete() {
        // Create record
        $this->timecompleted = time();

        // Save record
        if ($this->id) {
            $this->update();
        } else {
            $this->insert();
        }

        // Mark course completion record as started (if not already)
        $cc = array(
            'course'    => $this->course,
            'userid'    => $this->userid
        );
        $ccompletion = new completion_completion($cc);
        $ccompletion->mark_inprogress($this->timecompleted);
    }