Esempio n. 1
0
 /**
  * Renders the index view for the module
  * @return string
  */
 public function actionChangeGroup()
 {
     $count = 0;
     foreach (Object::find()->all() as $object) {
         /** @var $object Object */
         $group = Group::find()->where(['name' => mb_substr($object->name, 0, 1)])->one();
         if ($group) {
             \Yii::$app->db->createCommand()->update('object', ['group_id' => $group->id], ['id' => $object->id])->execute();
             $count++;
         }
     }
     echo "done - {$count}\n";
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Object::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'group_id' => $this->group_id, 'region_id' => $this->region_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Object::find()->joinWith(['sale']);
     //->orderBy(['id' => 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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['object.id' => $this->id, 'sale.region_id' => $this->region_id, 'sale.status' => $this->status, 'sale.district_id' => $this->district_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address]);
     return $dataProvider;
 }
Esempio n. 4
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\ObjectInfo */
/* @var $form yii\widgets\ActiveForm */
$object_list = \common\models\Object::find()->all();
?>

<div class="object-info-form">

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

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

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

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

    <?php 
echo $form->field($model, 'fullname_chairman')->textInput();
?>
Esempio n. 5
0
 public static function gpsMarkers($district_id)
 {
     $temp = Object::find()->joinWith(['sale']);
     if ($district_id > 0) {
         $temp = $temp->where(['district_id' => $district_id]);
     }
     $temp = $temp->asArray()->all();
     $items = [];
     foreach ($temp as $t) {
         $t = $t['sale'];
         $items[] = ['link' => Url::toRoute(['sale/update', 'id' => $t['id']]), 'status' => $t['status'], 'pos' => $t['gps'], 'title' => 'ID ' . $t['object_id'] . ' (' . $t['address'] . ') ' . $t['name'] . ' - ' . date('d.m.Y', $t['created_at'])];
     }
     return $items;
 }