Initializes the member form
@return boolean Returns false to continue processing
492473
protected function Init()
    {
        $this->group = new Membergroup(Request::GetData('membergroup'));
        $this->AddNameField();
        $this->AddSubmit();
        return parent::Init();
    }
1180835
public function init()
    {
        $this->version = $this->read(true);
        
        if(!$this->login()) return false;

        return true;
    }
311658
protected function InitForm()
    {
        $this->htmlWrap = $this->LoadElement();
        $name = 'Html';
        $this->AddRichTextField($name, $this->htmlWrap->GetHtml());
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
1231880
public function init()
    {
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
        if ($this->init) {
            echo Html::beginForm($this->action, $this->method, $this->options);
        }
    }
547879
public function init() {

        parent::init();

		// Permission
        $this->crudPermission = FormsGlobal::PERM_FORM_ADMIN;

		// Config
		$this->apixBase = 'forms/form/submit';

		// Services
		$this->modelService = Yii::$app->factory->get( 'formSubmitService' );
		$this->formService = Yii::$app->factory->get( 'formService' );

		// Sidebar
		$this->sidebar = [ 'parent' => 'sidebar-form', 'child' => 'form' ];

		// Return Url
		$this->returnUrl = Url::previous( 'form-submits' );
		$this->returnUrl = isset( $this->returnUrl ) ? $this->returnUrl : Url::toRoute( [ '/forms/form/submit/all' ], true );

		// All Url
		$allUrl = Url::previous( 'forms' );
		$allUrl = isset( $allUrl ) ? $allUrl : Url::toRoute( [ '/forms/form/all' ], true );

		// Breadcrumbs
		$this->breadcrumbs = [
			'base' => [
				[ 'label' => 'Home', 'url' => Url::toRoute( '/dashboard' ) ],
				[ 'label' => 'Forms', 'url' =>  $allUrl ]
			],
			'all' => [ [ 'label' => 'Form Submit' ] ],
			'create' => [ [ 'label' => 'Form Submit', 'url' => $this->returnUrl ], [ 'label' => 'Add' ] ],
			'update' => [ [ 'label' => 'Form Submit', 'url' => $this->returnUrl ], [ 'label' => 'Update' ] ],
			'delete' => [ [ 'label' => 'Form Submit', 'url' => $this->returnUrl ], [ 'label' => 'Delete' ] ],
			'items' => [ [ 'label' => 'Form Submit', 'url' => $this->returnUrl ], [ 'label' => 'Items' ] ]
		];
	}
377949
public function init()
    {
        //user model required
        if(!Yii::app()->hasModule('user')){
            return false;
        }
        
        if(!Yii::app()->getModule('user')->user()){
            return false;
        }        
        // parsing needed if urlFormat 'path'
        Yii::app()->urlManager->parseUrl(Yii::app()->getRequest());

		// 1. get language preference
		$preferred = null;
		if (isset($_GET[$this->data_key]) && preg_match('/^\d+$/',$_GET[$this->data_key])) {

			// use company from URL
			$preferred = $_GET[$this->data_key];

            //validate new comapny
            if(!$this->isValidUserCompany($preferred)){
                throw new CHttpException(404, "Company '{$_GET[$this->data_key ]}' is not available.");
            }

            //set new company as active
            $this->_setActiveCompany($preferred);

            return TRUE;

		} 
        
        if ($this->getActiveCompany()) {

			// use active company from profile.ccmp_id
			$preferred = $this->getActiveCompany();
            if($this->isValidUserCompany($preferred)){
                $this->_setActiveCompany($preferred);
                return TRUE;
            }
    	}

        //get first user company
        $a = $this->getClientCompanies();
        if(empty($a)){
            throw new CHttpException(404, "For user companies are not available.");
        }

        //set new company as active
        $this->_setActiveCompany($a[0]['ccmp_id']);

	}
1157141
public function init() {
        global $CFG, $USER;

        if (!empty($this->_fp)) {
            $this->close();
        }
        $filename = $CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid;
        if (!file_exists($filename)) {
            return false;
        }
        if (!$this->_fp = fopen($filename, "r")) {
            return false;
        }
        //skip header
        return (fgetcsv($this->_fp) !== false);
    }
1318438
protected function init()
    {
        if (null === $this->items) {
            list($constraints, $sorting, $joins) = $this->translate($this->filter, $this->sorting);

            if (empty($constraints)) {
                $constraints = '';
            } else {
                $constraints = ' WHERE ' . implode(' AND ', $constraints);
            }

            if ($this->prefetch) {
                $this->initEntities($constraints, $this->makeJoins($joins), $this->makeOrderBy($sorting, $joins));
            } else {
                $this->initKeys($constraints, $this->makeJoins($joins), $this->makeOrderBy($sorting, $joins));
            }

            $this->rewind();
        }
    }
731297
public function init()
    {
        parent::init();
        try {
            if (!empty($this->module->accessChecker)) {
                $this->accessType = call_user_func($this->module->accessChecker, $this->module->user);
            }
            if ($this->accessType === -1) {
                if (!empty($this->module->denyCallback)) {
                    call_user_func($this->module->denyCallback, $this->module->user);
                    return false;
                }
                return $this->goHome();
            }

            if (!$this->module->user->isGuest) {
                $user = User::findMe();
                if ($this->module->userComponent !== true && $this->accessType === 1) {
                    if (empty($user)) {
                        if (!User::createInheritedAccount()) {
                            throw new InvalidConfigException('There was an error while creating inherited user account. Podium can not run with the current configuration. Please contact administrator about this problem.');
                        }
                        $this->success(Yii::t('podium/flash', 'Hey! Your new forum account has just been automatically created! Go to {link} to complement it.', [
                            'link' => Html::a(Yii::t('podium/view', 'Profile'), ['profile/details'])
                        ]));
                    } elseif (!User::updateInheritedAccount()) {
                        throw new InvalidConfigException('There was an error while updating inherited user account. Podium can not run with the current configuration. Please contact administrator about this problem.');
                    }
                }
                if ($user && $user->status == User::STATUS_BANNED) {
                    return $this->redirect(['forum/ban']);
                }
                if ($user && !empty($user->meta->timezone)) {
                    $this->module->formatter->timeZone = $user->meta->timezone;
                }
            }
        } catch (Exception $exc) {
            Yii::$app->response->redirect([$this->module->prepareRoute('install/run')]);
        }
    }
915452
public function init()
    {
        //klucz
        $this->addElement((new Element\Text('key'))
                ->setLabel('form.text.key.label')
                ->setRequired()
                ->addValidator(new \Mmi\Validator\NotEmpty));

        //zawartość
        $this->addElement((new Element\Textarea('content'))
                ->setLabel('form.text.content.label'));

        //submit
        $this->addElement((new Element\Submit('submit'))
                ->setLabel('form.text.submit.label'));
    }
1340829
protected function InitForm()
    {
        $this->checkbox = $this->LoadElement();
        $this->AddRequiredField();
        $this->AddNameField();
        $this->AddLabelField();
        $this->AddCheckedField();
        $this->AddCheckedValueField();
        $this->AddDisableFrontendValidationField();
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
512778
public function init()
    {
        // Status
        $processed = false;

        // Receive information from: Store, Request and process it to a valid state representation

        // We can do the following without any side effects ...
        //   a) Load data pool from session - fall back to default one for first call
        //   b) Generate a fresh token used at least for next/first render()
        //   c) Detect if the form was in any kind submitted to here - maybe through a satellite form entry

        $this
            ->initializeDataPool()
            ->submitted($this->isASubmittedFormInRequest())
            ->jumped($this->receiveJumpFieldValueFromRequest());

        // We can now check for submitted data which can either control the flow (e.g. JUMP) or required to correctly bootstrap the form
        if (true === $this->wasSubmitted()) {

            // Collect data from request cause we have one!
            $step   = (int) $this->receiveStepFieldValueFromRequest();
            $steps  = (int) $this->receiveStepsFieldValueFromRequest();
            $token  = $this->receiveTokenFieldValueFromRequest();
            $upload = (int) $this->receiveUploadFieldValueFromRequest();
            $valid  = true;

            // When submitted we must have also this information! So we can use to check this as well
            $stepFromDataPool  = (int) $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_STEP);
            $stepsFromDataPool = (int) $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_STEPS);
            $lastValidStep     = (int) $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_LASTVALIDSTEP);

            // Adjust by following rule:
            // On a switch from one step to the next we need to adjust the step
            $step  = ($stepFromDataPool > $step)   ? $stepFromDataPool  : $step;
            $steps = ($stepsFromDataPool > $steps) ? $stepsFromDataPool : $steps;

            // If validation now fails for basic manipulation protection fallback to default
            if (
                $step                        <=  0                    ||    // ~ e.g. no valid step found
                $steps                       <=  0                    ||    // ~ e.g. no valid steps limit/end found
                null                         === $token               ||    // ~ e.g. no token submitted
                $step                        >   $steps               ||    // ~ e.g. stepped over goal
                ($lastValidStep              === 0      && $step > 1) ||    // ~ e.g. If no last valid step but where in a step > 1
                (abs($lastValidStep - $step) !=  1      && $step > 1)       // ~ e.g. More than 1 step diff is only allowed for jump
            ) {
                $valid = false;
            }

            if (true === $valid) {
                // Store the detected values for further processing
                $this->setStep($step);
                $this->setSteps($steps);
                $this->setToken($token);
                $this->setUpload($upload);

                // Check for form has file upload (in general not on current request limited) - and getMetaComponents it ...
                if (true === $this->hasFileUpload()) {
                    // ... getMetaComponents in this context is to ensure that we can't
                    $fileUploadHandler = $this->getFileUploadHandler();

                    // Retrieve files for this step (either from pool or fresh uploaded)
                    $files = $fileUploadHandler->getUploadedFiles(
                        $step,
                        $this->getDataPool(),
                        $this->getRequest()->getUploadedFiles()
                    );
                } else {
                    $files = [];
                }

                // Store files ...
                $this->setFiles($files);

                // Extract components for validation in this steps
                $validationRules = $this->getDataPool()[Doozr_Form_Service_Constant::IDENTIFIER_COMPONENTS][$step];

                // Manually inject validation for method
                $validationRules[Doozr_Form_Service_Constant::PREFIX.Doozr_Form_Service_Constant::IDENTIFIER_METHOD] = [
                    'validation' => ['value' => [$this->getDataPool()[Doozr_Form_Service_Constant::IDENTIFIER_METHOD]]],
                    'type'       => Doozr_Form_Service_Constant::COMPONENT_TYPE_GENERIC,
                ];

                $submittedValues = $this->buildValueArray(array_keys($validationRules));

                $submittedValues[Doozr_Form_Service_Constant::PREFIX.Doozr_Form_Service_Constant::IDENTIFIER_METHOD] = $this->getRequest()->getMethod();

                // Manually inject validation for token
                $validationRules[Doozr_Form_Service_Constant::PREFIX.Doozr_Form_Service_Constant::IDENTIFIER_TOKEN] = [
                    'validation' => ['value' => [$this->getDataPool()[Doozr_Form_Service_Constant::IDENTIFIER_TOKEN]]],
                    'type'       => Doozr_Form_Service_Constant::COMPONENT_TYPE_GENERIC,
                ];

                $submittedValues[Doozr_Form_Service_Constant::PREFIX.Doozr_Form_Service_Constant::IDENTIFIER_TOKEN] = $this->getToken();

                // Run validation by using validation handler ...
                $this->setValid(
                    $this->getValidationHandler()->validate(
                        $submittedValues,
                        $validationRules
                    )
                );

                /**
                 * Required to handle
                 *
                 * Token-Behavior -> comes from history
                 * $invalidTokenBehavior = $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_TOKENBEHAVIOR)
                 *
                 */
                $invalidTokenBehavior = $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_TOKENBEHAVIOR);
                $tokenValid           = $this->getError(
                    Doozr_Form_Service_Constant::PREFIX.Doozr_Form_Service_Constant::IDENTIFIER_TOKEN,
                    true
                );

                // Handle outsourced to token handler
                $this->getTokenHandler()->handleToken(
                    $invalidTokenBehavior,
                    $tokenValid
                );

                // Transfer valid data ...
                $this->transferValidDataAndFilesToPool($step);

                // If valid we must increase active step to the next one :)
                if (true === $this->isValid()) {
                    // We only accept completion of forms on a submit. This is a condition which prevent us from
                    // running into raise conditions with jumped forms which are valid ... and it makes the rule easy:
                    $this->setComplete($step === $steps);

                    if (true === $this->isComplete()) {
                        $data = $this->getDataHandler()->enrichWithMetaInformation($this->getDataPool());
                        $this->invalidateDataPool();
                        $this->setResult($data);
                    }

                    $this->setActiveStep($step + 1);
                } else {
                    $this->setActiveStep($step);
                }

                $processed = true;
            }

            // We can also check if form was not submitted - maybe it was jumped to this place!!!
            // The we must! have a valid data pool entry for each single element and restore the values from there to emulate a valid request
        } elseif (true === $this->wasJumped()) {

            // Collect data from store ...
            $step   = (int) $this->getDataPoolDataValue($this->getJumped(), $this->getFieldnameStep());
            $steps  = (int) $this->getDataPoolDataValue($this->getJumped(), $this->getFieldnameSteps());
            $token  = $this->getDataPoolDataValue($this->getJumped(), $this->getFieldnameToken());
            $data   = $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_DATA);
            $upload = (int) $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_UPLOAD);
            $valid  = true;
            $jumped = $this->getJumped();

            $lastValidStep = (int) $this->getDataPoolValue(Doozr_Form_Service_Constant::IDENTIFIER_LASTVALIDSTEP);

            // If validation now fails for basic manipulation protection fallback to default
            if (
                $step                        <=  0                    ||    // ~ e.g. no valid step found
                $steps                       <=  0                    ||    // ~ e.g. no valid steps limit/end found
                null                         === $token               ||    // ~ e.g. no token ever stored
                $step                        >   $steps               ||    // ~ e.g. stepped over goal
                ($lastValidStep              === 0      && $step > 1) ||    // ~ e.g. If no last valid step but where in a step > 1
                (abs($lastValidStep - $step) !=  1      && $step > 1)       // ~ e.g. More than 1 step diff is only allowed for jump
            ) {
                $valid = false;
            }

            if (
                (null !== $lastValidStep && 0 !== $lastValidStep) &&
                (abs($jumped - $lastValidStep) <= 1)
            ) {
                $valid = true;
                $step  = $jumped;
                $steps = (int) $this->getDataPoolDataValue($lastValidStep, $this->getFieldnameSteps());
                $token = $this->getDataPoolDataValue($lastValidStep, $this->getFieldnameToken());
            }

            //
            if (true === $valid) {
                // Store the detected values for further processing
                $this->setStep($step);
                $this->setSteps($steps);
                $this->setToken($token);
                $this->setUpload($upload);

                // Check for form has file upload (in general not on current request limited) - and getMetaComponents it ...
                if (true === $this->hasFileUpload()) {
                    // ... getMetaComponents in this context is to ensure that we can't
                    $fileUploadHandler = $this->getFileUploadHandler();

                    // Retrieve files for this step (either from pool or fresh uploaded)
                    $files = $fileUploadHandler->getUploadedFiles(
                        $step,
                        $this->getDataPool()
                    );

                } else {
                    $files = [];
                }

                // Store files ...
                $this->setFiles($files);

                // Validate only if we ...
                if ($jumped <= $lastValidStep) {

                    // Extract components for validation in this steps
                    $validationRules = $this->getDataPool()[Doozr_Form_Service_Constant::IDENTIFIER_COMPONENTS][$step];

                    $submittedValues = $this->buildValueArray(
                        array_keys($validationRules)
                    );

                    // Run validation by using validation handler ...
                    $this->setValid(
                        $this->getValidationHandler()->validate(
                            $submittedValues,
                            $validationRules
                        )
                    );
                }

                // Transfer valid data ...
                $this->transferValidDataAndFilesToPool($step);

                // If valid we must increase active step to the next one :)
                if (true === $this->isValid()) {
                    // We only accept completion of forms on a submit. This is a condition which prevent us from
                    // running into raise conditions with jumped forms which are valid ... and it makes the rule easy:
                    $this->setComplete($step === $steps);

                    if (true === $this->isComplete()) {
                        $data = $this->getDataHandler()->enrichWithMetaInformation($this->getDataPool());
                        $this->invalidateDataPool();
                        $this->setResult($data);
                    }

                    $this->setActiveStep($step);
                } else {
                    $this->setActiveStep($step);
                }

                $processed = true;
            }


            /*
            // At this point the basic validation must be done!
            if (true === $valid) {
                // Store the detected values for further processing
                $this->setStep($step);
                $this->setSteps($steps);
                $this->setToken($token);
                $this->setUpload($upload);

                // We could now call the validation. But why? We validated that the call to here is correct (validation)
                // and the data we would now validation ir already validated. The request method will probably fail cause
                // we jumped via ?...Step=x to here ;) So we do not validation again!
                $this->setValid(true);
                $this->setComplete(false);
                $this->setActiveStep($step);

                $processed = true;
            }*/
        }

        // If neither submit nor successful jump step back to defaults!
        if (false === $processed) {
            $step       = Doozr_Form_Service_Constant::DEFAULT_STEP_FIRST;
            $activeStep = $step;
            $steps      = Doozr_Form_Service_Constant::DEFAULT_STEP_FIRST;
            $upload     = Doozr_Form_Service_Constant::DEFAULT_HAS_FILE_UPLOAD;

            // Store the detected values for further processing
            $this->setStep($step);
            $this->setActiveStep($activeStep);
            $this->setSteps($steps);
            $this->setUpload($upload);
            $this->setFiles([]);
            $this->setValid(false);
            $this->setComplete(false);
        }

        return $this;
    }
1042158
public function init() {
        $this->addPrefixPath('Garp_Form', 'Garp/Form')
            ->addElementPrefixPath('Garp_Form', 'Garp/Form/')
            ->addDecorator('FormElements')
            ->addDecorator('Form');

        if (!$this->getAttrib('class')) {
            $this->setAttrib('class', 'garp-form');
        }

        // Anti-spam fields
        if ($this->_addTimestampValidation) {
            $this->addTimestampValidation();
        }
        if ($this->_addHoneypotValidation) {
            $this->addHoneypotValidation();
        }
    }
243720
public function init()
    {
        $replicators = null;

        $form = $this->getForm();
        if ($form !== null && $form->isSubmitted()) {
            $replicators = $form->getHiddenField(
                $this->getReplicatorFieldName()
            );

            if ($replicators !== null) {
                foreach ($replicators as $replicator) {
                    $this->createClonedWidget($replicator);
                }
            }
        }

        if ($replicators === null) {
            $this->prototype_widget->init();
        }
    }
1021585
protected function processForm()
    {
        // Check job monitors as long as the login form is being processed
        $this->util->getMonitor()->checkMonitors();

        // Start the real work
        $this->loadForm();

        $orgId = null;
        if ($this->request->isPost()) {
            $orgId = $this->loginForm->getActiveOrganizationId();

            if ($orgId && ($this->currentUser->getCurrentOrganizationId() != $orgId)) {
                $this->currentUser->setCurrentOrganization($orgId);
            }
        }

        if ($this->loginForm->wasSubmitted()) {
            $user = $this->loginForm->getUser();

            if ($this->loginForm->isValid($this->request->getPost(), false)) {
                $user->switchLocale();

                $this->loginStatusTracker
                        ->setPasswordText($this->loginForm->getPasswordText())
                        ->setUser($user);

                return false;
            }

            $errors = \MUtil_Ra::flatten($this->loginForm->getMessages());
            // \MUtil_Echo::track($errors);

            // Also log the error to the log table  when the project has logging enabled
            $logErrors = join(' - ', $errors);
            $msg = sprintf(
                    'Failed login for : %s (%s) - %s',
                    $user->getLoginName(),
                    $user->getCurrentOrganizationId(),
                    $logErrors
                    );
            $this->accesslog->logChange($this->request, $msg);
        }

        return true;
    }
584808
protected function Init()
    {
        $this->confirm = ContentRegisterConfirm::Schema()->ByContent($this->Content());
        $this->confirmer = new Confirmer();
        $this->isValid = $this->confirmer->Check(Request::GetArray());
        if ($this->isValid)
        {
            $this->OnSuccess();
        }
        else if ($this->confirm->GetErrorUrl())
        {
            Response::Redirect(FrontendRouter::Url($this->confirm->GetErrorUrl()));
            return true;
        }
        return parent::Init();
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }