Revize 1371
Přidáno uživatelem Ondřej Fibich před více než 12 roky(ů)
freenetis/branches/testing/application/controllers/logs.php | ||
---|---|---|
*
|
||
* @author Ondřej Fibich
|
||
*/
|
||
public function show_all(
|
||
$limit_results = 100, $page_word = null, $page = 1)
|
||
public function show_all($limit_results = 100, $page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
Controller::error(ACCESS);
|
||
... | ... | |
->type('select')
|
||
->values(array
|
||
(
|
||
Log_Model::ACTION_ADD => __('Add'),
|
||
Log_Model::ACTION_DELETE => __('Delete'),
|
||
Log_Model::ACTION_UPDATE => __('Update')
|
||
Log_Model::ACTION_ADD => __('Added'),
|
||
Log_Model::ACTION_DELETE => __('Deleted'),
|
||
Log_Model::ACTION_UPDATE => __('Updated')
|
||
));
|
||
|
||
$filter_form->add('object_id')
|
||
... | ... | |
if (($sql_offset = ($page - 1) * $limit_results) > $total_logs)
|
||
$sql_offset = 0;
|
||
|
||
// users checkbox
|
||
$user_model = new User_Model();
|
||
|
||
// load logs
|
||
$logs = $log_model->get_all_logs(
|
||
$sql_offset, (int) $limit_results, $filter_form->as_sql()
|
||
);
|
||
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value)
|
||
$arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
// title of view
|
||
$title = __('Action logs');
|
||
|
||
... | ... | |
'order_by' => 'id',
|
||
'order_by_direction' => 'DESC',
|
||
'limit_results' => $limit_results,
|
||
'query_string' => $query_string,
|
||
'filter' => $filter_form
|
||
));
|
||
|
||
$grid->field('id');
|
||
|
||
$grid->callback_field('user_id')
|
||
->label(__('User'))
|
||
->label('User')
|
||
->callback('callback::user_id_log_field');
|
||
|
||
$grid->callback_field('action')
|
||
->callback('callback::log_action_field');
|
||
|
||
$grid->field('table_name')
|
||
->label(__('Table'));
|
||
->label('Table');
|
||
|
||
$grid->callback_field('object_id')
|
||
->label(__('Object'))
|
||
->label('Object')
|
||
->callback('callback::object_log_field');
|
||
|
||
$grid->field('time');
|
||
... | ... | |
* @author Ondřej Fibich
|
||
* @param integer $user_id
|
||
*/
|
||
public function show_by_user(
|
||
$user_id = null, $limit_results = 200, $order_by = 'time',
|
||
$order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
public function show_by_user($user_id = null, $limit_results = 200,
|
||
$page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
Controller::error(ACCESS);
|
||
... | ... | |
'selector_max_multiplier' => 10,
|
||
'uri_segment' => 'page',
|
||
'base_url' => Config::get('lang')
|
||
. '/logs/show_all/' . $limit_results,
|
||
. '/logs/show_by_user/' . $user_id . '/'
|
||
. $limit_results,
|
||
'total_items' => $total_logs,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
... | ... | |
$grid->field('id');
|
||
|
||
$grid->callback_field('user_id')
|
||
->label(__('User'))
|
||
->label('User')
|
||
->callback('callback::user_id_log_field');
|
||
|
||
$grid->callback_field('action')
|
||
->label(__('Action'))
|
||
->label('Action')
|
||
->callback('callback::log_action_field');
|
||
|
||
$grid->field('table_name')
|
||
->label(__('Table'));
|
||
|
||
$grid->callback_field('object_id')
|
||
->label(__('Object'))
|
||
->label('Object')
|
||
->callback('callback::object_log_field');
|
||
|
||
$grid->field('time');
|
||
... | ... | |
* @param integer $object_id
|
||
*/
|
||
public function show_object(
|
||
$table, $object_id = null, $limit_results = 200, $order_by = 'time',
|
||
$order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
$table, $object_id = null, $limit_results = 200,
|
||
$page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
Controller::error(ACCESS);
|
||
... | ... | |
'selector_max_multiplier' => 10,
|
||
'uri_segment' => 'page',
|
||
'base_url' => Config::get('lang')
|
||
. '/logs/show_all/' . $limit_results,
|
||
. '/logs/show_object/' . $table . '/'
|
||
. $object_id . '/' . $limit_results,
|
||
'total_items' => $total_logs,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
... | ... | |
$grid->field('id');
|
||
|
||
$grid->callback_field('user_id')
|
||
->label(__('User'))
|
||
->label('User')
|
||
->callback('callback::user_id_log_field');
|
||
|
||
$grid->callback_field('action')
|
||
->label(__('Action'))
|
||
->label('Action')
|
||
->callback('callback::log_action_field');
|
||
|
||
$grid->field('table_name')
|
||
->label(__('Table'));
|
||
->label('Table');
|
||
|
||
$grid->callback_field('object_id')
|
||
->label(__('Object'))
|
||
->label('Object')
|
||
->callback('callback::object_log_field');
|
||
|
||
$grid->field('time');
|
||
|
||
$grid->callback_field('values')
|
||
->label(__('Changed values'))
|
||
->label('Changed values')
|
||
->callback('callback::value_log_field');
|
||
|
||
$grid->datasource($logs);
|
Také k dispozici: Unified diff
Zapomenute veci z predchoziho commitu.