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


PHP DataObject::scaffoldSearchFields方法代码示例

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


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

示例1: scaffoldSearchFields

 public function scaffoldSearchFields($_params = null)
 {
     $fields = parent::scaffoldSearchFields($_params);
     if ($allowed_types = $this->stat('allowed_types')) {
         $field = $fields->dataFieldByName('ClassName');
         $field->setSource($allowed_types);
         $field->setEmptyString('Select Type');
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-flexiform,代码行数:10,代码来源:FlexiFormField.php

示例2: scaffoldSearchFields

 public function scaffoldSearchFields($_params = null)
 {
     $fields = parent::scaffoldSearchFields();
     //$fields->removeByName('ID');
     //$fields->removeByName('Address');
     //$fields->removeByName('Address');
     //$fields->removeByName('Address');
     $parishes = Parish::get()->map('ID', 'NameWithLocation')->toArray();
     $parishField = DropdownField::create('ParishID', 'Parish')->setSource($parishes);
     $parishField->setEmptyString('select...');
     //$fields->push($parishField);
     $fields->replaceField('ParishID', $parishField);
     return $fields;
 }
开发者ID:thomaspaulson,项目名称:myparish,代码行数:14,代码来源:Family.php

示例3: scaffoldSearchFields

 /**
  * STANDARD SILVERSTRIPE STUFF
  **/
 function scaffoldSearchFields()
 {
     $fieldSet = parent::scaffoldSearchFields();
     if ($statusOptions = self::get_order_status_options()) {
         $createdOrderStatusID = 0;
         $preSelected = array();
         if ($createdOrderStatus = DataObject::get_one("OrderStep")) {
             $createdOrderStatusID = $createdOrderStatus->ID;
         }
         $arrayOfStatusOptions = $statusOptions->toDropDownMap();
         if (count($arrayOfStatusOptions)) {
             foreach ($arrayOfStatusOptions as $key => $value) {
                 $count = DB::query("SELECT COUNT(\"ID\") FROM \"Order\" WHERE \"StatusID\" = " . intval($key) . ";")->value();
                 if ($count < 1) {
                     unset($arrayOfStatusOptions[$key]);
                 } else {
                     $arrayOfStatusOptions[$key] .= " ({$count})";
                 }
                 //we use 100 here because if there is such a big list, an additional filter should be added
                 if ($count > 100) {
                 } else {
                     if ($key != $createdOrderStatusID) {
                         $preSelected[$key] = $key;
                     }
                 }
             }
         }
         $statusField = new CheckboxSetField("StatusID", "Status", $arrayOfStatusOptions);
         $statusField->setValue($preSelected);
         $fieldSet->push($statusField);
     }
     $fieldSet->push(new DropdownField("CancelledByID", "Cancelled", array(-1 => "(Any)", 1 => "yes", 0 => "no")));
     return $fieldSet;
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:37,代码来源:Order.php

示例4: scaffoldSearchFields

 /**
  * Determine which properties on the DataObject are
  * searchable, and map them to their default {@link FormField}
  * representations. Used for scaffolding a searchform for {@link ModelAdmin}.
  *
  * Some additional logic is included for switching field labels, based on
  * how generic or specific the field type is.
  *
  * Used by {@link SearchContext}.
  *
  * @param array $_params
  * 	'fieldClasses': Associative array of field names as keys and FormField classes as values
  * 	'restrictFields': Numeric array of a field name whitelist
  * @return FieldList
  */
 public function scaffoldSearchFields($_params = null)
 {
     $fieldList = parent::scaffoldSearchFields($_params);
     $statusOptions = OrderStep::get();
     if ($statusOptions && $statusOptions->count()) {
         $createdOrderStatusID = 0;
         $preSelected = array();
         $createdOrderStatus = $statusOptions->First();
         if ($createdOrderStatus) {
             $createdOrderStatusID = $createdOrderStatus->ID;
         }
         $arrayOfStatusOptions = clone $statusOptions->map("ID", "Title");
         $arrayOfStatusOptionsFinal = array();
         if (count($arrayOfStatusOptions)) {
             foreach ($arrayOfStatusOptions as $key => $value) {
                 if (isset($_GET["q"]["StatusID"][$key])) {
                     $preSelected[$key] = $key;
                 }
                 $count = Order::get()->Filter(array("StatusID" => intval($key)))->count();
                 if ($count < 1) {
                     //do nothing
                 } else {
                     $arrayOfStatusOptionsFinal[$key] = $value . " ({$count})";
                 }
             }
         }
         $statusField = new CheckboxSetField("StatusID", "Status", $arrayOfStatusOptionsFinal, $preSelected);
         $fieldList->push($statusField);
     }
     $fieldList->push(new DropdownField("CancelledByID", "Cancelled", array(-1 => "(Any)", 1 => "yes", 0 => "no")));
     return $fieldList;
 }
开发者ID:TouchtechLtd,项目名称:silverstripe-ecommerce,代码行数:47,代码来源:Order.php

示例5: scaffoldSearchFields

 /**
  * Determine which properties on the DataObject are
  * searchable, and map them to their default {@link FormField}
  * representations. Used for scaffolding a searchform for {@link ModelAdmin}.
  *
  * Some additional logic is included for switching field labels, based on
  * how generic or specific the field type is.
  *
  * Used by {@link SearchContext}.
  *
  * @param array $_params
  * 	'fieldClasses': Associative array of field names as keys and FormField classes as values
  * 	'restrictFields': Numeric array of a field name whitelist
  * @return FieldList
  */
 public function scaffoldSearchFields($_params = null)
 {
     $fields = parent::scaffoldSearchFields($_params);
     $fields->replaceField("OrderID", new NumericField("OrderID", "Order Number"));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:21,代码来源:OrderEmailRecord.php

示例6: scaffoldSearchFields

 /**
  * Filters for order admin area search.
  * 
  * @see DataObject::scaffoldSearchFields()
  * @return FieldSet
  */
 public function scaffoldSearchFields($params = array())
 {
     $fields = parent::scaffoldSearchFields();
     $request = Controller::curr()->getRequest();
     $query = $request->requestVar('q');
     $statusVal = isset($query['Status']) ? $query['Status'] : array();
     $fields->push(CheckboxSetField::create('Status', 'Status', array('Pending' => 'Pending', 'Processing' => 'Processing', 'Dispatched' => 'Dispatched'))->setValue($statusVal));
     return $fields;
 }
开发者ID:vinstah,项目名称:body,代码行数:15,代码来源:Order.php

示例7: scaffoldSearchFields

 function scaffoldSearchFields()
 {
     $fieldSet = parent::scaffoldSearchFields();
     $fieldSet->push(new CheckboxSetField("Status", "Status", self::get_order_status_options()));
     $fieldSet->push(new DropdownField("TotalPaid", "Has Payment", array(1 => "yes", 0 => "no")));
     return $fieldSet;
 }
开发者ID:riddler7,项目名称:silverstripe-ecommerce,代码行数:7,代码来源:Order.php

示例8: scaffoldSearchFields

 /**
  * Ensures the content type appears in the searchable fields
  * @param {array} $_params
  * @return {FieldList} Form fields to use in searching
  */
 public function scaffoldSearchFields($_params = null)
 {
     $fields = parent::scaffoldSearchFields($_params);
     if (!$fields->dataFieldByName('ClassNameNice')) {
         $classMap = ClassInfo::subclassesFor('KapostObject');
         unset($classMap['KapostObject']);
         foreach ($classMap as $key => $value) {
             $classMap[$key] = _t($key . '.SINGULARNAME', $value);
         }
         $fields->push(DropdownField::create('ClassNameNice', _t('KapostObject.CONTENT_TYPE', '_Content Type'), $classMap)->setEmptyString('(' . _t('Enum.ANY', 'Any') . ')'));
     }
     return $fields;
 }
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge,代码行数:18,代码来源:KapostObject.php

示例9: scaffoldSearchFields

 /**
  *
  *@return Fieldset
  **/
 function scaffoldSearchFields()
 {
     $fields = parent::scaffoldSearchFields();
     $fields->replaceField("OrderID", new NumericField("OrderID", "Order Number"));
     return $fields;
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:10,代码来源:OrderStatusLog.php

示例10: scaffoldSearchFields

 /**
  * Filters for order admin area search.
  * 
  * @see DataObject::scaffoldSearchFields()
  * @return FieldSet
  */
 function scaffoldSearchFields()
 {
     $fieldSet = parent::scaffoldSearchFields();
     $fieldSet->push(new DropdownField("HasPayment", "Has Payment", array(1 => "yes", 0 => "no")));
     $fieldSet->push(new CheckboxSetField("Status", "Status", array('Pending' => 'Pending', 'Processing' => 'Processing', 'Dispatched' => 'Dispatched')));
     return $fieldSet;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:13,代码来源:Order.php

示例11: scaffoldSearchFields

 /**
  * Determine which properties on the DataObject are
  * searchable, and map them to their default {@link FormField}
  * representations. Used for scaffolding a searchform for {@link ModelAdmin}.
  *
  * Some additional logic is included for switching field labels, based on
  * how generic or specific the field type is.
  *
  * Used by {@link SearchContext}.
  *
  * @param array $_params
  * 	'fieldClasses': Associative array of field names as keys and FormField classes as values
  * 	'restrictFields': Numeric array of a field name whitelist
  * @return FieldList
  */
 public function scaffoldSearchFields($_params = null)
 {
     $fields = parent::scaffoldSearchFields($_params);
     $fields->replaceField("OrderID", new NumericField("OrderID", "Order Number"));
     $availableLogs = EcommerceConfig::get("OrderStatusLog", "available_log_classes_array");
     $availableLogs = array_merge($availableLogs, array(EcommerceConfig::get("OrderStatusLog", "order_status_log_class_used_for_submitting_order")));
     $ecommerceClassNameOrTypeDropdownField = EcommerceClassNameOrTypeDropdownField::create("ClassName", "Type", "OrderStatusLog", $availableLogs);
     $ecommerceClassNameOrTypeDropdownField->setIncludeBaseClass(true);
     $fields->replaceField("ClassName", $ecommerceClassNameOrTypeDropdownField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:26,代码来源:OrderStatusLog.php


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