Beispiel #1
0
 public function getModelName()
 {
     $models = AppManager::getModels();
     if (isset($models[$this->model_id])) {
         return call_user_func(array($this->model_id, 'name'));
     } else {
         return '<span style="color:red">не существует</span>';
     }
 }
Beispiel #2
0
<?php

if ($this->model->isNewRecord) {
    $items = array();
} else {
    $model = $this->model->model_id;
    $items = array();
    $objects = $model::model()->findAll();
    foreach ($objects as $i => $object) {
        $items[$object->id] = (string) $object;
    }
}
return array('activeForm' => array('id' => 'meta-tag-form'), 'elements' => array('model_id' => array('type' => 'dropdownlist', 'items' => AppManager::getModels(array('meta_tags' => true)), 'prompt' => 'не выбрана', 'disabled' => $this->model->isNewRecord ? false : true), 'object_id' => array('type' => 'dropdownlist', 'label' => 'Объект', 'items' => $items, 'disabled' => $this->model->isNewRecord ? false : true), 'title' => array('type' => 'text'), 'description' => array('type' => 'text'), 'keywords' => array('type' => 'text')), 'buttons' => array('submit' => array('type' => 'submit', 'value' => $this->model->isNewRecord ? 'создать' : 'сохранить', 'id' => 'meta_tag_submit')));
Beispiel #3
0
<?php

Yii::app()->clientScript->registerScript('crud-form', '
    $("#crud-form").after("<div id=\'files_div\'><div>");

    $("#Crud_model").change(function() {
        var model = $(this).val();

        if (model) {
            $("#files_div").load("/codegen/crudAdmin/getFiles/model/" + model);
        }
        else {
            $("#files_div").html("");
        }
    });
    ', CClientScript::POS_READY);
return array('activeForm' => array('id' => 'crud-form', 'enableAjaxValidation' => false, 'clientOptions' => array('validateOnSubmit' => false)), 'elements' => array('class' => array('type' => 'dropdownlist', 'items' => AppManager::getModels(), 'empty' => 'не выбрано', 'label' => 'Модель'), 'genetive' => array('type' => 'text', 'label' => 'Добавление кого?, чего?'), 'instrumental' => array('type' => 'text', 'label' => 'Управление кем?, чем?'), 'accusative' => array('type' => 'text', 'label' => 'Создать кого?, что?')), 'buttons' => array('submit' => array('type' => 'submit', 'value' => t('Создать'))));
Beispiel #4
0
<?php

return array('activeForm' => array('id' => 'form-form'), 'elements' => array('model' => array('type' => 'dropdownlist', 'items' => AppManager::getModels())), 'buttons' => array('submit' => array('type' => 'submit', 'value' => t('Создать'))));