Sets the labels, format functions, etc...

@param boolean $detailed True when shopwing detailed information
@param boolean $edit When true use edit settings
@return \Gems_Tracker_Model_TrackModel
559444
public function applyFormatting($detailed = false, $edit = false)
    {
        $translated = $this->util->getTranslated();
        $translator = $this->getTranslateAdapter();
        if ($edit) {
            $dateFormat = \MUtil_Model_Bridge_FormBridge::getFixedOption('date', 'dateFormat');
        } else {
            $dateFormat = $translated->dateFormatString;
        }

        $this->resetOrder();

        $this->set('gtr_track_name',    'label', $translator->_('Name'));
        $this->set('gtr_track_class',   'label', $translator->_('Track Engine'),
                'multiOptions', $this->tracker->getTrackEngineList($detailed));
        $this->set('gtr_survey_rounds', 'label', $translator->_('Surveys'));

        $this->set('gtr_active',        'label', $translator->_('Active'),
                'multiOptions', $translated->getYesNo());
        $this->set('gtr_date_start',    'label', $translator->_('From'),
                'dateFormat', $dateFormat,
                'formatFunction', $translated->formatDate);
        $this->set('gtr_date_until',    'label', $translator->_('Use until'),
                'dateFormat', $dateFormat,
                'formatFunction', $translated->formatDateForever);
        $this->setIfExists('gtr_code',  'label', $translator->_('Track code'),
                'size', 10,
                'description', $translator->_('Optional code name to link the track to program code.'));

        if ($detailed) {
            $events = $this->loader->getEvents();

            $caList = $events->listTrackCalculationEvents();
            if (count($caList) > 1) {
                $this->setIfExists('gtr_calculation_event', 'label', $translator->_('Before (re)calculation'),
                        'multiOptions', $caList
                        );
            }

            $coList = $events->listTrackCompletionEvents();
            if (count($coList) > 1) {
                $this->setIfExists('gtr_completed_event', 'label', $translator->_('After completion'),
                        'multiOptions', $coList
                        );
            }

            $bfuList = $events->listTrackBeforeFieldUpdateEvents();
            if (count($bfuList) > 1) {
                $this->setIfExists('gtr_beforefieldupdate_event', 'label', $translator->_('Before field update'),
                        'multiOptions', $bfuList
                        );
            }

            $fuList = $events->listTrackFieldUpdateEvents();
            if (count($fuList) > 1) {
                $this->setIfExists('gtr_fieldupdate_event', 'label', $translator->_('After field update'),
                        'multiOptions', $fuList
                        );
            }
            $this->setIfExists('gtr_organizations', 'label', $translator->_('Organizations'),
                    'elementClass', 'MultiCheckbox',
                    'multiOptions', $this->util->getDbLookup()->getOrganizationsWithRespondents(),
                    'required', true
                    );
            $ct = new \MUtil_Model_Type_ConcatenatedRow('|', $translator->_(', '));
            $ct->apply($this, 'gtr_organizations');
        }
        if ($edit) {
            $this->set('toggleOrg',
                    'elementClass', 'ToggleCheckboxes',
                    'selectorName', 'gtr_organizations'
                    );
            $this->set('gtr_track_name',
                    'minlength', 4,
                    'size', 30,
                    'validators[unique]', $this->createUniqueValidator('gtr_track_name')
                    );
        }
        return $this;
    }
157073
protected function afterSave($changed)
    {
        if ($this->trackEngine) {
            $this->addMessage($this->_('Track merge finished'));
        } else {
            $this->addMessage($this->_('Track import finished'));
        }
        $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tracks'));
    }
601410
public function save($item, bool $update = false)
    {
        return Craft::$app->assetTransforms->saveTransform($item);
    }
1096544
public function createForm (bool $edit = false)
    {
        $form = [
            'storageURL' => route ('admin.api.resources'),
            'buttons'    => [
                [
                    "class" => "col-centered",
                    "label" => trans ('HCTranslations::core.buttons.submit'),
                    "type"  => "submit",
                ],
            ],
            'structure'  => [[
                "type"            => "resource",
                "fieldID"         => "resource",
                "uploadURL"       => route("admin.api.resources"),
                "viewURL"         => route("resource.get", ['/']),
                "label"           => trans ("HCResources::resources.resource"),
                "required"        => 1,
                "requiredVisible" => 1,
            ]],
        ];

        if (!$edit)
            return $form;

        //Make changes to edit form if needed
        $form['structure'] = [[
            "type"            => "singleLine",
            "fieldID"         => "original_name",
            "label"           => trans ("HCResources::resources.original_name"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "id",
            "label"           => trans ("HCResources::resources.safe_name"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "size",
            "label"           => trans ("HCResources::resources.size"),
            "readonly"        => 1,
        ], [
            "type"            => "singleLine",
            "fieldID"         => "path",
            "label"           => trans ("HCResources::resources.path"),
            "readonly"        => 1,
        ]];

        return $form;
    }
555206
public function applyDetailSettings()
    {
        $this->applyBrowseSettings(true);

        $this->_addLoadDependency = true;

        $this->set('gtf_id_track',          'label', $this->_('Track'),
                'multiOptions', $this->util->getTrackData()->getAllTracks()
                );
        $this->set('gtf_field_description', 'label', $this->_('Description'),
                'description', $this->_('Optional extra description to show the user.')
                );
        $this->set('gtf_track_info_label',   'label', $this->_('Add name to description'));

        $this->set('htmlUse', 'label', ' ');

        // But do always transform gtf_calculate_using on load and save
        // as otherwise we might not be sure what to do
        $contact = new \MUtil_Model_Type_ConcatenatedRow(self::FIELD_SEP, '; ', false);
        $contact->apply($this, 'gtf_calculate_using');

        // Clean up data always show in browse view, but not always in detail views
        $this->set('gtf_create_track',    'label', null);

        $switches = array(
            0 => array(
                'gtf_track_info_label'     => array('elementClass' => 'Hidden', 'label' => null),
            ),
        );
        $this->addDependency(array('ValueSwitchDependency', $switches), 'gtf_to_track_info');
    }
705241
public function createForm(bool $edit = false)
    {
        $form = [
            'storageURL' => route('admin.api.routes.menu'),
            'buttons'    => [
                [
                    "class" => "col-centered",
                    "label" => trans('HCTranslations::core.buttons.submit'),
                    "type"  => "submit",
                ],
            ],
            'structure'  => [
                [
                    'type'            => 'dropDownList',
                    'fieldID'         => 'language',
                    'label'           => trans('HCTranslations::core.language'),
                    'editType'        => 0,
                    'required'        => 1,
                    'requiredVisible' => 1,
                    'options'         => getHCLanguagesOptions('front_end', ['language']),
                    "search"          => [
                        "minimumInputLength"     => 0,
                        "maximumSelectionLength" => 1,
                    ],
                    "value"           => session('back-end', app()->getLocale()),
                ],
                [
                    "type"            => "singleLine",
                    "fieldID"         => "icon",
                    "label"           => trans("HCMenu::menu.icon"),
                    "required"        => 0,
                    "requiredVisible" => 0,
                ],
                [
                    'type'            => 'dropDownList',
                    'fieldID'         => 'menu_type',
                    'label'           => trans('HCMenu::menu.menu_type_id'),
                    'editType'        => 0,
                    'required'        => 1,
                    'requiredVisible' => 1,
                    "options"         => $this->getMenuList(),
                    "search"          => [
                        "minimumInputLength"     => 0,
                        "maximumSelectionLength" => 1,
                    ],
                ],
                [
                    'type'            => 'dropDownList',
                    'fieldID'         => 'menu_groups',
                    'label'           => trans('HCMenu::menu.menu_groups'),
                    'editType'        => 0,
                    'required'        => 0,
                    'requiredVisible' => 0,
                    "search"          => [
                        "url"                    => route('admin.api.routes.menu.groups.options'),
                        "minimumInputLength"     => 0,
                        "maximumSelectionLength" => 10,
                        "showNodes"              => [
                            'name',
                        ],
                    ],
                    "dependencies"    => [
                        [
                            "field_id" => "language",
                        ],
                    ],
                ],
                [
                    'type'            => 'dropDownList',
                    'fieldID'         => 'parent',
                    'label'           => trans('HCMenu::menu.parent_id'),
                    'editType'        => 0,
                    'required'        => 0,
                    'requiredVisible' => 0,
                    "search"          => [
                        "url"                    => route('admin.api.routes.menu.options'),
                        "minimumInputLength"     => 1,
                        "maximumSelectionLength" => 1,
                        "showNodes"              => [
                            'item_label',
                        ],
                    ],
                    "dependencies"    => [
                        [
                            "field_id" => "language",
                        ],
                        [
                            "field_id" => "menu_type",
                        ],
                    ],
                ],
                [
                    'type'            => 'radioList',
                    'fieldID'         => 'type',
                    'label'           => trans('HCMenu::menu.type'),
                    'editType'        => 0,
                    'required'        => 1,
                    'requiredVisible' => 1,
                    'options'         => HCMenu::getTableEnumList('type', 'label', 'HCMenu::menu.types.'),
                    'dependencies'    => [
                        [
                            'field_id' => 'language',
                        ],
                    ],
                ],
                [
                    "type"            => "singleLine",
                    "fieldID"         => "link_text",
                    "label"           => trans("HCMenu::menu.link_text"),
                    "required"        => 0,
                    "requiredVisible" => 0,
                    "dependencies"    => [
                        [
                            'field_id' => "type",
                            'field_value' => 'link',
                        ],
                    ],
                ],
                [
                    "type"            => "singleLine",
                    "fieldID"         => "url",
                    "label"           => trans("HCMenu::menu.url"),
                    "required"        => 0,
                    "requiredVisible" => 0,
                    "dependencies"    => [
                        [
                            'field_id' => "type",
                            'field_value' => 'link',
                        ],
                    ],
                ],
                [
                    'type'            => 'dropDownList',
                    'fieldID'         => 'page_translations',
                    'label'           => trans('HCMenu::menu.page_id'),
                    'editType'        => 0,
                    'required'        => 0,
                    'requiredVisible' => 0,
                    "search"          => [
                        "minimumInputLength"     => 1,
                        "maximumSelectionLength" => 1,
                        "url"                    => route('admin.api.pages.options'),
                        "showNodes"              => [
                            "title",
                        ],
                    ],
                    "dependencies"    => [
                        [
                            "field_id" => "language",
                        ],
                        [
                            'field_id' => "type",
                            'field_value' => 'page',
                        ],
                    ],
                ],
                [
                    'type'            => 'radioList',
                    'fieldID'         => 'link_type',
                    'label'           => trans('HCMenu::menu.link_type'),
                    "required"        => 1,
                    "requiredVisible" => 1,
                    "options"         => [
                        [
                            'id'    => '_blank',
                            'label' => '_blank',
                        ],
                        [
                            'id'    => '_self',
                            'label' => '_self',
                        ],
                    ],
                ],
                [
                    "type"            => "singleLine",
                    "fieldID"         => "sequence",
                    "label"           => trans("HCMenu::menu.sequence"),
                    "required"        => 0,
                    "requiredVisible" => 0,
                ],
            ],
        ];

        if( $this->multiLanguage )
            $form['availableLanguages'] = getHCContentLanguages();

        if( ! $edit )
            return $form;

        //Make changes to edit form if needed
        // $form['structure'][] = [];

        return $form;
    }
355761
public function formatOptions(bool $strict = false, bool $noBraces = false)
    {
        $this->options([
            'xAxis' => [
                'data' => json_decode($this->formatLabels()),
            ],
        ]);

        return parent::formatOptions($strict, $noBraces);
    }
192781
protected function checkScope($update = true)
    {
        $request = request();

        if ($update && $request->exists('scope')) {

            $this->activeScope = $request->get('scope');

            $this->markResetActivePage();
            $this->storeActiveScopeInSession();
        } else {
            $this->retrieveActiveScopeFromSession();
        }

        // Check if active is valid, reset it othwerwise
        if ($this->activeScope && ! $this->isValidScopeKey($this->activeScope)) {
            $this->activeScope = null;
            $this->storeActiveScopeInSession();
        }

        return $this;
    }
775421
public function deleteRevision($clear = true)
    {
        $this->getFieldTypes()->each(function ($type) {
            $type::where('revision_id', $this->revision->id)->delete();
        });

        // If this revision is currently
        // published, we need to publish
        // another revision in place.
        if ($this->revision->published && $this->revision->exists) {
            //TODO :: improve this logic
            Revision::where('content_id', $this->content->id)
                ->where('id', '!=', $this->revision->id)
                ->take(1)
                ->update(['published' => true]);
        }

        $this->revision->delete();

        if ($clear) {
            $this->clearFields();
        }
    }
1162812
public function editMode( $set = null )
    {
        $validModes = array(
            self::EDITMODE_NONE,
            self::EDITMODE_CONTENT,
            self::EDITMODE_LAYOUT
        );

        if ( null !== $set )
        {
            $set = strtolower( $set );

            if ( empty( $set ) || ! in_array( $set, $validModes ) )
            {
                $set = static::EDITMODE_NONE;
            }
        }

        return $this->setting( 'editMode', $set );
    }
490388
public function linkable($create = true, $edit = true)
    {
        $this->linkOnly = true;
        parent::writeable($create, $edit);
        return $this;
    }
1034287
public function setLastModified($lastModified)
    {
        if ($lastModified instanceof DateTime) {
            $this->lastModified = $lastModified;
            return;
        } elseif ($lastModified instanceof Model) {
            $this->lastModified = $lastModified->updated_at;
            return;
        }

        $this->lastModified = new DateTime($lastModified);
    }
337991
public function setBusy($bool = true)
    {
        $this->busyCounter = 0;
        $this->isBusy = (bool)$bool;
        if ($bool) {
            $text = "Please wait...";
            if (is_string($bool)) {
                $text = (string)$bool;
            }
            $lbl = Label::create();
            $lbl->setText($text)->setTextColor("fff")->setTextSize(6)
                ->setSize(90, 12)->setAlign("center", "center")
                ->setPosition($this->busyFrame->getWidth() / 2, -($this->busyFrame->getHeight() / 2));

            $this->busyFrame->addChild($lbl);
            $quad = Quad::create();
            $quad->setStyles("Bgs1", "BgDialogBlur");
            $quad->setBackgroundColor("f00")->setSize($this->busyFrame->getWidth(), $this->busyFrame->getHeight());
            $this->busyFrame->addChild($quad);
        } else {
            $this->busyFrame->removeAllChildren();
        }
    }
1333181
public function setStyle(array $style = [], $update = true)
    {
        $this->style = $update
            ? array_merge($this->style, $style)
            : $style;

        return $this;
    }
319429
public static function ex($var, $detailed = false, $label = null, $flags = ENT_SUBSTITUTE) {
        if(!Config::$o->debug) return;

        self::driver()->ex($var, $detailed, $label, $flags);
    }
41015
public function createForm(bool $edit = false)
    {
        $this->prefix = '';

        $form = [
            'storageURL' => route('admin.api.galleries'),
            'buttons'    => [
                [
                    "class" => "col-centered",
                    "label" => trans('HCTranslations::core.buttons.submit'),
                    "type"  => "submit",
                ],
            ],
            'structure'  => $this->getNewStructure(),
        ];

        if ($this->multiLanguage)
            $form['availableLanguages'] = getHCContentLanguages();

        if (!$edit)
            return $form;

        //Make changes to edit form if needed
        $form['structure'] = array_merge($form['structure'], $this->getEditStructure(true));

        return $form;
    }
732914
public function getCommLogModel($detailed)
    {
        $model = $this->_loadClass('CommLogModel', true);
        $model->applySetting($detailed);

        return $model;
    }