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


PHP DataList::count方法代码示例

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


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Remove MCListSegment GridField Tab And Manually Manage
     $fields->removeByName("MCListSegments");
     // Manually Manage Creation of MCListSegments Based on Selected MCLists
     if (empty($this->owner->ID)) {
         $lists = new DataList("MCList");
         if ($lists->count() > 1) {
             $fields->addFieldToTab('Root.Main', new LiteralField('_AffectedMCListsTitle', '<h2>Affected MailChimp Lists</h2>'));
             $map = $lists->map("ID", "Name");
             $listIDs = new CheckboxSetField('_AffectedMCListIDs', 'Which MailChimp List(s) Does This Event Relate To', $map);
             $listIDs->setDefaultItems(array_keys($map->toArray()));
         } else {
             if ($lists->count() == 1) {
                 $listIDs = new HiddenField('_AffectedMCListIDs', 'Which MailChimp List(s) Does This Event Relate To', $lists->first()->ID);
             } else {
                 $listIDs = new HiddenField('_AffectedMCListIDs', 'Which MailChimp List(s) Does This Event Relate To', 0);
             }
         }
         $fields->addFieldToTab('Root.Main', $listIDs);
     }
     // Configure Attendees Gridfield
     $gf = $fields->fieldByName('Root.Attendees.Attendees');
     if (is_object($gf) && $gf->exists()) {
         $gf->setList($this->getMyManyManyComponents('Attendees'));
         $config = $gf->getConfig();
         $config->removeComponentsByType('GridfieldAddNewButton');
     }
     return $fields;
 }
开发者ID:quadra-digital,项目名称:silverstripe-mailchimp-module,代码行数:31,代码来源:MCEvent.php

示例2: getLists

 public function getLists()
 {
     $lists = new DataList("MCList");
     if ($lists->count() == 0) {
         SS_Log::log("No MailChimp Lists To Run Updates Against!", SS_Log::ERR);
         return array();
     } else {
         return $lists;
     }
 }
开发者ID:quadra-digital,项目名称:silverstripe-mailchimp-module,代码行数:10,代码来源:MCSync.php

示例3: calculatePastOrders

 /**
  * retrieves previous orders and adds totals to it...
  * return DataList
  **/
 protected function calculatePastOrders()
 {
     if (!$this->pastOrders) {
         $this->pastOrders = $this->pastOrdersSelection();
         $this->calculatedTotal = 0;
         $this->calculatedPaid = 0;
         $this->calculatedOutstanding = 0;
         $member = Member::currentUser();
         $canDelete = false;
         if ($this->pastOrders->count()) {
             foreach ($this->pastOrders as $order) {
                 $this->calculatedTotal += $order->Total();
                 $this->calculatedPaid += $order->TotalPaid();
                 $this->calculatedOutstanding += $order->TotalOutstanding();
             }
         }
     }
     return $this->pastOrders;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:23,代码来源:AccountPage.php

示例4: productGroupFilterLinksCount

 /**
  * counts the total number in the combination....
  * @param DataList $items - list of
  * @param Arary $baseArray - list of products on the current page
  * @return array
  */
 protected function productGroupFilterLinksCount($items, $baseArray, $ajaxify = true)
 {
     $array = array();
     if ($items && $items->count()) {
         foreach ($items as $item) {
             $arrayOfIDs = $item->currentInitialProductsAsCachedArray($this->getMyUserPreferencesDefault("FILTER"));
             $newArray = array_intersect_key($arrayOfIDs, $baseArray);
             $count = count($newArray);
             if ($count) {
                 $array[$item->Title] = array("Item" => $item, "Count" => $count, "Ajaxify" => $ajaxify);
             }
         }
     }
     return $array;
 }
开发者ID:abhibavishi,项目名称:silverstripe-ecommerce,代码行数:21,代码来源:ProductGroup.php


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