• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ModelAdmin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getEditForm

 /**
  * Add GridFieldOrderableRows component to grid field keyed on ArtisanHasSortOrderExtension.FieldName (ArtisanSort).
  *
  * @param int|null $id
  * @param FieldList|null $fields
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
     $gridField->getConfig()->addComponent(new GridFieldOrderableRows(ArtisanHasSortOrderExtension::FieldName));
     return $form;
 }
开发者ID:CrackerjackDigital,项目名称:artisan,代码行数:14,代码来源:ArtisanModelAdmin.php


示例2: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     if ($this->modelClass == 'Order') {
         $fields = $form->Fields();
         $gridField = $fields->fieldByName('Order');
         // Bulk manager
         $manager = new GridFieldBulkManager();
         $manager->removeBulkAction("bulkEdit");
         $manager->removeBulkAction("unLink");
         $manager->removeBulkAction("delete");
         $manager->addBulkAction('paid', 'Mark Paid', 'CommerceGridFieldBulkAction_Paid');
         $manager->addBulkAction('processing', 'Mark Processing', 'CommerceGridFieldBulkAction_Processing');
         $manager->addBulkAction('dispatched', 'Mark Dispatched', 'CommerceGridFieldBulkAction_Dispatched');
         // Add dispatch button
         $field_config = $gridField->getConfig();
         $field_config->addComponent($manager);
         // Update list of items for subsite (if used)
         if (class_exists('Subsite')) {
             $list = $gridField->getList()->filter(array('SubsiteID' => Subsite::currentSubsiteID()));
             $gridField->setList($list);
         }
     }
     $this->extend("updateEditForm", $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:26,代码来源:OrderAdmin.php


示例3: getEditForm

 /**
  *
  * @param SS_Request $request
  * @return Form 
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         //			return $form;
     }
     if (!Permission::check('ADMIN')) {
         return $form;
     }
     $fields = $form->Fields();
     $config = $this->searchService->localEngineConfig();
     $allow = $config ? $config->RunLocal : null;
     $fields->push(new CheckboxField('RunLocal', _t('SolrAdmin.RUN_LOCAL', 'Run local Jetty instance of Solr?'), $allow));
     if ($allow) {
         $status = $this->searchService->localEngineStatus();
         if (!$status) {
             $fields->push(new CheckboxField('Start', _t('SolrAdmin.START', 'Start Solr')));
         } else {
             $fields->push(new CheckboxField('Kill', _t('SolrAdmin.Kill', 'Kill Solr process (' . $status . ')')));
         }
         $log = $this->searchService->getLogData(100);
         $log = array_reverse($log);
         $fields->push($logtxt = new TextareaField('Log', _t('SolrAdmin.LOG', 'Log')));
         $logtxt->setColumns(20)->setRows(15)->setValue(implode($log));
     }
     $form->Actions()->push(new FormAction('saveconfig', _t('SolrAdmin.SAVE', 'Save')));
     $form->Actions()->push(new FormAction('reindex', _t('SolrAdmin.REINDEX', 'Reindex')));
     //		$actions = new FieldSet();
     //		$form = new Form($this, 'EditForm', $fields, $actions);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-solr,代码行数:36,代码来源:SolrAdminController.php


示例4: getExportFields

 public function getExportFields()
 {
     if ($this->modelClass == 'Location') {
         return array('Title' => 'Name', 'Address' => 'Address', 'Suburb' => 'City', 'State' => 'State', 'Postcode' => 'Postcode', 'Country' => 'Country', 'Website' => 'Website', 'Phone' => 'Phone', 'Fax' => 'Fax', 'EmailAddress' => 'EmailAddress', 'Category.Name' => 'Category', 'ShowInLocator' => 'ShowInLocator', 'Featured' => 'Featured', 'Lat' => 'Lat', 'Lng' => 'Lng');
     }
     return parent::getExportFields();
 }
开发者ID:helpfulrobot,项目名称:dynamic-silverstripe-locator,代码行数:7,代码来源:LocationAdmin.php


示例5: getEditForm

 /**
  * adjust the gridfield: remove all options to change content
  *
  * @param int $id
  * @param FieldList $fields
  * @return CMSForm
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     // remove all the edit options
     $field = $form->Fields()->fieldByName('ComposerSecurityVulnerability');
     if ($field) {
         $field->setConfig(new GridFieldConfig_Base());
     }
     if ($field) {
         $field->getConfig()->addComponent(new GridFieldExternalLink());
     }
     // allow scheduled runs of the composer security vulnerability check if this is a admin and queuedjobs installed
     if ($field) {
         $this->addSimpleScheduleForm($form, 'ComposerSecurityVulnerability');
     }
     // add the available composer updates, if this package is installed
     $field = $form->Fields()->fieldByName('ComposerUpdate');
     if ($field) {
         $field->setConfig(new GridFieldConfig_Base());
     }
     // allow scheduled runs of the composer security vulnerability check if this is a admin and queuedjobs installed
     if ($field) {
         $this->addSimpleScheduleForm($form, 'ComposerUpdate');
     }
     return $form;
 }
开发者ID:helpfulrobot,项目名称:friendsofsilverstripe-silverstripe-maintenance,代码行数:33,代码来源:MaintenanceAdmin.php


示例6: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     if ($this->modelClass == 'Staff' && ($gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass)))) {
     }
     return $form;
 }
开发者ID:helpfulrobot,项目名称:andrewhoule-silverstripe-staffpage,代码行数:7,代码来源:StaffAdmin.php


示例7: init

 public function init()
 {
     parent::init();
     Requirements::themedCSS('AdvancedReportsAdmin');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
     Requirements::javascript('advancedreports/javascript/advancedreports.js');
 }
开发者ID:rodneyway,项目名称:silverstripe-advancedreports,代码行数:7,代码来源:AdvancedReportsAdmin.php


示例8: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
     $gridField->getConfig()->addComponents(new GridFieldAddExistingAutocompleter('buttons-before-left'), $filter = new GridFieldFilterHeader(), new GridFieldEditButton(), new GridFieldDeleteAction(true), new GridFieldDetailForm(), new GridFieldSortableRows('Order'));
     return $form;
 }
开发者ID:helpfulrobot,项目名称:adrexia-definitions,代码行数:7,代码来源:DefinitionAdmin.php


示例9: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
     $gridField->getConfig()->getComponentByType('GridFieldExportButton')->setExportColumns(singleton($this->sanitiseClassName($this->modelClass))->getExportFields());
     return $form;
 }
开发者ID:helpfulrobot,项目名称:adrexia-gamesevent,代码行数:7,代码来源:EventArchiveAdmin.php


示例10: init

    /**
     * Init
     * 	Include the javascript we will need
     *
     * @return void
     * @author Andrew Lowther <[email protected]>
     **/
    public function init()
    {
        parent::init();
        // Get the config variables we'll need
        $config = Config::inst()->get('MediaManager', 'Cloudinary');
        // Inject them into the global scope
        Requirements::customScript(<<<JS
\t\t\t;(function (window, undefined) {
\t\t\t\twindow.mediamanager = window.mediamanager || {};
\t\t\t\twindow.mediamanager.cloudinary = {
\t\t\t\t\tcloud_name: "{$config['cloud_name']}",
\t\t\t\t\tapi_key: "{$config['api_key']}"
\t\t\t\t}
\t\t\t}/)(window);
JS
);
        // Get the base javascript path
        $BaseJsPath = MEDIAMANAGER_CORE_PATH . '/javascript';
        // Combine the cloudinary files into one super file
        Requirements::combine_files('cloudinary.js', array("{$BaseJsPath}/cloudinary/js/load-image.min.js", "{$BaseJsPath}/cloudinary/js/canvas-to-blob.min.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload.js", "{$BaseJsPath}/cloudinary/js/jquery.ui.widget.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-process.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-image.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-validate.js", "{$BaseJsPath}/cloudinary/js/jquery.cloudinary.js"));
        // Same again for our files
        Requirements::combine_files('mediamanager.js', array("{$BaseJsPath}/mediamanager/mediamanager.core.js"));
        // Set the cloudinary config
        \Cloudinary::config($config);
    }
开发者ID:helpfulrobot,项目名称:andrewlowther-mediamanager,代码行数:32,代码来源:MediaManagerAdmin.php


示例11: getList

 public function getList()
 {
     $list = parent::getList();
     if ($this->modelClass === 'SurveyTemplate') {
         $list = $list->filter(array('ClassName' => 'SurveyTemplate'));
     }
     return $list;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:8,代码来源:SurveyTemplateAdmin.php


示例12: init

 public function init()
 {
     parent::init();
     $res = Permission::check("ADMIN") || Permission::check("ADMIN_JOBS");
     if (!$res) {
         Security::permissionFailure();
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:8,代码来源:JobAdmin.php


示例13: canView

 public function canView($member = null)
 {
     $managedModels = $this->getManagedModels();
     if (count($managedModels) == 0) {
         return false;
     }
     return parent::canView($member);
 }
开发者ID:mandrew,项目名称:silverstripe-registry,代码行数:8,代码来源:RegistryAdmin.php


示例14: Tools

 public function Tools()
 {
     if ($this->modelClass == 'ShopConfig') {
         return false;
     } else {
         return parent::Tools();
     }
 }
开发者ID:vinstah,项目名称:body,代码行数:8,代码来源:ShopAdmin.php


示例15: init

 public function init()
 {
     parent::init();
     $res = Permission::check("ADMIN") || Permission::check("ADMIN_SUMMIT_APP") || Permission::check("ADMIN_SUMMIT_APP_SCHEDULE");
     if (!$res) {
         Security::permissionFailure();
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:8,代码来源:SummitAdmin.php


示例16: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     if ($grid = $form->Fields()->fieldByName('AdminHelp')) {
         $grid->getConfig()->addComponent(GridFieldOrderableRows::create('Sort'));
     }
     return $form;
 }
开发者ID:helpfulrobot,项目名称:webtorque7-adminhelp,代码行数:8,代码来源:AdminHelpModelAdmin.php


示例17: getList

 public function getList()
 {
     $list = parent::getList();
     if ($this->modelClass == 'Presentation' || $this->modelClass == 'PresentationSpeaker') {
         $list = $list->sort('Created', 'DESC');
     }
     return $list;
 }
开发者ID:balajijegan,项目名称:openstack-org,代码行数:8,代码来源:PresentationAdmin.php


示例18: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
     $Config = $gridField->getConfig();
     $Config->removeComponentsByType('GridFieldDeleteAction');
     $gridField->setConfig($Config);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:mediabeast-silverstripe-shop-currency,代码行数:9,代码来源:ExchangeRateAdmin.php


示例19: init

 function init()
 {
     parent::init();
     Requirements::css("dynamictemplate/css/DynamicTemplateAdmin.css");
     Requirements::css("dynamictemplate/thirdparty/jquery.treetable/src/stylesheets/jquery.treeTable.css");
     Requirements::javascript("dynamictemplate/thirdparty/editarea_0_8_2/edit_area/edit_area_full.js");
     Requirements::javascript("dynamictemplate/thirdparty/jquery.treetable/src/javascripts/jquery.treeTable.min.js");
     Requirements::javascript("dynamictemplate/javascript/DynamicTemplateAdmin.js");
 }
开发者ID:helpfulrobot,项目名称:silverstripe-dynamictemplate,代码行数:9,代码来源:DynamicTemplateAdmin.php


示例20: getEditForm

 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $gridfield = $form->fields->first()->getConfig();
     // TODO: not sure why it's not getting placed before ExportButton, but will look after first commit
     $gridfield->addComponent(new GridFieldAddNewMultiClass(), 'GridFieldExportButton');
     $gridfield->removeComponentsByType('GridFieldAddNewButton');
     return $form;
 }
开发者ID:silverstripe-terraformers,项目名称:silverstripe-lightbox,代码行数:9,代码来源:LightboxAdmin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ModelAsController类代码示例发布时间:2022-05-23
下一篇:
PHP Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap