/** * @param Action $action * @param ActiveRecord $model * @param bool $horizontal * @param array $privs * @param array $defaultActions * @param array $confirms * @return array */ public function getMenuCurrent(Action $action, $model, $horizontal, $privs, $defaultActions, $confirms) { $id = $model->isNewRecord ? null : $action->exportKey($model->getPrimaryKey(true)); $menu = parent::getMenuCurrent($action, $model, $horizontal, $privs, $defaultActions, $confirms); if (!$horizontal && $model->isNewRecord) { return $menu; } if ($privs['update'] && ($horizontal || $action->id !== 'process')) { $menu['process'] = ['label' => \Yii::t('nineinchnick/sync/app', 'Process'), 'icon' => 'cog', 'url' => ['process', 'id' => $id], 'active' => false]; if ($model->isNewRecord) { $menu['process']['disabled'] = true; } } return $menu; }
public function behaviors() { return array_merge(parent::behaviors(), ['labels' => ['class' => 'netis\\utils\\db\\LabelsBehavior', 'attributes' => ['id'], 'crudLabels' => ['default' => Yii::t('nineinchnick/sync/models', 'Message'), 'relation' => Yii::t('nineinchnick/sync/models', 'Messages'), 'index' => Yii::t('nineinchnick/sync/models', 'Browse Messages'), 'create' => Yii::t('nineinchnick/sync/models', 'Create Message'), 'read' => Yii::t('nineinchnick/sync/models', 'View Message'), 'update' => Yii::t('nineinchnick/sync/models', 'Update Message'), 'delete' => Yii::t('nineinchnick/sync/models', 'Delete Message')]]]); }
/** * @inheritdoc */ public function afterFind() { $parserOptions = json_decode($this->parser_options, true); if (!is_array($parserOptions)) { return parent::afterFind(); } $attributeLabels = $this->attributeLabels(); $newOptions = []; foreach ($parserOptions as $option => $value) { //fill inputs; $this->{$option} = $value; //format parserOptions $newOptions[$attributeLabels[$option]] = $attributeLabels[$option] . ': ' . $value; } $this->parser_options = implode('<br>', $newOptions); return parent::afterFind(); }
public function behaviors() { return array_merge(parent::behaviors(), ['labels' => ['class' => 'netis\\utils\\db\\LabelsBehavior', 'attributes' => ['url'], 'crudLabels' => ['default' => Yii::t('nineinchnick/sync/models', 'File'), 'relation' => Yii::t('nineinchnick/sync/models', 'Files'), 'index' => Yii::t('nineinchnick/sync/models', 'Browse Files'), 'create' => Yii::t('nineinchnick/sync/models', 'Create File'), 'read' => Yii::t('nineinchnick/sync/models', 'View File'), 'update' => Yii::t('nineinchnick/sync/models', 'Update File'), 'delete' => Yii::t('nineinchnick/sync/models', 'Delete File')]], 'blameable' => ['class' => 'netis\\utils\\db\\BlameableBehavior', 'createdByAttribute' => 'author_id', 'updatedByAttribute' => 'editor_id'], 'timestamp' => ['class' => 'netis\\utils\\db\\TimestampBehavior', 'updatedAtAttribute' => 'updated_on', 'createdAtAttribute' => 'created_on']]); }