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


PHP GridField::FieldHolder方法代码示例

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


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

示例1: testShowEditLinksWithAdminPermission

 public function testShowEditLinksWithAdminPermission()
 {
     $this->logInWithPermission('ADMIN');
     $content = new CSSContentParser($this->gridField->FieldHolder());
     $editLinks = $content->getBySelector('.edit-link');
     $this->assertEquals(2, count($editLinks), 'Edit links should show when logged in.');
 }
开发者ID:normann,项目名称:sapphire,代码行数:7,代码来源:GridFieldEditButtonTest.php

示例2: testShowDeleteButtonsWithAdminPermission

 public function testShowDeleteButtonsWithAdminPermission()
 {
     $this->logInWithPermission('ADMIN');
     $content = new CSSContentParser($this->gridField->FieldHolder());
     $deleteButtons = $content->getBySelector('.gridfield-button-delete');
     $this->assertEquals(3, count($deleteButtons), 'Delete buttons should show when logged in.');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:7,代码来源:GridFieldDeleteActionTest.php

示例3: testThereIsNoPaginatorWhenOnlyOnePage

 function testThereIsNoPaginatorWhenOnlyOnePage()
 {
     // We set the itemsPerPage to an reasonably big number so as to avoid test broke from small changes on the fixture YML file
     $total = $this->list->count();
     $this->gridField->getConfig()->getComponentByType("GridFieldPaginator")->setItemsPerPage($total);
     $fieldHolder = $this->gridField->FieldHolder();
     $content = new CSSContentParser($fieldHolder);
     // Check that there is no paginator render into the footer
     $this->assertEquals(0, count($content->getBySelector('.datagrid-pagination')));
     // Check that there is still 'View 1 - 4 of 4' part on the left of the paginator
     $this->assertEquals(1, count($content->getBySelector('.pagination-records-number')));
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:12,代码来源:GridFieldPaginatorTest.php

示例4: FieldHolder

 /**
  * Returns the whole gridfield rendered with all the attached components
  *
  * @param array $properties
  * @return string
  */
 public function FieldHolder($properties = array())
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.min.js');
     $modulePath = dirname(dirname(__FILE__));
     $modulePath = str_replace(BASE_PATH, '', $modulePath);
     $modulePath = substr($modulePath, 1);
     Requirements::javascript($modulePath . '/js/feedblock_manager.js');
     Requirements::css($modulePath . '/css/GridFieldRefreshButton.css');
     return parent::FieldHolder($properties);
 }
开发者ID:richardsjoqvist,项目名称:silverstripe-blocks,代码行数:16,代码来源:FeedBlock_Manager.php

示例5: FieldHolder

 /**
  * Returns the whole gridfield rendered with all the attached components
  * @return string
  */
 public function FieldHolder($properties = array())
 {
     Requirements::block(FRAMEWORK_DIR . '/css/GridField.css');
     Requirements::themedCSS('FrontEndGridField', FRONTEND_GRIDFIELD_BASE);
     Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lib.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(FRONTEND_GRIDFIELD_BASE . '/javascript/FrontEndGridField.js');
     return parent::FieldHolder();
 }
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-frontendgridfield,代码行数:17,代码来源:FrontEndGridField.php

示例6: testCanViewOnlyOddIDs

 /**
  *  @covers GridField::FieldHolder
  */
 public function testCanViewOnlyOddIDs()
 {
     $this->logInWithPermission();
     $list = new ArrayList(array(new GridFieldTest_Permissions(array("ID" => 1, "Email" => "ongi.schwimmer@example.org", 'Name' => 'Ongi Schwimmer')), new GridFieldTest_Permissions(array("ID" => 2, "Email" => "klaus.lozenge@example.org", 'Name' => 'Klaus Lozenge')), new GridFieldTest_Permissions(array("ID" => 3, "Email" => "otto.fischer@example.org", 'Name' => 'Otto Fischer'))));
     $config = new GridFieldConfig();
     $config->addComponent(new GridFieldDataColumns());
     $obj = new GridField('testfield', 'testfield', $list, $config);
     $form = new Form(new Controller(), 'mockform', new FieldList(array($obj)), new FieldList());
     $content = new CSSContentParser($obj->FieldHolder());
     $members = $content->getBySelector('.ss-gridfield-item tr');
     $this->assertEquals(2, count($members));
     $this->assertEquals((string) $members[0]->td[0], 'Ongi Schwimmer', 'First object Name should be Ongi Schwimmer');
     $this->assertEquals((string) $members[0]->td[1], 'ongi.schwimmer@example.org', 'First object Email should be ongi.schwimmer@example.org');
     $this->assertEquals((string) $members[1]->td[0], 'Otto Fischer', 'Second object Name should be Otto Fischer');
     $this->assertEquals((string) $members[1]->td[1], 'otto.fischer@example.org', 'Second object Email should be otto.fischer@example.org');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:19,代码来源:GridFieldTest.php

示例7: handle

 /**
  * Handles the action.
  * Prepares the popup to load the pring preview
  * 
  * @param GridField $gridField GridField to handle action for
  * @param array     $recordIDs Record IDs to handle action for
  * @param array     $data      Data to handle action for
  * 
  * @return void
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 14.03.2013
  */
 public function handle(GridField $gridField, $recordIDs, $data)
 {
     $orders = new ArrayList();
     foreach ($recordIDs as $orderID) {
         $order = SilvercartOrder::get_by_id('SilvercartOrder', $orderID);
         if ($order->exists()) {
             $order->markAsSeen();
             $orders->push($order);
         }
     }
     $gridField->getConfig()->addComponent(new SilvercartGridFieldPopupTrigger(SilvercartPrint::getPrintURLForMany($orders)));
     return $gridField->FieldHolder();
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:26,代码来源:SilvercartGridFieldBatchAction.php

示例8: handleBlockTypeAssignment

 /**
  * Handles requests to assign a new block area to a block item
  *
  * @param GridField $grid
  * @param SS_HTTPRequest $request
  * @return SS_HTTPResponse
  */
 public function handleBlockTypeAssignment($grid, $request)
 {
     $list = $grid->getList();
     // @TODO: do we need this? (copied from GridFieldOrderableRows::handleReorder)
     //		$modelClass = $grid->getModelClass();
     //		if ($list instanceof ManyManyList && !singleton($modelClass)->canView()) {
     //			$this->httpError(403);
     //		} else if(!($list instanceof ManyManyList) && !singleton($modelClass)->canEdit()) {
     //			$this->httpError(403);
     //		}
     $blockid = $request->postVar('block_id');
     $blocktype = $request->postVar('block_type');
     $block = $list->byID($blockid);
     // Update item with correct Area assigned (custom query required to write m_m_extraField)
     $block->ClassName = $blocktype;
     $block->write();
     //print_r($block->record);
     //        // @TODO: improve this custom query to be more robust?
     //        DB::query(sprintf(
     //            "UPDATE `%s` SET `%s` = '%s' WHERE `BlockID` = %d",
     //            'SiteTree_Blocks',
     //            'BlockArea',
     //            $blockarea,
     //            $blockid
     //        ));
     return $grid->FieldHolder();
 }
开发者ID:micschk,项目名称:silverstripe-block_enhancements,代码行数:34,代码来源:GF_BlockEnhancements.php

示例9: handleMoveToPage

 /**
  * Handles requests to move an item to the previous or next page.
  */
 public function handleMoveToPage(GridField $grid, $request)
 {
     if (!($paginator = $grid->getConfig()->getComponentByType('GridFieldPaginator'))) {
         $this->httpError(404, 'Paginator component not found');
     }
     $move = $request->postVar('move');
     $field = $this->getSortField();
     $list = $grid->getList();
     $manip = $grid->getManipulatedList();
     $existing = $manip->map('ID', $field)->toArray();
     $values = $existing;
     $order = array();
     $id = isset($move['id']) ? (int) $move['id'] : null;
     $to = isset($move['page']) ? $move['page'] : null;
     if (!isset($values[$id])) {
         $this->httpError(400, 'Invalid item ID');
     }
     $this->populateSortValues($list);
     $page = (int) $grid->getState()->GridFieldPaginator->currentPage ?: 1;
     $per = $paginator->getItemsPerPage();
     if ($to == 'prev') {
         $swap = $list->limit(1, ($page - 1) * $per - 1)->first();
         $values[$swap->ID] = $swap->{$field};
         $order[] = $id;
         $order[] = $swap->ID;
         foreach ($existing as $_id => $sort) {
             if ($id != $_id) {
                 $order[] = $_id;
             }
         }
     } elseif ($to == 'next') {
         $swap = $list->limit(1, $page * $per)->first();
         $values[$swap->ID] = $swap->{$field};
         foreach ($existing as $_id => $sort) {
             if ($id != $_id) {
                 $order[] = $_id;
             }
         }
         $order[] = $swap->ID;
         $order[] = $id;
     } else {
         $this->httpError(400, 'Invalid page target');
     }
     $this->reorderItems($list, $values, $order);
     return $grid->FieldHolder();
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:49,代码来源:GridFieldOrderableRows.php

示例10: FieldHolder

 /**
  * @param array $properties
  * @return HTMLText
  */
 public function FieldHolder($properties = array())
 {
     $stateHash = $this->getStateHash();
     if ($previousState = Session::get($stateHash)) {
         $this->state->setValue($previousState);
     }
     return parent::FieldHolder($properties);
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-persistentgridfield,代码行数:12,代码来源:PersistentGridField.php


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