Example #1
0
 public function searchByDomains($params, $allowed_domains)
 {
     $this->load($params);
     $domains_name = [];
     foreach ($allowed_domains as $domain) {
         $domains_name[] = $domain->name;
     }
     if ($this->status && $this->domain) {
         if ($this->status == "enabled") {
             $workflows = BpmWorkflow::find()->where(['domain' => $this->domain])->andWhere(['in', 'domain', $domains_name])->andWhere(['active' => BpmWorkflow::STATUS_ENABLED])->orderBy(['domain' => SORT_ASC]);
         } else {
             $workflows = BpmWorkflow::find()->where(['domain' => $this->domain])->andWhere(['in', 'domain', $domains_name])->andWhere(['active' => BpmWorkflow::STATUS_DISABLED])->orderBy(['domain' => SORT_ASC]);
         }
     } else {
         if ($this->domain) {
             $workflows = BpmWorkflow::find()->where(['domain' => $this->domain])->andWhere(['in', 'domain', $domains_name])->orderBy(['domain' => SORT_ASC]);
         } else {
             if ($this->status) {
                 if ($this->status == "enabled") {
                     $workflows = BpmWorkflow::find()->where(['in', 'domain', $domains_name])->andWhere(['in', 'domain', $domains_name])->andWhere(['active' => BpmWorkflow::STATUS_ENABLED])->orderBy(['domain' => SORT_ASC]);
                 } else {
                     $workflows = BpmWorkflow::find()->where(['in', 'domain', $domains_name])->andWhere(['in', 'domain', $domains_name])->andWhere(['active' => BpmWorkflow::STATUS_DISABLED])->orderBy(['domain' => SORT_ASC]);
                 }
             } else {
                 $workflows = BpmWorkflow::find()->where(['in', 'domain', $domains_name])->orderBy(['domain' => SORT_ASC]);
             }
         }
     }
     $dataProvider = new ActiveDataProvider(['query' => $workflows, 'sort' => false, 'pagination' => ['pageSize' => 15]]);
     return $dataProvider;
 }
Example #2
0
use meican\bpm\models\BpmWorkflow;
use meican\base\grid\Grid;
\meican\bpm\assets\Index::register($this);
$this->params['header'] = ["Workflows", ['Home', 'Workflows']];
?>

<div class="box box-default">
    <div class="box-body">               
	<?php 
echo Grid::widget(['options' => ['class' => 'list'], 'dataProvider' => $data, 'filterModel' => $searchModel, 'id' => 'gridDevices', 'layout' => "{items}{summary}{pager}", 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'contentOptions' => function ($model) {
    return ['class' => 'btn-delete', 'id' => $model->id];
}, 'buttons' => ['delete' => function ($url, $model) {
    return Html::a('<span class="fa fa-trash"></span>', '#');
}], 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{copy}', 'buttons' => ['copy' => function ($url, $model) {
    return Html::a('<span class="fa fa-copy"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t("bpm", 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 35%;']], ['label' => Yii::t("bpm", 'Domain'), 'value' => 'domain', 'filter' => Html::activeDropDownList($searchModel, 'domain', ArrayHelper::map(BpmWorkflow::find()->select(["domain"])->distinct(true)->orderBy(['domain' => SORT_ASC])->asArray()->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => Yii::t("bpm", 'any')]), 'headerOptions' => ['style' => 'width: 35%;']], ['format' => 'raw', 'label' => 'Status', 'value' => function ($model) {
    return Html::input('checkbox', '', $model->id, ['id' => 'toggle-' . $model->id, 'class' => 'toggle-event-class', 'checked' => !$model->isDisabled(), 'data-toggle' => "toggle", 'data-size' => "mini", "data-on" => Yii::t("bpm", "Enabled"), "data-off" => Yii::t("bpm", "Disabled"), "data-width" => "100", "data-onstyle" => "success", "data-offstyle" => "warning"]);
}, 'filter' => Html::activeDropDownList($searchModel, 'status', ["enabled" => Yii::t("bpm", "Enabled"), "disabled" => Yii::t("bpm", "Disabled")], ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 18%;']])]);
?>
	</div>
</div>

<?php 
Modal::begin(['id' => 'delete-workflow-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="delete-btn" class="btn btn-danger">' . Yii::t("bpm", "Delete") . '</button><button id="cancel-btn" class="btn btn-default">' . Yii::t("bpm", "Cancel") . '</button>']);
echo '<p style="text-align: left; height: 100%; width:100%;">' . Yii::t("bpm", "Delete this workflows?") . '</p>';
Modal::end();
Modal::begin(['id' => 'disable-workflow-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="confirm-btn" class="btn btn-danger">' . Yii::t("bpm", "Yes") . '</button><button id="cancel-btn" class="btn btn-default">' . Yii::t("bpm", "Cancel") . '</button>']);
echo '<p style="text-align: left; height: 100%; width:100%;" id="disable-message"></p>';
Modal::end();
Example #3
0
 public function getOwnedWorkflows()
 {
     return BpmWorkflow::find()->where(['domain_id' => $this->id]);
 }