本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例9: scaffoldSearchFields
/**
*
*@return Fieldset
**/
function scaffoldSearchFields()
{
$fields = parent::scaffoldSearchFields();
$fields->replaceField("OrderID", new NumericField("OrderID", "Order Number"));
return $fields;
}
示例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;
}
示例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;
}