示例#1
0
文件: Base.php 项目: ivphpan/iris
 public function save($validation = false, $attributes = [])
 {
     SettingsRecord::deleteAll(['categoryAlias' => $this->category]);
     foreach ($this->fields() as $key) {
         $model = new SettingsRecord();
         $model->categoryAlias = $this->category;
         $model->alias = $key;
         $model->content = $this->{$key};
         $model->save();
     }
     return true;
 }
示例#2
0
文件: Facebook.php 项目: ivphpan/iris
 public function summary()
 {
     return [['property' => 'og:type', 'content' => SettingsRecord::get($this->category, 'type')], ['property' => 'profile:first_name', 'content' => SettingsRecord::get($this->category, 'first_name')], ['property' => 'profile:last_name', 'content' => SettingsRecord::get($this->category, 'last_name')], ['property' => 'og:title', 'content' => SettingsRecord::get($this->category, 'title')], ['property' => 'og:description', 'content' => SettingsRecord::get($this->category, 'description')], ['property' => 'og:url', 'content' => SettingsRecord::get($this->category, 'url')], ['property' => 'og:site_name', 'content' => SettingsRecord::get($this->category, 'site_name')], ['property' => 'og:see_also', 'content' => SettingsRecord::get($this->category, 'see_also')], ['property' => 'fb:admins', 'content' => SettingsRecord::get($this->category, 'admins')]];
 }
示例#3
0
文件: index.php 项目: ivphpan/iris
        <div class="panel panel-default">
            <div class="panel-heading"><?php 
    echo $model->classTitle;
    ?>
</div>
            <div class="panel-body">
                <?php 
    $form = ActiveForm::begin(['action' => ['index', 'className' => $model->className()]]);
    ?>

                <?php 
    foreach ($model->fields() as $k) {
        ?>
                    <?php 
        echo $form->field($model, $k)->textInput(['value' => Settings::get($model->category, $k)]);
        ?>
                <?php 
    }
    ?>
                <?php 
    echo \yii\bootstrap\Html::submitButton('Сохранить', ['class' => 'btn btn-success']);
    ?>
                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>
    </div>
    <?php 
}