public function actionIndex()
 {
     $modelRelation = 'Cats-Items';
     $model_name = 'Cats';
     $appUrl = '/backend/';
     $cats = Cats::find()->all();
     return $this->render('index', ['model_name' => $model_name, 'appUrl' => $appUrl, 'cats' => $cats, 'optionsList' => $this->actionCommonOptionsList($modelRelation)]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cats::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, 'parent_id' => $this->parent_id]);
     $query->andFilterWhere(['like', 'title_az', $this->title_az])->andFilterWhere(['like', 'title_ru-RU', $this->title_ru - RU])->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
 public function actionList($id)
 {
     $countCats = Cats::find()->where(['parent_id' => $id])->count();
     $cats = Cats::find()->where(['parent_id' => $id])->all();
     if ($countCats > 0) {
         echo "<option></option>";
         foreach ($cats as $cat) {
             echo "<option value='" . $cat->id . "'>" . $cat->title_az . "</option>";
         }
     } else {
         echo "<option></option>";
     }
 }
Exemplo n.º 4
0
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use common\models\Cats;
/* @var $this yii\web\View */
/* @var $model common\models\Cats */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="cats-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'parent_id')->dropDownList(ArrayHelper::map(Cats::find()->all(), 'id', 'title_az'), ['prompt' => 'Select category']);
?>

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

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

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

    <?php 
Exemplo n.º 5
0
<div class="content">
	<!-- Staff Slider-->
	<div class="container">
		<a href="#" class="next-staff"></a>
		<a href="#" class="prev-staff"></a>

		<div class="staff-slider" data-snap-ignore="true">

			<?php 
$premiums = Lost::find()->where(['status_p' => 1])->all();
foreach ($premiums as $premium) {
    $user = User::findOne(['id' => $premium['user_id']]);
    $category = Cats::findOne(['id' => $premium['cat_id']]);
    $category1 = Cats::findOne(['id' => $premium['cat_1']]);
    $category2 = Cats::findOne(['id' => $premium['cat_2']]);
    $category3 = Cats::findOne(['id' => $premium['cat_3']]);
    ?>

				<div>
                                    
                                    <a href="#popup" class="lost follow" lost_id="<?php 
    echo $premium['id'];
    ?>
" elan_type="lost" >
                                        <span class="premium-span">
                                            <i id="premium-span-icon" class="fa fa-eye fa-4x" style="color:white;"></i>
                                        </span>
                                        <div class="staff-item">
						<?php 
    if ($premium['image']) {
        ?>
Exemplo n.º 6
0
                <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">
                    <?php 
    } else {
        ?>
                        <img src="/newtemp/images/pictures/3s.jpg" alt="img">
                    <?php 
    }
Exemplo n.º 7
0
        <div id="preloader">
            <div id="status">
                <p class="center-text">
    
                    <//?= Yii::t('yii','Loading...') ?>
                    <em><//?= Yii::t('yii','Please Wait')?></em>
                </p>
            </div>
        </div>

        <div class="menu-wrapper">
            
            <div class="menu">
            <?php 
$cats = Cats::find()->where('position IS NOT NULL')->andWhere('position NOT IN (0)')->orderBy('position')->all();
var_dump($cats);
foreach ($cats as $cat) {
    ?>
                <a href="<?php 
    echo '/cats/' . $cat['id'];
    ?>
" class="item" id="selected">
                    <img src="/<?php 
    echo $cat['image'];
    ?>
" alt="img">
                    <?php 
    echo $cat['title_en'];
    ?>
                </a>
Exemplo n.º 8
0
 /**
  * Finds the Cats model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Cats the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cats::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 9
0
										$("#lost-cat_3").fadeIn("slow");
                                        $.get( "/lost/list/' . '"+$(this).val(), function( data ) {
                                        		if(data == 0){
                                            		$("#lost-cat_3").parents(".select").hide();
                                            	}
                                            	else {
                                            		$( "select#lost-cat_3" ).html( data );
                                            	}

                                        });'])->label(false);
?>
                            
                        </div>
                        <div class="select">
                            <?php 
echo $form->field($model, 'cat_3')->dropDownList(ArrayHelper::map(Cats::find()->all(), 'id', 'title_az'), ['prompt' => '', 'onchange' => '
                                    	$("#lost-cat_id").parents(".select").fadeIn("slow");
                                        $.get( "/lost/list/' . '"+$(this).val(), function( data ) {
                                            if(data == 0){
												$("#lost-cat_id").parents(".select").hide();
											}
											else {
												$( "select#lost-cat_id" ).html( data );
											}

                                        });'])->label(false);
?>
                        
                        </div>
                        
                        </div>
Exemplo n.º 10
0
                                        	$("#lost-cat_2").fadeIn("slow");
                                            $.get( "/elan/list/' . '"+$(this).val(), function( data ) {
                                            	if(data == 0){
                                            		$("#lost-cat_2").parents(".select").hide();
                                            	}
                                            	else {
                                            		$( "select#lost-cat_2" ).html( data );
                                            	}

                                            });'])->label(false);
?>
                            
                        </div>
                            <div class="select">
                            <?php 
echo $form->field($model, 'cat_2')->dropDownList(ArrayHelper::map(Cats::find()->all(), 'id', 'title_az'))->label(false);
?>
                            
                        </div>

                        
                        </div>
                        </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">
          <?php 
Exemplo n.º 11
0
					</div>
                            <?php 
ActiveForm::end();
?>
				
			</div>
		</section>
	</div>
                
                <div id="cats" class="container">
                    <div style="text-align: center;">
                        <div  class="row" style="margin: auto;">
                            
                          
            <?php 
$cats = Cats::find()->where('parent_id IS NULL')->orderBy('divClass')->all();
foreach ($cats as $cat) {
    ?>
                    <a class="cat-link" href="<?php 
    echo $cat['id'];
    ?>
">
                        <div class="<?php 
    echo $cat['divClass'];
    ?>
">
                                
                                    <div><?php 
    echo $cat['title_en'];
    ?>
</div>
Exemplo n.º 12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCats()
 {
     return $this->hasMany(Cats::className(), ['parent_id' => 'id']);
 }
Exemplo n.º 13
0
 public function getCat3()
 {
     return $this->hasOne(Cats::className(), ['id' => 'cat_3']);
 }
Exemplo n.º 14
0
                <div class="decoration2"></div>

            <?php 
}
?>
        </div>

        <div class="one-third-responsive last-column">
            <?php 
$losts = Lost::find()->where(['status_m' => 'active'])->limit(4)->offset(8)->all();
foreach ($losts as $lost) {
    $user = User::findOne(['id' => $lost['user_id']]);
    $category = Cats::findOne(['id' => $lost['cat_id']]);
    $category1 = Cats::findOne(['id' => $lost['cat_1']]);
    $category2 = Cats::findOne(['id' => $lost['cat_2']]);
    $category3 = Cats::findOne(['id' => $lost['cat_3']]);
    ?>
                <p class="user-list-follow">
                    <?php 
    if ($lost['image']) {
        ?>
                        <img src="/admin/<?php 
        echo $lost['image'];
        ?>
" alt="img">
                    <?php 
    } else {
        ?>
                        <img src="/newtemp/images/pictures/3s.jpg" alt="img">
                    <?php 
    }