Get the submit action name.

@param EnvironmentInterface $environment      The environment.
@param boolean              $regardSelectMode Determine regard the select mode parameter.

@return string
163727
private function getSubmitAction(EnvironmentInterface $environment, $regardSelectMode = false)
    {
        if (!$regardSelectMode
            && $environment->getInputProvider()->hasParameter('select')
            && !$environment->getInputProvider()->hasValue('properties')
        ) {
            return 'select' . \ucfirst($environment->getInputProvider()->getParameter('select'));
        }

        if (null !== ($action = $this->determineAction($environment))) {
            return $action;
        }

        if ($regardSelectMode) {
            return $environment->getInputProvider()->getParameter('mode') ?: null;
        }

        return $environment->getInputProvider()->getParameter('select') ?
            'select' . \ucfirst($environment->getInputProvider()->getParameter('select')) : null;
    }
1153712
private function isSortable(EnvironmentInterface $environment)
    {
        return ((true === (bool) ViewHelpers::getManualSortingProperty($environment))
                && (true === $environment->getDataDefinition()->getBasicDefinition()->isEditable()));
    }
979411
protected function renderPasteTopButton(EnvironmentInterface $environment, $sorting)
    {
        $definition     = $environment->getDataDefinition();
        $dispatcher     = $environment->getEventDispatcher();
        $languageDomain = 'contao_' . $definition->getName();

        $filter = new Filter();
        $filter->andModelIsFromProvider($definition->getBasicDefinition()->getDataProvider());

        if (!$sorting || $environment->getClipboard()->isEmpty($filter)) {
            return null;
        }
        if (!ViewHelpers::getManualSortingProperty($environment)) {
            return null;
        }

        /** @var AddToUrlEvent $urlEvent */
        $urlEvent = $dispatcher->dispatch(
            ContaoEvents::BACKEND_ADD_TO_URL,
            new AddToUrlEvent(
                'act=paste&after=' . ModelId::fromValues($definition->getName(), '0')->getSerialized()
            )
        );

        /** @var GenerateHtmlEvent $imageEvent */
        $imageEvent = $dispatcher->dispatch(
            ContaoEvents::IMAGE_GET_HTML,
            new GenerateHtmlEvent(
                'pasteafter.svg',
                $this->translate('pasteafter.0', $languageDomain),
                'class="blink"'
            )
        );

        return \sprintf(
            '<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a>',
            $urlEvent->getUrl(),
            StringUtil::specialchars($this->translate('pasteafter.0', $languageDomain)),
            $imageEvent->getHtml()
        );
    }
1127663
public function getExecuteMode()
    {
        $sessionClass = ReporticoSession();

        // User clicked Report Dropdown + Go Button
        if (array_key_exists('submit_execute_mode', $_REQUEST)) {
            if (array_key_exists('execute_mode', $_REQUEST)) {
                $this->execute_mode = $_REQUEST['execute_mode'];
            }
        }

        // User clicked Design Mode Button
        if (array_key_exists('submit_design_mode', $_REQUEST)) {
            $this->execute_mode = "MAINTAIN";
        }

        // User clicked Design Mode Button
        if (array_key_exists('submit_genws_mode', $_REQUEST)) {
            $this->execute_mode = "SOAPSAVE";
        }

        // User clicked Design Mode Button
        if (array_key_exists('submit_prepare_mode', $_REQUEST)) {
            $this->execute_mode = "PREPARE";
        }

        // User clicked Design Mode Button
        if (array_key_exists('submit_criteria_mode', $_REQUEST)) {
            $this->execute_mode = "CRITERIA";
        }

        if (array_key_exists('execute_mode', $_REQUEST)) {
            if ($_REQUEST["execute_mode"] == "MAINTAIN" && $this->allow_maintain != "SAFE"
                && $this->allow_maintain != "FULL" && $this->allow_maintain != "DEMO") {} else {
                $this->execute_mode = $_REQUEST["execute_mode"];
            }
        }

        if (!$this->execute_mode && array_key_exists('submit', $_REQUEST)) {
            $this->execute_mode = "EXECUTE";
        }

        if (!$this->execute_mode && array_key_exists('submitPrepare', $_REQUEST)) {
            $this->execute_mode = "EXECUTE";
        }

        if (!$this->execute_mode && $sessionClass::issetReporticoSessionParam("execute_mode")) {
            $this->execute_mode = $sessionClass::getReporticoSessionParam("execute_mode");
        }

        // If user has pressed expand then we want to staty in PREPARE mode
        foreach ($_REQUEST as $key => $value) {
            if (preg_match("/^EXPAND_/", $key)) {
                $this->execute_mode = "PREPARE";
                break;
            }
        }

        if (!$this->execute_mode) {
            $this->execute_mode = "MENU";
        }

        if ($this->execute_mode == "MAINTAIN" &&
            $this->allow_maintain != "SAFE" &&
            $this->allow_maintain != "DEMO" &&
            $this->allow_maintain != "FULL" &&
            !$this->parent_query) {
            ReporticoApp::handleError("Report Maintenance Mode Disallowed");
            $this->execute_mode = "PREPARE";
        }
        if (array_key_exists('execute_mode', $_REQUEST)) {
            if ($_REQUEST["execute_mode"] == "MAINTAIN" && $this->allow_maintain != "SAFE"
                && $this->allow_maintain != "DEMO"
                && $this->allow_maintain != "FULL") {} else {
                $this->execute_mode = $_REQUEST["execute_mode"];
            }
        }

        if (!$this->execute_mode) {
            $this->execute_mode = "MENU";
        }

        // Override mode if specified from ADMIN page
        if (ReporticoUtility::getRequestItem("jump_to_delete_project", "") && array_key_exists("submit_delete_project", $_REQUEST)) {
            $this->execute_mode = "PREPARE";
        }

        if (ReporticoUtility::getRequestItem("jump_to_configure_project", "") && array_key_exists("submit_configure_project", $_REQUEST)) {
            $this->execute_mode = "PREPARE";
        }

        if (ReporticoUtility::getRequestItem("jump_to_menu_project", "") && array_key_exists("submit_menu_project", $_REQUEST)) {
            $this->execute_mode = "MENU";
        }

        if (ReporticoUtility::getRequestItem("jump_to_design_project", "") && array_key_exists("submit_design_project", $_REQUEST)) {
            $this->xmloutfile = "";
            $this->execute_mode = "PREPARE";
        }

        // If Reset pressed force to Prepare mode
        if (array_key_exists("clearform", $_REQUEST)) {
            $sessionClass::setReporticoSessionParam("firstTimeIn", true);
            $this->execute_mode = "PREPARE";
        }

        // If logout pressed then force to MENU mode
        if (array_key_exists("logout", $_REQUEST)) {
            $this->execute_mode = "MENU";
        }

        // If initialised from framework then set mode from there
        if ($this->initial_execute_mode && $sessionClass::getReporticoSessionParam("awaiting_initial_defaults")) {
            $this->execute_mode = $this->initial_execute_mode;
        }

        // Maintain execute mode through except for CRITERIA
        if ($this->execute_mode != "CRITERIA") {
            $sessionClass::setReporticoSessionParam("execute_mode", $this->execute_mode);
        }

        return ($this->execute_mode);
    }
692497
public static function EnvironmentDetectBySystemConfig (array $environmentsSectionData = []) {
		$environment = NULL;
		$app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance();
		$request = $app->GetRequest();
		$clientIp = NULL;
		$serverHostName = NULL;
		$serverGlobals = NULL;
		foreach ((array) $environmentsSectionData as $environmentName => $environmentSection) {
			$sectionData = static::envDetectParseSysConfigEnvSectionData($environmentSection);
			$detected = static::envDetectBySystemConfigEnvSection(
				$sectionData, $request, $clientIp, $serverHostName, $serverGlobals
			);
			if ($detected) {
				$environment = $environmentName;
				break;
			}
		}
		if ($environment && !static::$environment) {
			static::SetEnvironment($environment);
		} else if (!static::$environment) {
			static::SetEnvironment('production');
		}
		return static::$environment;
	}
994534
private function handleGlobalCommands(EnvironmentInterface $environment)
    {
        $dataDefinition = $environment->getDataDefinition();
        $backendView    = $dataDefinition->getDefinition(Contao2BackendViewDefinitionInterface::NAME);

        $backButton = null;
        if ($backendView->getGlobalCommands()->hasCommandNamed('back_button')) {
            $backButton = $backendView->getGlobalCommands()->getCommandNamed('back_button');
        }

        if (!$backButton) {
            return;
        }

        $parametersBackButton = $backButton->getParameters();

        if (\in_array($this->getSelectAction($environment), ['properties', 'edit'])) {
            $parametersBackButton->offsetSet('act', 'select');
            $parametersBackButton->offsetSet(
                'select',
                ('edit' === $this->getSelectAction($environment)) ? 'properties' : 'models'
            );
            $parametersBackButton->offsetSet('mode', $this->getSubmitAction($environment, true));
        }

        $closeCommand = new Command();
        $backendView->getGlobalCommands()->addCommand($closeCommand);

        $closeExtra = [
            'href'       => $this->getReferrerUrl($environment),
            'class'      => 'header_icon header_stop',
            'accessKey'  => 'x',
            'attributes' => 'onclick="Backend.getScrollOffset();"'
        ];

        $closeCommand
            ->setName('close_all_button')
            ->setLabel('MSC.closeAll.0')
            ->setDescription('MSC.closeAll.1')
            ->setParameters(new \ArrayObject())
            ->setExtra(new \ArrayObject($closeExtra))
            ->setDisabled(false);
    }
636858
protected function getCollectionFromSession(Action $action, EnvironmentInterface $environment)
    {
        $inputProvider  = $environment->getInputProvider();
        $sessionStorage = $environment->getSessionStorage();
        $dataDefinition = $environment->getDataDefinition();
        $dataProvider   = $environment->getDataProvider($dataDefinition->getName());

        $addEditProperties =
            $inputProvider->hasValue('FORM_INPUTS')
            && ($dataDefinition->getName() === $inputProvider->getValue('FORM_SUBMIT'));

        $session = $this->getSession($action, $environment);

        $editProperties = [];

        $modelIds = [];
        foreach ($session['models'] as $modelId) {
            $modelIds[] = ModelId::fromSerialized($modelId)->getId();

            if ($addEditProperties) {
                $modelEditProperties = $inputProvider->getValue(\str_replace('::', '____', $modelId) . '_', true);
                $inputProvider->unsetValue(\str_replace('::', '____', $modelId) . '_');

                $editProperties[$modelId] = $modelEditProperties;
            }
        }

        $idProperty = \method_exists($dataProvider, 'getIdProperty') ? $dataProvider->getIdProperty() : 'id';
        $collection = $dataProvider->fetchAll(
            $dataProvider->getEmptyConfig()->setFilter(
                [['operation' => 'IN', 'property' => $idProperty, 'values' => $modelIds]]
            )
        );

        $session['editProperties'] = $editProperties;

        $sessionStorage->set($dataDefinition->getName() . '.' . $this->getMode($action), $session);

        return $collection;
    }
841355
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	public ActionMode.Callback getCustomSelectionActionModeCallback (){
		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
			return mInputView.getCustomSelectionActionModeCallback();

		return null;
	}
1314383
public function getServiceUrlFor($region, $environment, $overrideUrl)
	{
		return sprintf(self::SERVICE_FORMAT_STRING,
					$this->_getServiceHostFor($region, $overrideUrl),
					$this->_getSectionNameFor($environment),
					OffAmazonPaymentsService_Client::SERVICE_VERSION);
	}
624780
private function handleSelectPropertiesAllAction(EnvironmentInterface $environment, Action $action)
    {
        $this->clearClipboard($environment);
        $this->handleGlobalCommands($environment);
        $this->handleSessionOverrideEditAll(
            $this->getModelIds($environment, $action, $this->getSubmitAction($environment)),
            'models',
            $environment
        );

        $collection = $this->getSelectCollection($environment);
        $this->setIntersectProperties($collection, $environment);
        $this->setIntersectValues($collection, $environment);

        if ($response = $this->callAction($environment, 'selectPropertyAll')) {
            return $response;
        }

        return null;
    }
1356157
private function getOperation(Action $action, EnvironmentInterface $environment)
    {
        /** @var Contao2BackendViewDefinitionInterface $definition */
        $definition = $environment->getDataDefinition()->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
        $name       = $action->getName();
        $commands   = $definition->getModelCommands();

        if (!$commands->hasCommandNamed($name)) {
            return null;
        }

        return $commands->getCommandNamed($name);
    }
515816
protected function getSelectButtons()
    {
        $environment = $this->getEnvironment();

        $event = new GetSelectModeButtonsEvent($environment);
        $event->setButtons([]);
        $environment->getEventDispatcher()->dispatch(GetSelectModeButtonsEvent::NAME, $event);

        return $event->getButtons();
    }
154777
private function get_display_mode_selector_html(int $displaymode) : string {
        $baseurl = $this->baseurl;
        $select = new single_select(
            $baseurl,
            'mode',
            forum_get_layout_modes(),
            $displaymode,
            null,
            'mode'
        );
        $select->set_label(get_string('displaymode', 'forum'), ['class' => 'accesshide']);

        return $this->renderer->render($select);
    }
773164
private function getLegendPropertyNames(
        ModelInterface $intersectModel,
        EnvironmentInterface $environment,
        PaletteInterface &$defaultPalette = null
    ) {
        $inputProvider      = $environment->getInputProvider();
        $palettesDefinition = $environment->getDataDefinition()->getPalettesDefinition();

        $legendPropertyNames = [];
        if ($inputProvider->hasValue('FORM_INPUTS') && (1 === \count($palettesDefinition->getPalettes()))) {
            return $legendPropertyNames;
        }

        $defaultPalette = $palettesDefinition->findPalette($intersectModel);
        foreach ($defaultPalette->getProperties($intersectModel) as $paletteProperty) {
            $legendPropertyNames[] = $paletteProperty->getName();
        }

        return $legendPropertyNames;
    }
16454
public static function detectEnvironment($request = null)
    {
        if (!empty(static::$env)) {
            return static::$env;
        }

        $rules = self::get('env');

        $request = $request ? $request : Request::createFromGlobals();

        $host = $request->getHost();

        foreach ($rules as $env => $rule) {
            if (is_callable($rule)) {
                static::$env = $env;
            } elseif (preg_match($rule, $host)) {
                static::$env = $env;
                break;
            }
        }

        static::loadEnvironment(static::$env);

        return static::$env;
    }
903382
public function detectEnvironment($environments)
    {
        $r = Request::getInstance();
        $pos = stripos($r->server->get('SCRIPT_NAME'), DISPATCHER_FILENAME);
        if ($pos > 0) {
            //we do this because in CLI circumstances (and some random ones) we would end up with index.ph instead of index.php
            $pos = $pos - 1;
        }
        $home = substr($r->server->get('SCRIPT_NAME'), 0, $pos);
        $this['app_relative_path'] = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $home), '/');

        $args = $this->isRunThroughCommandLineInterface() && isset($_SERVER['argv']) ? $_SERVER['argv'] : null;

        $detector = new EnvironmentDetector();

        return $this->environment = $detector->detect($environments, $args);
    }
360801
public function submitButton()
    {
        if (self::MODE_VIEW === $this->mode) {
            return '';
        }

        if (!$this->options['enableSubmit']) {
            return '';
        }

        if (self::MODE_EDIT === $this->mode) {
            $text = trans('admin.save');
        } else {
            $text = trans('admin.submit');
        }

        return <<<EOT
<div class="btn-group pull-right">
    <button type="submit" class="btn btn-info pull-right" data-loading-text="<i class='fa fa-spinner fa-spin '></i> $text">$text</button>
</div>
EOT;
    }