Returns a model that can be used to retrieve or save the data.

@param boolean $detailed Create a model for the display of detailed item data or just a browse table
@param string $action The current action
@return \MUtil_Model_ModelAbstract
325079
public function getRoundModel($detailed, $action)
    {
        $model      = $this->createRoundModel();
        $translated = $this->util->getTranslated();

        // Set the keys to the parameters in use.
        $model->setKeys(array(\MUtil_Model::REQUEST_ID => 'gro_id_track', \Gems_Model::ROUND_ID => 'gro_id_round'));

        if ($detailed) {
            $model->set('gro_id_track',      'label', $this->_('Track'),
                    'elementClass', 'exhibitor',
                    'multiOptions', $this->util->getTrackData()->getAllTracks
                    );
        }

        $model->set('gro_id_survey',         'label', $this->_('Survey'),
                'multiOptions', $this->util->getTrackData()->getAllSurveysAndDescriptions()
                );
        $model->set('gro_icon_file',         'label', $this->_('Icon'));
        $model->set('gro_id_order',          'label', $this->_('Order'),
                'default', 10,
                'required', true,
                'validators[uni]', $model->createUniqueValidator(array('gro_id_order', 'gro_id_track'))
                );
        $model->set('gro_round_description', 'label', $this->_('Description'),
                'size', '30'
                ); //, 'minlength', 4, 'required', true);

        $list = $this->events->listRoundChangedEvents();
        if (count($list) > 1) {
            $model->set('gro_changed_event', 'label', $this->_('After change'),   'multiOptions', $list);
        }
        $list = $this->events->listSurveyDisplayEvents();
        if (count($list) > 1) {
            $model->set('gro_display_event', 'label', $this->_('Answer display'),
                    'multiOptions', $list
                    );
        }
        $model->set('gro_active',            'label', $this->_('Active'),
                'elementClass', 'checkbox',
                'multiOptions', $translated->getYesNo()
                );
        $model->setIfExists('gro_code',      'label', $this->_('Round code'),
                'description', $this->_('Optional code name to link the field to program code.'),
                'size', 10
                );

        $model->addColumn(
            "CASE WHEN gro_active = 1 THEN '' ELSE 'deleted' END",
            'row_class');
        $model->addColumn(
            "CASE WHEN gro_organizations IS NULL THEN 0 ELSE 1 END",
            'org_specific_round');
        $model->addColumn('gro_organizations', 'organizations');

        $model->set('organizations', 'label', $this->_('Organizations'),
                'elementClass', 'MultiCheckbox',
                'multiOptions', $this->util->getDbLookup()->getOrganizations(),
                'data-source', 'org_specific_round'
                );
        $tp = new \MUtil_Model_Type_ConcatenatedRow('|', $this->_(', '));
        $tp->apply($model, 'organizations');

        $model->set('gro_condition',
                'label', $this->_('Condition'),
                'elementClass', 'Select',
                'multiOptions', $this->loader->getConditions()->getConditionsFor(Gems\Conditions::ROUND_CONDITION)
                );

        $model->set('condition_display', 'label', $this->_('Condition help'), 'elementClass', 'Hidden', 'no_text_search', true, 'noSort', true);

        $model->addDependency('Condition\\RoundDependency');

        switch ($action) {
            case 'create':
                $this->_ensureRounds();

                if ($this->_rounds && ($round = end($this->_rounds))) {
                    $model->set('gro_id_order', 'default', $round['gro_id_order'] + 10);
                }

                // Intentional fall through
                // break;
            case 'edit':
            case 'show':
            	$model->set('gro_icon_file',
                        'multiOptions', $translated->getEmptyDropdownArray() + $this->_getAvailableIcons()
                        );
                $model->set('org_specific_round',
                        'label', $this->_('Organization specific round'),
                        'default', 0,
                        'multiOptions', $translated->getYesNo(),
                        'elementClass', 'radio'
                        );

                break;

            default:
                $model->set('gro_icon_file', 'formatFunction', array('MUtil_Html_ImgElement', 'imgFile'));
                break;

        }

        return $model;
    }
43355
public function RelativeLink($action = null)
    {
        if ($this->owner->ParentID && SiteConfig::current_site_config()->nested_urls) {
            $parent = $this->owner->Parent();
            // If page is removed select parent from version history (for archive page view)
            if ((!$parent || !$parent->exists()) && !$this->owner->isOnDraft()) {
                $parent = Versioned::get_latest_version($this->owner->ClassName, $this->owner->ParentID);
            }
            $base = $parent->RelativeLink($this->owner->URLSegment);
        } elseif (!$action && $this->owner->URLSegment == RootURLController::get_homepage_link()) {
            // Unset base for root-level homepages.
            // Note: Homepages with action parameters (or $action === true)
            // need to retain their URLSegment.
            $base = null;
        } else {
            $base = $this->owner->URLSegment;
        }

        $this->owner->extend('updateRelativeLink', $base, $action);

        // Legacy support: If $action === true, retain URLSegment for homepages,
        // but don't append any action
        if ($action === true) {
            $action = null;
        }

        return Controller::join_links($base, '/', $action);
    }
1194598
public function detailAction()
    {
        $interface = isset($_GET["interface"]) ? trim($_GET["interface"]) : "";
        if (empty($interface)) {
            return $this->error();
        }

        try {
            $config = Factory::getServer($interface);
            $reflectionClass = new ReflectionClass($interface);
        } catch (InitiallyRpcException $e) {
            return $this->error();
        } catch (ReflectionException $e) {
            return $this->error();
        }

        include $this->templateDir . "/detailView.php";
    }
1125097
public function moduleForAction($action)
    {
        if (!isset($this->actions[$action])) {
            return null;
        }

        return $this->modules[$this->actions[$action]];
    }
357409
public function resolveMeta($action, $arguments)
    {
        // Model meta data is saved as single record. In this
        // case meta data key is always model slug, so to
        // be sure, we overwrite this argument.
        if ($this->isPreservedAs('single')) {
            $arguments[1] = $this->getSlug();

            return $this->{"{$action}Meta"}($arguments);
        }

        // Model meta data is saved as multiple records. Unserialize
        // Singularity array string, before returning the results.
        if ($this->isPreservedAs('multiple')) {
            return $this->unserializeCollection($this->{"{$action}Meta"}($arguments));
        }

        // Model meta don't have any preserve settings.
        // Just process action and nothing more.
        return $this->{"{$action}Meta"}($arguments);
    }
922080
protected function convertToControllerAction($action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        }

        // Here we'll merge any group "uses" statement if necessary so that the action
        // has the proper clause for this property. Then we can simply set the name
        // of the controller on the action and return the action array for usage.
        if (! empty($this->groupStack)) {
            $action['uses'] = $this->prependGroupNamespace($action['uses']);
        }

        // Here we will set this controller name on the action array just so we always
        // have a copy of it for reference if we need it. This can be used while we
        // search for a controller name or do some other type of fetch operation.
        $action['controller'] = $action['uses'];

        return $action;
    }
518310
public static function toSearch(string $modelName, array $params = [], string $action = 'index')
    {
        $formName = Inflector::id2camel($modelName) . 'Search';

        return static::toAction($modelName, [$formName => $params], $action);
    }
160117
public function relatedModels($related = null, $action = null)
    {
        if ($related === null) {
            return $this->_action($action)->getConfig('relatedModels');
        }

        return $this->_action($action)->setConfig('relatedModels', $related, false);
    }
491559
protected function action($action)
    {
        $action = in_array($action, $this->actions) ? $action : null;
        $action = array_key_exists($action, $this->aliases) ? $this->aliases[$action] : $action;

        return $action;
    }
581289
public function Link($action=null) {
        $link = Controller::join_links(
            $this->stat('url_base', true),
            $this->stat('url_segment', true), // in case we want to change the segment
            '/', // trailing slash needed if $action is null!
            "$action"
        );
        
        $this->extend('updateLink', $link);
        return $link;
    }
579774
public function getMethodByAction($action)
    {
        foreach ($this->methods as $method => $actions) {
            if (in_array($action, $actions)) {
                return $method;
            }
        }

        return 'get';
    }
426035
public static function make($action, $type = 'button', array $attributes = [], $disabled = false)
    {
        return new static($action, $type, $attributes, $disabled);
    }
560692
public function actionClass(string $action): string
    {
        switch ($action) {
            case ModelHistory::ACTION_CREATE:
                $class = 'success';
                break;
            case ModelHistory::ACTION_DELETE:
                $class = 'danger';
                break;
            case ModelHistory::ACTION_COMMENT:
                $class = 'active';
                break;
            case ModelHistory::ACTION_UPDATE:
            default:
                $class = 'info';
                break;
        }

        return $class;
    }
1226752
public function beforeAction($action)
    {
        $itemName = '';
        $controller = $action->controller;

        /**
         * @var \yii\web\User $user
         */
        $user = \Yii::$app->getUser();

        if ($user->isGuest) {
            $user->loginRequired();
        }

        if (($module = $controller->module) !== null) {
            $itemName .= $module->id . '.';
            if ($user->can($itemName . '*')) {
                return true;
            }
        }

        $itemName .= $controller->id;
        if ($user->can($itemName . '.*')) {
            return true;
        }

        $itemName .= '.' . $action->id;
        if ($user->can($itemName, $this->params)) {
            return true;
        }

        throw new HttpException(401, \Yii::t('yii', 'You are not permission to perform this action.'));
    }
1372727
public function getViewer($action)
    {
        // Hard-coded templates
        if (isset($this->templates[$action]) && $this->templates[$action]) {
            $templates = $this->templates[$action];
        } elseif (isset($this->templates['index']) && $this->templates['index']) {
            $templates = $this->templates['index'];
        } elseif ($this->template) {
            $templates = $this->template;
        } else {
            // Build templates based on class hierarchy
            $actionTemplates = [];
            $classTemplates = [];
            $parentClass = static::class;
            while ($parentClass !== parent::class) {
                // _action templates have higher priority
                if ($action && $action != 'index') {
                    $actionTemplates[] = strtok($parentClass, '_') . '_' . $action;
                }
                // class templates have lower priority
                $classTemplates[] = strtok($parentClass, '_');
                $parentClass = get_parent_class($parentClass);
            }

            // Add controller templates for inheritance chain
            $templates = array_unique(array_merge($actionTemplates, $classTemplates));
        }

        return SSViewer::create($templates);
    }
550236
public function Link($action = null)
    {
        if (!$action) {
            $action = $this->step;
        }

        return $this->dataRecord->RelativeLink($action);
    }
89707
public function getByAction($action)
    {
        return isset($this->actions[$action]) ? $this->actions[$action] : null;
    }