Ejemplo n.º 1
0
                    <input type='hidden' name="format[]" class="book-format">

                    <div class="progress">
                        <div class="progress-bar" role="progressbar" style="width: 0%;">
                            0%
                        </div>
                    </div>
                    <button type="button" class="btn btn-default delete-file">Delete</button>
                </div>
                <div class="col-lg-4 row">
                    <div class="col-lg-7">
                        <select class="selectpicker format form-control"
                                data-live-search="true">
                            <option class="hide empty" selected value="">--</option>
                            <?php 
$rows = Format::find()->all();
?>
                            <?php 
foreach ($rows as $row) {
    ?>
                                <option value="<?php 
    echo $row->id;
    ?>
">
                                    <?php 
    echo $row->name;
    ?>
                                </option>
                            <?php 
}
?>
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['title', 'categoryId', 'languageId', 'publisherId'], 'required'], [['description'], 'string', 'max' => 2000], [['title'], 'string', 'max' => 255], [['ISBN'], 'string', 'max' => 45], [['publisherId', 'pages', 'categoryId', 'languageId', 'year'], 'integer'], ['year', 'number', 'max' => 9999, 'min' => 1], ['raiting', 'number', 'max' => 5, 'min' => 1], ['imageFile', 'file', 'extensions' => 'jpeg, jpg, png', 'maxSize' => 2 * pow(10, 6)], ['bookFile', 'file', 'extensions' => array_column(Format::find()->asArray()->all(), 'name'), 'maxSize' => 150 * pow(10, 6)], ['publisherId', 'exist', 'targetClass' => 'app\\models\\Publisher', 'targetAttribute' => 'id'], ['categoryId', 'exist', 'targetClass' => 'app\\models\\Category', 'targetAttribute' => 'id'], ['languageId', 'exist', 'targetClass' => 'app\\models\\Language', 'targetAttribute' => 'id'], ['tags', 'exist', 'targetClass' => 'app\\models\\Tag', 'targetAttribute' => 'id', 'allowArray' => true], ['authors', 'exist', 'targetClass' => 'app\\models\\Author', 'targetAttribute' => 'id', 'allowArray' => true], ['formats', 'exist', 'targetClass' => 'app\\models\\Format', 'targetAttribute' => 'id', 'allowArray' => true]];
 }