Exemplo n.º 1
0
 /**
  * Lists all Office models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new OfficeSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $institutions = ArrayHelper::map(Institution::find()->all(), 'id_institution', 'institution_name');
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'institutions' => $institutions]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Institution::find();
     if (!isset($params['sort'])) {
         $query->orderBy(['id_institution' => SORT_DESC]);
     }
     $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_institution' => $this->id_institution, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'institution_id', $this->institution_id])->andFilterWhere(['like', 'institution_name', $this->institution_name])->andFilterWhere(['like', 'phone', $this->phone]);
     return $dataProvider;
 }
Exemplo n.º 3
0
use yii\widgets\MaskedInput;
use common\models\Institution;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Office */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="office-form">

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

    <?php 
echo $form->field($model, 'id_institution')->dropDownList(ArrayHelper::map(Institution::find()->all(), 'id_institution', 'institution_name'))->label('Institution');
?>

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

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

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

    <?php 
Exemplo n.º 4
0
/* @var $model common\models\Advisor */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="advisor-form">

    <?php 
$form = ActiveForm::begin(['enableAjaxValidation' => true]);
?>

    <?php 
echo $form->field($model, 'advisor_id')->textInput();
?>

    <?php 
echo $form->field($model, 'id_institution')->label('Institution')->dropDownList(ArrayHelper::map(Institution::find()->all(), 'id_institution', function ($item) {
    return $item['institution_id'] . '-' . $item['institution_name'];
}), ['prompt' => 'Select...']);
?>

    <div class="form-group field-advisorgroup-id_advisor required">
	    	<label class="col-sm-3 control-label form-label" for="id_advisor">Id Group</label>
	    	<div class="col-sm-8">
			<?php 
echo Select2::widget(['name' => 'id_group', 'value' => ArrayHelper::map($model->groups, 'id_group', 'id_group'), 'data' => ArrayHelper::map(Group::find()->all(), 'id_group', 'group_id'), 'options' => ['placeholder' => 'Select  ...', 'multiple' => true], 'pluginOptions' => ['maximumInputLength' => 10, 'ajax' => ['url' => Url::to(['group/get-all-group-list']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')]]]);
?>
	    	</div>
    	</div>

    <?php 
echo $form->field($model, 'id_office')->dropDownList(ArrayHelper::map(Office::find()->all(), 'id_office', 'office_id'), ['prompt' => 'Select...']);