예제 #1
0
 /**
  * Displays homepage.
  *
  * @return mixed
  */
 public function actionIndex()
 {
     $query = Content::find()->where(['=', 'section_id', 2])->andWhere(['=', '`contentmanager_content`.`lang_id`', Lang::getCurrent()->id])->orderBy('date DESC');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 3]);
     $models = $query->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('index', ['models' => $models, 'pages' => $pages]);
     return $this->render('index');
 }
예제 #2
0
 /**
  * @param string $slug
  * @return mixed
  */
 public function actionSlugrubric($slug)
 {
     $rubric = ContentRubrics::find()->where(['=', 'slug', $slug])->andWhere(['=', 'section_id', 7])->one();
     if (!isset($rubric->id)) {
         return $this->redirect('/methods');
     }
     $query = Content::find()->where(['=', 'section_id', 7])->andWhere(['=', '`contentmanager_content`.`lang_id`', Lang::getCurrent()->id])->andWhere(['=', 'published', true])->andWhere(['=', 'rubric_id', $rubric->id])->orderBy('date DESC');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 3]);
     $models = $query->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('rubric', ['models' => $models, 'pages' => $pages, 'rubric' => $rubric, 'rubrics' => ContentRubrics::findBySection(7)]);
 }
예제 #3
0
 public function getLangUrl()
 {
     if ($this->_lang_url === null) {
         $this->_lang_url = $this->getUrl();
         $url_list = explode('/', $this->_lang_url);
         $lang_url = isset($url_list[1]) ? $url_list[1] : null;
         Lang::setCurrent($lang_url);
         if ($lang_url !== null && $lang_url === Lang::getCurrent()->url && strpos($this->_lang_url, Lang::getCurrent()->url) === 1) {
             $this->_lang_url = substr($this->_lang_url, strlen(Lang::getCurrent()->url) + 1);
         }
     }
     return $this->_lang_url;
 }
예제 #4
0
 public function createUrl($params)
 {
     if (isset($params['lang_id'])) {
         //Если указан идентификатор языка, то делаем попытку найти язык в БД,
         //иначе работаем с языком по умолчанию
         $lang = Lang::findOne($params['lang_id']);
         if ($lang === null) {
             $lang = Lang::getDefaultLang();
         }
         unset($params['lang_id']);
     } else {
         //Если не указан параметр языка, то работаем с текущим языком
         $lang = Lang::getCurrent();
     }
     //Получаем сформированный URL(без префикса идентификатора языка)
     $url = parent::createUrl($params);
     //Добавляем к URL префикс - буквенный идентификатор языка
     if ($url == '/') {
         return '/' . $lang->url;
     } else {
         return '/' . $lang->url . $url;
     }
 }
예제 #5
0
?>

    <?php 
echo $form->field($model, 'SystemTags')->widget(Select2::class, ['data' => $tags->getByType(1, 1), 'language' => 'en', 'options' => ['multiple' => true, 'placeholder' => 'tags for locate item on page template'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <div class="form-group row">
        <div class="col-lg-2 small"><?php 
echo Yii::t('main', 'Date');
?>
</div>
        <?php 
echo $form->field($model, 'date', ['template' => '<div class="col-lg-5">{input}</div>', 'options' => ['class' => 'inline']])->widget(DateTimePicker::class);
?>
        <?php 
echo $form->field($model, 'lang_id', ['template' => '<div class="col-lg-5">{input}</div>', 'options' => ['class' => 'inline']])->dropDownList(Lang::selector());
?>
    </div>

    <div class="form-group row">
        <div class="col-lg-2 small text-left"><?php 
echo Yii::t('main', 'Publication');
?>
</div>
        <?php 
echo $form->field($model, 'publication_date', ['template' => '<div class="col-lg-5">{input}</div>', 'options' => ['class' => 'inline']])->widget(DateTimePicker::class);
?>
        <?php 
echo $form->field($model, 'published', ['template' => '<div class="col-lg-5">{input}</div>', 'options' => ['class' => 'inline']])->checkbox();
?>
    </div>
예제 #6
0
 /**
  * @param null $nullOption
  * @return array
  */
 public static function selector($nullOption = null)
 {
     $out = Lang::find()->select('name')->indexBy('id')->column();
     if ($nullOption) {
         $out = $nullOption + $out;
     }
     return $out;
 }
예제 #7
0
        </div>
    </div>
    <?php 
echo $form->field($model, 'slider_id', ['template' => '{input}'])->hiddenInput();
?>

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

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

    <?php 
echo $form->field($model, 'lang_id')->dropDownList(Lang::selector());
?>

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

    <?php 
echo $form->field($model, 'image')->widget(FileInput::className(), ['buttonTag' => 'button', 'buttonName' => 'Browse', 'buttonOptions' => ['class' => 'btn btn-default'], 'options' => ['class' => 'form-control'], 'template' => '<div class="input-group">{input}<span class="input-group-btn">{button}</span></div>', 'thumb' => 'original', 'imageContainer' => '.image_preview', 'pasteData' => FileInput::DATA_URL, 'callbackBeforeInsert' => 'function(e, data) {
        console.log( data );
    }']);
?>
    <?php 
//    $form->field($model, 'image')->textInput(['maxlength' => true])
?>
예제 #8
0
 public function run()
 {
     return $this->render('lang/view', ['current' => Lang::getCurrent(), 'langs' => Lang::find()->all()]);
 }
예제 #9
0
<?php

use ut8ia\multylang\models\Lang;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model ut8ia\contentmodule\models\Content */
$this->title = Yii::t('app', 'Create Content');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Content'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
// lang id to current
$model->lang_id = Lang::getCurrent()->id;
?>
<div class="content-create">

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
예제 #10
0
파일: index.php 프로젝트: ut8ia/iwet
<?php

/* @var $this yii\web\View */
use ut8ia\multylang\models\Lang;
$lang_url = Lang::getCurrent()->url;
$this->title = 'I-Wet : Health at net';
?>
<!--<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d657525.7109506081!2d32.40240907432744!3d49.92771297065197!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sru!2sua!4v1449233967344" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>-->

<div class="container">

    <!-- Page Heading/Breadcrumbs -->
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">Places
                <small>of clear water</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="index.html">Home</a>
                </li>
                <li class="active">find or checkout places with good water or equipment</li>
            </ol>
        </div>
    </div>
    <!-- /.row -->

    <!-- Content Row -->
    <div class="row">
        <!-- Map Column -->
        <div class="col-md-8">
            <!-- Embedded Google Map -->
예제 #11
0
 /**
  * tags collection for the content
  * @return array
  */
 public function collection()
 {
     return Content::find()->asArray()->with('tags')->where(['=', '`contentmanager_content`.`lang_id`', Lang::getCurrent()->id])->all();
 }