Show a confirmation page to make sure they want to remove submission data.

@return string
182062
protected function view_remove_submission_confirm() {
        global $USER, $DB;

        $userid = optional_param('userid', $USER->id, PARAM_INT);

        if (!$this->can_edit_submission($userid, $USER->id)) {
            print_error('nopermission');
        }
        $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);

        $o = '';
        $header = new assign_header($this->get_instance(),
                                    $this->get_context(),
                                    false,
                                    $this->get_course_module()->id);
        $o .= $this->get_renderer()->render($header);

        $urlparams = array('id' => $this->get_course_module()->id,
                           'action' => 'removesubmission',
                           'userid' => $userid,
                           'sesskey' => sesskey());
        $confirmurl = new moodle_url('/mod/assign/view.php', $urlparams);

        $urlparams = array('id' => $this->get_course_module()->id,
                           'action' => 'view');
        $cancelurl = new moodle_url('/mod/assign/view.php', $urlparams);

        if ($userid == $USER->id) {
            $confirmstr = get_string('removesubmissionconfirm', 'assign');
        } else {
            $name = $this->fullname($user);
            $confirmstr = get_string('removesubmissionconfirmforstudent', 'assign', $name);
        }
        $o .= $this->get_renderer()->confirm($confirmstr,
                                             $confirmurl,
                                             $cancelurl);
        $o .= $this->view_footer();

        \mod_assign\event\remove_submission_form_viewed::create_from_user($this, $user)->trigger();

        return $o;
    }
528853
public function wasSubmitted()
    {
        $formMethod = strtoupper($this->getAttribute('method', 'post'));
        $formId = $this->getRequest()->getPost('form-id', false);
        $formId = $formId
            ? $formId
            : $this->getRequest()->getQuery('form-id', null);

        $submitted = $this->request->getMethod() == $formMethod &&
            $formId == $this->getId();
        if ($submitted) {
            $this->updateValuesFromRequest();
        }
        return $submitted;
    }
588336
public function accept()
    {
        $accepted = (bool) $this->isAccepted();
        if ($accepted === false && $this->current() instanceof PageInterface) {
            $parent = $this->current()->getParent();
            if (!empty($parent)) {
                $parent->removePage($this->current());
            }
        }

        return $accepted;
    }
402676
public function markApproved(): bool
    {
        $this->owner->{$this->statusAttribute} = Status::APPROVED;

        if ($this->beforeModeration()) {
            return $this->owner->save();
        }

        return false;
    }
541651
public function confirmDelete()
    {
        if (null === $this->confirm_delete) {
            return (bool) config('cms-models.defaults.confirm_delete', false);
        }

        return (bool) $this->confirm_delete;
    }
405243
protected function SaveElement()
    {
        $this->confirm->SetErrorUrl($this->selectorError->Save($this->confirm->GetErrorUrl()));
        $this->confirm->SetSuccessUrl($this->selectorSuccess->Save($this->confirm->GetSuccessUrl()));
        return $this->confirm;
    }
10631
public function showLoginForm()
    {
        $this->app->template->trySet('page_title', 'Login');
        if ($this->app->layout && $this->login_layout_class) {
            $this->app->layout->destroy();
            $this->app->add($this->login_layout_class);
            /** @type Page $p */
            $p = $this->app->layout->add('Page', null, null, array('page/login'));
        } else {
            /** @type Page $p */
            $p = $this->app->add('Page', null, null, array('page/login'));
        }
        $this->app->page_object = $p;

        // hook: createForm use this to build basic login form
        $this->form = $this->hook('createForm', array($p))[0];

        // If no hook, build standard form
        if (!is_object($this->form)) {
            $this->form = $this->createForm($p);
        }

        $this->hook('updateForm');
        $f = $this->form;
        if ($f->isSubmitted()) {
            $id = $this->verifyCredentials($f->get('username'), $f->get('password'));
            if ($id) {
                $this->loginByID($id);
                $this->loggedIn($f->get('username'), $f->get('password'));
                exit;
            }
            $f->getElement('password')->displayFieldError('Incorrect login information');
        }

        return $p;
    }
202039
public function process_stage_confirm() {
        global $CFG, $DB, $OUTPUT;

        $previous = $DB->get_records(
            'portfolio_log',
            array(
                'userid'      => $this->user->id,
                'portfolio'   => $this->instance->get('id'),
                'caller_sha1' => $this->caller->get_sha1(),
            )
        );
        if (isset($this->noexportconfig) && empty($previous)) {
            return true;
        }
        $strconfirm = get_string('confirmexport', 'portfolio');
        $baseurl = $CFG->wwwroot . '/portfolio/add.php?sesskey=' . sesskey() . '&id=' . $this->get('id');
        $yesurl = $baseurl . '&stage=' . PORTFOLIO_STAGE_QUEUEORWAIT;
        $nourl  = $baseurl . '&cancel=1';
        $this->print_header(get_string('confirmexport', 'portfolio'));
        echo $OUTPUT->box_start();
        echo $OUTPUT->heading(get_string('confirmsummary', 'portfolio'), 3);
        $mainsummary = array();
        if (!$this->instance->get_export_config('hideformat')) {
            $mainsummary[get_string('selectedformat', 'portfolio')] = get_string('format_' . $this->instance->get_export_config('format'), 'portfolio');
        }
        if (!$this->instance->get_export_config('hidewait')) {
            $mainsummary[get_string('selectedwait', 'portfolio')] = get_string(($this->instance->get_export_config('wait') ? 'yes' : 'no'));
        }
        if ($previous) {
            $previousstr = '';
            foreach ($previous as $row) {
                $previousstr .= userdate($row->time);
                if ($row->caller_class != get_class($this->caller)) {
                    if (!empty($row->caller_file)) {
                        portfolio_include_callback_file($row->caller_file);
                    } else if (!empty($row->caller_component)) {
                        portfolio_include_callback_file($row->caller_component);
                    } else { // Ok, that's weird - this should never happen. Is the apocalypse coming?
                        continue;
                    }
                    $previousstr .= ' (' . call_user_func(array($row->caller_class, 'display_name')) . ')';
                }
                $previousstr .= '<br />';
            }
            $mainsummary[get_string('exportedpreviously', 'portfolio')] = $previousstr;
        }
        if (!$csummary = $this->caller->get_export_summary()) {
            $csummary = array();
        }
        if (!$isummary = $this->instance->get_export_summary()) {
            $isummary = array();
        }
        $mainsummary = array_merge($mainsummary, $csummary, $isummary);
        $table = new html_table();
        $table->attributes['class'] = 'generaltable exportsummary';
        $table->data = array();
        foreach ($mainsummary as $string => $value) {
            $table->data[] = array($string, $value);
        }
        echo html_writer::table($table);
        echo $OUTPUT->confirm($strconfirm, $yesurl, $nourl);
        echo $OUTPUT->box_end();
        echo $OUTPUT->footer();
        return false;
    }
469239
public function promptForDeletion()
    {
        $cli = $this->climate();

        if (is_string($this->action)) {
            $opts = [ 'y', 'n', 'r', 'q', '?' ];
            $help = [
                '[y]es    — delete the attachment',
                '[n]o     — don’t delete the attachment',
                '[r]epeat — apply previous choice to remaining attachments',
                '[q]uit   — exit immediately (does not undo previous actions)',
            ];
        } else {
            $opts = [ 'y', 'a', 'n', 's', 'q', '?' ];
            $help = [
                '[y]es  — delete this attachment',
                '[a]ll  — delete all attachments',
                '[n]o   — don’t delete this attachment',
                '[s]kip — don’t delete attachments',
                '[q]uit — exit immediately (does not undo previous actions)',
            ];
        }

        $input = $cli->input($this->indent.'Delete attachment');
        $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->promptForDeletion();

            case 'q':
                exit;

            case 'r':
                $this->repeat = -1;
                return ($this->action === 'y');

            case 's':
                $this->repeat = -1;
                $this->action = 'n';
                return false;

            case 'a':
                $this->repeat = -1;
                $this->action = 'y';
                return true;

            case 'n':
                $this->repeat = 0;
                $this->action = 'n';
                return false;

            case 'y':
            default:
                $this->repeat = 0;
                $this->action = 'y';
                return true;
        }
    }
229476
private function confirm($data){
		$content = '';
		$hidden = '';
		foreach( $this->table_definition->columns as $column_definition ){
			// var_dump($column_definition);
			if( !$this->exdb->is_editable_column( $column_definition ) ){
				continue;
			}
			$type_info = $this->exdb->form_elements()->get_type_info($column_definition->type);
			$form_elm = $this->form_endpoint->render(
				$type_info['templates']['preview'],
				array(
					'value'=>@$data[$column_definition->name],
					'name'=>@$column_definition->name,
					'def'=>@$column_definition,
					'error'=>@$errors[$column_definition->name],
				)
			);
			$content .= $this->form_endpoint->render(
				'form_elms_unit.html',
				array(
					'label'=>@$column_definition->label,
					'content'=>$form_elm,
					'def'=>@$column_definition,
					'error'=>@$errors[$column_definition->name],
				)
			);
			$hidden .= '<input type="hidden" name="'.htmlspecialchars($column_definition->name).'" value="'.htmlspecialchars(@$data[$column_definition->name]).'"/>';
		}

		$rtn = $this->form_endpoint->render(
			'form_delete.html',
			array(
				'href_backto'=>$this->form_endpoint->generate_url($this->table_name, $this->row_id),
				'action'=>$this->form_endpoint->generate_url($this->table_name, $this->row_id, $this->action_name),
				'content'=>$content,
				'hidden'=>$hidden,
			)
		);

		$rtn = $this->form_endpoint->wrap_theme($rtn);
		return $rtn;
	}
515762
public function confirmEmailAction()
    {
        $code = $this->dispatcher->getParam('code');

        $confirmation = EmailConfirmations::findFirstByCode($code);

        if (!$confirmation) {
            return $this->dispatcher->forward([
                'controller' => 'index',
                'action' => 'index'
            ]);
        }

        if ($confirmation->confirmed != 'N') {
            return $this->dispatcher->forward([
                'controller' => 'session',
                'action' => 'login'
            ]);
        }

        $confirmation->confirmed = 'Y';

        $confirmation->user->active = 'Y';

        /**
         * Change the confirmation to 'confirmed' and update the user to 'active'
         */
        if (!$confirmation->save()) {

            foreach ($confirmation->getMessages() as $message) {
                $this->flash->error($message);
            }

            return $this->dispatcher->forward([
                'controller' => 'index',
                'action' => 'index'
            ]);
        }

        /**
         * Identify the user in the application
         */
        $this->auth->authUserById($confirmation->user->id);

        /**
         * Check if the user must change his/her password
         */
        if ($confirmation->user->mustChangePassword == 'Y') {

            $this->flash->success('The email was successfully confirmed. Now you must change your password');

            return $this->dispatcher->forward([
                'controller' => 'users',
                'action' => 'changePassword'
            ]);
        }

        $this->flash->success('The email was successfully confirmed');

        return $this->dispatcher->forward([
            'controller' => 'users',
            'action' => 'index'
        ]);
    }
233880
public function show()
    {
        if (!$this->isHidden())
            return;

        $updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
        $updateHiddenStm->bindParam(1, $this->hidden);
        $updateHiddenStm->bindParam(2, $this->page_id);
        $this->hidden = false;
        $updateHiddenStm->execute();
    }
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;
    }
196360
public function confirm()
    {
        Yii::$app->get('hiart')->disableAuth();

        return Client::perform('add-allowed-i-p', [
            'confirm_data' => Yii::$app->request->get(),
        ]);
    }
815123
protected function generateChecksumForPostback()
    {
        return sha1(
                sprintf("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s", $this->_secretCode, $this->_merchantID, $this->data->status, $this->data->statusCode, $this->data->orderID, $this->data->paymentID, $this->data->reference, $this->data->transactionID, $this->data->amount, $this->data->currency, $this->data->duration, $this->data->consumerIPAddress
                )
        );
    }
1232850
public function html() {
        global $OUTPUT;

        if (!empty($this->initerrors)) {
            $warnings = '';
            foreach ($this->initerrors as $mesg) {
                $warnings .= $OUTPUT->notification($mesg);
            }
            return $warnings;
        }
        $table = new html_table();

        $table->head = $this->headers();

        $summary = $this->summary();
        if (!empty($summary)) {
            $table->summary = $summary;
        }

        // To be used for extra formatting.
        $this->index = 0;
        $this->total = count($this->items);

        foreach ($this->items as $item) {
            if ($this->index >= ($this->perpage * $this->page) &&
                $this->index < ($this->perpage * ($this->page + 1))) {
                $table->data[] = $this->format_line($item);
            }
            $this->index++;
        }

        $underlying = get_class($this);

        $data = new stdClass();
        $data->table = $table;
        $data->instance = $this;

        $buttonattr = array('class' => 'singleview_buttons submit');
        $buttonhtml = implode(' ', $this->buttons());

        $buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
        $selectview = new select($this->courseid, $this->itemid, $this->groupid);

        $sessionvalidation = html_writer::empty_tag('input',
            array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));

        $html = $selectview->html();
        $html .= html_writer::tag('form',
            $buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
            array('method' => 'POST')
        );
        $html .= $selectview->html();
        return $html;
    }
397479
protected function validationData()
    {
        return $this->merge([
            // default value to the checkbox
            'on_mainpage' => $this->input('on_mainpage', 0),
            'is_pinned' => $this->input('is_pinned', 0),
            'is_catpinned' => $this->input('is_catpinned', 0),
            'is_favorite' => $this->input('is_favorite', 0),
        ])->all();
    }