public function getValue($record) { $value = $this->admin->getColumnValue($this->name, $record); list($column, $model) = $this->admin->getChainedModel($this->name, $record); if ($model === null) { return null; } $field = $model->getField($column, false); if ($field) { if (is_a($field, HasManyField::className()) || is_a($field, ManyToManyField::className())) { return null; } else { if (is_a($field, BooleanField::className())) { return $value ? '<i class="icon checkmark"></i>' : ''; } else { if (!empty($field->choices) && array_key_exists($value, $field->choices)) { return $field->choices[$value]; } else { return (string) $value; } } } } else { return (string) $model->{$column}; } }
public static function getFields() { $fields = ['is_custom' => ['class' => BooleanField::className(), 'verboseName' => MetaModule::t('Is custom'), 'helpText' => MetaModule::t('If "Set manually" field was not set, data will be generated automatically')], 'title' => ['class' => CharField::className(), 'length' => 200, 'verboseName' => MetaModule::t('Title')], 'keywords' => ['class' => CharField::className(), 'length' => 200, 'verboseName' => MetaModule::t('Keywords'), 'null' => true], 'description' => ['class' => CharField::className(), 'length' => 200, 'verboseName' => MetaModule::t('Description'), 'null' => true], 'url' => ['class' => CharField::className(), 'verboseName' => MetaModule::t('Url'), 'null' => true]]; $onSite = Mindy::app()->getModule('Meta')->onSite; if ($onSite) { $fields['site'] = ['class' => ForeignField::className(), 'modelClass' => Mindy::app()->getModule('Sites')->modelClass, 'verboseName' => SitesModule::t('Site'), 'required' => true, 'null' => true]; } return $fields; }
public static function getFields() { return ["code" => ['class' => CharField::className(), 'verboseName' => self::t("Key"), 'unique' => true, 'helpText' => self::t("Rule code for developers to use in source code")], "name" => ['class' => CharField::className(), 'verboseName' => self::t("Name"), 'helpText' => self::t("Rule name")], "bizrule" => ['class' => CharField::className(), 'null' => true, 'verboseName' => self::t("Bussines rule"), 'helpText' => self::t("More info in documentation")], "is_locked" => ['class' => BooleanField::className(), 'verboseName' => self::t("Is locked"), 'helpText' => self::t("Locked for editing. Editing allowed only for super-administrator.")], "is_auto" => ['class' => BooleanField::className(), 'verboseName' => self::t("Is auto"), 'helpText' => self::t("Rule created automatically by module. Editing allowed only for super-administrator.")], "is_visible" => ['class' => BooleanField::className(), 'default' => true, 'verboseName' => self::t("Is visible"), 'helpText' => self::t('Rule is visible only to super-administrator')], "is_default" => ['class' => BooleanField::className(), 'verboseName' => self::t("Is default"), 'helpText' => self::t("Default rule. Rule applies to all users after creation")], "is_global" => ['class' => BooleanField::className(), 'verboseName' => self::t("Is global"), 'helpText' => self::t("Global rule. This type of rule has priority and overrides other rules. More info in documentation.")]]; }
public static function getFields() { return ['code' => ['class' => CharField::className(), 'verboseName' => self::t("Permission code")], 'type' => ['class' => CharField::className(), 'verboseName' => self::t("Type")], 'name' => ['class' => CharField::className(), 'verboseName' => self::t("Permission name")], 'module' => ['class' => CharField::className(), 'verboseName' => self::t("Module")], 'is_auto' => ['class' => BooleanField::className(), 'verboseName' => self::t("Is auto")], 'is_locked' => ['class' => BooleanField::className(), 'verboseName' => self::t("Is locked")]]; }