Пример #1
0
 public function getSelectedTasksStatesNames()
 {
     $selected_states = \app\models\States::find()->where(['ID' => $this->states])->all();
     if ($selected_states) {
         $selected_states_string = 'выбрано: ';
         foreach ($selected_states as $state) {
             $selected_states_string .= $state->STATE_NAME . ' ';
         }
         return $selected_states_string;
     }
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = States::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(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Пример #3
0
 /**
  * Updates an existing Devices model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $listparent = Devices::find()->all();
     $listobject = Objects::find()->all();
     $listbrend = Brends::find()->all();
     $listinterface = Interfaces::find()->all();
     $liststate = States::find()->all();
     $listype = Types::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'listparent' => $listparent, 'listobject' => $listobject, 'listbrend' => $listbrend, 'listinterface' => $listinterface, 'liststate' => $liststate, 'listype' => $listype]);
     }
 }
 public function actionStates()
 {
     $permissions_for_states_change = \app\models\Permissions::find()->where('SUBJECT_TYPE = :subject_type and SUBJECT_ID = :user_id and DEL_TRACT_ID = :del_tract and PERM_LEVEL != :perm_level and ACTION_ID = :action', ['action' => 2, 'subject_type' => 2, 'user_id' => \Yii::$app->user->id, 'del_tract' => 0, 'perm_level' => 0])->one();
     /*
         Проверка на доступ пользователя к странице
     */
     if ($permissions_for_states_change) {
         /*
             Формирование списка состояний
         */
         $states_list = \app\models\States::find()->all();
         /*
             Рендер страницы и передача сформированных переменных в нее
         */
         return $this->render('states', ['states_list' => $states_list, 'perm_level' => $permissions_for_states_change->PERM_LEVEL]);
     } else {
         /*
             Вызываем эксепшн в случае, если доступ к странце запрещен
         */
         throw new \yii\web\ForbiddenHttpException('У Вас нет доступа на "Последовательность смены состояний".');
     }
 }
Пример #5
0
        echo $counter_overdue;
        ?>
)</a> <?php 
        if (isset(Yii::$app->request->getQueryParams()['overdue']) && Yii::$app->request->getQueryParams()['overdue'] == 1) {
            ?>
<i class="pull-right glyphicon glyphicon-ok"></i><?php 
        }
        ?>
</li>
			<?php 
    }
    ?>
			<hr>
			<li class="submenu-li">
				<?php 
    $states = \app\models\States::find()->all();
    foreach ($states as $state) {
        ?>
				<div style="padding-bottom: 3px;"><?php 
        echo $state->getState_name_state_colour();
        ?>
</div>
				<?php 
    }
    ?>
			</li>
		</ul>
		<?php 
}
?>
	</div>
Пример #6
0
 private function nextState($model)
 {
     /* @var $model States */
     $next = States::find()->where(['id_country' => $model->id_country])->andwhere(['>', 'name', "{$model->name}"])->orderBy('name')->one();
     if ($next) {
         return $next;
     } else {
         Yii::$app->session->setFlash('warning', 'Last record is achieved.');
         return $model;
     }
 }
Пример #7
0
								<div class="panel-heading" role="tab" id="headingOne">
									<h4 class="panel-title">
										<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
											Состояние
											<div class="what-selected pull-right" id="state_moment">
												<?php 
echo $searchModel->getSelectedTasksStatesNames();
?>
											</div>
										</a>
									</h4>
								</div>
								<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
									<div class="panel-body">
										<?php 
echo $form_filter->field($searchModel, 'states', ['template' => "{label}\n{input}"])->label(false)->checkboxList(yii\helpers\ArrayHelper::map(\app\models\States::find()->orderBy('ID asc')->all(), 'ID', 'STATE_NAME'), ['separator' => '', 'class' => 'state-checkbox']);
?>
									</div>
								</div>
							</div>
							<div class="panel panel-default">
								<div class="panel-heading" role="tab" id="headingTwo">
									<h4 class="panel-title">
										<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
											Подразделение
											<div class="what-selected pull-right" id="podr_list_moment"><?php 
if ($searchModel->podr_list) {
    ?>
выбрано: <?php 
    echo count(explode(',', $searchModel->podr_list)) . ' подразделение(ия)';
}
Пример #8
0
use app\models\States;
use app\models\Types;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $searchModel app\models\DevicesSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Devices';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="devices-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Devices', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'description:ntext', ['attribute' => 'type', 'label' => 'Тип', 'value' => 'types.name', 'filter' => ArrayHelper::map(Types::find()->all(), 'id', 'name')], ['attribute' => 'state', 'label' => 'state', 'value' => 'states.name', 'filter' => ArrayHelper::map(States::find()->all(), 'id', 'name')], ['attribute' => 'idobject', 'label' => 'Обьект', 'value' => 'objects.name', 'filter' => ArrayHelper::map(Objects::find()->all(), 'id', 'name')], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #9
0
											<?php 
        echo $state->getState_name_state_colour_without_text() . ' ' . $state->STATE_NAME;
        ?>
										</a>
									</h4>
								</div>
								<div id="collapse-state-item-<?php 
        echo $state->ID;
        ?>
" class="panel-collapse collapse" role="tabpanel" aria-labelledby="state-list-item-<?php 
        echo $state->ID;
        ?>
">
									<div class="panel-body">
										<?php 
        $inner_states = \app\models\States::find()->where(['!=', 'ID', $state->ID])->all();
        foreach ($inner_states as $inner_state) {
            $state_next = \app\models\StatesNext::find()->where(['STATE_ID' => $state->ID, 'NEXT_STATE_ID' => $inner_state->ID, 'DEL_TRACT_ID' => 0])->one();
            //if($state_next) echo $state_next->NEXT_STATE_ID;
            ?>
											<div class="checkbox" style="font-size: 11px;"><label><input <?php 
            if ($perm_level != 2) {
                ?>
disabled<?php 
            }
            ?>
 type="checkbox" <?php 
            if ($state_next) {
                ?>
checked<?php 
            }