After added feedback on entered search terms for search attributes
and search logs, this now also works for LogsController::index()
and next and previous page.

Signed-off-by: Noud de Brouwer <noud4@home.nl>
pull/63/head
Noud de Brouwer 2012-12-18 03:01:02 +00:00
parent d5bcee63af
commit 9211e4d405
3 changed files with 47 additions and 12 deletions

View File

@ -658,6 +658,9 @@ class AttributesController extends AppController {
// and store into session
$this->Session->write('paginate_conditions',$this->paginate);
$this->Session->write('paginate_conditions_keyword',$keyword);
$this->Session->write('paginate_conditions_type',$type);
$this->Session->write('paginate_conditions_category',$category);
// set the same view as the index page
$this->render('index');
@ -682,6 +685,15 @@ class AttributesController extends AppController {
$this->set('categoryDefinitions', $this->Attribute->categoryDefinitions);
$this->Attribute->recursive = 0;
// get from Session
$keyword = $this->Session->read('paginate_conditions_keyword');
$type = $this->Session->read('paginate_conditions_type');
$category = $this->Session->read('paginate_conditions_category');
$this->set('keywordSearch', $keyword);
$this->set('typeSearch', $type);
$this->set('isSearch', 1);
$this->set('categorySearch', $category);
// re-get pagination
$this->paginate = $this->Session->read('paginate_conditions');
$this->set('attributes', Sanitize::clean($this->paginate()));

View File

@ -43,6 +43,7 @@ class LogsController extends AppController {
public function admin_index() {
$this->Log->recursive = 0;
$this->set('logs', Sanitize::clean($this->paginate()));
$this->set('isSearch', 0);
}
/**
@ -86,6 +87,7 @@ class LogsController extends AppController {
$this->set('actionSearch', $action);
$this->set('titleSearch', $title);
$this->set('changeSearch', $change);
$this->set('isSearch', 1);
// search the db
$conditions = array();
@ -106,7 +108,7 @@ class LogsController extends AppController {
}
$this->Log->recursive = 0;
$this->paginate = array(
'limit' => 60,
'limit' => 6,
'maxLimit' => 9999, // LATER we will bump here on a problem once we have more than 9999 logs(?)
'conditions' => $conditions
);
@ -114,6 +116,11 @@ class LogsController extends AppController {
// and store into session
$this->Session->write('paginate_conditions_log', $this->paginate);
$this->Session->write('paginate_conditions_log_email', $email);
$this->Session->write('paginate_conditions_log_org', $org);
$this->Session->write('paginate_conditions_log_action', $action);
$this->Session->write('paginate_conditions_log_title', $title);
$this->Session->write('paginate_conditions_log_change', $change);
// set the same view as the index page
$this->render('admin_index');
@ -128,8 +135,23 @@ class LogsController extends AppController {
} else {
$this->set('actionDefinitions', $this->Log->actionDefinitions);
$this->Log->recursive = 0;
// get from Session
$email = $this->Session->read('paginate_conditions_log_email');
$org = $this->Session->read('paginate_conditions_log_org');
$action = $this->Session->read('paginate_conditions_log_action');
$title = $this->Session->read('paginate_conditions_log_title');
$change = $this->Session->read('paginate_conditions_log_change');
// for info on what was searched for
$this->set('emailSearch', $email);
$this->set('orgSearch', $org);
$this->set('actionSearch', $action);
$this->set('titleSearch', $title);
$this->set('changeSearch', $change);
$this->set('isSearch', 1);
// re-get pagination
$this->Log->recursive = 0;
$this->paginate = $this->Session->read('paginate_conditions_log');
$this->set('logs', Sanitize::clean($this->paginate()));

View File

@ -1,15 +1,16 @@
<div class="logs index">
<h2><?php echo __('Logs');?></h2>
<h4>Results for all log entries
<?php
if ($emailSearch!=null) echo " for user \"<b>".h($emailSearch)."\"</b>";
if ($orgSearch!=null) echo " of the organisation \"<b>".h($orgSearch)."</b>\"";
if ($actionSearch!="ALL") echo " of type \"<b>".h($actionSearch)."</b>\"";
if ($titleSearch!=null) echo " with the title \"<b>".h($titleSearch)."</b>\"";
if ($changeSearch!=null) echo " including the change \"<b>".h($changeSearch)."</b>\"";
echo ":";
?>
</h4>
<?php
if ($isSearch==1){
echo "<h4>Results for all log entries";
if ($emailSearch!=null) echo " for user \"<b>".h($emailSearch)."\"</b>";
if ($orgSearch!=null) echo " of the organisation \"<b>".h($orgSearch)."</b>\"";
if ($actionSearch!="ALL") echo " of type \"<b>".h($actionSearch)."</b>\"";
if ($titleSearch!=null) echo " with the title \"<b>".h($titleSearch)."</b>\"";
if ($changeSearch!=null) echo " including the change \"<b>".h($changeSearch)."</b>\"";
echo ":</h4>";
}
?>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $this->Paginator->sort('id');?></th>