Exemplo n.º 1
0
 public function fillModel(Model $model)
 {
     $r = parent::fillModel($model);
     if (substr($this->controller->action, 0, 4) == 'edit' && !$this->submitted()) {
         $this->password->value('');
     }
     return $r;
 }
Exemplo n.º 2
0
 public function actionAdmin()
 {
     $model = new AdminForm();
     $frequency = KeyValue::model()->findByPk('newsletter_frequency');
     $model->frequency = abs($frequency->value);
     if (isset($_POST['AdminForm'])) {
         $model->attributes = $_POST['AdminForm'];
         if ($model->validate()) {
             if (isset($_POST['yt1']) || $frequency->value < 0) {
                 $frequency->value = -$model->frequency;
             } else {
                 $frequency->value = $model->frequency;
             }
             $frequency->save();
             $this->redirect('admin');
         }
     }
     $newsletter = new Newsletter();
     $this->render('admin', array('newsletter' => $newsletter->make(), 'model' => $model));
 }
Exemplo n.º 3
0
 public function toModel(Model $model, $fields = null, $ignore = null)
 {
     $model->Permissions = array();
     if (!empty($this->controller->request->data['permission_id'])) {
         $permissionIds = $this->controller->request->data['permission_id'];
         foreach ($permissionIds as $permissionId) {
             $model->Permissions[] = new Permission($permissionId);
         }
     }
     return parent::toModel($model, $fields, $ignore);
 }
Exemplo n.º 4
0
 public function fillModel(Model $model)
 {
     parent::fillModel($model);
     if (!$this->submitted() && $model instanceof Node) {
         if ($this->hasField('allowComments')) {
             $this->allowComments->checked($model->hasFlag(NodeFlag::ALLOW_COMMENTS));
         }
         if ($this->hasField('allowRSS')) {
             $this->allowRSS->checked($model->hasFlag(NodeFlag::ALLOW_RSS));
         }
         if ($this->hasField('user_id')) {
             $this->user_id->value($model->get('user_id'));
         }
     }
 }
Exemplo n.º 5
0
 public function fillModel(Model $model)
 {
     parent::fillModel($model);
     if (!$this->submitted() && $model) {
         $this->allowComments->checked($model->hasFlag(BlogPostFlag::ALLOW_COMMENTS));
         $this->sticky->checked($model->hasFlag(BlogPostFlag::STICKY));
         // tags
         if (!empty($model->Tags)) {
             $tags = new IndexedArray();
             foreach ($model->Tags as $Tag) {
                 $tags[] = $Tag->get('name');
             }
             $this->tags->value($tags->implode(' '));
         }
     }
 }
Exemplo n.º 6
0
 public function init()
 {
     $methodVar = $this->getMethodVar();
     $filterId = $this->getFilterId();
     $filterVar = 'filter_' . $filterId;
     if (isset($methodVar['resetFilter_' . $filterId . ''])) {
         Yii::app()->session->remove($filterVar);
         unset($_GET['resetFilter_' . $filterId . '']);
         foreach ($this->getModel() as $key => $value) {
             if (isset($_GET[get_class($value)])) {
                 unset($_GET[get_class($value)]);
             }
         }
         $str = Yii::app()->request->getBaseUrl() . '/' . Yii::app()->request->getPathInfo() . '?' . http_build_query($_GET);
         Yii::app()->request->redirect($str);
         Yii::app()->end();
     }
     $filterData = array();
     if (isset($methodVar[$filterVar])) {
         if ($this->storeInSession) {
             Yii::app()->session->add($filterVar, serialize($methodVar));
         }
         $filterData = $methodVar;
     } else {
         /** @var $session CHttpSession */
         $session = Yii::app()->session;
         if ($this->storeInSession && !isset($methodVar['resetFilter_' . $filterId]) && $session[$filterVar]) {
             $filterData = unserialize($session[$filterVar]);
         }
     }
     if (isset($filterData) && $filterData) {
         $this->loadFilterDataToModel($filterData);
     }
     parent::init();
     echo CHtml::hiddenField($filterVar, true);
     $this->registerScripts();
 }
Exemplo n.º 7
0
 public function addAction()
 {
     $form = new AdminForm();
     $form->get('submit')->setValue('Add');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $Admin = new Admin();
         $form->setInputFilter($Admin->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $Admin->exchangeArray($form->getData());
             $this->getAdminTable()->saveAdmin($Admin);
             // Redirect to list of Admins
             return $this->redirect()->toRoute('Hwi');
         }
     }
     return array('form' => $form);
 }
Exemplo n.º 8
0
 public function startUp()
 {
     $this->config = array('Language' => array('fields' => array('id', 'status' => array('type' => 'DropDown', 'options' => Status::$list), 'name', 'locale')), array('type' => 'submit', 'value' => __('Speichern')));
     return parent::startUp();
 }
Exemplo n.º 9
0
session_start();
if (!empty($_SESSION['email'])) {
    //this prevents bypassing
    $form;
    // declare a global variable for the object to access the tables
    //if user is farmer use farmers table, landowners and admins if landowner or administrator
    if ($_SESSION['type'] == "Farmer") {
        include "models/farmer_model.php";
        $form = new FarmerForm();
    } else {
        if ($_SESSION['type'] == "Landowner") {
            include "models/landowner_model.php";
            $form = new LandownerForm();
        } else {
            include "models/admin_model.php";
            $form = new AdminForm();
        }
    }
    $err = array('old_password' => '', 'new_password' => '', 'password_confirm' => '');
    $valid = true;
    if (!empty($_POST)) {
        //check of post operation is not empty. if a field is empty display message indicating the field is required
        foreach ($err as $key => $value) {
            if (empty($_POST[$key])) {
                $valid = false;
                $err[$key] = "This field is required";
            }
        }
    }
    if (isset($_POST['new_password']) && isset($_POST['password_confirm'])) {
        // check if the password and confirmation match, if not display message uponn post operation
Exemplo n.º 10
0
<?php

require_once $home_dir . 'models/category.m.php';
require_once $home_dir . 'models/alias.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('category');
$page = 'admin/form';
$form->add([['name' => 'category_name', 'label' => 'Name', 'type' => 'text'], ['name' => 'alias_url', 'label' => 'Alias', 'type' => 'text'], ['name' => 'category_parent_id', 'label' => 'Parent Category', 'type' => 'select', 'select_table' => 'categories', 'select_id_field' => 'category_id', 'select_label_field' => 'category_name']]);
if (isset($_POST['category_id'])) {
    $category = new Category($db, $_POST['category_id']);
    $category->setData($form->processInput($_POST));
    $category->data['category_parent_id'] = parseInt($category->val('category_parent_id'));
    $alias_url = $category->val('alias_url');
    unset($category->data['alias_url']);
    $category->save();
    $alias = new Alias($db, $category->ival('category_alias_id'));
    // save alias if new or changed
    if ($alias->val('alias_url') != $alias_url || !$alias->is_loaded) {
        $alias->data['alias_path'] = $category->getAliasPath();
        if (isset($alias_url) && strlen(trim($alias_url)) > 0) {
            $alias->setUrl($alias_url);
        } else {
            $alias->setUrl($category->getAliasUrl());
        }
        $alias->save();
    }
    // update category alias if changed
    if ($alias->ival('alias_id') != $category->ival('category_alias_id')) {
        $category->data['category_alias_id'] = $alias->ival('alias_id');
        $category->save();
    }
Exemplo n.º 11
0
<?php

require_once $home_dir . 'models/currency.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('currency');
$page = 'admin/form';
$form->add([['name' => 'currency_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]], ['name' => 'currency_format', 'label' => 'Format', 'type' => 'text', 'hint' => 'This specifies how prices will be displayed in this currency. Put token %s where you want amount to be.'], ['name' => 'currency_value', 'label' => 'Value', 'type' => 'text', 'hint' => 'Put value 1 for default currency.', 'validations' => [['type' => 'price'], ['type' => 'min', 'param' => 0]]], ['name' => 'currency_decimals', 'label' => 'Displayed decimals', 'type' => 'text', 'hint' => 'This specifies how many decimal places will be displayed for prices in this currency.', 'validations' => [['type' => 'integer']]]]);
Currency::process($db, $form);
Exemplo n.º 12
0
                            <div class="input-line">
                                <label><?php 
_e('New password');
?>
</label>
                                <div class="input">
                                    <?php 
AdminForm::password_text($admin);
?>
                                </div>
                                <?php 
if ($admin_edit) {
    ?>
                                    <div class="input">
                                        <?php 
    AdminForm::check_password_text($admin);
    ?>
                                        <p class="help-inline"><em><?php 
    _e('Type your new password again');
    ?>
</em></p>
                                    </div>
                                <?php 
}
?>
                            </div>
                            <div class="actions">
                                <input type="submit" value="<?php 
echo osc_esc_html($btn_text);
?>
" />
Exemplo n.º 13
0
<?php

require_once $home_dir . 'models/payment_type.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('payment_type');
$page = 'admin/form';
$form->add([['name' => 'payment_type_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]], ['name' => 'payment_type_price', 'label' => 'Price', 'type' => 'text', 'validations' => [['type' => 'price']]], ['name' => 'payment_type_min_order_cost', 'label' => 'Min. order cost', 'type' => 'text', 'validations' => [['type' => 'price']]], ['name' => 'payment_type_is_default', 'label' => 'Is Default', 'type' => 'bool']]);
PaymentType::process($db, $form);
Exemplo n.º 14
0
<?php

\Admin::model('App\\Product')->title('Products')->alias('products')->display(function () {
    $display = AdminDisplay::datatablesAsync();
    $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::string('publish')->label('Опубликован')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::icheckbox('active', 'Статус')->defaultValue(true), FormItem::text('rest', 'Остаток'), FormItem::text('price', 'Цена')], [FormItem::text('sort', 'сортировка'), FormItem::bsselect('user_id', 'Пользователь')->model('App\\User')->defaultValue(Sentinel::check()->id)->display('email'), FormItem::bsselect('catalog_id', 'Категоря')->model('App\\Catalog')->display('level_label')->disableSort()->required()]])], 'content' => [FormItem::markdown('content', 'Контент')], 'images' => [FormItem::images('gallery', 'Картинки')], 'files' => [FormItem::view('suroviy.soa_addon::admin.elfinder')]]);
    return $form;
});
Exemplo n.º 15
0
<?php

require_once $home_dir . 'models/alias.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('alias');
$page = 'admin/form';
$form->add([['name' => 'alias_url', 'label' => 'URL', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]], ['name' => 'alias_path', 'label' => 'Path', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]]]);
Alias::process($db, $form);
Exemplo n.º 16
0
<?php

require_once $home_dir . 'models/product.m.php';
require_once $home_dir . 'models/category.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('product');
$page = 'admin/form';
$form->add([['name' => 'product_ext_id', 'label' => 'ABX ID', 'type' => 'static'], ['name' => 'product_category_id', 'label' => 'Category', 'type' => 'select', 'select_table' => 'categories', 'select_data' => Category::getTreeForSelect($db), 'select_id_field' => 'category_id', 'select_label_field' => 'category_name'], ['name' => 'product_name', 'label' => 'Name', 'type' => 'text'], ['name' => 'product_price', 'label' => 'Price', 'type' => 'text', 'validations' => [['type' => 'price']]], ['name' => 'product_description', 'label' => 'Description', 'type' => 'static'], ['name' => 'product_image', 'label' => 'Image', 'type' => 'image']]);
Product::process($db, $form);
Exemplo n.º 17
0
<?php

require_once $home_dir . 'models/language.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('language');
$page = 'admin/form';
$form->add([['name' => 'language_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1], ['type' => 'maxlen', 'param' => 100]]], ['name' => 'language_code', 'label' => 'Code', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1], ['type' => 'maxlen', 'param' => 10]]], ['name' => 'language_decimal_separator', 'label' => 'Decimal Separator', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1], ['type' => 'maxlen', 'param' => 10]]], ['name' => 'language_thousands_separator', 'label' => 'Thousand Separator', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1], ['type' => 'maxlen', 'param' => 10]]], ['name' => 'language_default_currency_id', 'label' => 'Default Currency', 'type' => 'select', 'select_table' => 'currencies', 'select_id_field' => 'currency_id', 'select_label_field' => 'currency_name']]);
Language::process($db, $form);
Exemplo n.º 18
0
 public function startUp()
 {
     $this->config = array('NodeText' => array('fields' => array('headline' => array('label' => __('Überschrift'), 'mandatory' => false), 'subline' => array('label' => __('Unter-Überschrift'), 'mandatory' => false), 'text' => array('mandatory' => false, 'label' => __('Text/Beschreibung')), 'excerpt' => array('label' => __('Auszug/Zusammenfassung'), 'mandatory' => false), 'url' => array('label' => __('URL'), 'mandatory' => false), 'tags' => array('mandatory' => false, 'label' => __('Tags (SEO)'), 'type' => 'text'), 'language_id' => array('type' => 'hidden'))), array('type' => 'submit', 'value' => __('Speichern')));
     return parent::startUp();
 }
Exemplo n.º 19
0
<?php

require_once $home_dir . 'models/customer.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('customer');
$page = 'admin/form';
$form->add([['name' => 'customer_created', 'label' => 'Date', 'type' => 'static'], ['name' => 'customer_last_access', 'label' => 'Last visited', 'type' => 'static'], ['name' => 'customer_deleted', 'label' => 'Deleted', 'type' => 'bool'], ['name' => 'customer_anonymous', 'label' => 'Anonymous', 'type' => 'bool'], ['label' => 'Login', 'type' => 'begin_group'], ['name' => 'customer_email', 'label' => 'E-mail', 'type' => 'text', 'validations' => [['type' => 'email']]], ['name' => 'customer_password', 'label' => 'Password', 'type' => 'password', 'validations' => [['type' => 'password']]], ['name' => 'customer_password_confirm', 'label' => 'Confirm Password', 'type' => 'password', 'validations' => [['type' => 'confirm', 'param' => 'customer_password']]], ['type' => 'end_group'], ['label' => 'Address', 'type' => 'begin_group'], ['name' => 'customer_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_address_city', 'label' => 'City', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_address_street', 'label' => 'Street with house n.', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_address_zip', 'label' => 'ZIP', 'type' => 'text', 'validations' => [['type' => 'integer', 'param' => true]]], ['type' => 'end_group'], ['label' => 'Shipping Address', 'type' => 'begin_group'], ['name' => 'customer_ship_name', 'label' => 'Name (shipping)', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_ship_city', 'label' => 'City (shipping)', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_ship_street', 'label' => 'Street (shipping)', 'type' => 'text', 'validations' => [['type' => 'maxlen', 'param' => 50]]], ['name' => 'customer_ship_zip', 'label' => 'ZIP (shipping)', 'type' => 'text', 'validations' => [['type' => 'integer', 'param' => true]]], ['type' => 'end_group'], ['name' => 'customer_failed_attempts', 'label' => 'Failed attempts', 'type' => 'text', 'validations' => [['type' => 'integer']]], ['name' => 'customer_delivery_type_id', 'label' => 'Delivery Type', 'type' => 'select', 'select_table' => 'delivery_types', 'select_id_field' => 'delivery_type_id', 'select_label_field' => 'delivery_type_name'], ['name' => 'customer_payment_type_id', 'label' => 'Payment Type', 'type' => 'select', 'select_table' => 'payment_types', 'select_id_field' => 'payment_type_id', 'select_label_field' => 'payment_type_name']]);
if (isset($_POST['customer_id'])) {
    if ($_POST['customer_id'] > 0) {
        $customer = new Customer($db, $_POST['customer_id']);
    } else {
        $customer = new Customer($db);
    }
    $customer->setData($form->processInput($_POST));
    unset($customer->data['customer_password']);
    unset($customer->data['customer_password_confirm']);
    if (isset($_POST['customer_password']) && strlen($_POST['customer_password']) > 0) {
        $customer->data['customer_password_hash'] = CustomerAuthentication::hashPassword($_POST['customer_password']);
    }
    if ($customer->save()) {
        redirect(_g('r', '/admin/customers'));
    }
} elseif (isset($path[2]) && $path[2] == 'edit') {
    $customer = new Customer($db, $path[3]);
    $page_title = t('Editing Customer');
} elseif (isset($path[2]) && $path[2] == 'delete') {
    if (Customer::del($db, $path[3])) {
        redirect(_g('r', '/admin/customers'));
    }
} else {
    $customer = new Customer($db);
Exemplo n.º 20
0
 public function startUp()
 {
     $this->config = array(array('type' => 'email', 'placeholder' => __('E-Mail'), 'label' => false), array('type' => 'password', 'label' => false, 'placeholder' => __('Passwort')), array('type' => 'checkbox', 'name' => 'permanent', 'checked' => true, 'label' => __('Eingeloggt bleiben')), array('type' => 'submit', 'value' => __('Einloggen')));
     return parent::startUp();
 }
Exemplo n.º 21
0
 public function startUp()
 {
     $this->config = array('Comment' => array('fields' => array('name', 'email' => array('mandatory' => false, 'label' => __('E-Mail')), 'url' => array('mandatory' => false), 'text')), array('type' => 'submit', 'name' => 'submit', 'value' => __('Speichern')));
     return parent::startUp();
 }
Exemplo n.º 22
0
<?php

require_once $home_dir . 'models/order.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('order');
$page = 'admin/form';
$form->add([['name' => 'order_id', 'label' => 'Order ID', 'type' => 'hidden'], ['name' => 'order_created', 'label' => 'Date', 'type' => 'static', 'disabled' => 'disabled'], ['name' => 'order_order_state_id', 'label' => 'Status', 'type' => 'select', 'select_table' => 'order_states', 'select_id_field' => 'order_state_id', 'select_label_field' => 'order_state_name'], ['name' => 'order_customer_id', 'label' => 'Customer', 'type' => 'foreign_key_link', 'link_table' => 'customers', 'link_template' => 'admin/customer/edit/%d', 'link_id_field' => 'customer_id', 'link_label_field' => 'customer_name'], ['name' => 'order_payment_code', 'label' => 'Payment Code', 'type' => 'text', 'disabled' => 'disabled'], ['name' => 'order_ship_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]], ['name' => 'order_ship_city', 'label' => 'City', 'type' => 'text'], ['name' => 'order_ship_street', 'label' => 'Street', 'type' => 'text'], ['name' => 'order_ship_zip', 'label' => 'ZIP', 'type' => 'text']]);
Order::process($db, $form);
Exemplo n.º 23
0
 public function startUp()
 {
     $this->config = array(array('type' => 'text', 'name' => 'q', 'label' => false, 'placeholder' => __('Suchbegriff'), 'value' => coalesce(@$this->controller->params['q'], false)));
     return parent::startUp();
 }
Exemplo n.º 24
0
<?php

require_once $home_dir . 'models/delivery_type.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('delivery_type');
$page = 'admin/form';
$form->add([['name' => 'delivery_type_name', 'label' => 'Name', 'type' => 'text', 'validations' => [['type' => 'length', 'param' => 1]]], ['name' => 'delivery_type_price', 'label' => 'Price', 'type' => 'text', 'validations' => [['type' => 'price']]], ['name' => 'delivery_type_min_order_cost', 'label' => 'Min. order cost', 'type' => 'text', 'validations' => [['type' => 'price']]]]);
DeliveryType::process($db, $form);
Exemplo n.º 25
0
 public function startUp()
 {
     $folderList = array(false => __('kein Kategorie')) + $this->controller->Folder->listAll('name', array('conditions' => array('id > 1')));
     $this->config = array('MediaFile' => array('fields' => array('folder_id' => array('mandatory' => false, 'type' => 'DropDown', 'label' => __('Kategorie (optional)'), 'options' => $folderList))), array('type' => 'file', 'name' => 'file', 'label' => false), array('type' => 'submit', 'value' => __('Hochladen')));
     return parent::startUp();
 }
Exemplo n.º 26
0
 public function startUp()
 {
     $this->config = array('Folder' => array('fields' => array('name')), array('type' => 'submit', 'value' => __('Speichern')));
     return parent::startUp();
 }
Exemplo n.º 27
0
<?php

session_start();
if (isset($_SESSION['type'])) {
    if ($_SESSION['type'] != "Administrator") {
        header('Location: index.php');
    }
} else {
    header('Location: index.php');
}
include "models/admin_model.php";
$admins = new AdminForm();
$to_edit = new AdminForm();
if (isset($_POST['add_admin'])) {
    $to_edit->load_from_post();
    $valid = $to_edit->validate();
    if ($_POST['password2'] != $to_edit->fields['password']->value) {
        $valid = false;
    } else {
        $to_edit->fields['password']->hash_pass();
    }
    if ($valid) {
        $to_edit->save();
    }
} elseif (isset($_POST['admin_id'])) {
    $to_edit->load_by_pk($_POST['admin_id']);
    $to_edit->load_from_post();
    $valid = $to_edit->validate();
    if ($valid) {
        $to_edit->save();
        $to_edit = new AdminForm();
Exemplo n.º 28
0
 public function startUp()
 {
     $this->config = array('MediaText' => array('fields' => array('title' => array('mandatory' => false, 'label' => __('Überschrift')), 'text' => array('mandatory' => false, 'label' => __('Text/Beschreibung')), 'language_id' => array('type' => 'hidden'))), array('type' => 'submit', 'value' => __('Speichern')));
     return parent::startUp();
 }
Exemplo n.º 29
0
<?php

Admin::model('App\\Marker')->title('Маркеры')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('markerGroups');
    $display->filters([]);
    $display->columns([Column::string('name')->label('Имя'), Column::lists('markerGroups.name')->label('Входит в группы'), Column::image('ico')->label('Иконка')]);
    return $display;
})->create(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта')->defaultValue(0), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
})->edit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта'), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
});
Exemplo n.º 30
0
<?php

require_once $home_dir . 'models/ip_failed.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('ip_failed_attempt');
$page = 'admin/form';
$form->add([['name' => 'ip_failed_attempt_ip', 'label' => 'IP', 'type' => 'text', 'validations' => [['type' => 'ip']]], ['name' => 'ip_failed_attempt_count', 'label' => 'Failed Attempts', 'type' => 'text', 'validations' => [['type' => 'integer']]], ['name' => 'ip_failed_attempt_first', 'label' => 'First', 'type' => 'date', 'hint' => 'Date of the first failed attempt.', 'validations' => [['type' => 'date']]], ['name' => 'ip_failed_attempt_last', 'label' => 'Last', 'type' => 'date', 'hint' => 'Date of the last failed attempt.', 'validations' => [['type' => 'date']]]]);
IpFailedAttempt::process($db, $form);