Infolog - use current sorting on infolog list for calendar todo list

This commit is contained in:
nathangray 2017-03-23 09:00:13 -06:00
parent 8afb3072fc
commit 21b1cc8e7e
3 changed files with 25 additions and 3 deletions

View File

@ -1452,8 +1452,8 @@ class infolog_bo
$to_include = array();
$date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']);
$query = array(
'order' => 'info_startdate',
'sort' => $do_events ? 'ASC' : 'DESC',
'order' => $args['order'] ? $args['order'] : 'info_startdate',
'sort' => $args['sort'] ? $args['sort'] : ($do_events ? 'ASC' : 'DESC'),
'filter'=> "user$user".($do_events ? 'date' : 'opentoday').$date_wanted,
'start' => 0,
);

View File

@ -686,6 +686,28 @@ class infolog_ui
return $event;
}
/**
* hook called be calendar to include events or todos in the cal-dayview
* Since the hook has no idea about infolog or preferences, we add the user's
* current sorting for infolog here so they're in the expected order
*
* @param int $args[year], $args[month], $args[day] date of the events
* @param int $args[owner] owner of the events
* @param string $args[location] calendar_include_{events|todos}
* @return array of events (array with keys starttime, endtime, title, view, icon, content)
*/
public function cal_to_include($args)
{
$nm = Api\Cache::getSession('infolog', 'session_data');
if($nm)
{
$args['order'] = $nm['order'];
$args['sort'] = $nm['sort'];
}
return $this->bo->cal_to_include($args);
}
/**
* Shows the infolog list
*

View File

@ -57,7 +57,7 @@ $setup_info['infolog']['hooks']['projects_view'] = 'infolog.infolog_ui.hook_v
$setup_info['infolog']['hooks']['calendar_view'] = 'infolog.infolog_ui.hook_view';
$setup_info['infolog']['hooks']['infolog'] = 'infolog.infolog_ui.hook_view';
$setup_info['infolog']['hooks']['calendar_include_events'] = 'infolog.infolog_bo.cal_to_include';
$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.infolog_bo.cal_to_include';
$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.infolog_ui.cal_to_include';
$setup_info['infolog']['hooks']['sidebox_menu'] = 'infolog_hooks::all_hooks';
$setup_info['infolog']['hooks']['search_link'] = 'infolog_hooks::search_link';
$setup_info['infolog']['hooks']['pm_custom_app_icons'] = 'infolog.infolog_bo.pm_icons';