Example #1
0
 /**
  * Registers entity types.
  */
 public function registerEntityTypes()
 {
     /** @var \im\base\types\EntityTypesRegister $typesRegister */
     $typesRegister = Yii::$app->get('typesRegister');
     $typesRegister->registerEntityType(new EntityType('terms_facet', 'im\\search\\models\\TermsFacet', 'facets', Module::t('facet', 'Terms facet')));
     $typesRegister->registerEntityType(new EntityType('range_facet', 'im\\search\\models\\RangeFacet', 'facets', Module::t('facet', 'Range facet')));
     $typesRegister->registerEntityType(new EntityType('interval_facet', 'im\\search\\models\\IntervalFacet', 'facets', Module::t('facet', 'Interval facet')));
     $typesRegister->registerEntityType(new EntityType('facet_term', 'im\\search\\models\\FacetTerm', 'facet_values', Module::t('facet', 'Term')));
     $typesRegister->registerEntityType(new EntityType('facet_range', 'im\\search\\models\\FacetRange', 'facet_values', Module::t('facet', 'Range')));
 }
Example #2
0
<?php

use im\search\Module;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel im\search\models\FacetSet */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('facetSet', 'Facet sets');
$this->params['subtitle'] = Module::t('facetSet', 'Facet sets list');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box">
    <div class="box-header with-border">
        <h3 class="box-title"><?php 
echo $this->params['subtitle'];
?>
</h3>
        <div class="box-tools pull-right">
            <?php 
echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default']);
?>
        </div>
    </div>

    <div class="box-body">
        <?php 
Pjax::begin();
?>
        <?php 
Example #3
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model im\search\models\FacetSet */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="index-form">

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

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

    <?php 
echo $form->field($model, 'facets')->widget(Select2::classname(), ['data' => ArrayHelper::map(Facet::find()->asArray()->orderBy('name')->all(), 'id', 'name'), 'options' => ['multiple' => true]]);
?>

    <?php 
echo Html::submitButton($model->isNewRecord ? Module::t('module', 'Create') : Module::t('module', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-success']);
?>

    <?php 
ActiveForm::end();
?>

</div>
Example #4
0
<?php

use im\search\Module;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model im\search\models\Index */
$this->title = Module::t('index', 'Indexes');
$this->params['subtitle'] = Module::t('index', 'Index creation');
$this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']];
?>
<div class="box box-primary">
    <div class="box-header with-border">
        <h3 class="box-title"><?php 
echo $this->params['subtitle'];
?>
</h3>
        <div class="box-tools pull-right">
            <?php 
echo Html::a('<i class="fa fa-reply"></i>', ['index'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Cancel')]);
?>
        </div>
    </div>
    <div class="box-body">
        <?php 
echo $this->render('_form', ['model' => $model]);
?>
    </div>
</div>
Example #5
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['term' => Module::t('facet-value', 'Term')]);
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function getCMSDescription()
 {
     return Module::t('module', 'Widget for displaying search facets');
 }
Example #7
0
 /**
  * Returns array of facet operators
  * @return array
  */
 public static function getOperatorsList()
 {
     return [self::OPERATOR_OR => Module::t('facet', 'OR'), self::OPERATOR_AND => Module::t('facet', 'AND')];
 }
Example #8
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('facet-value', 'ID'), 'facet_id' => Module::t('facet-value', 'Facet ID'), 'display' => Module::t('facet-value', 'Display'), 'sort' => Module::t('facet-value', 'Sort')];
 }
Example #9
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('indexAttribute', 'ID'), 'name' => Module::t('indexAttribute', 'Name'), 'index_name' => Module::t('indexAttribute', 'Name in index'), 'type' => Module::t('indexAttribute', 'Type'), 'index_type' => Module::t('indexAttribute', 'Index type'), 'label' => Module::t('indexAttribute', 'Label'), 'indexable' => Module::t('indexAttribute', 'Indexable')];
 }
Example #10
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['lower_bound' => Module::t('facet-value', 'Lower bound'), 'upper_bound' => Module::t('facet-value', 'Upper bound'), 'include_lower_bound' => Module::t('facet-value', 'Include lower bound'), 'include_upper_bound' => Module::t('facet-value', 'Include upper bound')]);
 }
Example #11
0
 /**
  * Deletes an existing Index model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     Yii::$app->session->setFlash('success', Module::t('index', 'Index has been successfully deleted.'));
     return $this->redirect(['index']);
 }
Example #12
0
 /**
  * Returns value types list.
  *
  * @return array
  */
 public static function getTypesList()
 {
     return ['string' => Module::t('indexAttribute', 'String'), 'int' => Module::t('indexAttribute', 'Integer'), 'float' => Module::t('indexAttribute', 'Floating point number'), 'bool' => Module::t('indexAttribute', 'Boolean')];
 }
Example #13
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box">
    <div class="box-header with-border">
        <h3 class="box-title"><?php 
echo $this->params['subtitle'];
?>
</h3>
        <div class="box-tools pull-right">
            <?php 
echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default']);
?>
        </div>
    </div>

    <div class="box-body">
        <?php 
Pjax::begin();
?>
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['name', 'status', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {attributes} {delete}', 'buttons' => ['attributes' => function ($url) {
    $options = ['title' => Module::t('index', 'Attributes'), 'aria-label' => Module::t('index', 'Attributes'), 'data-pjax' => '0'];
    return Html::a('<span class="glyphicon glyphicon-cog"></span>', $url, $options);
}]]]]);
?>
        <?php 
Pjax::end();
?>
    </div>
</div>
Example #14
0
 /**
  * Returns statuses list.
  *
  * @return array
  */
 public static function getStatusesList()
 {
     return [self::STATUS_ENABLED => Module::t('index', 'Enabled'), self::STATUS_DISABLED => Module::t('index', 'Disabled')];
 }
Example #15
0
/* @var $this yii\web\View */
/* @var $model im\search\models\Index */
$this->title = Module::t('index', 'Indexes');
$this->params['subtitle'] = Module::t('index', 'Index updating');
$this->params['breadcrumbs'] = [['label' => $this->title, 'url' => ['index']], $this->params['subtitle']];
?>
<div class="box box-success">
    <div class="box-header with-border">
        <h3 class="box-title"><?php 
echo $this->params['subtitle'];
?>
</h3>
        <div class="box-tools pull-right">
            <?php 
echo Html::a('<i class="fa fa-reply"></i>', ['index'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Cancel')]);
?>
            <?php 
echo Html::a('<i class="fa fa-plus"></i>', ['create'], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Create')]);
?>
            <?php 
echo Html::a('<i class="fa fa-trash-o"></i>', ['delete', 'id' => $model->id], ['class' => 'btn btn-sm btn-default', 'title' => Module::t('module', 'Delete'), 'data-confirm' => Module::t('module', 'Are you sure you want to delete this item?'), 'data-method' => 'delete']);
?>
        </div>
    </div>
    <div class="box-body">
        <?php 
echo $this->render('_form', ['model' => $model]);
?>
    </div>
</div>
Example #16
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('facetSet', 'ID'), 'name' => Module::t('facetSet', 'Name')];
 }