当前位置: 首页>>代码示例>>PHP>>正文


PHP AdminForm类代码示例

本文整理汇总了PHP中AdminForm的典型用法代码示例。如果您正苦于以下问题:PHP AdminForm类的具体用法?PHP AdminForm怎么用?PHP AdminForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AdminForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionAdmin

 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));
 }
开发者ID:kostya1017,项目名称:our,代码行数:20,代码来源:AdminController.php

示例2: addAction

 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);
 }
开发者ID:pdhwi,项目名称:hwi_test,代码行数:18,代码来源:IndexController.php

示例3: session_start

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
开发者ID:SirTekno,项目名称:cfa_dev,代码行数:31,代码来源:change_password.php

示例4: AdminForm

<?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();
    }
开发者ID:lotcz,项目名称:zshop,代码行数:31,代码来源:category.c.php

示例5: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:8,代码来源:currency.c.php

示例6: _e

                            <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);
?>
" />
开发者ID:randomecho,项目名称:OSClass,代码行数:31,代码来源:frm.php

示例7: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:8,代码来源:payment_type.c.php

示例8:

<?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;
});
开发者ID:larabox,项目名称:larabox,代码行数:11,代码来源:Product.php

示例9: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:8,代码来源:alias.c.php

示例10: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:9,代码来源:product.c.php

示例11: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:8,代码来源:language.c.php

示例12: AdminForm

<?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);
开发者ID:lotcz,项目名称:zshop,代码行数:31,代码来源:customer.c.php

示例13: fillModel

 public function fillModel(Model $model)
 {
     $r = parent::fillModel($model);
     if (substr($this->controller->action, 0, 4) == 'edit' && !$this->submitted()) {
         $this->password->value('');
     }
     return $r;
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:8,代码来源:AdminUserForm.php

示例14: toModel

 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);
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:11,代码来源:AdminUserGroupForm.php

示例15: fillModel

 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'));
         }
     }
 }
开发者ID:Ephigenia,项目名称:harrison,代码行数:15,代码来源:AdminNodeForm.php


注:本文中的AdminForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。