Exemple #1
0
 public function rules()
 {
     $rules = array(array('title, page, text', 'filter', 'filter' => 'trim'), array('title, page, text', 'required'), array('status', 'numerical', 'integerOnly' => TRUE), array('page, title, seo_title, seo_description, seo_keywords', 'length', 'max' => 255), array('page, title', 'length', 'min' => 4), array('text', 'length', 'min' => 15), array('page', 'unique', 'criteria' => array('condition' => 'lang = :lang', 'params' => array('lang' => $this->lang)), 'message' => Yii::t('main', 'Страница уже существует.')), array('page', 'match', 'pattern' => '#^([' . self::PAGE_PATTERN . ']+)$#', 'message' => Yii::t('main', 'В поле «{attribute}» можно ввести следующие символы ":chars".', array(':chars' => self::PAGE_PATTERN))), array('status', 'in', 'range' => array_keys(parent::getStatusList())), array('id, page, title, status', 'safe', 'on' => 'search'));
     if (isMultiLang()) {
         $rules[] = array('lang', 'filter', 'filter' => 'trim');
         $rules[] = array('lang', 'required');
         $rules[] = array('lang', 'in', 'range' => array_keys(app()->params['languages']));
     }
     return $rules;
 }
Exemple #2
0
 /**
  * @return array validation rules for model attributes.
  */
 public function rules()
 {
     $rules = array(array('title, description, text, seo_title, seo_description, seo_keywords, status', 'filter', 'filter' => 'trim'), array('title, description, text, status', 'required'), array('status', 'numerical', 'integerOnly' => TRUE), array('title, seo_title, seo_keywords, seo_description', 'length', 'max' => 255), array('description, text', 'length', 'min' => 15), array('title', 'length', 'min' => 4), array('img', 'file', 'types' => 'jpg,jpeg,png', 'allowEmpty' => TRUE), array('status', 'in', 'range' => array_keys(parent::getStatusList())), array('id, title, status', 'safe', 'on' => 'search'));
     if (isMultiLang()) {
         $rules[] = array('lang', 'filter', 'filter' => 'trim');
         $rules[] = array('lang', 'required');
         $rules[] = array('lang', 'in', 'range' => array_keys(app()->params['languages']));
     }
     return $rules;
 }
Exemple #3
0
        echo e($row->title);
        ?>
</td>
                        <td><span class="label <?php 
        echo $row->isStatusOn() ? 'label-success' : 'label-default';
        ?>
"><?php 
        echo $row->getStatus();
        ?>
</span></td>
                        <td><?php 
        echo $row->getCreatedAt();
        ?>
</td>
                        <td><?php 
        echo isMultiLang() ? $row->getLangText() : '-';
        ?>
</td>
                        <td>
                            <ul class="actions list-unstyled">
                                <li><?php 
        echo HTML::link('', array('/backend/' . $this->getId() . '/form', 'id' => $row->id), array('class' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('backend', 'Редактировать'), 'rel' => 'tooltip'));
        ?>
</li>
                                <li><?php 
        echo HTML::link('', array('/backend/' . $this->getId() . '/allow', 'id' => $row->id), array('class' => $row->isStatusOn() ? 'glyphicon glyphicon-eye-close' : 'glyphicon glyphicon-eye-open', 'title' => $row->isStatusOn() ? Yii::t('backend', 'Выключить') : Yii::t('backend', 'Включить'), 'rel' => 'tooltip'));
        ?>
</li>
                                <li><?php 
        echo HTML::link('', array('/backend/' . $this->getId() . '/del', 'id' => $row->id), array('class' => 'glyphicon glyphicon-remove', 'title' => Yii::t('backend', 'Удалить'), 'rel' => 'tooltip'));
        ?>
Exemple #4
0
echo $form->textField($model, 'page', array('placeholder' => $model->getAttributeLabel('page'), 'class' => 'form-control'));
?>
        </div>
    </div>
    <div class="form-group">
        <?php 
echo $form->labelEx($model, 'text', array('class' => 'col-lg-3 control-label'));
?>
        <div class="col-lg-9">
            <?php 
echo $form->textArea($model, 'text', array('placeholder' => $model->getAttributeLabel('text'), 'class' => 'form-control'));
?>
        </div>
    </div>
    <?php 
if (isMultiLang()) {
    ?>
        <div class="form-group">
            <?php 
    echo $form->labelEx($model, 'lang', array('class' => 'col-lg-3 control-label'));
    ?>
            <div class="col-lg-9">
                <?php 
    echo $form->dropDownList($model, 'lang', app()->params['languages'], array('class' => 'form-control'));
    ?>
            </div>
        </div>
    <?php 
}
?>
    <div class="form-group">