/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Found::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'cat_id' => $this->cat_id, 'cat_1' => $this->cat_1, 'cat_2' => $this->cat_2, 'cat_3' => $this->cat_3, 'user_id' => $this->user_id, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'status_m', $this->status_m])->andFilterWhere(['like', 'status_f', $this->status_f])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
 protected function findFoundModel($id)
 {
     if (($model = Found::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
 <i class="fa fa-angle-right"></i> <?php 
    //=$category->title_az
    ?>
</em><em class="user-lf">Tapılıb</em></strong>
                    <a href="#popup" class="follow">Ətraflı</a>
                </p>
                <div class="decoration2"></div>

            <?php 
}
?>
        </div>

        <div class="one-third-responsive last-column">
            <?php 
$founds = Found::find()->where(['status_m' => 'active'])->limit(4)->offset(8)->all();
foreach ($founds as $found) {
    $user = User::findOne(['id' => $found['user_id']]);
    $category = Cats::findOne(['id' => $found['cat_id']]);
    $category1 = Cats::findOne(['id' => $found['cat_1']]);
    $category2 = Cats::findOne(['id' => $found['cat_2']]);
    $category3 = Cats::findOne(['id' => $found['cat_3']]);
    ?>
                <p class="user-list-follow">
                    <?php 
    if ($found['image']) {
        ?>
                        <img src="/admin/<?php 
        echo $found['image'];
        ?>
" alt="img">
                    </p>
                    <div class="decoration2"></div>

            <?php 
    }
} catch (Exception $e) {
}
?>
        </div>

        <div class="one-third-responsive last-column">
            <?php 
$c_1 = Found::find()->where(['status_m' => 'active'])->andWhere(['cat_1' => $model->id])->limit(4)->offset(8)->all();
$c_2 = Found::find()->where(['status_m' => 'active'])->andWhere(['cat_2' => $model->id])->limit(4)->offset(8)->all();
$c_3 = Found::find()->where(['status_m' => 'active'])->andWhere(['cat_3' => $model->id])->limit(4)->offset(8)->all();
$c_id = Found::find()->where(['status_m' => 'active'])->andWhere(['cat_id' => $model->id])->limit(4)->offset(8)->all();
if ($c_1) {
    $founds = $c_1;
}
if ($c_2) {
    $founds = $c_2;
}
if ($c_3) {
    $founds = $c_3;
}
if ($c_id) {
    $founds = $c_id;
}
try {
    foreach ($founds as $found) {
        $user = User::findOne(['id' => $found['user_id']]);
Beispiel #5
0
/* @var $this yii\web\View */
$this->title = 'Admin';
?>
<div class="site-index">

    <div class="jumbotron">
        <h1>Cəmi elan sayı</h1>
<?php 
$lost_all = \common\models\Lost::find()->count();
$found_all = \common\models\Found::find()->count();
$count_all = $lost_all + $found_all;
$lost_premium = \common\models\Lost::find()->where(['status_p' => 1])->count();
$lost_active = \common\models\Lost::find()->where(['status_m' => 'active'])->count();
$lost_inactive = \common\models\Lost::find()->where(['status_m' => 'inactive'])->count();
$found_active = \common\models\Found::find()->where(['status_m' => 'active'])->count();
$found_inactive = \common\models\Found::find()->where(['status_m' => 'inactive'])->count();
?>
        <p class="lead"><?php 
echo $count_all;
?>
</p>

        <p><a class="btn btn-lg btn-success" href="http://etap.az/">Sayta keç</a></p>
    </div>

    <div class="body-content">

        <div class="row">
            <div class="col-lg-4">
                <h2>Axtarılan elanların</h2>
    echo yii::t('yii', 'More');
    ?>
</a>
                            </p>
                            <div class="decoration2"></div>
                            
                    <?php 
}
?>
                    
                </div>

                <div class="one-responsive tab-content tab-content-2">

                    <?php 
$founds = Found::find()->where(['user_id' => $model->id])->all();
foreach ($founds as $found) {
    $user = User::findOne(['id' => $found['user_id']]);
    $category = Cats::findOne(['id' => $found['cat_id']]);
    $category1 = Cats::findOne(['id' => $found['cat_1']]);
    $category2 = Cats::findOne(['id' => $found['cat_2']]);
    $category3 = Cats::findOne(['id' => $found['cat_3']]);
    ?>
                            <p class="user-list-follow">
                                <?php 
    if ($found['image']) {
        ?>
                                    <img src="/admin/<?php 
        echo $found['image'];
        ?>
" alt="img">
Beispiel #7
0
 public function getFound()
 {
     return $this->hasOne(Found::className(), ['id' => 'found_id']);
 }
Beispiel #8
0
?>
<div class="found-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>



    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', 'image', 'cat_id', 'cat_1', 'cat_2', 'cat_3', 'user_id', 'date', 'status_m', 'status_f', 'description:ntext']]);
?>

    <?php 
$posts = Found::find()->where(['title' => $model->title])->andWhere('id != :id', ['id' => $model->id])->limit(10)->asArray()->all();
if ($posts) {
    foreach ($posts as $post) {
        ?>
            <a href="<?php 
        echo $url = Url::to(['found/view', 'id' => $post['id']]);
        ?>
"><?php 
        echo $post['title'];
        ?>
</a>
        <?php 
    }
}
?>
    
Beispiel #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFounds()
 {
     return $this->hasMany(Found::className(), ['cat_id' => 'id']);
 }