\ELearn_Searcher

نمایش، فیلتر و جستجو در فهرستی از مدلهای داده

یک نمونه استفاده از این کلاس در زیر آورده شده است:

$model = new ELearn_Lesson(); $lister = new ELearn_Searcher($model); // Get the parameters from the request $lister->setFromRequest($request); print $lister->render();

Summary

Methods
Properties
Constants
__construct()
configure()
setFromRequest()
render_array()
render_object()
filter()
$items
$list_filters
$forced_where
$model_view
$search_string
$sort_fields
$sort_order
$sort_reverse_order
No constants found
No protected methods found
$model
$search_fields
$where_clause
$active_list_filter
N/A
No private methods found
No private properties found
N/A

Properties

$items

$items : 

The items being paginated.

If no model is given when creating the paginator, it will use the items to list them.

Type

$list_filters

$list_filters : 

List filter.

Allow the generation of filtering options for the list. If you provide a list of fields having a "choices" option, you will be able to filter on the choice values.

Type

$forced_where

$forced_where : 

The forced where clause on top of the search.

Type

$model_view

$model_view : 

نمایشی از مدل داده‌ای را تعیین می‌کند که باید در این صفحه بندی استفاده شود.

Type

$search_string

$search_string : 

Search string.

Type

$sort_fields

$sort_fields : 

Which fields of the model can be used to sort the dataset.

To be useable these fields must be in the $list_display so that the sort links can be shown for the user to click on them and sort the list.

Type

$sort_order

$sort_order : 

Current sort order.

An array with first value the field and second the order of the sort.

Type

$sort_reverse_order

$sort_reverse_order : 

Keys where the sort is reversed.

Let say, you have a column using a timestamp but displaying the information as an age. If you sort "ASC" you espect to get the youngest first, but as the timestamp is used, you get the oldest. But the key here and the sort will be reverted.

Type

$model

$model : 

این مدل داده‌ای جستجوگر خواهد شد.

Type

$search_fields

$search_fields : 

The fields being searched.

Type

$where_clause

$where_clause : 

The where clause from the search.

Type

$active_list_filter

$active_list_filter : 

Type

Methods

__construct()

__construct(  $model = null,   $search_fields = array()) 

یک صفحه بند را برای مدل تعیین شده ایجاد می‌کند

Parameters

$model

مدل داده‌ای که باید صفحه بندی شود.

$search_fields

فهرست پارامترهایی که می‌تواند جستجو شود.

configure()

configure(  $search_fields = array(),   $sort_fields = array()) 

صفحه بند را تنظیم می‌کند

Parameters

$search_fields

فهرست پارامترهایی که می‌تواند جستجو شود.

$sort_fields

فهرستی از داده‌ها که قابلیت مرتب شدن را دارند.

setFromRequest()

setFromRequest(  $request) 

بر اساس تقاضای دریافت شده پارامترها را تنظیم می‌کند

این پارامترها برای ایجاد یک فهرست از داده‌ها به کار گرفته می‌شوند. تمام پارامترهای ممکن برای این کلاس عبارتند از:

_px_q : Query string to search. _px_sk : Sort key. _px_so : Sort order. _px_fk : Filter key. _px_fv : Filter value.

Parameters

$request

render_array()

render_array() : \Array.

ترجمه و ایجاد آرایه

آرایه ایجاد شده هیچ محدودیتی ندارد و شامل تمام مواردی است که قبل در سیستم ایجاد می‌شود. علاوه بر این داده‌هایی که از پایگاه داده به دست آمده اند به صورت مستقیم برگردانده می‌شوند و شامل هیچ ساختاری نیستند. این روش برای استفاده از داده‌ها در ساختارهایی مانند JSON بسیار مناسب خواهد بود.

Returns

\Array.

render_object()

render_object() : \unknown

تمام گزینه‌های یافت شده را تعیین می‌کند

با استفاده از این فراخوانی می‌توان به فهرست تمام موجودیت‌ها دست یافت.

Returns

\unknown

filter()

filter() : string

Generate the where clause.

Returns

string —

The ready to use where clause.