當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ModelAdmin類代碼示例

本文整理匯總了PHP中ModelAdmin的典型用法代碼示例。如果您正苦於以下問題:PHP ModelAdmin類的具體用法?PHP ModelAdmin怎麽用?PHP ModelAdmin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ModelAdmin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 <andrew.lowther@mademedia.co.uk>
     **/
    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


注:本文中的ModelAdmin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。