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)]);
 }
Esempio 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>";
     }
 }
Esempio 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 
        <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>
Esempio n. 6
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>
Esempio n. 7
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 
Esempio n. 8
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>