本文整理汇总了PHP中item::quicksearch方法的典型用法代码示例。如果您正苦于以下问题:PHP item::quicksearch方法的具体用法?PHP item::quicksearch怎么用?PHP item::quicksearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::quicksearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
global $layout;
global $DB;
global $website;
global $theme;
global $user;
$out = '';
$item = new item();
switch ($_REQUEST['act']) {
case 'json':
case 1:
// json data retrieval & operations
switch ($_REQUEST['oper']) {
case 'del':
// remove rows
$ids = $_REQUEST['ids'];
foreach ($ids as $id) {
$item->load($id);
$item->delete();
}
echo json_encode(true);
break;
default:
// list or search
// translation of request search & order fields
switch ($_REQUEST['searchField']) {
case 'id':
$_REQUEST['searchField'] = 'i.id';
break;
case 'title':
$_REQUEST['searchField'] = 'd.text';
break;
case 'language':
$_REQUEST['searchField'] = 'd.lang';
break;
case 'category':
$_REQUEST['searchField'] = 'i.category';
break;
case 'dates':
$_REQUEST['searchField'] = 'i.date_published';
break;
case 'permission':
$_REQUEST['searchField'] = 'i.permission';
break;
default:
}
if ($_REQUEST['sidx'] == 'dates') {
$_REQUEST['sidx'] = 'i.date_published';
}
$page = intval($_REQUEST['page']);
$max = intval($_REQUEST['rows']);
$offset = ($page - 1) * $max;
$orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
$where = ' i.website = ' . $website->id;
if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
if (isset($_REQUEST['quicksearch'])) {
$where .= $item->quicksearch($_REQUEST['quicksearch']);
} else {
if (isset($_REQUEST['filters'])) {
if (is_array($_REQUEST['filters'])) {
$filters = json_decode(json_encode($_REQUEST['filters']), FALSE);
} else {
$filters = json_decode($_REQUEST['filters']);
}
for ($r = 0; $r < count($filters->rules); $r++) {
switch ($filters->rules[$r]->field) {
case 'id':
$filters->rules[$r]->field = 'i.id';
break;
case 'title':
$filters->rules[$r]->field = 'd.text';
break;
case 'language':
$filters->rules[$r]->field = 'd.lang';
break;
case 'category':
$filters->rules[$r]->field = 'i.category';
break;
case 'dates':
$filters->rules[$r]->field = 'i.date_published';
break;
case 'permission':
$filters->rules[$r]->field = 'i.permission';
break;
default:
}
}
$where .= navitable::jqgridsearch(json_encode($filters));
} else {
// single search
$where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
}
}
}
$sql = ' SELECT SQL_CALC_FOUND_ROWS
i.*, d.text as title, d.lang as language,
u.username as author_username,
( SELECT COUNT(*)
FROM nv_comments cm
//.........这里部分代码省略.........