Do it! Prompt the user for information!

@return string
195751
public function prompt()
    {
        $this->output->write($this->parser->apply($this->promptFormatted()));

        $this->writeCheckboxes();

        $this->util->system->exec('stty sane');

        return $this->checkboxes->getCheckedValues();
    }
1122163
protected function getInput() {

        @set_time_limit(120);
        @ini_set('max_execution_time', 120);

        // Initialisation.
        $html = array();
        $text = $this->getText();

        // JS
        (new RequireJSUtility())
            ->addDomReadyJS("$('[data-toggle=\"tooltip\"], .hasTooltip').tooltip({container:'body',html:true});", false, "bootstrap");

        if (!empty($this->value)) {
            $value = new Registry($this->value);
        }

        $class = $this->element['class'] ? ' ' . (string)$this->element['class'] : '';

        // On récupère l'instance de gestion ACL.
        $acl    = Acl::getInstance($this->form->getDb());
	    $simple = $acl->getSimpleAcl();

        // On récupère les sections et les actions.
        $actions = $this->getActions();

        // On charge les groupes utilisateurs.
        $groups = $this->getUserGroups();

	    // On charge les rôles.
	    $roles = $acl->getRoles();

        // Building tab nav
        $html[] = '<div role="tabpanel" class="nav-tabs-left">';

        $html[] = '<ul class="nav nav-tabs" role="tablist">';

        foreach ($groups as $i => $group) {
            $tab_class = $i == 0 ? ' class="active"' : '';
            $html[] = '<li role="presentation"' . $tab_class . '><a href="#group-' . $group->id . '" aria-controls="group-' . $group->id . '" role="tab" data-toggle="tab">';
            $html[] = str_repeat('<span class="level">&ndash;</span> ', $curLevel = $group->level) . $group->title;
            $html[] = '</a></li>';
        }

        $html[] = '</ul>';
        $html[] = '<div class="tab-content">';

        foreach ($groups as $i => $group) {

            $tab_class = $i == 0 ? ' active' : '';

            $html[] = '<div role="tabpanel" class="tab-pane' . $tab_class .'" id="group-' . $group->id . '">';

            $html[] = '<table class="rights table table-condensed' . $class . '">';

            $html[] = '<thead>';
            $html[] = '<tr>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_SECTION') . '</th>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_ACTION') . '</th>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_RIGHT') . '</th>';

            if ($group->parent_id) {
                $html[] = '<th id="aclactionth' . $group->id . '">';
                $html[] = '<span class="acl-action">' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_CALCULATED_SETTING') . '</span>';
                $html[] = '</th>';
            }

            $html[] = '</tr>';
            $html[] = '</thead>';

            $html[] = '<tbody>';

            // On parcourt les sections.
            foreach ($actions as $section) {

                $rowspan = count($section->actions);

                foreach ($section->actions as $i => $action) {

                    $html[] = '<tr>';

                    if ($i == 0) {
                        $html[] = '<td class="section" rowspan="' . $rowspan . '"><span class="hasTooltip" title="' . $text->translate($section->description) . '">' . $text->translate($section->title) . '</td>';
                    }

                    $html[] = '<td class="action"><span class="hasTooltip" title="' . $text->translate($action->description) . '">' . $text->translate($action->title) . '</td>';
                    $html[] = '<td class="right">';

                    $html[] = '<select class="form-control input-sm"'
                        . ' name="' . $this->name . '[' . $section->name . '][' . $action->name . '][' . $group->id . ']"'
                        . ' id="' . $this->id . '_' . $section->name . '_' . $action->name	. '_' . $group->id . '"'
                        . ' title="' . $text->sprintf('APP_GLOBAL_RIGHTS_SELECT_ALLOW_DENY_GROUP', $text->translate($action->title), trim($group->title)) . '">';

                    // On récupère les droits pour l'action hérités pour le groupe.
                    $inheritedRule = $acl->checkGroup($group->id, $section->name, $action->name);

                    // On récupère les droits pour l'action NON HÉRITÉS pour le groupe.
                    $assetRule = null;

	                $groups = new RoleAggregate();
	                $groups->addRole($roles[$group->id]);
                    $res = $simple->isAllowedReturnResult($groups, $section->name, $action->name)->collection;

                    if ($res->count() > 0) {
                        $res->top();
                        while($res->valid()) {
                            $priority = $res->current()->getPriority();

                            // La règle est appliqué à ce groupe en particulier si la priorité est à zero.
                            if ($priority == 0) {
                                $assetRule = $res->current()->getAction();
                            }

                            $res->next();
                        }
                    }

                    // Build the dropdowns for the permissions sliders

                    // The parent group has "Not Set", all children can rightly "Inherit" from that.
                    $html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>'
                        . $text->translate(empty($group->parent_id) ? 'APP_GLOBAL_RIGHTS_NOT_SET' : 'APP_GLOBAL_RIGHTS_INHERITED') . '</option>';
                    $html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED')
                        . '</option>';
                    $html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . $text->translate('APP_GLOBAL_RIGHTS_DENIED')
                        . '</option>';

                    $html[] = '</select>&#160; ';

                    // If this asset's rule is allowed, but the inherited rule is deny, we have a conflict.
                    if (($assetRule === true) && ($inheritedRule === false)) {
                        $html[] = $text->translate('APP_GLOBAL_RIGHTS_CONFLICT');
                    }

                    $html[] = '</td>';

                    // Build the Calculated Settings column.
                    // The inherited settings column is not displayed for the root group in global configuration.
                    if ($group->parent_id) {

                        $html[] = '<td headers="aclactionth' . $group->id . '">';

                        // This is where we show the current effective settings considering currrent group, path and cascade.
                        // Check whether this is a component or global. Change the text slightly.

                        if ($acl->checkGroup($group->id, "app", "admin") !== true) {

                            if ($inheritedRule === true) {
                                $html[] = '<span class="label label-success">' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED') . '</span>';
                            } elseif ($inheritedRule === false) {
                                $html[] = '<span class="label label-danger">' . $text->translate('APP_GLOBAL_RIGHTS_NOT_ALLOWED') . '</span>';
                            }

                        } elseif ($section->name != 'app') {
                                $html[] = '<span class="label label-success"><i class="fa fa-lock"></i> ' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED_ADMIN')
                                    . '</span>';
                        } else {

                            // Special handling for  groups that have global admin because they can't  be denied.
                            // The admin rights can be changed.

                            if ($section->name === 'app' && $action->name === 'admin') {
                                $html[] = '<span class="label label-success">' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED') . '</span>';
                            } elseif ($inheritedRule === false) {
                                // Other actions cannot be changed.
                                $html[] = '<span class="label label-danger"><i class="fa fa-lock"></i> '
                                    . $text->translate('APP_GLOBAL_RIGHTS_NOT_ALLOWED_ADMIN_CONFLICT') . '</span>';
                            } else {
                                $html[] = '<span class="label label-success"><i class="fa fa-lock"></i> ' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED_ADMIN')
                                    . '</span>';
                            }
                        }

                        $html[] = '</td>';
                    }

                    $html[] = '</tr>';

                }

            }


            $html[] = '';
            $html[] = '';
            $html[] = '';
            $html[] = '</tbody>';

            $html[] = '</table>';

            $html[] = '</div>';

        }

        $html[] = '</div>';
        $html[] = '</div>';

        return implode($html);

    }
1141900
protected function promptForProviderOrTag()
    {
        $choice = $this->choice(
            "Which provider or tag's files would you like to publish?",
            $choices = $this->publishableChoices()
        );

        if ($choice == $choices[0] || is_null($choice)) {
            return;
        }

        $this->parseChoice($choice);
    }
1193411
public function getActionText()
    {
        switch ($this->action) {
            case 'ask':
                return Yii::t('credit', 'Ask questions');
                break;
            case 'answer_question':
                return Yii::t('credit', 'Answered the question');
                break;
            case 'answer_adopted':
                return Yii::t('credit', 'answer is adopted');
                break;
            default:
                return null;
                break;
        }
    }
327251
public function promptToStart()
    {
        $cli = $this->climate();

        $opts = [ 'y', 'n', 'v', '?' ];
        $help = [
            '[y]es  — continue to deletion phase',
            '[n]o   — cancel deletion phase',
            '[v]iew — view unused attachments',
        ];

        $input = $cli->input($this->indent.'Continue');
        $input->accept($opts, true);

        $value = $input->prompt();
        switch ($value) {
            case '?':
                $cli->br();
                $cli->out($this->indent.implode("\n".$this->indent, $help));
                $cli->br();
                return $this->promptToStart();

            case 'v':
                return 'view';

            case 'n':
                return false;

            case 'y':
            default:
                return true;
        }
    }
1370095
public function getFormattingHelp()
    {
        $note = _t(
            'NotifyUsersWorkflowAction.FORMATTINGNOTE',
            'Notification emails can contain HTML formatting. The following special variables are replaced with their
			respective values in the email subject, email from and template/body.'
        );
        $member = _t(
            'NotifyUsersWorkflowAction.MEMBERNOTE',
            'These fields will be populated from the member that initiates the notification action. For example,
			{$Member.FirstName}.'
        );
        $initiator = _t(
            'NotifyUsersWorkflowAction.INITIATORNOTE',
            'These fields will be populated from the member that initiates the workflow request. For example,
			{$Initiator.Email}.'
        );
        $context = _t(
            'NotifyUsersWorkflowAction.CONTEXTNOTE',
            'Any summary fields from the workflow target will be available. For example, {$Context.Title}.
			Additionally, the {$Context.AbsoluteEditLink} variable will contain a link to edit the workflow target in
            the CMS (if it is a Page), and {$Context.AbsoluteLink} the frontend link. The {$Context.LinkToPendingItems}
            variable will generate a link to the CMS workflow admin, useful for allowing users to enact workflow
            transitions, directly from emails.'
        );
        $fieldName = _t('NotifyUsersWorkflowAction.FIELDNAME', 'Field name');
        $commentHistory = _t('NotifyUsersWorkflowAction.COMMENTHISTORY', 'Comment history up to this notification.');

        $memberFields = implode(', ', array_keys($this->getMemberFields()));

        return "<p>$note</p>
			<p><strong>{\$Member.($memberFields)}</strong><br>$member</p>
			<p><strong>{\$Initiator.($memberFields)}</strong><br>$initiator</p>
			<p><strong>{\$Context.($fieldName)}</strong><br>$context</p>
			<p><strong>{\$CommentHistory}</strong><br>$commentHistory</p>";
    }
80032
protected function getActionText()
    {
        if ($this->hasBeenSent()) {
            $action = 'action_sent';
        } elseif ($this->isSendingPrevented()) {
            $action = 'action_not_sent';
        } else {
            $action = 'action_unknown';
        }
        return $this->t($action);
    }
712315
public function getActionText()
    {
        switch ($this->action) {
            case 'follow_user':
                return Yii::t('doing', 'follow on you');
                break;
            case 'answer_question':
                return Yii::t('doing', 'answered the question');
                break;
            case 'follow_question':
                return Yii::t('doing', 'is concerned about the problem');
                break;
            case 'create_article':
                return Yii::t('doing', 'Share an article');
                break;
            case 'create_note':
                return Yii::t('doing', 'Share an note');
                break;
            case 'create_news':
                return Yii::t('doing', 'Share an news');
                break;
            case 'create_live':
                return Yii::t('doing', 'Create the stream');
                break;
            case 'join_live':
                return Yii::t('doing', 'join the live');
                break;
            default:
                return null;
                break;
        }
    }
1074565
protected function promptFormatted()
    {
        $prompt = $this->prompt . ' ';

        if ($this->show_acceptable) {
            $prompt .= $this->acceptableFormatted() . ' ';
        }

        return $prompt;
    }
663667
public function actionInscription()
    {
        $form = $this->getInscriptionForm();
        if ($form->isValid()) {
            $user = $this->getUserModel()
                ->set('login', $form->login)
                ->set('password', $form->password);
            try {
                $saved = FALSE;
                $saved = $user->save();
            } catch (\PDOException $e) {
            }
            if ($saved) {
                $this->login($user);
                Notif::success(sprintf(static::MSG_INSCRIPTION_VALID, $form->login));
                \Staq\Util::httpRedirectUri($this->getRedirectUri());
            } else {
                Notif::error(static::MSG_INSCRIPTION_KO);
            }
        }
        $view = $this->createView('inscription');
        $view['form'] = $form;
        $view['redirect'] = $this->getRedirectUri();
        return $view;
    }
326088
public function showHelp()
    {
        $io     = $this->io();
        $helper = new OutputHelper($io->writer());

        $io->bold("Command {$this->_name}, version {$this->_version}", true)->eol();
        $io->comment($this->_desc, true)->eol();
        $io->bold('Usage: ')->yellow("{$this->_name} [OPTIONS...] [ARGUMENTS...]", true);

        $helper
            ->showArgumentsHelp($this->allArguments())
            ->showOptionsHelp($this->allOptions(), '', 'Legend: <required> [optional] variadic...');

        if ($this->_usage) {
            $io->eol();
            $io->boldGreen('Usage Examples:', true)->colors($this->_usage)->eol();
        }

        return $this->emit('_exit', 0);
    }
1110382
public function askYesNo(string $prompt)
    {
        $prompt .= ' (y/n): ';
        $result = null;

        $result = $this->askUntillValid($prompt, function($answer) {
            /* Lowercase user prompt */
            $answer = strtolower($answer);

            /* Correrct answer is y or n */
            return $answer === 'y' || $answer === 'n';
        });

        return $result === 'y';
    }
1197789
public function getDescription(): string
    {
        if (\is_array($this->haystack)) {
            $haystack = implode(', ', $this->haystack);
        } else {
            $haystack = $this->haystack;
        }
        return __('must be in "%s"', $haystack);
    }
709786
public String showPrompt() {
        String prompt = isAnsiEnabled() ? ansiPrompt(PROMPT).toString() : PROMPT;
        return showPrompt(prompt);
    }
1149837
protected function renderRequestInfo()
    {
        $output = '';
        if ($this->requestInformationRenderer !== null) {
            $output = $this->requestInformationRenderer->__invoke();
        }

        return $output;
    }
1028341
protected function getHelpOutput()
    {
        /* @var $result string */
        $result = "\n";
        $result .= "Copyright 2014 by Jasper van Herpt <jasper.v.herpt@gmail.com>\n";
        $result .= "\n";
        $result .= "Database actions:";
        $result .= "\n";
        $result .= "Usage:\t\tacl database [clean-install|update] [--email=] [--help|-h] [--verbose|-v]\n";
        $result .= "Examples:\tacl database clean-install --email=john.doe@example.com --verbose\n";
        $result .= "\t\tacl database update --verbose\n";
        $result .= "\t\tacl database --help\n";
        $result .= "\n";
        $result .= "clean-install: Installs the database schema to the configurated database connection\n";
        $result .= "\t--e-mail\t(required):\tAny e-mail address\n";
        $result .= "\t--verbose|-v\t(optional):\tOutput progress\n";
        $result .= "\n";
        $result .= "update: Update the class data to the existing database schema.\n";
        $result .= "\t--verbose|-v\t(optional):\tOutput progress\n";
        $result .= "\n";
        $result .= "\n";
        $result .= "Creating a new user";
        $result .= "\n";
        $result .= "Usage:\t\tacl new-user --username=|-u --email=|-e --password=|-p [--help|-h] [--verbose|-v]\n";
        $result .= "Example:\tacl new-user --email=john.doe@example.com --password=something --verbose\n";
        $result .= "This action will create a new admin user";
        $result .= "\t--e-mail\t(required):\tAny e-mail address\n";
        $result .= "\t--password\t(required):\tA valid password, minimum 8 characters\n";
        return $result;
    }
520322
protected function askQuestion()
    {
        //  Ask away cap'n!
        $this->data['page']->title = lang('auth_twofactor_answer_title');
        $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/mfa/question/ask.php');
        Factory::service('View')
            ->load([
                'structure/header/blank',
                'auth/mfa/question/ask',
                'structure/footer/blank',
            ]);
    }