本文整理汇总了PHP中block::quicksearch方法的典型用法代码示例。如果您正苦于以下问题:PHP block::quicksearch方法的具体用法?PHP block::quicksearch怎么用?PHP block::quicksearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block
的用法示例。
在下文中一共展示了block::quicksearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
global $layout;
global $DB;
global $website;
$out = '';
$item = new block();
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'] = 'b.id';
break;
case 'type':
$_REQUEST['searchField'] = 'b.type';
break;
case 'title':
$_REQUEST['searchField'] = 'd.text';
break;
case 'category':
$_REQUEST['searchField'] = 'b.category';
break;
case 'dates':
$_REQUEST['searchField'] = 'b.date_published';
break;
case 'enabled':
$_REQUEST['searchField'] = 'b.enabled';
break;
case 'date_modified':
default:
$_REQUEST['searchField'] = 'b.date_modified';
}
if ($_REQUEST['sidx'] == 'dates') {
$_REQUEST['sidx'] = 'b.date_published';
}
$page = intval($_REQUEST['page']);
$max = intval($_REQUEST['rows']);
$offset = ($page - 1) * $max;
$orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
$where = " 1=1 ";
if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
if (isset($_REQUEST['quicksearch'])) {
$where .= $item->quicksearch($_REQUEST['quicksearch']);
} else {
if (isset($_REQUEST['filters'])) {
$where .= navitable::jqgridsearch($_REQUEST['filters']);
// special case
if (strpos($where, 'title LIKE') !== false) {
$where = substr_replace($where, 'd.text', strpos($where, 'title LIKE'), 5);
}
} else {
// single search
$where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
}
}
}
$sql = ' SELECT SQL_CALC_FOUND_ROWS b.*, d.text as title
FROM nv_blocks b
LEFT JOIN nv_webdictionary d
ON b.id = d.node_id
AND d.node_type = "block"
AND d.subtype = "title"
AND d.lang = "' . $website->languages_list[0] . '"
AND d.website = ' . $website->id . '
WHERE ' . $where . '
AND b.website = ' . $website->id . '
ORDER BY ' . $orderby . '
LIMIT ' . $max . '
OFFSET ' . $offset;
if (!$DB->query($sql, 'array')) {
throw new Exception($DB->get_last_error());
}
$dataset = $DB->result();
$total = $DB->foundRows();
$block_types = block::types();
$block_types_list = array();
for ($i = 0; $i < count($block_types); $i++) {
if (is_numeric($block_types[$i]['id'])) {
$block_types_list[$block_types[$i]['code']] = $block_types[$i]['title'];
} else {
$block_types_list[$block_types[$i]['id']] = $block_types[$i]['title'];
}
}
$dataset = grid_notes::summary($dataset, 'block', 'id');
// we need to format the values and retrieve the needed strings from the dictionary
//.........这里部分代码省略.........