* fix bug #24813
This commit is contained in:
@@ -60,7 +60,7 @@ class search extends control
|
||||
$this->view->searchFields = $fields;
|
||||
$this->view->actionURL = $actionURL;
|
||||
$this->view->fieldParams = $this->search->setDefaultParams($fields, $params);
|
||||
$this->view->queries = $this->search->getQueryPairs($module);
|
||||
$this->view->queries = $this->search->getQueryList($module);
|
||||
$this->view->queryID = $queryID;
|
||||
$this->view->style = empty($style) ? 'full' : $style;
|
||||
$this->view->onMenuBar = empty($onMenuBar) ? 'no' : $onMenuBar;
|
||||
@@ -148,14 +148,13 @@ class search extends control
|
||||
{
|
||||
$query = $queryID ? $queryID : '';
|
||||
$module = empty($module) ? $this->session->searchParams['module'] : $module;
|
||||
$queries = $this->search->getQueryPairs($module);
|
||||
$queries = $this->search->getQueryList($module);
|
||||
$html = '';
|
||||
foreach($queries as $queryID => $queryName)
|
||||
foreach($queries as $query)
|
||||
{
|
||||
if(empty($queryID)) continue;
|
||||
$query = $this->search->getByID($queryID);
|
||||
if(empty($query->id)) continue;
|
||||
|
||||
$html .= '<li>' . html::a("javascript:executeQuery({$queryID})", $queryName . ((common::hasPriv('search', 'deleteQuery') and $this->app->user->account == $query->account) ? '<i class="icon icon-close"></i>' : ''), '', "class='label user-query' data-query-id='$queryID' title='{$queryName}'") . '</li>';
|
||||
$html .= '<li>' . html::a("javascript:executeQuery({$query->id})", $query->title . ((common::hasPriv('search', 'deleteQuery') and $this->app->user->account == $query->account) ? '<i class="icon icon-close"></i>' : ''), '', "class='label user-query' data-query-id='$query->id' title='{$query->title}'") . '</li>';
|
||||
}
|
||||
echo $html;
|
||||
}
|
||||
|
||||
@@ -439,6 +439,30 @@ class searchModel extends model
|
||||
return $queries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query list.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getQueryList($module)
|
||||
{
|
||||
$queries = $this->dao->select('id, account, title')
|
||||
->from(TABLE_USERQUERY)
|
||||
->where()
|
||||
->markLeft(1)
|
||||
->where('account')->eq($this->app->user->account)
|
||||
->orWhere('common')->eq(1)
|
||||
->markRight(1)
|
||||
->andWhere('module')->eq($module)
|
||||
->orderBy('id_desc')
|
||||
->fetchAll();
|
||||
if(!$queries) return array('' => $this->lang->search->myQuery);
|
||||
$queries = array('' => $this->lang->search->myQuery) + $queries;
|
||||
return $queries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get records by the condition.
|
||||
*
|
||||
|
||||
@@ -227,10 +227,9 @@ foreach($fieldParams as $fieldName => $param)
|
||||
<td class='w-160px hidden' rowspan='2' id='userQueries'>
|
||||
<h4><?php echo $lang->search->savedQuery;?></h4>
|
||||
<ul>
|
||||
<?php foreach($queries as $queryID => $queryName):?>
|
||||
<?php if(empty($queryID)) continue;?>
|
||||
<?php $query = $this->search->getByID($queryID);?>
|
||||
<li><?php echo html::a("javascript:executeQuery($queryID)", $queryName . ((common::hasPriv('search', 'deleteQuery') and $this->app->user->account == $query->account) ? '<i class="icon icon-close"></i>' : ''), '', "class='label user-query' data-query-id='$queryID' title='{$queryName}'");?></li>
|
||||
<?php foreach($queries as $query):?>
|
||||
<?php if(empty($query->id)) continue;?>
|
||||
<li><?php echo html::a("javascript:executeQuery($query->id)", $query->title . ((common::hasPriv('search', 'deleteQuery') and $this->app->user->account == $query->account) ? '<i class="icon icon-close"></i>' : ''), '', "class='label user-query' data-query-id='$query->id' title='{$query->title}'");?></li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user