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


PHP DataList::add方法代码示例

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


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

示例1: processAll

 /**
  * Add records to the list.
  */
 protected function processAll($filepath, $preview = false)
 {
     $iterator = $this->getSource()->getIterator();
     $results = new BetterBulkLoader_Result();
     foreach ($iterator as $record) {
         if ($id = $this->processRecord($record, $this->columnMap, $results, $preview)) {
             $this->list->add($id);
         }
     }
     return $results;
 }
开发者ID:burnbright,项目名称:silverstripe-importexport,代码行数:14,代码来源:ListBulkLoader.php

示例2: handleAction

 /**
  * Handles the given action context.
  * 
  * @param GridField $gridField  GridField to handle action for
  * @param string    $actionName Name of the action to handle
  * @param array     $arguments  Arguments
  * @param array     $data       Post data to handle
  * 
  * @return string
  * 
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 14.03.2013
  */
 public function handleAction(GridField $gridField, $actionName, $arguments, $data)
 {
     if ($actionName == 'addsubobject') {
         $recordID = $data['SubObjectParentID'];
         $subObjectID = $data[$gridField->getModelClass() . 'SubObjects'][$recordID];
         $list = $gridField->getList();
         $parent = DataObject::get($gridField->getModelClass())->byID($recordID);
         $subObject = DataObject::get($this->targetClassName)->byID($subObjectID);
         if ($subObject instanceof $this->targetClassName && $subObject->exists()) {
             $this->subList->add($subObject);
         }
     } elseif ($actionName == 'removesubobject' || $actionName == 'activatesubobject' || $actionName == 'deactivatesubobject' || $actionName == 'defaultsubobject' || $actionName == 'undefaultsubobject') {
         $recordID = $data['SubObjectParentID'];
         $subObjectID = $data['SubObjectID'];
         $list = $gridField->getList();
         $parent = DataObject::get($gridField->getModelClass())->byID($recordID);
         $subObject = DataObject::get($this->targetClassName)->byID($subObjectID);
         if ($subObject instanceof $this->targetClassName && $subObject->exists()) {
             if ($actionName == 'defaultsubobject' || $actionName == 'undefaultsubobject') {
                 $this->subList->add($subObject, array('IsDefault' => $actionName == 'defaultsubobject'));
             } elseif ($actionName == 'activatesubobject' || $actionName == 'deactivatesubobject') {
                 $this->subList->add($subObject, array('IsActive' => $actionName == 'activatesubobject'));
             } elseif ($actionName == 'removesubobject') {
                 $this->subList->remove($subObject);
             }
         }
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:41,代码来源:SilvercartGridFieldSubObjectHandler.php


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