Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Workflow::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['workflow_id' => $this->workflow_id, 'regist_date' => $this->regist_date, 'update_date' => $this->update_date, 'del_chk' => $this->del_chk]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Finds the Workflow model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Workflow the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Workflow::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
/* @var $this yii\web\View */
/* @var $model app\models\Project */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="project-form">

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

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'workflow_id')->dropDownList(ArrayHelper::map(Workflow::find()->all(), 'workflow_id', 'name'))->label('ワークフロー');
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getWorkflow()
 {
     return $this->hasOne(Workflow::className(), ['workflow_id' => 'workflow_id']);
 }
Пример #5
0
 public function stop($id)
 {
     if (!($workflow = Workflow::find((int) $id))) {
         return redirect('workflows')->with('status_error', "Workflow not found.");
     }
     if (empty($workflow->path)) {
         return redirect('workflows')->with('status_error', "Workflow not found.");
     }
     if (empty($workflow->pid)) {
         return redirect('workflows')->with('status_error', "Workflow already stopped.");
     }
     shell_exec("kill {$workflow->pid} > /dev/null & echo \$!");
     $workflow->pid = null;
     $workflow->save();
     return redirect('workflows')->with('status_success', "Workflow stopped.");
 }