本文整理汇总了PHP中Filters::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Filters::getInstance方法的具体用法?PHP Filters::getInstance怎么用?PHP Filters::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filters
的用法示例。
在下文中一共展示了Filters::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_userlist_by_filter
public function get_userlist_by_filter()
{
if (!empty($this->postData['filter_set'])) {
$filter_set = \Filters::getInstance();
$filter_set->setResellerID(array_key_exists('reseller', $this->postData) ? $this->postData['reseller'] : 0);
$filter_set->initData('users', 'id');
$curr_filter_set = \Mysql::getInstance()->from('filter_set')->where(array('id' => $this->postData['filter_set']))->get()->first();
if (!empty($curr_filter_set) && ($unserialize_data = @unserialize($curr_filter_set['filter_set']))) {
$filter_data = array();
foreach ($unserialize_data as $row) {
$filter_data[$row[0]] = $row;
}
$filters_with_cond = array_filter(array_map(function ($row) use($filter_data) {
if (array_key_exists($row['text_id'], $filter_data)) {
$value = $row['text_id'] == 'status' || $row['text_id'] == 'state' ? (int) ($filter_data[$row['text_id']][2] - 1 > 0) : $filter_data[$row['text_id']][2];
return array($row['method'], $filter_data[$row['text_id']][1], $value);
}
}, $filter_set->getFilters()));
$filter_set->setFilters($filters_with_cond);
$this->user_list = $filter_set->getData();
}
}
return $this;
}
示例2: users_filter_list_json
public function users_filter_list_json()
{
if ($this->isAjax) {
if ($no_auth = $this->checkAuth()) {
return $no_auth;
}
}
$response = array('data' => array(), 'recordsTotal' => 0, 'recordsFiltered' => 0);
$error = $this->setLocalization("Error");
$param = !empty($this->data) ? $this->data : array();
$query_param = $this->prepareDataTableParams($param, array('operations', '_'));
if (!isset($query_param['where'])) {
$query_param['where'] = array();
}
$filds_for_select = $this->getFilterSetFields();
$this->cleanQueryParams($query_param, array_keys($filds_for_select), $filds_for_select);
if (!empty($this->data['filters']['admin_id'])) {
$query_param['where'] = array('A.id' => $this->data['filters']['admin_id']);
}
$response['recordsTotal'] = $this->db->getTotalRowsUsersFilters();
$response["recordsFiltered"] = $this->db->getTotalRowsUsersFilters($query_param['where'], $query_param['like']);
if (empty($query_param['limit']['limit'])) {
$query_param['limit']['limit'] = 50;
}
$filter_set = \Filters::getInstance();
$filter_set->setResellerID($this->app['reseller']);
$filter_set->initData('users', 'id');
$self = $this;
$response['data'] = array_map(function ($row) use($filter_set, $self) {
if (($filter_set_data = @unserialize($row['filter_set'])) !== FALSE) {
$row['filter_set'] = '';
foreach ($filter_set_data as $data_row) {
$filter_set_filter = $filter_set->getFilters(array($data_row[0]));
$row_filter_set = $self->setLocalization($filter_set_filter[0]['title']) . ': ';
if (!empty($filter_set_filter[0]['values_set']) && is_array($filter_set_filter[0]['values_set'])) {
foreach ($filter_set_filter[0]['values_set'] as $filter_row) {
if ($data_row[2] == $filter_row['value']) {
$row_filter_set .= $self->setLocalization($filter_row['title']) . '; ';
}
}
} else {
$row_filter_set .= $data_row[2] . '; ';
}
$row['filter_set'] .= $row_filter_set;
}
}
settype($row['favorites'], 'int');
settype($row['for_all'], 'int');
return $row;
}, $this->db->getUsersFiltersList($query_param));
$response["draw"] = !empty($this->data['draw']) ? $this->data['draw'] : 1;
$error = '';
if ($this->isAjax) {
$response = $this->generateAjaxResponse($response);
return new Response(json_encode($response), empty($error) ? 200 : 500);
} else {
return $response;
}
}
示例3: getAllFilters
private function getAllFilters()
{
$filter_set = \Filters::getInstance();
$filter_set->setResellerID($this->app['reseller']);
$filter_set->initData('users', 'id');
$self = $this;
return array_map(function ($row) use($filter_set, $self) {
if (($filter_set_data = @unserialize($row['filter_set'])) !== FALSE) {
$row['filter_set'] = '';
foreach ($filter_set_data as $data_row) {
$filter_set_filter = $filter_set->getFilters(array($data_row[0]));
$row_filter_set = $self->setLocalization($filter_set_filter[0]['title']) . ': ';
if (!empty($filter_set_filter[0]['values_set']) && is_array($filter_set_filter[0]['values_set'])) {
foreach ($filter_set_filter[0]['values_set'] as $filter_row) {
if ($data_row[2] == $filter_row['value']) {
$row_filter_set .= $self->setLocalization($filter_row['title']) . '; ';
}
}
} else {
$row_filter_set .= $data_row[2] . '; ';
}
$row['filter_set'] .= $row_filter_set;
}
}
settype($row['favorites'], 'int');
settype($row['for_all'], 'int');
return $row;
}, $this->db->getAllFromTable('filter_set', 'title'));
}