Returns a generated "steps" field.
This field contains the total of steps available in the form.

@author Benjamin Carl <opensource@clickalicious.de>

@return Doozr_Form_Service_Component_Input Generated field.
502238
protected function generateStepsField()
    {
        return $this->metaComponentFactory(
            $this->getFieldnameSteps(), $this->getSteps(), $this->getAngularDirectives(), $this->getScope()
        );
    }
746603
public function getCMSFields()
    {
        // Create Field Tab Set:
        
        $fields = FieldList::create(TabSet::create('Root'));
        
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNSELECT', 'Select');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                DropdownField::create(
                    'ColumnID',
                    $this->fieldLabel('ColumnID')
                )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder),
                PageMultiselectField::create(
                    'Pages',
                    $this->fieldLabel('Pages')
                ),
                ViewportsField::create(
                    'Span',
                    $this->fieldLabel('Span'),
                    $this->getColumnSpanOptions()
                ),
                CheckboxField::create(
                    'DoNotInherit',
                    $this->fieldLabel('DoNotInherit')
                )
            ]
        );
        
        // Extend Field Objects:
        
        $this->extend('updateCMSFields', $fields);
        
        // Answer Field Objects:
        
        return $fields;
    }
1138367
public function formProperty()
    {
        if ($this->formProperty === null) {
            $this->formProperty = false;

            if ($this->objType() && $this->propertyIdent()) {
                $propertyIdent = $this->propertyIdent();

                $model = $this->modelFactory()->create($this->objType());
                $props = $model->metadata()->properties();

                if (isset($props[$propertyIdent])) {
                    $propertyMetadata = $props[$propertyIdent];

                    $property = $this->propertyFactory()->create($propertyMetadata['type']);

                    $property->setIdent($propertyIdent);
                    $property->setData($propertyMetadata);

                    $this->formProperty = $property;
                }
            }
        }

        return $this->formProperty;
    }
1291211
protected function getFormFor($step)
    {
        $model    = $this->getModel();
        $baseform = $this->createForm();

        if ((\MUtil_Bootstrap::enabled() !== true) && ($baseform instanceof \MUtil_Form)) {
            $table = new \MUtil_Html_TableElement();
            $table->setAsFormLayout($baseform, true, true);

            // There is only one row with formLayout, so all in output fields get class.
            $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);
        }
        $baseform->setAttrib('class', $this->class);

        $bridge = $model->getBridgeFor('form', $baseform);

        $this->_items = null;
        $this->initItems();

        $this->addFormElementsFor($bridge, $model, $step);

        return $baseform;
    }
25086
protected function generateTokenComponent()
    {
        return $this->metaComponentFactory(
            $this->getFieldnameToken(), $this->getToken(), $this->getAngularDirectives(), $this->getScope()
        );
    }
722128
public function generate()
	{
		$output    = parent::generate();
		$columnSet = \Netzmacht\ColumnSet\ColumnsetModel::findByPK($this->columnset_id);

		if(TL_MODE == 'BE') {
			$output = sprintf(
				'<h1>%s <small>[%s: %s]</small></h1>%s',
				$this->headline,
				$GLOBALS['TL_LANG']['CTE']['bootstrap_columnset'][0],
				$columnSet->title,
				$output
			);
		}

		return $output;
	}
267472
public function getUploadEditorFields()
    {
        /** @var FieldList $fields */
        $fields = FieldList::create();
        $translatedFields = TranslatableDataObject::get_localized_class_fields($this->owner->class);
        $transformation = null;
        $defaultLocale = Translatable::default_locale();
        if ($defaultLocale != Translatable::get_current_locale()) {
            /** @var TranslatableFormFieldTransformation $transformation */
            $transformation = TranslatableFormFieldTransformation::create($this->owner);
        }

        foreach ($translatedFields as $fieldName) {
            // create the field in the default locale
            /** @var FormField $field */
            $field = $this->owner->getLocalizedFormField($fieldName, $defaultLocale);
            // use translated title if available
            $field->setTitle(_t('File.' . $fieldName, $fieldName));

            // if not in the default locale, we apply the form field transformation to the field
            if ($transformation) {
                $field = $transformation->transformFormField($field);
            }

            $fields->push($field);
        }
        return $fields;
    }
874043
public function generateHiddenFields()
    {
        $name = $this->generateFormName();
        $token = $this->generateToken($name);
        $html = '<input type="hidden" name="' . self::REQUEST_TOKEN_NAME . '" value="' . $name . '" />';
        $html .= '<input type="hidden" name="' . self::REQUEST_TOKEN_VALUE . '" value="' . $token . '" />';
        return $html;
    }
1157232
public function getInputId()
  {
    $n = false;
    if ($f = $this->getForm()) {
      $n = $f->getName();
    }

    return 'form-' . ($n ? $n . '-' : '') . $this->getField();
  }
1181643
public function getCurrentStepName()
    {
        if ('' == $this->getModel()->getWorkflowStepName() || is_null($this->getModel()->getWorkflowStepName())) {
            $this->getModel()->setWorkflowStepName($this->getDefaultStepName());
        }

        return $this->getModel()->getWorkflowStepName();
    }
764404
public function getRootForm()
    {
        $rootRenderable = $this->parentRenderable;
        while ($rootRenderable !== null && !($rootRenderable instanceof FormDefinition)) {
            $rootRenderable = $rootRenderable->getParentRenderable();
        }
        if ($rootRenderable === null) {
            throw new FormDefinitionConsistencyException(sprintf('The form element "%s" is not attached to a parent form.', $this->identifier), 1326803398);
        }

        return $rootRenderable;
    }
134217
public static function getResultAsTable()
    {
        $labelWidth = self::$labelWidth;

        $result = str_pad('Step', $labelWidth) . ' '
            . str_pad('Total (ms)', 10, ' ', STR_PAD_LEFT) . ' '
            . str_pad('Diff (ms)', 10, ' ', STR_PAD_LEFT) . ' '
            . str_pad('Diff (%)', 10, ' ', STR_PAD_LEFT) . "\n";

        $lastStep = end(self::$steps);
        $totalTime = $lastStep['total'];

        foreach (self::$steps as $step) {
            if ($step['silent']) continue;

            $result .= self::padLabel($step['label'], $labelWidth) . ' '
                . str_pad(round($step['total'] * 1000), 10, ' ', STR_PAD_LEFT) . ' '
                . str_pad(number_format($step['diff'] * 1000, 1), 10, ' ', STR_PAD_LEFT) . ' '
                . str_pad(number_format(($step['diff'] / $totalTime) * 100, 1), 10, ' ', STR_PAD_LEFT) . "\n";
        }

        if (count(self::$aggregated) > 0) {
            ksort(self::$aggregated);
            $result .= "\n" . str_pad('Aggregated', $labelWidth) . ' '
                . str_pad('Count', 10, ' ', STR_PAD_LEFT) . ' '
                . str_pad('Time (ms)', 10, ' ', STR_PAD_LEFT) . ' '
                . str_pad('Time (%)', 10, ' ', STR_PAD_LEFT) . "\n";

            foreach (self::$aggregated as $label => $values) {
                if ($values['count'] == 0) continue;

                $result .= self::padLabel($label, $labelWidth) . ' '
                    . str_pad($values['count'], 10, ' ', STR_PAD_LEFT) . ' '
                    . str_pad(number_format($values['total'] * 1000, 1), 10, ' ', STR_PAD_LEFT) . ' '
                    . str_pad(number_format(($values['total'] / $totalTime) * 100, 1), 10, ' ', STR_PAD_LEFT) . "\n";

                ksort($values['sub']);

                foreach ($values['sub'] as $sublabel => $subvalues) {
                    $result .= self::padSublabel($sublabel, $labelWidth) . ' '
                        . str_pad($subvalues['count'], 10, ' ', STR_PAD_LEFT) . ' '
                        . str_pad(number_format($subvalues['total'] * 1000, 1), 10, ' ', STR_PAD_LEFT) . ' '
                        . str_pad(number_format(($subvalues['total'] / $totalTime) * 100, 1), 10, ' ', STR_PAD_LEFT) . "\n";
                }
            }
        }

        return $result;
    }
701607
private function stepOne()
    {
        $t = $this->option('t');
        if($t === 'add') {
            $this->container['username']        = $this->ask('Please enter the username:', 'admin1');
            $this->container['password']        = $this->ask('Please enter the password:', 'admin888');
            $this->comment('You have provided the following manifest information:');
            $this->comment('Username:                           '.$this->container['username']);
            $this->comment('Password:                           '.$this->container['password']);
            if ($this->confirm('If the provided information is correct, type "yes" to generate.')) {
                if(ManageUserModel::where('username', $this->container['username'])->count()) {
                    $this->error(hst_lang('hstcms::manage.founder.username.noone'));
                    return $this->stepOne();
                }
                $salt = hst_random(6);
                $postData = [
                    'username'=>trim($this->container['username']),
                    'password'=>trim(hst_md5(trim($this->container['password']), $salt)),
                    'salt'=>$salt,
                    'status'=>1,
                    'gid'=>99
                ];
                ManageUserModel::insert($postData);
                ManageUserModel::setCache();
                $this->info('Add Success');
            }
        } else if($t === 'edit') {
            $this->container['username']        = $this->ask('Please enter the username:', 'admin1');
            $this->container['password']        = $this->ask('Please enter the new password:', 'admin888');
            $this->comment('You have provided the following manifest information:');
            $this->comment('Username:                           '.$this->container['username']);
            $this->comment('Password:                           '.$this->container['password']);
            if ($this->confirm('If the provided information is correct, type "yes" to generate.')) {
                $user = ManageUserModel::where('username', $this->container['username'])->first();
                if(!$user) {
                    $this->error(hst_lang('hstcms::manage.no.username'));
                    return true;
                }
                $postData = [
                    'username'=>trim($this->container['username']),
                    'password'=>trim(hst_md5(trim($this->container['password']), $user['salt'])),
                ];
                ManageUserModel::where('username', $this->container['username'])->update($postData);
                ManageUserModel::setCache();
                $this->info('Edit Success');
            }
        } else if($t === 'delete') {
            $this->container['username']        = $this->ask('Please enter the username:', 'admin1');
            $this->comment('You have provided the following manifest information:');
            $this->comment('Username:                           '.$this->container['username']);
            if ($this->confirm('If the provided information is correct, type "yes" to generate.')) {
                $user = ManageUserModel::where('username', $this->container['username'])->first();
                if(!$user) {
                    $this->error(hst_lang('hstcms::manage.no.username'));
                    return true;
                }
                ManageUserModel::where('username', $this->container['username'])->delete();
                ManageUserModel::setCache();
                $this->info('Delete Success');
            }
        }   
        return true;
    }
1053750
public function generate()
	{
		if ($this->imageSubmit)
		{
			$objModel = \FilesModel::findByPk($this->singleSRC);

			if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path))
			{
				return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s" title="%s" alt="%s"%s>%s</button>',
					$this->strId,
					(($this->strClass != '') ? ' ' . $this->strClass : 'btn-default'),
					specialchars($this->slabel),
					specialchars($this->slabel),
					$this->getAttributes(),
					\Image::getHtml($objModel->path, $this->slabel)
				);
			}
		}

		$label = specialchars($this->slabel);

		if($this->bootstrap_addIcon) {
			$icon = Icons::generateIcon($this->bootstrap_icon);

			if($this->bootstrap_iconPosition == 'right') {
				$label = $label . ' ' . $icon;
			}
			else {
				$label = $icon  . ' ' . $label;
			}
		}

		// Return the regular button
		return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s"%s>%s</button>',
			$this->strId,
			(($this->strClass != '') ? $this->strClass : 'btn-default'),
			$this->getAttributes(),
			$label
		);
	}
866651
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Remove Field Objects:
        
        $fields->fieldByName('Root')->removeByName('Style');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                CheckboxSetField::create(
                    'Areas',
                    $this->fieldLabel('Areas'),
                    AreaComponent::get()->map()
                )
            ]
        );
        
        // Insert Show On Field (within folder only):
        
        if ($this->getParent() instanceof PanelFolder) {
            
            $fields->insertAfter(
                SelectionGroup::create(
                    'ShowOn',
                    [
                        SelectionGroup_Item::create(
                            'AllPages',
                            null,
                            $this->fieldLabel('AllPages')
                        ),
                        SelectionGroup_Item::create(
                            'OnlyThesePages',
                            PageMultiselectField::create('Pages', ''),
                            $this->fieldLabel('OnlyThesePages')
                        )
                    ]
                )->setTitle($this->fieldLabel('ShowOn')),
                'Areas'
            );
            
        }
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'PanelOptions',
                $this->fieldLabel('PanelOptions'),
                [
                    CheckboxField::create(
                        'DoNotInherit',
                        $this->fieldLabel('DoNotInherit')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
648783
public function getSteps()
    {
        // Carregar step do conexto e atual
        $step = $this->flow(router()->current()->parameter('step'));

        // Carregar view
        $view_id = sprintf('%s.%s', $this->prefixViewName, $step->key);
        if (! view()->exists($view_id)) {
            error('View of step "%s" not found', $view_id);
        }

        $view = view($view_id);
        $view->with('steps', $this->model->steps);
        $view->with('step', $step);
        $view->with('model', $this->model);
        $view->with($this->viewParams);

        $view->with('step_url', function ($step, $method = 'get') {
            return $this->stepUrl($step, $method);
        });

        return $view;
    }
82785
public function getSelect() {
        if ($this->fields && $this->fields != '*' && (!(is_string($this->fields) && '*' == $this->fields[0] && 'END) AS `__parentRelationKey`' == substr($this->fields, -29)))) {
            if (is_string($this->fields)) {
                return $this->fields;
            }
            $columns = array();
            foreach ($this->fields as $field) { // @TODO: column generation here.
                $columns[] = trim($field);
            }
            return implode(', ', $columns);
        }
        if ((is_string($this->fields) && '*' == $this->fields[0] && 'END) AS `__parentRelationKey`' == substr($this->fields, -29))){
            return implode(', ', $this->getAllColumnsForSelect()) . substr($this->fields, 1);
        } else {
            return implode(', ', $this->getAllColumnsForSelect());
        }
    }