示例#1
0
 /**
  * @param $id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionStepUpdate($id)
 {
     $model = WorkflowStep::findOne($id);
     $wf_id = $model->wf_id;
     $wf = $this->findModel($wf_id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['list', 'wf_id' => $wf_id]);
     } else {
         return $this->render('step-update', ['wf' => $wf, 'model' => $model]);
     }
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getWorkflowSteps()
 {
     return $this->hasMany(WorkflowStep::className(), ['wf_id' => 'id']);
 }
示例#3
0
/* @var $form ActiveForm */
?>
<div class="step-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'wf_id')->hiddenInput()->label(false);
?>
    <?php 
echo $form->field($model, 'role_id');
?>
    <?php 
echo $form->field($model, 'append_note')->dropDownList(WorkflowStep::appendNode(), ['prompt' => Yii::t('app', 'Select append note')]);
?>
    <?php 
echo $form->field($model, 'intro');
?>
    <?php 
echo $form->field($model, 'name');
?>
    <?php 
echo $form->field($model, 'before_state')->hint(Yii::t('app', 'If more than one state split by slashes'));
?>
    <?php 
echo $form->field($model, 'after_state')->hint(Yii::t('app', 'If more than one state split by slashes'));
?>

    <div class="form-group">
示例#4
0
文件: list.php 项目: jackieit/aimocms
use yii\grid\GridView;
use backend\models\WorkflowStep;
use backend\models\Workflow;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model backend\models\Workflow */
$this->title = Yii::t('app', 'View step list');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Workflows'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $wf->name, 'url' => ['view', 'id' => $wf->id]];
?>

<div class="workflow-index">


    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Step'), ['step-create', 'wf_id' => $wf->id], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'name', 'before_state', 'after_state', ['attribute' => 'append_note', 'value' => function ($model) {
    $an = WorkflowStep::appendNode();
    return ArrayHelper::getValue($an, $model->append_note);
}], 'intro', ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['step-update', 'id' => $model->id], ['data-pjax' => 1, 'title' => Yii::t('app', 'Update')]);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['step-delete', 'id' => $model->id], ['data-pjax' => 1, 'title' => Yii::t('app', 'Delete'), 'data-method' => 'post', 'data-confirm' => Yii::t('app', 'Are you sure you want to delete this item?')]);
}]]]]);
?>
</div>